May 10, 2018 at 7:42am UTC
Hi all:
I am trying to create a memory scanner, but my readprocessmemory()
line always returns error!
The problem appears to originate from incorrect values/variables fed to the
function.
https://pastebin.com/4KAJLLL3
Last edited on May 10, 2018 at 7:42am UTC
May 11, 2018 at 8:09pm UTC
I'm going to go out on a limb here and guess that the error code you are getting is error code 5; access denied. You need to enable the SeDebug flag on any process reading memory from other processes.
EDIT: Sorry, it just occurred to me that my last post was less than useful.
1 2 3 4 5 6 7 8 9 10 11 12
HANDLE CurrentProc = OpenProcess(PROCESS_ALL_ACCESS, TRUE, GetCurrentProcessId());
HANDLE CurrentToken = NULL;
TOKEN_PRIVILEGES tPriv[1];
tPriv[0].PrivilegeCount = 1;
OpenProcessToken(CurrentProc, TOKEN_ADJUST_PRIVILEGES, &CurrentToken))
LookupPrivilegeValueA(NULL, "SeDebugPrivilege" , &PrivValue))
tPriv[0].Privileges[0].Luid = PrivValue;
tPriv[0].Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(CurrentToken, FALSE, tPriv, 0, NULL, NULL);
The headers to include are windows.h, winbase.h; also link to what ever version of Advapi32 works with your compiler.
Last edited on May 11, 2018 at 8:28pm UTC