SimpleDriver
代码说明:
#include #include #include //定义一个字节型全局变量g_Tmp,用来暂存应用程序传进来的数据 static BYTE g_Tmp = 0; //g_OpenCount则驱动程序打开计数器,用于计数驱动打开的次数 static DWORD g_OpenCount =0; BOOL WINAPI DllEntry(HANDLE hInstDll ,DWORD dwReason ,LPVOID lpvReserved) { switch(dwReason) { case DLL_PROCESS_ATTACH: RETAILMSG(1,(TEXT("SPL:DLL_PROCESS_ATTACH. "))); DisableThreadLibraryCalls((HMODULE)hInstDll); break; case DLL_PROCESS_DETACH: RETAILMSG(1,(TEXT("SPL:DLL_PROCESS_DETACH. "))); break; } return TRUE; } DWORD SPL_Init(DWORD dwContext) { RETAILMSG(1,(TEXT(":::SPL_Init. "))); g_Tmp = 0; g_OpenCount = 0; return 1; } BOOL SPL_Deinit(DWORD dwContext) { RETAILMSG(1,(TEXT(":::SPL_Denit. "))); g_Tmp = 0; g_OpenCount = 0; return TRUE; } DWORD SPL_Open (DWORD hDeviceContext, DWORD AccessCode, DWORD ShareMode) { RETAILMSG(1,(TEXT(":::SPL_Open. n"))); //不允许多个应用打开本驱动 i
下载说明:请别用迅雷下载,失败请重下,重下不扣分!