Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple PID Support #24

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CloseHandle Fixes
dlardo committed Nov 25, 2023
commit 4f149f3407236889ce20eb723f9dff8d538d15a3
21 changes: 8 additions & 13 deletions Main.c
Original file line number Diff line number Diff line change
@@ -208,6 +208,7 @@ i8 PauseProcess(u32 Pid) {
}

NtSuspendProcess(ProcessHandle);
CloseHandle(ProcessHandle);
gIsPaused = TRUE;
addToSet(&gPids, Pid);
DbgPrint(L"Process %d paused!", Pid);
@@ -228,16 +229,15 @@ u32 PidOfForegroundProcess(void) {
MsgBox(L"Failed to get PID from foreground window! Error code 0x%08lx", APPNAME L" Error", MB_OK | MB_ICONERROR, GetLastError());
return 0;
}

HANDLE ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessId);
if (ProcessHandle == NULL)
{
MsgBox(L"Failed to open process %d! Error 0x%08lx", APPNAME L" Error", MB_OK | MB_ICONERROR, ProcessId, GetLastError());
return 0;
}
else
{
CloseHandle(ProcessHandle);
return 0;
}
CloseHandle(ProcessHandle);
return ProcessId;
}

@@ -333,15 +333,10 @@ i8 ResumeProcess(u32 Pid)
MsgBox(L"Failed to open process %d! Error 0x%08lx", APPNAME L" Error", MB_OK | MB_ICONERROR, Pid, GetLastError());
return -1;
}
else
{
NtResumeProcess(ProcessHandle);
DbgPrint(L"Resume of %d successful.", Pid);
}
if (ProcessHandle)
{
CloseHandle(ProcessHandle);
}

NtResumeProcess(ProcessHandle);
CloseHandle(ProcessHandle);
DbgPrint(L"Resume of %d successful.", Pid);
return 0;
}