IopMarkBootPartition

NTSTATUS __stdcall IopMarkBootPartition(
        _LOADER_PARAMETER_BLOCK *LoaderBlock,
        PVOID Context,
        _UNICODE_STRING *DeviceNameUnicodeString){
  NTSTATUS v5; 
  INT8 v6; 
  PVOID *v7; 
  DEVICE_OBJECT *DeviceAttachmentBaseRefWithTag; 
  _GUID *v9; 
  DEVICE_OBJECT *v10; 
  UNICODE_STRING *v11; 
  int v13; 
  void *FileHandle; 
  struct _STRING DestinationString; 
  struct _UNICODE_STRING UnicodeString; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  struct _IO_STATUS_BLOCK IoStatusBlock; 
  char pszFormat[24]; 
  char pszDest[256]; 
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  FileHandle = 0i64;
  *(_QWORD *)&UnicodeString.Length = 0i64;
  UnicodeString.Buffer = 0i64;
  strcpy(pszFormat, "\\ArcName\\%s");
  DestinationString = 0i64;
  IoStatusBlock = 0i64;
  v5 = RtlStringCchPrintfA(pszDest, 0x100ui64, pszFormat);
  if( v5 >= 0 )
  {
    RtlInitAnsiString(&DestinationString, pszDest, v6);
    v5 = RtlAnsiStringToUnicodeString(DeviceNameUnicodeString, &DestinationString, 1u);
    if( v5 >= 0 )
    {
      ObjectAttributes.RootDirectory = 0i64;
      ObjectAttributes.Length = 48;
      ObjectAttributes.Attributes = 576;
      *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
      ObjectAttributes.ObjectName = DeviceNameUnicodeString;
      v5 = ZwOpenFile((UNICODE_STRING *)&FileHandle, (PWCHAR)0x80);
      if( v5 >= 0 )
      {
        *(_QWORD *)&DestinationString.Length = 0i64;
        v5 = ObReferenceObjectByHandle(
               FileHandle,
               0,
               (POBJECT_TYPE)IoFileObjectType,
               0,
               (PVOID *)&DestinationString,
               0i64);
        if( v5 >= 0 )
        {
          v7 = *(PVOID **)&DestinationString.Length;
          DeviceAttachmentBaseRefWithTag = IoGetDeviceAttachmentBaseRefWithTag(
                                             *(DEVICE_OBJECT **)(*(_QWORD *)&DestinationString.Length + 8i64),
                                             0x746C6644ui64);
          v9 = (_GUID *)v7[1];
          v10 = DeviceAttachmentBaseRefWithTag;
          v9[3].Data1 |= 0x100u;
          *((_DWORD *)DeviceAttachmentBaseRefWithTag + 12) |= 0x100u;
          if( InitIsWinPEMode )
          {
            v9 = (_GUID *)v7[1];
            v13 = *(_DWORD *)&v9[3].Data2;
            if( (v13 & 1) != 0 )
              InitWinPEModeType |= 0x200u;
            if( (v13 & 2) != 0 )
              InitWinPEModeType |= 0x100u;
          }
          PnpHardwareConfigCreateBootDriverFlags(v9, FileHandle);
          ObfReferenceObjectWithTag(v7[1], 0x746C6644u);
          ObCloseHandle(FileHandle, 0);
          ObfDereferenceObjectWithTag(v7, 0x746C6644ui64);
          ObfDereferenceObjectWithTag(v10, 0x746C6644ui64);
          IopAssignBootDriveLetter();
          v5 = IopCreateUnicodeFromAnsiBuffer(&UnicodeString, *((PSTR *)LoaderBlock + 26));
          if( v5 >= 0 )
          {
            IopStoreSystemPartitionInformation(v11, &UnicodeString);
            RtlFreeAnsiString(&UnicodeString);
          }
        }
      }
    }
  }
  return v5;
}

Referenced by:

No references.