|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
yazigegeda Expert Cheater Reputation: 0
Joined: 22 Jan 2019 Posts: 159
|
Posted: Thu Oct 15, 2020 12:04 am Post subject: Call failed |
|
|
Code: |
function OpenProcessA(pid)
return executeCodeLocalEx('KERNEL32.OpenProcess',{0,2035711},{0,0},{0,pid})
end
function ReadProcessMemory(hand,address,value)
return executeCodeLocalEx('KERNEL32.ReadProcessMemory',{0,hand},{0,address},{0,value},{0,4},{0,0})
end
|
My call failed. I may have written it wrong. Help me. :oops:
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Oct 15, 2020 3:53 am Post subject: |
|
|
First, I am not sure this work with CE Lua, but anyhow:
Code: | from : Microsoft.docs
signature :
BOOL ReadProcessMemory(
HANDLE hProcess,
LPCVOID lpBaseAddress,
LPVOID lpBuffer,
SIZE_T nSize,
SIZE_T *lpNumberOfBytesRead
)
hProcess
--------
A handle to the process with memory that is being read.
The handle must have PROCESS_VM_READ access to the process.
lpBaseAddress
-------------
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
--------
A pointer to a buffer that receives the contents from the address space of
the specified process.
nSize
-----
The number of bytes to be read from the specified process.
lpNumberOfBytesRead
-------------------
A pointer to a variable that receives the number of bytes transferred
into the specified buffer.
If lpNumberOfBytesRead is NULL, the parameter is ignored.
Note:
1. If the function succeeds, the return value is nonzero.
2. ReadProcessMemory copies the data in the specified address range
from the address space of the specified process into the specified buffer
of the current process. Any process that has a handle
with PROCESS_VM_READ access can call the function.
3. The entire area to be read must be accessible, and if it is not accessible,
the function fails.
So, the function shoud be:
function ReadProcessMemory(hProcess, lpBase, lpBuffer, nSize, lpNumberOfBytesRead)
-- hProcess = Pointer
-- lpBase = Integer or integer 64 for 64bit
-- lpBuffer = Integer
-- nSize = Integer
-- lpNumberOfBytesRead = integer
return executeCodeLocalEx("kernel32.ReadProcessMemory",hProcess, lpBase, lpBuffer,
nSize, lpNumberOfBytesRead)
end
function _OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId)
-- dwDesiredAccess = DWORD = acess flag
-- bInheritHandle = Booelan
-- dwProcessId = PID
return executeCodeLocalEx("kernel32.OpenProcess", dwDesiredAccess, bInheritHandle, dwProcessId)
end
-----------
-- example:
-----------
PROCESS_ALL_ACCESS = 0x001F0FFF
openProcess(1234) -- 1234 = PID of opened process
--- or
openProcess("game.exe")
--- or
hProc=OpenProcess(PROCESS_ALL_ACCESS, false, 1234)
-- Make sure the base address is correct first and then
local Pointer = 0
ReadProcessMemory(hProc, 22724000, Pointer, 4, 0)
local Address = 0x21EF80 + 0x784B2
local value = 0
ReadProcessMemory(hp, Address, value, 4, nil)
print(value) |
In the end just note down this: I don't know what exactly what I am doing.
And I love NASCAR, I don't know why.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Oct 15, 2020 4:33 am Post subject: |
|
|
a memorystream's .Memory property can be used as address /pointer
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
yazigegeda Expert Cheater Reputation: 0
Joined: 22 Jan 2019 Posts: 159
|
Posted: Thu Oct 15, 2020 7:04 pm Post subject: |
|
|
Dark Byte wrote: | a memorystream's .Memory property can be used as address /pointer |
How to write .Memory? help me :?
Thank you very much for replying, but it seems invalid. . . :oops:
Description: |
|
Filesize: |
62.87 KB |
Viewed: |
1596 Time(s) |
|
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
|
Back to top |
|
|
yazigegeda Expert Cheater Reputation: 0
Joined: 22 Jan 2019 Posts: 159
|
Posted: Thu Oct 15, 2020 8:55 pm Post subject: |
|
|
1.png: I define it according to the function you gave, but this is invalid
2.png: I changed the second parameter to 0 to output correctly :oops:
I don't know what's going on :?
But even if 2.png can get the correct hand, 3.png cannot be read. . :cry:
Description: |
|
Filesize: |
17.74 KB |
Viewed: |
1576 Time(s) |
|
Description: |
|
Filesize: |
34.26 KB |
Viewed: |
1580 Time(s) |
|
Description: |
|
Filesize: |
28.85 KB |
Viewed: |
1580 Time(s) |
|
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Fri Oct 16, 2020 6:14 am Post subject: |
|
|
Just example:
Code: | PROCESS_WM_READ = 0x10
function _OpenProcess(Access, InheritHandle, pPID)
return executeCodeLocalEx("kernel32.OpenProcess", Access, InheritHandle, pPID)
end
function ReadProcessMemory(hProcess, pBaseAddress, lpBuffer, dwSize, lpNumberOfBytesRead)
return executeCodeLocalEx("kernel32.ReadProcessMemory", hProcess, pBaseAddress, lpBuffer, dwSize, lpNumberOfBytesRead)
end
-- Example:
function testReadProMem()
use_this = [[
local notepadProcess = openProcess("notepad.exe")
local notepadpid = getOpenedProcessID()
local processHandle = _OpenProcess(PROCESS_WM_READ, false, notepadpid)
local bytesRead = 0
local buffer = createMemoryStream()
buffer.Size = 1024
buffer.Position = 0
print(buffer.readDword(), buffer.Size)
print(readStringLocal(buffer.Memory , buffer.Size))
print("address: ", buffer.Memory)
]]
-- or
processHandle = openProcess("notepad.exe")
local bytesRead = 0
local buffer = createMemoryStream()
buffer.Size = 23
buffer.Position = 0
ReadProcessMemory(processHandle, 0x36B9D0, buffer.Memory, buffer.Length, bytesRead)
note = [[
to get result = Console.WriteLine(Encoding.Unicode.GetString(buffer))
but I don't know write it in Lua
]]
print(buffer.readDword(), buffer.Size)
print(readStringLocal(buffer.Memory , buffer.Size))
print("address: ", buffer.Memory)
print( readIntegerLocal(buffer.Memory) ) -- 1
buffer.Position = buffer.Position + 6
print( readIntegerLocal(buffer.Memory + buffer.Position, true) )
print( readIntegerLocal(buffer.Memory + buffer.Position) )
buffer.Destroy()
buffer = nil
end
testReadProMem() |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
|
|
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
|
|