V
Vic.Dong
Hello All:
I use detours method of MS kit to hook CloseHandle() file systme API and
inject this hook.dll into NotePad process by static registry key value:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\Windows\AppInit_DLLs with one INI file that specified
only one NotePad application below is:
INI file:
[Scope]
UseWindowsHook=Yes
HookAll=No
Hook=notepad
Protect=MSDEV
[Trace]
Enabled=Yes
In my hook.dll:
use detours function:
DetourFunctionWithTrampoline((PBYTE)Real_CloseHandle,(PBYTE)Mine_CloseHandle);
DetourRemove((PBYTE)Real_CloseHandle,
(PBYTE)Mine_CloseHandle);
.....
based MS detours sample.
But I found when my hooked dll was loaded in NotePad process that TXT file
can not be opend, and appears a lot of trace string in my Mine_CloseHandle()
function. But another function e.g.: CreatFile(), ReadFile() .... can be
hooked and open TXT file.
Why can not I hook CloseHandle() API?
B.R.
Vic
I use detours method of MS kit to hook CloseHandle() file systme API and
inject this hook.dll into NotePad process by static registry key value:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\Windows\AppInit_DLLs with one INI file that specified
only one NotePad application below is:
INI file:
[Scope]
UseWindowsHook=Yes
HookAll=No
Hook=notepad
Protect=MSDEV
[Trace]
Enabled=Yes
In my hook.dll:
use detours function:
DetourFunctionWithTrampoline((PBYTE)Real_CloseHandle,(PBYTE)Mine_CloseHandle);
DetourRemove((PBYTE)Real_CloseHandle,
(PBYTE)Mine_CloseHandle);
.....
based MS detours sample.
But I found when my hooked dll was loaded in NotePad process that TXT file
can not be opend, and appears a lot of trace string in my Mine_CloseHandle()
function. But another function e.g.: CreatFile(), ReadFile() .... can be
hooked and open TXT file.
Why can not I hook CloseHandle() API?
B.R.
Vic