我的流驱动啊,老是出问题。DLL_THREAD_DETACH

nuanshuiping   2009-8-26 14:00 楼主
我的串口总是提示DLL_THREAD_DETACH如下:
MID = 0xec, DID = 0x76 4th Cycle : 0xa5
NUMBLOCKS : 512(0x200), SECTORSPERBLOCK = 256(0x100), BYTESPERSECTOR = 512(0x200)
STRINGS: **********DLL_PROCESS_ATTACH
STRFMD_OEMIoControl: unrecognized IOCTL (0x71c24).
INGS: **********STR_Init
Venus CIS_Init: context Drivers\Active\14
Virtual alloc/copy success :
Virtual alloc/copy success :
Virtual alloc/copy success :
Virtual alloc/copy success :
CAMERA.DLL::InterruptThread Initialized.
Camera initialization completed successfully..
CAM_Init: ActivateDevice on Pin failed


BWSCON=0x22111120, BANKCON3=0x700, BANKCON4=0x700
BWSCON=0x22111120
[dm9: Tries to map io space with 18000000
[dm9: The mapped address is D0BF0000
[dm9: Chip signature is 90000A46
[dm9: Chip signature is 90000A46

STRINGS: **********DLL_THREAD_DETACH
STRINGS: **********DLL_THREAD_DETACH
STRINGS: **********DLL_THREAD_DETACH
STRINGS: **********DLL_THREAD_DETACH
STRINGS: **********DLL_THREAD_DETACH
STRINGS: **********DLL_THREAD_DETACH
STRINGS: **********DLL_THREAD_DETACH

回复评论 (8)

这是我的入口函数。
#define BUFSIZE 256

WCHAR achBuffer[BUFSIZE];

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

BOOL WINAPI  

DllEntryPoint(HANDLE hinstDLL,

              DWORD dwReason,

              LPVOID /* lpvReserved */)

{

    switch(dwReason)

    {

    case DLL_PROCESS_ATTACH:

        g_hInstance = hinstDLL;

        RETAILMSG(1,(TEXT("STRINGS: **********DLL_PROCESS_ATTACH\n")));

        return TRUE;

    case DLL_THREAD_ATTACH:

        RETAILMSG(1,(TEXT("STRINGS: **********DLL_THREAD_ATTACH\n")));

        break;

    case DLL_THREAD_DETACH:

        RETAILMSG(1,(TEXT("STRINGS: **********DLL_THREAD_DETACH\n")));

        break;

    case DLL_PROCESS_DETACH:

        RETAILMSG(1,(TEXT("STRINGS: **********DLL_PROCESS_DETACH\n")));

        break;

#ifdef UNDER_CE

    case DLL_PROCESS_EXITING:

        RETAILMSG(1,(TEXT("STRINGS: **********DLL_PROCESS_EXITING\n")));

        break;

    case DLL_SYSTEM_STARTED:

        RETAILMSG(1,(TEXT("STRINGS: **********DLL_SYSTEM_STARTED\n")));

        break;

#endif

    }

    return TRUE;

}
点赞  2009-8-26 14:01
DWORD STR_Init(DWORD dwContext)

{

    DWORD dwRet = 0;

    RETAILMSG(1,(TEXT("STRINGS: **********STR_Init\n")));

    // Initialize buffer to zero.

    memset (achBuffer, 0, BUFSIZE * sizeof(WCHAR));

    // Set return value to non-zero.

    dwRet = 1;

    return dwRet;

}
点赞  2009-8-26 14:01
一个驱动可不仅仅是初始化呀!楼主,建议你好好研究一下流驱动的架构。你的驱动连线程都没有创建,肯定会一直报DETACH的。
点赞  2009-8-26 14:56

5楼 afg 

我其他的函数也写了,不过即使createfile函数移植返回INVALID_HANDLE_VALUE所以贴上了init函数,
返回INVALID_HANDLE_VALUE函数跟是否创建线程有关吗?
点赞  2009-8-26 15:18
不是所有的流驱动都需要ist吧,我的驱动不需要中断,只是创建一个内存空间,存储书写,读出数据。
点赞  2009-8-26 15:30
引用: 引用 4 楼 jiereliyi 的回复:
我其他的函数也写了,不过即使createfile函数移植返回INVALID_HANDLE_VALUE所以贴上了init函数,
返回INVALID_HANDLE_VALUE函数跟是否创建线程有关吗?

xxx_write()   xxx_open()    xxx_iocontrol()等等函数你都实现了吗?你的createfile很明显没成功啊。
点赞  2009-8-26 17:34
我找到原因了,漏掉了一个‘:’号。creatfile(“XXX:”):漏掉了
点赞  2009-8-27 12:06
谢谢帮忙 ,分给你了。呵呵
点赞  2009-8-27 12:07
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复