|
DLL入口DLLMain两次被系统用DLL_PROCESS_DETACH调用
[复制链接]
CE5下.自己写了个motola手机的USB驱动程序. 现在加载OK. 串口出来的信息如下:
USBInstallDriver++
load USBD.DLL sucess!
USBInstallDriver--
DLL_PROCESS_DETACH
Device Attached!
Looking for Stream Interfaces 2 2
There are 2 interfaces.
Found 1 stream interfaces. ID 0
1 interfaces will be saved!
Saving interface 0...
Device interfaces saved!
Create Driver Context!
Activate Device!
Data Abort: Thread=8fdc96c4 Proc=8e626160 'device.exe'
AKY=00000005 PC=03f63698(devmgr.dll+0x00003698) RA=03f636c0(devmgr.dll+0x000036c0) BVA=0389055f FSR=00000003
DLL_PROCESS_DETACH
里面两次打印出DLL_PROCESS_DETACH. 检查程序是
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
hInst = (HINSTANCE)hModule;
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH: //进程被调用
DEBUGREGISTER(hInst);
// Improve performance by passing on thread attach calls
DisableThreadLibraryCalls (hInst);
break;
case DLL_PROCESS_DETACH: //进程被停止
RETAILMSG(1, (TEXT("DLL_PROCESS_DETACH\r\n")));
break;
case DLL_THREAD_ATTACH: //线程被调用
break;
case DLL_THREAD_DETACH: //线程被停止
break;
}
return TRUE;
}
DLL入口DLLMain两次被系统用DLL_PROCESS_DETACH调用了. 请问这是否正常?
|
|