forked from strivexjun/DriverInjectDll
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc.cpp
More file actions
Latest commit
29 lines (27 loc) · 967 Bytes
/
Copy pathmisc.cpp
File metadata and controls
29 lines (27 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include"misc.h"
#include"undocumented.h"
ULONGMisc::GetProcessIDFromProcessHandle(HANDLE ProcessHandle)
{
PROCESS_BASIC_INFORMATIONPBI;
if(NT_SUCCESS(Undocumented::ZwQueryInformationProcess(ProcessHandle, ProcessBasicInformation, &PBI, sizeof(PBI), NULL)))
return (ULONG)PBI.UniqueProcessId;
else
return0;
}
ULONGMisc::GetProcessIDFromThreadHandle(HANDLE ThreadHandle)
{
typedefstruct_THREAD_BASIC_INFORMATION
{
NTSTATUS ExitStatus;
PVOID TebBaseAddress;
CLIENT_ID ClientId;
KAFFINITY AffinityMask;
KPRIORITY Priority;
KPRIORITY BasePriority;
} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
THREAD_BASIC_INFORMATIONTBI;
if(NT_SUCCESS(Undocumented::ZwQueryInformationThread(ThreadHandle, ThreadBasicInformation, &TBI, sizeof(TBI), NULL)))
returnPtrToUlong(TBI.ClientId.UniqueProcess);
else
return0;
}