-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathntprivapi.hpp
More file actions
68 lines (53 loc) · 1.87 KB
/
Copy pathntprivapi.hpp
File metadata and controls
68 lines (53 loc) · 1.87 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- userdpiapi.hpp
Abstract:
- This module is used for abstracting calls to ntdll DLL APIs to break DDK dependencies.
Author(s):
- Michael Niksa (MiNiksa) July-2016
--*/
#pragma once
#include "conddkrefs.h"
// From winternl.h
typedef enum _PROCESSINFOCLASS {
ProcessBasicInformation = 0,
ProcessDebugPort = 7,
ProcessWow64Information = 26,
ProcessImageFileName = 27,
ProcessBreakOnTermination = 29
} PROCESSINFOCLASS;
typedef struct _PROCESS_BASIC_INFORMATION {
PVOID Reserved1;
PVOID PebBaseAddress;
PVOID Reserved2[2];
ULONG_PTR UniqueProcessId;
ULONG_PTR Reserved3;
} PROCESS_BASIC_INFORMATION;
typedef PROCESS_BASIC_INFORMATION *PPROCESS_BASIC_INFORMATION;
// end From winternl.h
class NtPrivApi sealed
{
public:
[[nodiscard]]
static NTSTATUS s_GetProcessParentId(_Inout_ PULONG ProcessId);
~NtPrivApi();
private:
[[nodiscard]]
static NTSTATUS s_NtOpenProcess(_Out_ PHANDLE ProcessHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
_In_opt_ PCLIENT_ID ClientId);
[[nodiscard]]
static NTSTATUS s_NtQueryInformationProcess(_In_ HANDLE ProcessHandle,
_In_ PROCESSINFOCLASS ProcessInformationClass,
_Out_ PVOID ProcessInformation,
_In_ ULONG ProcessInformationLength,
_Out_opt_ PULONG ReturnLength);
[[nodiscard]]
static NTSTATUS s_NtClose(_In_ HANDLE Handle);
static NtPrivApi& _Instance();
HMODULE _hNtDll;
NtPrivApi();
};