MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / DriverEntry

Function DriverEntry

Anti-Rootkit/ARK.cpp:110–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108// ����Ϊȫ��ִ��ʧ�ܣ���ô�Dz������ġ�
109// ϵͳ���ڵ���Դ���ж�״̬�£�Ӧ��֤�������ڶ��ӻ����£����̶ȵ�����߼�����
110extern "C" NTSTATUS
111DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath) {
112 if (*InitSafeBootMode > 0) {
113 // The operating system is in Safe Mode.
114 return STATUS_NOT_SAFE_MODE_DRIVER;
115 }
116
117 // �������Լ����ˣ������û��ʵ������������Ӧ
118 if (DriverObject == nullptr) {
119 return STATUS_UNSUCCESSFUL;
120 }
121
122 g_DriverObject = DriverObject;
123
124 TraceLoggingRegister(g_Provider);
125
126 TraceLoggingWrite(g_Provider, "DriverEntry started",
127 TraceLoggingLevel(TRACE_LEVEL_INFORMATION),
128 TraceLoggingValue("Ark Driver", "DriverName"),
129 TraceLoggingUnicodeString(RegistryPath, "RegistryPath")
130 );
131
132 Log(LogLevel::Information, "DriverEntry called.Registry Path: %wZ\n", RegistryPath);
133
134 RTL_OSVERSIONINFOW info;
135 NTSTATUS status = RtlGetVersion(&info);
136 if (!NT_SUCCESS(status)) {
137 KdPrint(("Failed to get the version information (0x%08X)\n", status));
138 return status;
139 }
140
141 InitializeListHead(&g_SysMonGlobals.ItemHead);
142 g_SysMonGlobals.Mutex.Init();
143
144 // Set an Unload routine
145 DriverObject->DriverUnload = AntiRootkitUnload;
146 // Set dispatch routine the driver supports
147 // ��ͼ����ʱ
148 DriverObject->MajorFunction[IRP_MJ_CREATE] = AntiRootkitCreateClose;
149 // ��������ʱ
150 DriverObject->MajorFunction[IRP_MJ_CLOSE] = AntiRootkitCreateClose;
151 // �豸��������
152 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = AntiRootkitDeviceControl;
153 DriverObject->MajorFunction[IRP_MJ_READ] = AntiRootkitRead;
154 DriverObject->MajorFunction[IRP_MJ_WRITE] = AntiRootkitWrite;
155 DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = AntiRootkitShutdown;
156
157 // After the DriverUnload is been initialized, this is very important!
158 status = g_State.Lock.Init();
159 if (!NT_SUCCESS(status))
160 return status;
161
162
163 UNICODE_STRING devName = RTL_CONSTANT_STRING(L"\\Device\\AntiRootkit");
164 // �������ʱ��ʼ����Щ����
165 PDEVICE_OBJECT DeviceObject = nullptr;
166 UNICODE_STRING symLink = RTL_CONSTANT_STRING(L"\\??\\AntiRootkit");
167 bool symLinkCreated = false;

Callers

nothing calls this directly

Calls 6

LogFunction · 0.85
InitializeListHeadFunction · 0.85
InitMiniFilterFunction · 0.85
LogErrorFunction · 0.85
InitMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected