Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Return value of ReadProcess
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ColdDoT
Grandmaster Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 703
Location: The netherlands

PostPosted: Sun Jun 03, 2007 2:26 pm    Post subject: Return value of ReadProcess Reply with quote

Code:
invoke   ReadProcessMemory, ProcessInfo.hProcess, 0042E5C1h, offset ReadBuff, 1, NULL


Thiss will never return 02, why??????

//EDIT
LoL appalsap, this has everything to do with maplestory why move ?

_________________
Back to top
View user's profile Send private message MSN Messenger
Disgruntled Citizen
Master Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 462
Location: Canada

PostPosted: Sun Jun 03, 2007 2:50 pm    Post subject: Re: Return value of ReadProcess Reply with quote

ColdDoT wrote:
Code:
invoke   ReadProcessMemory, ProcessInfo.hProcess, 0042E5C1h, offset ReadBuff, 1, NULL


Thiss will never return 02, why??????

//EDIT
LoL appalsap, this has everything to do with maplestory why move ?


i have no clue, but the move might be because 90% of the people in this section have no clue about anything, and in general programming you mite get a more fulfilling answer.

_________________
Selling lvl 13X F/P Mage [khani] pm for information


PW Cracker
Back to top
View user's profile Send private message
ColdDoT
Grandmaster Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 703
Location: The netherlands

PostPosted: Sun Jun 03, 2007 2:57 pm    Post subject: Reply with quote

True......

Btw this is for EMS GG CRC

_________________
Back to top
View user's profile Send private message MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Jun 03, 2007 3:04 pm    Post subject: Reply with quote

ReadProcessMemory()'s return value is a bool on if it succeeded or not. The value you are looking for is returned in the function as a pointer.

MSDN wrote:
ReadProcessMemory


Reads data from an area of memory in a specified process. The entire area to be read must be accessible or the operation fails.
BOOL ReadProcessMemory(
HANDLE hProcess,
LPCVOID lpBaseAddress,
LPVOID lpBuffer,
SIZE_T nSize,
SIZE_T* lpNumberOfBytesRead
);
Parameters
hProcess
[in] A handle to the process with memory that is being read. The handle must have PROCESS_VM_READ access to the process.
lpBaseAddress
[in] A pointer to the base address in the specified process from which to read. Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for read access, and if it is not accessible the function fails.
lpBuffer
[out] A pointer to a buffer that receives the contents from the address space of the specified process.
nSize
[in] The number of bytes to be read from the specified process.
lpNumberOfBytesRead
[out] A pointer to a variable that receives the number of bytes transferred into the specified buffer. If lpNumberOfBytesRead is NULL, the parameter is ignored.
Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.

The function fails if the requested read operation crosses into an area of the process that is inaccessible.


In x0r's example he compares the output parameter instead of the return value:

Code:
invoke       ReadProcessMemory, ProcessInfo.hProcess, 00400000h, offset ReadBuff, 2, NULL ; Change 0040000 to the "PUSH 2" address
cmp         ReadBuff, 02


Hope this helps.
Back to top
View user's profile Send private message
ColdDoT
Grandmaster Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 703
Location: The netherlands

PostPosted: Sun Jun 03, 2007 3:08 pm    Post subject: Reply with quote

I know maybe i put it wrong.

Here is script
Code:
.386
.model flat,stdcall
option casemap:none

include         windows.inc
include         kernel32.inc
include         user32.inc

includelib      kernel32.lib
includelib      user32.lib

.data
Process      db "MapleStory.exe",0
TitleError   db "Error",0
TimeError   db "Time out on reading addres.",0
OpenError   db "There was a error.",0
WriteError   db "Coud not write to the addres.",0
write      db 00
counter      dd 0


Startup STARTUPINFO <>
ProcessInfo PROCESS_INFORMATION <>

.data?
ReadBuff   db 100 dup (?)

.code
start:
   invoke   CreateProcess, offset Process, NULL, NULL, NULL, NULL, NULL, NULL, NULL, offset Startup, offset ProcessInfo
   test      eax, eax
   jz      openerr
rpm:
   inc      counter
   cmp      counter, 500
   jge      timeerr

   invoke   Sleep, 10
   invoke   ReadProcessMemory, ProcessInfo.hProcess, 0042E5C1h, offset ReadBuff, 1, NULL
   cmp      ReadBuff, 02
   jne      rpm

   invoke   WriteProcessMemory, ProcessInfo.hProcess, 0042E5C1h, offset write, sizeof write, 2
   cmp      eax, 2
   jne      writeerr

   jmp      exit

@@:
   invoke   CloseHandle, ProcessInfo.hThread
   invoke   CloseHandle, ProcessInfo.hProcess
   jmp      exit

openerr:
   invoke   MessageBox, 0, offset OpenError, offset TitleError, 0
   jmp      @B

writeerr:
   invoke   MessageBox, 0, offset WriteError, offset TitleError, 0
   jmp      @B

timeerr:
   invoke   MessageBox, 0, offset TimeError, offset TitleError, 0
   jmp      @B

exit:
   invoke   ExitProcess, 0
end start

