驱动加载后又马上被卸载了
我现在学习流驱动,写了一个空的驱动,驱动是编进内核了,但加载了,马上又被卸载了,超级终端输出为
GPI DLL_PROCESS_ATTACH
GPI DLL_PROCESS_DETACH
我写了一个测试程序,GetLastError返回值为55,
驱动源码如下:
// GPI.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
RETAILMSG(1,(TEXT("GPI DLL_PROCESS_ATTACH\n")));
return TRUE;
case DLL_THREAD_ATTACH:
RETAILMSG(1,(TEXT("GPI DLL_THEARD_ATTACH\n")));
return TRUE;
case DLL_PROCESS_DETACH:
RETAILMSG(1,(TEXT("GPI DLL_PROCESS_DETACH\n")));
return TRUE;
case DLL_THREAD_DETACH:
RETAILMSG(1,(TEXT("GPI DLL_THEARD_DETACH\n")));
return TRUE;
}
}
DWORD GPI_Init(DWORD dwContext)
{
DWORD dwRet=0;
RETAILMSG(1,(TEXT("GPI Init\n\r")));
dwRet=1;
return dwRet;
}
BOOL GPI_Deinit(DWORD dwContext)
{
RETAILMSG(1,(TEXT("GPI Deinit\n\r")));
return true;
}
DWORD GPI_Open(DWORD dwContext)
{
RETAILMSG(1,(TEXT("GPI Open\n\r")));
return true;
}
BOOL GPI_Close(DWORD dwContext)
{
RETAILMSG(1,(TEXT("GPI Close\n\r")));
return true;
}
[解决办法]
55:指定网络资源或设备不再可用
驱动应该没加载成功
[解决办法]
5.0 还是 6.0
检查下 注册表,跟bib文件
[解决办法]
用驱动调试助手看看
[解决办法]
驱动加载又卸载也可能与驱动的def文件有关