Click here to Skip to main content
15,893,622 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Why? Pin
Blake Miller6-Mar-06 5:49
Blake Miller6-Mar-06 5:49 
AnswerRe: Why? Pin
Michael Dunn6-Mar-06 8:03
sitebuilderMichael Dunn6-Mar-06 8:03 
QuestionHow? Pin
Lampros Giampouras6-Mar-06 5:35
Lampros Giampouras6-Mar-06 5:35 
AnswerRe: How? Pin
David Crow6-Mar-06 5:36
David Crow6-Mar-06 5:36 
AnswerRe: How? Pin
Roger Stoltz6-Mar-06 5:39
Roger Stoltz6-Mar-06 5:39 
Question_DebugHeapTag error Pin
Eytukan6-Mar-06 5:13
Eytukan6-Mar-06 5:13 
AnswerRe: _DebugHeapTag error Pin
toxcct6-Mar-06 6:59
toxcct6-Mar-06 6:59 
QuestionMicrosoft detour + hook winapi functions Pin
David-coder6-Mar-06 5:08
David-coder6-Mar-06 5:08 
Hi all,

Since a few weeks I am playing with detour and winapi functions.
I hooked DirectDrawCreate and GetProcAdress. In the function GetProcAdress I want to return the adress of the api function "DirectDrawCreate" without detour does some 1 got the solution for this? Below the code I made so far:

<br />
<br />
DETOUR_TRAMPOLINE( HWND __stdcall zDirectDrawCreate(GUID* lpGUID , LPDIRECTDRAW* lplpDD , IUnknown* pUnkOuter) ,DirectDrawCreate );<br />
<br />
HWND __stdcall sDirectDrawCreate(GUID* lpGUID , LPDIRECTDRAW* lplpDD , IUnknown* pUnkOuter) <br />
{<br />
return zDirectDrawCreate(lpGUID , lplpDD , pUnkOuter); // Give PB the HRESULT<br />
}<br />
<br />
<br />
<br />
DETOUR_TRAMPOLINE(FARPROC WINAPI zGetProcAddress (HMODULE hModule, LPCSTR lp),GetProcAddress);<br />
<br />
FARPROC WINAPI sGetProcAddress (HMODULE hModule, LPCSTR lp)<br />
{<br />
if(HIWORD(lp))<br />
{<br />
<br />
<br />
if(!strcmp(lp, "GetProcAddress")) return (FARPROC) zGetProcAddress;<br />
//else if (!strcmp(lp, "DirectDrawCreate")) return // how can I return here the adress of the DirectDrawCreate api function without detour.. detour make jumps 0xE9 or 0x90.<br />
<br />
}<br />
return zGetProcAddress(hModule, lp);<br />
}<br />
<br />
void Detour_PB_DirectDraw()<br />
{ <br />
DetourFunctionWithTrampoline((PBYTE)zDirectDrawCreate,(PBYTE)sDirectDrawCreate);<br />
}<br />
<br />
void Detour_PB_GetProcAddress()<br />
{<br />
DetourFunctionWithTrampoline((PBYTE)zGetProcAddress,(PBYTE)sGetProcAddress);<br />
}<br />
<br />
bool WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, PVOID pvReserved)<br />
{<br />
if(dwReason == DLL_PROCESS_ATTACH) <br />
{<br />
<br />
Detour_PB_GetProcAddress(); <br />
Detour_PB_DirectDraw();<br />
<br />
}<br />
<br />
else if(dwReason == DLL_PROCESS_DETACH)<br />
{<br />
<br />
}<br />
<br />
return true; <br />
}<br />

AnswerRe: Microsoft detour + hook winapi functions Pin
Stephen Hewitt6-Mar-06 11:46
Stephen Hewitt6-Mar-06 11:46 
GeneralRe: Microsoft detour + hook winapi functions Pin
David-coder7-Mar-06 6:06
David-coder7-Mar-06 6:06 
GeneralRe: Microsoft detour + hook winapi functions Pin
Stephen Hewitt7-Mar-06 12:08
Stephen Hewitt7-Mar-06 12:08 
GeneralRe: Microsoft detour + hook winapi functions Pin
David-coder8-Mar-06 3:46
David-coder8-Mar-06 3:46 
GeneralRe: Microsoft detour + hook winapi functions Pin
Stephen Hewitt8-Mar-06 11:29
Stephen Hewitt8-Mar-06 11:29 
GeneralRe: Microsoft detour + hook winapi functions Pin
David-coder9-Mar-06 7:29
David-coder9-Mar-06 7:29 
GeneralRe: Microsoft detour + hook winapi functions Pin
Stephen Hewitt9-Mar-06 11:25
Stephen Hewitt9-Mar-06 11:25 
GeneralRe: Microsoft detour + hook winapi functions Pin
David-coder20-Mar-06 2:47
David-coder20-Mar-06 2:47 
QuestionArrays and SendMessage Pin
Waldermort6-Mar-06 4:33
Waldermort6-Mar-06 4:33 
AnswerRe: Arrays and SendMessage Pin
Iain Clarke, Warrior Programmer6-Mar-06 4:46
Iain Clarke, Warrior Programmer6-Mar-06 4:46 
GeneralRe: Arrays and SendMessage Pin
Waldermort6-Mar-06 4:56
Waldermort6-Mar-06 4:56 
Questionisolate differents parts of the string Pin
SWDevil6-Mar-06 4:20
SWDevil6-Mar-06 4:20 
AnswerRe: isolate differents parts of the string Pin
toxcct6-Mar-06 4:24
toxcct6-Mar-06 4:24 
GeneralRe: isolate differents parts of the string Pin
Roger Stoltz6-Mar-06 5:01
Roger Stoltz6-Mar-06 5:01 
GeneralRe: isolate differents parts of the string Pin
SWDevil6-Mar-06 5:04
SWDevil6-Mar-06 5:04 
GeneralRe: isolate differents parts of the string Pin
David Crow6-Mar-06 5:41
David Crow6-Mar-06 5:41 
AnswerRe: isolate differents parts of the string Pin
James R. Twine6-Mar-06 5:15
James R. Twine6-Mar-06 5:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.