IopMarkBootPartition

NTSTATUS __stdcall IopMarkBootPartition(
        _LOADER_PARAMETER_BLOCK *LoaderBlock,
        PVOID Context,
        _UNICODE_STRING *DeviceNameUnicodeString){
  int v5; 
  VOID **v6; 
  _DEVICE_OBJECT *DeviceAttachmentBaseRefWithTag; 
  _GUID *v8; 
  _DEVICE_OBJECT *v9; 
  _UNICODE_STRING *v10; 
  int v12; 
  PVOID *Object; 
  UINT64 OpenOptions; 
  VOID *FileHandle; 
  _STRING DestinationString; 
  _UNICODE_STRING UnicodeString; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  _IO_STATUS_BLOCK IoStatusBlock; 
  INT8 pszFormat[24]; 
  INT8 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);
    v5 = RtlAnsiStringToUnicodeString(DeviceNameUnicodeString, &DestinationString, 1u);
    if( v5 >= 0 )
    {
      ObjectAttributes.RootDirectory = 0i64;
      LODWORD(OpenOptions) = 64;
      LODWORD(Object) = 0;
      ObjectAttributes.Length = 48;
      ObjectAttributes.Attributes = 576;
      *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
      ObjectAttributes.ObjectName = DeviceNameUnicodeString;
      v5 = ZwOpenFile(&FileHandle, 0x80ui64, &ObjectAttributes, &IoStatusBlock, (UINT64)Object, OpenOptions);
      if( v5 >= 0 )
      {
        *(_QWORD *)&DestinationString.Length = 0i64;
        v5 = ObReferenceObjectByHandle(
               FileHandle,
               0i64,
               (_OBJECT_TYPE *)IoFileObjectType,
               0,
               (VOID **)&DestinationString,
               0i64);
        if( v5 >= 0 )
        {
          v6 = *(VOID ***)&DestinationString.Length;
          DeviceAttachmentBaseRefWithTag = IoGetDeviceAttachmentBaseRefWithTag(
                                             *(_DEVICE_OBJECT **)(*(_QWORD *)&DestinationString.Length + 8i64),
                                             0x746C6644ui64);
          v8 = (_GUID *)v6[1];
          v9 = DeviceAttachmentBaseRefWithTag;
          v8[3].Data1 |= 0x100u;
          DeviceAttachmentBaseRefWithTag->Flags |= 0x100u;
          if( InitIsWinPEMode )
          {
            v8 = (_GUID *)v6[1];
            v12 = *(_DWORD *)&v8[3].Data2;
            if( (v12 & 1) != 0 )
              dword_140C50500 |= 0x200u;
            if( (v12 & 2) != 0 )
              dword_140C50500 |= 0x100u;
          }
          PnpHardwareConfigCreateBootDriverFlags(v8, (__int64)FileHandle);
          ObfReferenceObjectWithTag(v6[1], 0x746C6644ui64);
          ObCloseHandle(FileHandle, 0);
          ObfDereferenceObjectWithTag(v6, 0x746C6644ui64);
          ObfDereferenceObjectWithTag(v9, 0x746C6644ui64);
          IopAssignBootDriveLetter();
          v5 = IopCreateUnicodeFromAnsiBuffer(&UnicodeString, LoaderBlock->NtHalPathName);
          if( v5 >= 0 )
          {
            IopStoreSystemPartitionInformation(v10, &UnicodeString);
            RtlFreeAnsiString(&UnicodeString);
          }
        }
      }
    }
  }
  return v5;
}

Referenced by:

No references.