Click here to Skip to main content
15,887,812 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionnfo Pin
john563227-Nov-07 23:24
john563227-Nov-07 23:24 
AnswerRe: nfo Pin
toxcct27-Nov-07 23:28
toxcct27-Nov-07 23:28 
GeneralOfftopic Pin
Nelek28-Nov-07 3:13
protectorNelek28-Nov-07 3:13 
GeneralRe: Offtopic Pin
toxcct28-Nov-07 3:18
toxcct28-Nov-07 3:18 
GeneralRe: Offtopic Pin
Nelek28-Nov-07 21:43
protectorNelek28-Nov-07 21:43 
GeneralRe: Offtopic Pin
toxcct28-Nov-07 21:47
toxcct28-Nov-07 21:47 
QuestionConsult the issue of Win API routine address and code injection Pin
Jude Deng27-Nov-07 23:04
Jude Deng27-Nov-07 23:04 
AnswerRe: Consult the issue of Win API routine address and code injection [modified] Pin
maciu202028-Nov-07 0:20
maciu202028-Nov-07 0:20 
Injecting functions written in high level programming language this way is unsafe, when they are relocated, some addresses change. It's safer to call
 HANDLE hRemoteThread = CreateRemoteThread(<br />
hTargetProcess, NULL, 0, LoadLibraryA,<br />
pRemotelyAllocatedStringContainigPathToTheDll, 0, &dwWriteBytes);

And in the DllMain of this dll call your RemoteThreadProc.

Anyway, as far as I understand the comments in your code, WriteProcessMemory is the part that fails. What process do you try inject your code to?
Are you sure that you have sufficient rights?


-- added at 6:56 Wednesday 28th November, 2007

One more thing. Do you compile it in debug mode? If so, at the address of your function you'll see:
jmp some_other_address
Then WriteProcessMemory will copy just these 5 (6?) bytes and some "other" data, not useful for you instead of your function's body.
GeneralRe: Consult the issue of Win API routine address and code injection Pin
Jude Deng28-Nov-07 14:48
Jude Deng28-Nov-07 14:48 
GeneralRe: Consult the issue of Win API routine address and code injection Pin
maciu202028-Nov-07 23:15
maciu202028-Nov-07 23:15 
QuestionRe: Consult the issue of Win API routine address and code injection Pin
David Crow29-Nov-07 2:43
David Crow29-Nov-07 2:43 
AnswerRe: Consult the issue of Win API routine address and code injection Pin
maciu202029-Nov-07 9:47
maciu202029-Nov-07 9:47 
AnswerRe: Consult the issue of Win API routine address and code injection Pin
Jude Deng29-Nov-07 13:26
Jude Deng29-Nov-07 13:26 
QuestionRe: Consult the issue of Win API routine address and code injection Pin
David Crow30-Nov-07 2:40
David Crow30-Nov-07 2:40 
QuestionOpening and reading XML files in MFC (C++) Pin
MrFloyd200927-Nov-07 23:01
MrFloyd200927-Nov-07 23:01 
AnswerRe: Opening and reading XML files in MFC (C++) Pin
toxcct27-Nov-07 23:06
toxcct27-Nov-07 23:06 
GeneralRe: Opening and reading XML files in MFC (C++) Pin
MrFloyd200927-Nov-07 23:26
MrFloyd200927-Nov-07 23:26 
GeneralRe: Opening and reading XML files in MFC (C++) Pin
ThatsAlok27-Nov-07 23:28
ThatsAlok27-Nov-07 23:28 
GeneralRe: Opening and reading XML files in MFC (C++) Pin
toxcct27-Nov-07 23:29
toxcct27-Nov-07 23:29 
AnswerRe: Opening and reading XML files in MFC (C++) Pin
Hamid_RT27-Nov-07 23:44
Hamid_RT27-Nov-07 23:44 
QuestionProbllem related to recv() function in winsock.h header fle Pin
Raghavendra Pise27-Nov-07 22:47
Raghavendra Pise27-Nov-07 22:47 
AnswerRe: Probllem related to recv() function in winsock.h header fle Pin
led mike28-Nov-07 4:53
led mike28-Nov-07 4:53 
AnswerRe: Probllem related to recv() function in winsock.h header fle Pin
Mark Salsbery28-Nov-07 5:47
Mark Salsbery28-Nov-07 5:47 
Questionhow to read event log Pin
T@su27-Nov-07 22:39
T@su27-Nov-07 22:39 
AnswerRe: how to read event log Pin
Hamid_RT27-Nov-07 23:40
Hamid_RT27-Nov-07 23:40 

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.