forked from RiotVanguard/Vanguard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
98 lines (71 loc) · 1.9 KB
/
main.c
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//
// *OFFICIAL* Riot Vanguard source code.
//
#include <ntddk.h>
//
// Because we don't know how PE files work.
//
NTKERNELAPI
PVOID
NTAPI
RtlFindExportedRoutineByName(
_In_ PVOID ImageBase,
_In_ PCCH RoutineNam
);
_IRQL_requires_same_ _IRQL_requires_(PASSIVE_LEVEL)
void
DriverUnload(
_In_ PDRIVER_OBJECT DriverObject
)
/*++
Routine Description:
This is the unload routine for the Vanguard kernel driver.
Arguments:
DriverObject - Pointer to driver object created by the system.
Return Value:
None
--*/
{
UNREFERENCED_PARAMETER(DriverObject);
//
// Bye~
//
}
_IRQL_requires_same_ _IRQL_requires_(PASSIVE_LEVEL)
NTSTATUS
DriverEntry(
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
/*++
Routine Description:
This is the entry routine for the Vanguard kernel driver.
Arguments:
DriverObject - Pointer to driver object created by the system.
RegistryPath - Receives the full registry path to the SERVICES
node of the current control set.
Return Value:
An NTSTATUS code.
--*/
{
UNREFERENCED_PARAMETER(RegistryPath);
NTSTATUS Status = STATUS_UNSUCCESSFUL;
DriverObject->DriverUnload = DriverUnload;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\vgk_PLZNOHACK");
PFILE_OBJECT FileObject = NULL;
PDEVICE_OBJECT DeviceObject = NULL;
if (NT_SUCCESS(IoGetDeviceObjectPointer(&DeviceName, FILE_READ_DATA, &FileObject, &DeviceObject)))
{
const PDRIVER_OBJECT VgkDriverObject = DeviceObject->DriverObject;
if (VgkDriverObject && VgkDriverObject->DriverStart)
{
//
// Executing Vanguard kernel.
//
((void(*)())(RtlFindExportedRoutineByName(VgkDriverObject->DriverStart, "Egg")))();
Status = STATUS_SUCCESS;
}
ObDereferenceObject(FileObject);
}
return Status;
}