阅读:1433回复:2
请问如何用应用程序加载Vxd
thank
|
|
沙发#
发布于:2002-10-18 08:16
可以看看如下示例代码,vxdldr.h由VToolsD提供
#define Not_VxD #include <vxdldr.h> BOOL WINAPI Vxd_load(LPCSTR szFileName) { DWORD nRet; BOOL isDone; HANDLE hLoader; char szShortName[MAX_PATH]; if( !GetShortPathName( szFileName, szShortName, sizeof(szShortName) ) ) { return FALSE; } hLoader = CreateFile( \"\\\\\\\\.\\\\VXDLDR\", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hLoader == INVALID_HANDLE_VALUE) { return FALSE; } isDone = DeviceIoControl( hLoader, VXDLDR_APIFUNC_LOADDEVICE, (PVOID)szShortName, strlen(szShortName)+1, NULL, 0, &nRet, NULL); CloseHandle(hLoader); return isDone; } BOOL WINAPI Vxd_unload(LPCSTR szVxdNameOnly) { struct { DWORD dwSignature; char szVxdName[MAX_PATH]; }ToUnload = { -1 }; HANDLE hLoader = CreateFile( \"\\\\\\\\.\\\\VXDLDR\", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); strcpy( ToUnload.szVxdName, szVxdNameOnly ); if(hLoader != INVALID_HANDLE_VALUE) { DWORD nRet; BOOL isDone = DeviceIoControl( hLoader, VXDLDR_APIFUNC_UNLOADDEVICE, (PVOID)&ToUnload, strlen(ToUnload.szVxdName)+1+sizeof(DWORD), // size of ToUnload NULL, 0, &nRet, NULL); CloseHandle(hLoader); return isDone; } return FALSE; } |
|
|
板凳#
发布于:2002-10-20 11:24
楼上的是动态VXD,对于静态VXD,可在注册表或者是system.ini相关节中添加
|
|