My bad. I meant start address of the executable so that my pointers work inside script without checking it every time in CE. If what you said is exactly that then after reading your explanation I can sadly say that I do not know how to do it. Could you point me in correct direction?
Maybe some way to do this using ffi.C option which I currently use to read double values in memory.
Currently use this type of ffi code to read double. Maybe that could be reused?
Код
local ffi = require("ffi")
local user, kernel = ffi.load('User32'), ffi.load('Kernel32')
ffi.cdef[[
int OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
int GetWindowThreadProcessId(int hWnd, int *lpdwProcessId);
bool CloseHandle(int hObject);
bool ReadProcessMemory(int hProcess, int lpBaseAddress, void *lpBuffer, int nSize, int *lpNumberOfBytesRead);
int GetModuleHandleA(const char *lpModuleName);
]]
function readDouble(address)
if workwindow() == 0 then log('No Workwindow') return -1 end
local PID, pointer_double = ffi.new('unsigned long[1]'), ffi.new('double[1]')
user.GetWindowThreadProcessId(workwindow(), PID)
local process = kernel.OpenProcess(PROCESS_VM_READ, true, PID[0])
if process > 0 then
kernel.ReadProcessMemory(process, address, pointer_double, 8, nil)
kernel.CloseHandle(process);
return tonumber(pointer_double[0])
end
--log('Proccess not open.')
end_script () --
end
Sorry for the trouble I create.
Сообщение отредактировал DarkMaster - 1.11.2023, 5:51