Closed GoogleCodeExporter closed 9 years ago
How do you know that calling WebBrowser.Navigate will fire
InternetSetCookieExW/InternetGetCookieExW ?
Please try to call InternetGetCookieExW/InternetSetCookieExW directly after
hooking .If it's works that's probably means that WebBrowser.Navigate does not
call/use the previous functions.
Original comment by ismspi...@gmail.com
on 18 Jan 2015 at 1:41
How do I know? :)
http://www.raysoftware.cn/?p=357
Has example how to do it..
Original comment by david.lo...@gmail.com
on 18 Jan 2015 at 1:44
And this too..
www.codeproject.com/Articles/38616/Retrieve-HttpOnly-Session-Cookie-in-WebBrowse
r
Original comment by david.lo...@gmail.com
on 18 Jan 2015 at 1:46
This is a definite bug. I used this
https://code.google.com/p/delphi-hook-library/
I can see these functions being fired.
function InternetSetCookieEx(lpszUrl, lpszCookieName, lpszCookieData: LPCWSTR;
dwFlags: DWORD; lpReserved: Pointer): DWORD; stdcall;
begin
Result := _InternetSetCookieEx(lpszUrl, lpszCookieData, lpszCookieData, dwFlags, lpReserved);
end;
function InternetGetCookieEx(lpszUrl, lpszCookieName, lpszCookieData: LPCWSTR;
var lpdwSize: DWORD; dwFlags: DWORD; lpReserved: Pointer): BOOL; stdcall;
begin
Result := _InternetGetCookieEx(lpszUrl, lpszCookieName, lpszCookieData, lpdwSize, dwFlags, lpReserved);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('www.google.com');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
@_InternetSetCookieEx := HookProcInModule('Wininet.dll', 'InternetSetCookieExW', @InternetSetCookieEx);
@_InternetGetCookieEx := HookProcInModule('Wininet.dll', 'InternetGetCookieExW', @InternetGetCookieEx);
end;
end.
Original comment by david.lo...@gmail.com
on 18 Jan 2015 at 3:49
It seem this library cannot hook IAT/EAT ?
Original comment by david.lo...@gmail.com
on 18 Jan 2015 at 11:31
I am very disappointed !
Please refer to the documentation first before reporting a fake bug.
From DDetours wiki:
<ForceLoadModule : if True the DDL will try to load the module/library if it's
not loaded.>
On x64 Wininet module is not loaded that's mean DDL can not find
InternetSetCookieEx/InternetGetCookieEx methods pointer.
You need to set ForceLoadModule (True).In that way even if the Wininet module
is not loaded DDL will load it:
@_InternetSetCookieEx := InterceptCreate('Wininet.dll', 'InternetSetCookieExW', @InternetSetCookieEx, True);
@_InternetGetCookieEx := InterceptCreate('Wininet.dll', 'InternetGetCookieExW', @InternetGetCookieEx, True);
Original comment by ismspi...@gmail.com
on 19 Jan 2015 at 1:50
This doesn't work on 32 bit too !
Original comment by david.lo...@gmail.com
on 19 Jan 2015 at 2:18
I really don't know what's the problem .
I tested this code and it works fine on x32 & x64.
//-----------------------------------
uses DDetours;
var
_InternetSetCookieEx: function(lpszUrl, lpszCookieName, lpszCookieData: LPCWSTR; dwFlags: DWORD; lpReserved: Pointer): DWORD; stdcall;
_InternetGetCookieEx: function(lpszUrl, lpszCookieName, lpszCookieData: LPCWSTR; var lpdwSize: DWORD; dwFlags: DWORD; lpReserved: Pointer): BOOL; stdcall;
function InternetSetCookieEx(lpszUrl, lpszCookieName, lpszCookieData: LPCWSTR;
dwFlags: DWORD; lpReserved: Pointer): DWORD; stdcall;
begin
Main.LogMem.Lines.Add('InternetSetCookieEx');
Result := _InternetSetCookieEx(lpszUrl, lpszCookieData, lpszCookieData, dwFlags, lpReserved);
end;
function InternetGetCookieEx(lpszUrl, lpszCookieName, lpszCookieData: LPCWSTR;
var lpdwSize: DWORD; dwFlags: DWORD; lpReserved: Pointer): BOOL; stdcall;
begin
Main.LogMem.Lines.Add('InternetGetCookieEx');
Result := _InternetGetCookieEx(lpszUrl, lpszCookieName, lpszCookieData, lpdwSize, dwFlags, lpReserved);
end;
procedure TMain.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('google.com');
end;
initialization
@_InternetGetCookieEx := InterceptCreate('Wininet.dll', 'InternetGetCookieExW',
@InternetGetCookieEx,True);
@_InternetSetCookieEx := InterceptCreate('Wininet.dll', 'InternetSetCookieExW',
@InternetSetCookieEx,True);
Original comment by ismspi...@gmail.com
on 19 Jan 2015 at 2:47
Original issue reported on code.google.com by
david.lo...@gmail.com
on 18 Jan 2015 at 1:33