-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathnt.c
More file actions
52 lines (46 loc) · 1.11 KB
/
Copy pathnt.c
File metadata and controls
52 lines (46 loc) · 1.11 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
#include <Windows.h>
#include <stdio.h>
// Define NTDLL function prototypes
typedef struct _UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} UNICODE_STRING, *PUNICODE_STRING;
typedef struct _OBJECT_ATTRIBUTES {
ULONG Length;
HANDLE RootDirectory;
PUNICODE_STRING ObjectName;
ULONG Attributes;
PVOID SecurityDescriptor;
PVOID SecurityQualityOfService;
} OBJECT_ATTRIBUTES;
typedef struct _CLIENT_ID {
HANDLE UniqueProcess;
HANDLE UniqueThread;
} CLIENT_ID;
<MAIN>
{
HANDLE test;
HANDLE processHandle = GetCurrentProcess();
PVOID remoteAddress = NULL;
OBJECT_ATTRIBUTES ObjectAttributes = { 0 };
CLIENT_ID ClientId;
ClientId.UniqueProcess = 8888;
NTSTATUS status;
HANDLE hProcess = NULL;
DWORD DesiredAccess = PROCESS_ALL_ACCESS;
DWORD allocationSize = 1024;
status = NtOpenProcess(
&hProcess,
DesiredAccess,
&ObjectAttributes,
&ClientId
);
status = NtAllocateVirtualMemory(hProcess,
&remoteAddress,
0,
&allocationSize,
MEM_COMMIT | MEM_RESERVE,
PAGE_READWRITE);
return 0;
}