IopStoreSystemPartitionInformation
VOID __stdcall IopStoreSystemPartitionInformation(_UNICODE_STRING *OsLoaderPathName, _UNICODE_STRING *a2){
NTSTATUS v3;
NTSTATUS v4;
NTSTATUS v5;
VOID *v6;
__int64 Length;
unsigned __int16 v8;
wchar_t *Buffer;
unsigned __int16 v10;
UINT64 CreateOptions;
UINT64 *Disposition;
_UNICODE_STRING LinkTarget;
_UNICODE_STRING KeyName;
VOID *LinkHandle;
VOID *Handle;
PVOID KeyHandle;
_OBJECT_ATTRIBUTES ObjectAttributes;
int v19;
int v20;
int v21;
int v22;
int v23;
int v24;
int v25;
int v26;
WCHAR pszDest[256];
LinkHandle = 0i64;
*(&ObjectAttributes.Length + 1) = 0;
*(&ObjectAttributes.Attributes + 1) = 0;
Handle = 0i64;
KeyHandle = 0i64;
KeyName = 0i64;
*(_DWORD *)(&LinkTarget.MaximumLength + 1) = 0;
RtlStringCchCopyW(pszDest, 0x100ui64, IoArcHalDeviceName.Buffer);
LinkTarget.Buffer = pszDest;
LinkTarget.Length = IoArcHalDeviceName.Length;
if( IoArcHalDeviceName.Length > 0x200u )
LinkTarget.Length = 512;
LinkTarget.MaximumLength = 510;
while( 1 )
{
ObjectAttributes.Length = 48;
ObjectAttributes.ObjectName = &LinkTarget;
ObjectAttributes.RootDirectory = 0i64;
ObjectAttributes.Attributes = 576;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
v3 = ZwOpenSymbolicLinkObject(&LinkHandle, 1, &ObjectAttributes);
if( v3 < 0 )
break;
v4 = NtQuerySymbolicLinkObject(LinkHandle, &LinkTarget, 0i64);
ObCloseHandle(LinkHandle, 0);
if( v4 < 0 )
return;
LinkTarget.Buffer[(unsigned __int64)LinkTarget.Length >> 1] = 0;
}
if( v3 == -1073741788 && IopOpenRegistryKeyEx(&Handle, 0i64, &CmRegistryMachineSystemName, 0xF003Fui64) >= 0 )
{
KeyName.Buffer = (wchar_t *)&v19;
v19 = 6619219;
v20 = 7667828;
v21 = 112;
*(_DWORD *)&KeyName.Length = 786442;
LODWORD(CreateOptions) = 0;
v5 = IopCreateRegistryKeyEx(&KeyHandle, Handle, &KeyName, 0xF003Fui64, CreateOptions, 0i64);
ObCloseHandle(Handle, 0);
if( v5 >= 0 )
{
v6 = KeyHandle;
if( !InitIsWinPEMode )
{
v19 = 7929939;
LODWORD(Disposition) = LinkTarget.Length + 2;
v20 = 7602291;
v21 = 7143525;
v22 = 6357072;
v23 = 7602290;
v24 = 7602281;
v25 = 7274601;
v26 = 110;
*(_DWORD *)&KeyName.Length = 2097182;
NtSetValueKey(KeyHandle, &KeyName, 0i64, 1ui64, LinkTarget.Buffer, (UINT64)Disposition);
}
Length = a2->Length;
v19 = 7536719;
v8 = Length;
v20 = 7274572;
v21 = 6553697;
v22 = 7471205;
v23 = 6357072;
v24 = 6815860;
LOWORD(v25) = 0;
*(_DWORD *)&KeyName.Length = 1703960;
if( (unsigned __int16)Length > 2u )
{
Buffer = a2->Buffer;
if( *(wchar_t *)((char *)Buffer + Length - 2) == 92 )
{
v10 = Length - 2;
a2->Length = v10;
*(wchar_t *)((char *)Buffer + v10) = 0;
v8 = a2->Length;
}
}
LODWORD(Disposition) = v8 + 2;
NtSetValueKey(v6, &KeyName, 0i64, 1ui64, a2->Buffer, (UINT64)Disposition);
ObCloseHandle(v6, 0);
}
}
}Referenced by:
IopMarkBootPartition