RawInitialize

INT64 __stdcall RawInitialize(_DRIVER_OBJECT *DriverObject, _UNICODE_STRING *RegistryPath){
  WCHAR v2; 
  INT64 result; 
  WCHAR v5; 
  NTSTATUS v6; 
  WCHAR v7; 
  UINT64 v8; 
  UINT64 v9; 
  UINT64 v10; 
  struct _UNICODE_STRING DestinationString; 
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, L"\\Device\\RawDisk", v2);
  LODWORD(v8) = 0;
  LODWORD(result) = IoCreateDevice(DriverObject, 0i64, &DestinationString, 8ui64, v8, 0, &RawDeviceDiskObject);
  if( (int)result >= 0 )
  {
    DriverObject->DriverUnload = (void(__fastcall *)(_DRIVER_OBJECT *))RawUnload;
    RtlInitUnicodeString(&DestinationString, L"\\Device\\RawCdRom", v5);
    LODWORD(v9) = 0;
    v6 = IoCreateDevice(DriverObject, 0i64, &DestinationString, 3ui64, v9, 0, &RawDeviceCdRomObject);
    if( v6 >= 0 )
    {
      RtlInitUnicodeString(&DestinationString, L"\\Device\\RawTape", v7);
      LODWORD(v10) = 0;
      v6 = IoCreateDevice(DriverObject, 0i64, &DestinationString, 0x20ui64, v10, 0, &RawDeviceTapeObject);
      if( v6 >= 0 )
      {
        v6 = IoRegisterShutdownNotification(RawDeviceTapeObject);
        if( v6 >= 0 )
        {
          *((_DWORD *)RawDeviceDiskObject + 12) |= 0x10u;
          *((_DWORD *)RawDeviceCdRomObject + 12) |= 0x10u;
          *((_DWORD *)RawDeviceTapeObject + 12) |= 0x10u;
          DriverObject->MajorFunction[9] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[27] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[14] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[13] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[10] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[6] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[5] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[4] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[3] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[2] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[18] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[0] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawDispatch;
          DriverObject->MajorFunction[16] = (int(__fastcall *)(_DEVICE_OBJECT *, _IRP *))RawShutdown;
          IoRegisterFileSystem(RawDeviceDiskObject);
          IoRegisterFileSystem(RawDeviceCdRomObject);
          IoRegisterFileSystem(RawDeviceTapeObject);
          ObfReferenceObject(RawDeviceDiskObject);
          ObfReferenceObject(RawDeviceCdRomObject);
          ObfReferenceObject(RawDeviceTapeObject);
          RawGlobalLock.Owner = 0i64;
          RawGlobalLock.Contention = 0;
          RawGlobalLock.Event.Header.SignalState = 0;
          qword_140C1DCF8 = (__int64)&RawMountedQueue;
          RawMountedQueue = (__int64)&RawMountedQueue;
          qword_140C1DCE8 = (__int64)&RawDismountedQueue;
          RawDismountedQueue = (__int64)&RawDismountedQueue;
          RawGlobalLock.Event.Header.WaitListHead.Blink = &RawGlobalLock.Event.Header.WaitListHead;
          RawGlobalLock.Event.Header.WaitListHead.Flink = &RawGlobalLock.Event.Header.WaitListHead;
          result = 0i64;
          RawGlobalLock.Count = 1;
          LOWORD(RawGlobalLock.Event.Header.Lock) = 1;
          RawGlobalLock.Event.Header.Size = 6;
          return result;
        }
        IoDeleteDevice(RawDeviceTapeObject);
      }
      IoDeleteDevice(RawDeviceCdRomObject);
    }
    IoDeleteDevice(RawDeviceDiskObject);
    return(unsigned int)v6;
  }
  return result;
}

Referenced by:

No references.