toizy-mr / delphi-detours-library

Automatically exported from code.google.com/p/delphi-detours-library
0 stars 0 forks source link

Hooking CloseHandle causes exception @ ResumeThreads. Fix supplied #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What is the function that you are trying to hook ?
CloseHandle

What is the expected output? What do you see instead?
At function ResumeSuspendedThreads CloseHandle trumpoline function is not yet 
returned, so exception is caused

What version of the product are you using? On what operating system? Which
architecture x86 or x64 ?
Both

If the function hooked is not an windows API function , please include this
function .

Here is the fix by adding the following overloaded function:
procedure InterceptCreate(const TargetProc, InterceptProc: Pointer; var 
MyPointer : Pointer; Options: Byte = v1compatibility);
var
  Intercept: TIntercept;
begin
  Intercept := TIntercept.Create(Options);
  try
    MyPointer := Intercept.InstallHook(TargetProc, InterceptProc, Options);
  finally
    Intercept.Free;
  end;
end;

Please provide any additional information below.

Original issue reported on code.google.com by stiaanpr...@gmail.com on 26 Feb 2015 at 1:03

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r84.

Original comment by ismspi...@gmail.com on 27 Feb 2015 at 2:32