| View previous topic :: View next topic |
| Author |
Message |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
Posted: Sat Sep 15, 2007 7:44 pm Post subject: [masm] ReadProcessMemory error |
|
|
Ok here is a snippet from a masm program I was toying with;
| Code: |
.if process == NULL
; throw error not finding process
.else
invoke VirtualProtectEx,process,theoffsettopatch,100,PAGE_EXECUTE_READWRITE,ADDR OldProtected
.if eax == 0
; error unprotecting memory
.else
invoke ReadProcessMemory,process,theoffsettopatch,ADDR TheReadValue,SIZEOF TheReadValue,0
invoke GetLastError
invoke wsprintf,ADDR outBuffer,ADDR decimalformat,eax
invoke MessageBox, NULL, addr outBuffer, addr caption, MB_OK
.endif
.endif
|
Well I can get the process fine - and the VirtualProtectEx appears to be working fine. The ReadProcessMemory is failing with error code 5. This is an access restriction error...
Hopefully someone can point me in the right direction with this one, I'm probably just doing something dumb. Is the VirtualProtectEx not working as I am expecting it to be? Or is my ReadProcessMemory bad...
_________________
0x7A 0x61 0x72 0x74
TEAM RESURRECTiON |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat Sep 15, 2007 7:49 pm Post subject: |
|
|
| Did you open the process with PROCESS_VM_READ and PROCESS_VM_OPERATION rights?
|
|
| Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
|
| Back to top |
|
 |
zart Master Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 351 Location: russia
|
|
| Back to top |
|
 |
|