MahdiSafsafi/DDetours

Hook Fails..

GoogleCodeExporter opened this issue · 2 comments

Fails on 32 & 64..

program Project3;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  Winapi.Windows,
  Winapi.Wininet,
  DDetours;

var
  FHttpAddRequestHeadersW: function(hRequest: HINTERNET; lpszHeaders: LPWSTR; dwHeadersLength: DWORD; dwModifiers: DWORD): BOOL; stdcall;

function HttpAddRequestHeadersW(hRequest: HINTERNET; lpszHeaders: LPWSTR; 
dwHeadersLength: DWORD; dwModifiers: DWORD): BOOL; stdcall;
begin
  Result := FHttpAddRequestHeadersW(hRequest, lpszHeaders, dwHeadersLength, dwModifiers);
end;

begin
   @FHttpAddRequestHeadersW := InterceptCreate('wininet.dll', 'HttpAddRequestHeadersW', @FHttpAddRequestHeadersW, tRUE); // ERROR!!
end.

{
  First chance exception at $75514598. Exception class Exception with message 'Invalid InterceptProc Pointer.'. Process Project3.exe (4296)
}

Original issue reported on code.google.com by david.lo...@gmail.com on 20 Jan 2015 at 11:33

Ah remove this report. :)

Original comment by david.lo...@gmail.com on 20 Jan 2015 at 11:37

That's because you are passing a nil InterceptProc .
//------------------------------
 @FHttpAddRequestHeadersW := InterceptCreate('wininet.dll', 'HttpAddRequestHeadersW', @HttpAddRequestHeadersW, tRUE); // ERROR!!

I use always trampo prefix and hook/Intercept suffix to just not get confused!

Original comment by ismspi...@gmail.com on 20 Jan 2015 at 3:34

  • Changed state: Invalid