If i print it to the console i get jj[hart]`[hart]`[hart]`

_________________
Back to top
View user's profile Send private message MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Jun 03, 2007 3:30 pm    Post subject: Reply with quote

I don't even have Maple Story on my computer so I cannot really help you debug it. Though I can give you a list of things to check:

1) Make sure you are reading the right address.
2) Make sure you are reading the correct amount of memory.
3) Check to make sure your conditional jumps for your error checks are not messed up.
Back to top
View user's profile Send private message
ColdDoT
Grandmaster Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 703
Location: The netherlands

PostPosted: Sun Jun 03, 2007 3:50 pm    Post subject: Reply with quote

1) Addy is from x0r and others that posted same addres
2) Tested 2 and 1 byte
3) added crt_printf after ReadProcess so i did see everything

_________________
Back to top
View user's profile Send private message MSN Messenger
Uzeil
Moderator
Reputation: 6

Joined: 21 Oct 2006
Posts: 2411

PostPosted: Sun Jun 03, 2007 4:01 pm    Post subject: Reply with quote

Silly silly man.


The return value is never 2 because the return value is boolean, which is 0 or 1. Razz

EXAMPLE

Code:
  push dword ptr Holder
  pop dword ptr HoldPos
Reader:
  push 0
  push 4
  push offset HoldPos
  push offRead
  push hProc
  call ReadProcessMemory
  test al,al
 jz Leave

  add offRead,4
  add HoldPos,4
  jmp Reader

Leave:
  push 0
  push 0
  push myString ; 'Failed to ReadProcessMemory'
  push 0
  call MessageBoxA
  push 0
  call ExitProcess


OR

Code:
if not ReadProcessMemory(hProc,pointer($00453456),addr(mybuffer),4,nil) then
  raise exception.create('Annoying Beep here to tell you that ReadProcessMemory phailed');

_________________


Mini Engine v3.0
Mipla v1.0

Reposted old threads out of the MS section.
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Jun 03, 2007 4:05 pm    Post subject: Reply with quote

Uzeil wrote:
Silly silly man.


The return value is never 2 because the return value is boolean, which is 0 or 1. Razz

EXAMPLE

Code:
  push dword ptr Holder
  pop dword ptr HoldPos
Reader:
  push 0
  push 4
  push offset HoldPos
  push offRead
  push hProc
  call ReadProcessMemory
  test al,al
 jz Leave

  add offRead,4
  add HoldPos,4
  jmp Reader

Leave:
  push 0
  push 0
  push myString ; 'Failed to ReadProcessMemory'
  push 0
  call MessageBoxA
  push 0
  call ExitProcess


OR

Code:
if not ReadProcessMemory(hProc,pointer($00453456),addr(mybuffer),4,nil) then
  raise exception.create('Annoying Beep here to tell you that ReadProcessMemory phailed');


I already said that above Uzeil.

Oh, and try reading 0042E5C2.

0042E5C1 looks like the start of the PUSH 2. You want to change the second byte and not the first one.
Back to top
View user's profile Send private message
ColdDoT
Grandmaster Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 703
Location: The netherlands

PostPosted: Sun Jun 03, 2007 4:07 pm    Post subject: Reply with quote

Nop uzeil your a silly silly man
ReadProcessMemory returns 0 or 1
ReadProcessMemory's buffer return value on the secifik addres (ReadBuff)

I see it chang when i start EMS
first it starts as a J 1 time in 10 mili seconds then it prints
4 times a heart with a ` so the loading takes
50 mili seconds i asume
that the j is when it is still packed by ASPack
and the hearts are unpacked but i dont know how to get there true value

_________________
Back to top
View user's profile Send private message MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Jun 03, 2007 4:09 pm    Post subject: Reply with quote

ColdDoT wrote:
Nop uzeil your a silly silly man
ReadProcessMemory returns 0 or 1
ReadProcessMemory's buffer return value on the secifik addres (ReadBuff)

I see it chang when i start EMS
first it starts as a J 1 time in 10 mili seconds then it prints
4 times a heart with a ` so the loading takes
50 mili seconds i asume
that the j is when it is still packed by ASPack
and the hearts are unpacked but i dont know how to get there true value


Look above your post and try that address. Looking though some threads I think it might be that one.
Back to top
View user's profile Send private message
ColdDoT
Grandmaster Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 703
Location: The netherlands

PostPosted: Sun Jun 03, 2007 4:10 pm    Post subject: Reply with quote

Thx going to check it
here is screenie of current work


//EDIT
changed addres wowa it is flipping out if i run it then but i think i getting closer
(ASProtect error 15)

_________________
Back to top
View user's profile Send private message MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Jun 03, 2007 4:18 pm    Post subject: Reply with quote

ColdDoT wrote:
Thx going to check it
here is screenie of current work
//EDIT
changed addres wowa it is flipping out if i run it then but i think i getting closer
(ASProtect error 15)


I think that error has to do with ASProtect checking the memory before it unpacks it, meaning that you have to time your write to be after ASProtect unpacks but before GameGuard is loaded. This would be why you can do it for an unpacked version and not a packed one.

If you can somehow find a way to time it properly you should be good.
Back to top
View user's profile Send private message
ColdDoT
Grandmaster Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 703
Location: The netherlands

PostPosted: Sun Jun 03, 2007 4:22 pm    Post subject: Reply with quote

Lol that why the read memory is for Smile
It check if the value is 2 if so then it is unpacked so we can read it then it rewrite it Smile
But still no luk

_________________
Back to top
View user's profile Send private message MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Jun 03, 2007 4:32 pm    Post subject: Reply with quote

ColdDoT wrote:
Lol that why the read memory is for Smile
It check if the value is 2 if so then it is unpacked so we can read it then it rewrite it Smile
But still no luk


The info I got was from a translated Russian site.

http://translate.google.com/translate?hl=en&sl=ru&u=http://www.cracklab.ru/art/%3Faction%3Dview%26id%3D151&sa=X&oi=translate&resnum=10&ct=result&prev=/search%3Fq%3Dprotection%2Berror%2B15%2Basprotect%26hl%3Den%26client%3Dopera%26rls%3Den%26hs%3DupJ%26sa%3DG

It used Sleep(300) after it found the memory then wrote to avoid error 15.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites