Click here to Skip to main content
15,889,116 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why C++ doesn't use the parent's class function? (C++ question) Pin
eusto29-May-10 8:44
eusto29-May-10 8:44 
Questionproblem with creating model-less dialog as a child of CFormView Pin
m_code28-May-10 18:54
m_code28-May-10 18:54 
AnswerRe: problem with creating model-less dialog as a child of CFormView Pin
Richard MacCutchan28-May-10 22:26
mveRichard MacCutchan28-May-10 22:26 
GeneralRe: problem with creating model-less dialog as a child of CFormView Pin
m_code29-May-10 8:39
m_code29-May-10 8:39 
Questionabout Hook WriteProcessMemory Pin
rockago28-May-10 12:30
rockago28-May-10 12:30 
AnswerRe: about Hook WriteProcessMemory Pin
Garth J Lancaster28-May-10 14:02
professionalGarth J Lancaster28-May-10 14:02 
GeneralRe: about Hook WriteProcessMemory Pin
rockago28-May-10 14:23
rockago28-May-10 14:23 
GeneralRe: about Hook WriteProcessMemory Pin
Garth J Lancaster28-May-10 15:07
professionalGarth J Lancaster28-May-10 15:07 
well, your formatting sucks for a start .. I cant quite put my finger on whats wrong .. looking at examples, I cant help feel that this (your code),

BOOL WINAPI MyWriteProcessMemory(
HANDLE hProcess, // handle to process
LPVOID lpBaseAddress, // base of memory area
LPVOID lpBuffer, // data buffer
DWORD nSize, // number of bytes to write
LPDWORD lpNumberOfBytesWritten) // number of bytes written
{
BOOL nResult=WriteProcessMemory(hProcess,lpBaseAddress,lpBaseAddress,nSize,lpNumberOfBytesWritten); //call origin function
MessageBoxA(NULL,(LPCTSTR)lpBaseAddress,"Hook!",MB_OK); 
return nResult;
}


should be this :-

BOOL WINAPI MyWriteProcessMemory(
HANDLE hProcess, // handle to process
LPVOID lpBaseAddress, // base of memory area
LPVOID lpBuffer, // data buffer
DWORD nSize, // number of bytes to write
LPDWORD lpNumberOfBytesWritten) // number of bytes written
{
BOOL nResult=CopyWriteProcessMemory(hProcess,lpBaseAddress,lpBaseAddress,nSize,lpNumberOfBytesWritten); //call origin function
MessageBoxA(NULL,(LPCTSTR)lpBaseAddress,"Hook!",MB_OK); 
return nResult;
}


CopyWriteProcessMemory has replaced WriteProcessMemory so calling WriteProcessMemory I dont think will work. Ive seen 'Real_' used instead of 'Copy', to make it a bit more obvious .. ie instead of

CopyWriteProcessMemory you would have Real_WriteProcessMemory

Obviously that means you start with

DETOUR_TRAMPOLINE(BOOL WINAPI Real_WriteProcessMemory(HANDLE, LPVOID, LPVOID, DWORD, LPDWORD), WriteProcessMemory);


Other than that I cant spot anything dramatically wrong ..

You might want to compare your code with this http://code.google.com/p/dxhook/source/browse/trunk/dxhook.cpp?r=4[^] to see if it helps

'g'
GeneralRe: about Hook WriteProcessMemory Pin
rockago28-May-10 21:48
rockago28-May-10 21:48 
GeneralRe: about Hook WriteProcessMemory Pin
Garth J Lancaster28-May-10 22:27
professionalGarth J Lancaster28-May-10 22:27 
AnswerRe: about Hook WriteProcessMemory Pin
Richard MacCutchan28-May-10 22:22
mveRichard MacCutchan28-May-10 22:22 
GeneralRe: about Hook WriteProcessMemory Pin
Garth J Lancaster28-May-10 22:33
professionalGarth J Lancaster28-May-10 22:33 
GeneralRe: about Hook WriteProcessMemory Pin
Richard MacCutchan28-May-10 23:09
mveRichard MacCutchan28-May-10 23:09 
QuestionWrite a function to cause a thread to wait Pin
Danzy8328-May-10 9:08
Danzy8328-May-10 9:08 
AnswerRe: Write a function to cause a thread to wait Pin
CPallini28-May-10 9:19
mveCPallini28-May-10 9:19 
AnswerRe: Write a function to cause a thread to wait Pin
Luc Pattyn28-May-10 9:33
sitebuilderLuc Pattyn28-May-10 9:33 
AnswerRe: Write a function to cause a thread to wait Pin
Cedric Moonen28-May-10 10:02
Cedric Moonen28-May-10 10:02 
GeneralRe: Write a function to cause a thread to wait Pin
CPallini28-May-10 11:08
mveCPallini28-May-10 11:08 
AnswerRe: Write a function to cause a thread to wait Pin
malaugh28-May-10 11:18
malaugh28-May-10 11:18 
AnswerRe: Write a function to cause a thread to wait Pin
Richard MacCutchan28-May-10 22:17
mveRichard MacCutchan28-May-10 22:17 
QuestionOnPrint from IE Pin
mesajflaviu28-May-10 4:34
mesajflaviu28-May-10 4:34 
AnswerRe: OnPrint from IE Pin
mesajflaviu28-May-10 7:43
mesajflaviu28-May-10 7:43 
QuestionAllocating memory for function pointers [modified] Pin
SelvaKr28-May-10 4:08
SelvaKr28-May-10 4:08 
AnswerRe: Allocating memory for function pointers Pin
Aescleal28-May-10 4:16
Aescleal28-May-10 4:16 
GeneralRe: Allocating memory for function pointers Pin
SelvaKr28-May-10 4:41
SelvaKr28-May-10 4:41 

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.