9 HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
11 typedef LONG(NTAPI *NtSuspendProcess)(IN HANDLE ProcessHandle);
13 NtSuspendProcess pfnNtSuspendProcess = (NtSuspendProcess)GetProcAddress(
14 GetModuleHandleA(
"ntdll"),
"NtSuspendProcess");
15 if (!pfnNtSuspendProcess) {
18 LONG res = pfnNtSuspendProcess(processHandle);
19 CloseHandle(processHandle);
28 HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
30 typedef LONG(NTAPI *NtResumeProcess)(IN HANDLE ProcessHandle);
32 NtResumeProcess pfnNtResumeProcess = (NtResumeProcess)GetProcAddress(
33 GetModuleHandleA(
"ntdll"),
"NtResumeProcess");
34 if (!pfnNtResumeProcess) {
37 LONG res = pfnNtResumeProcess(processHandle);
38 CloseHandle(processHandle);
47 DWORD my_pid = GetCurrentProcessId();
48 const bool is_me = remote_pid == my_pid;
60 bool is_my_child = remote_parent == my_pid;
61 bool is_my_parent = my_parent == remote_pid;
62 bool is_sibling = my_parent == remote_parent;
64 if (!is_my_child && !is_my_parent && !is_sibling) {
75 PROCESS_BASIC_INFORMATION pbi;
79 typedef NTSTATUS(__stdcall *FPTR_NtQueryInformationProcess) (HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
81 FPTR_NtQueryInformationProcess NtQueryInformationProcess
82 = (FPTR_NtQueryInformationProcess)GetProcAddress(GetModuleHandleA(
"ntdll"),
"NtQueryInformationProcess");
83 if (!NtQueryInformationProcess) {
87 hProcess = OpenProcess(PROCESS_QUERY_INFORMATION,
96 ntStatus = NtQueryInformationProcess(hProcess,
97 ProcessBasicInformation,
99 sizeof(PROCESS_BASIC_INFORMATION),
103 if (ntStatus == S_OK)
104 dwParentPID = (DWORD)pbi.InheritedFromUniqueProcessId;
105 CloseHandle(hProcess);