Who needs a goal when you're doing something enjoyable?
On the code side; I think I set my flags wrong though, GetLastError is returning 299 (Quote msdn: "Only part of a ReadProcessMemory or WriteProcessMemory request was completed.") Probably my tokens;
Code:
HANDLE tProc;
HWND tWND;
DWORD ProcessId;
HANDLE TokenHandle;
LUID debugid;
TOKEN_PRIVILEGES tp;
HANDLE CURRENTPROCESS = GetCurrentProcess();
tWND = FindWindow(NULL, "Calculator");
if(tWND){
GetWindowThreadProcessId(tWND, &ProcessId);
tProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessId);
OpenProcessToken(CURRENTPROCESS, TOKEN_QUERY, &TokenHandle);
LookupPrivilegeValue(NULL, "SeDebugPrivilege", &debugid);
tp.Privileges[0].Luid = debugid;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(TokenHandle, FALSE, &tp, NULL, NULL, NULL);
Meh... Why wont you work damn you!