DLL是一个键盘钩子。
其dll入口这样写的:
Procedure DLLEntryPoint(dwReason
Word);
Var
Init:Boolean;
Begin
Case dwReason of
DLL_PROCESS_ATTACH:
Begin
MapHandle := CreateFileMapping($FFFFFFFF,Nil,PAGE_READWRITE,0,SizeOf(TCommonData),MapFileName);
Init := GetLastError <> ERROR_ALREADY_EXISTS;
If MapHandle = 0 then
Exit;
PDATA := MapViewOfFile(MapHandle,FILE_MAP_ALL_ACCESS,0,0,0);
If PDATA = Nil then Begin
CloseHandle(MapHandle);
Exit;
End;
If Init then Begin
FillChar(PDATA^,SizeOf(TCommonData),0);
End;
End;
DLL_PROCESS_DETACH:
Begin
UnmapViewOfFile(PDATA);
CloseHandle(MapHandle);
End;
DLL_THREAD_ATTACH:;
DLL_THREAD_DETACH:;
End;
End;
exports
EnableHotKeyHook,
DisableHotKeyHook;
Begin
IntoDll;
DLLProc := @DLLEntryPoint;
DLLEntryPoint(DLL_PROCESS_ATTACH);
End.
请问该如何释放dll呢?
我把这个钩子定义为系统钩子了。