NtReplacePartitionUnit
NTSTATUS __stdcall NtReplacePartitionUnit(
_UNICODE_STRING *TargetInstancePath,
_UNICODE_STRING *SpareInstancePath,
UINT64 Flags){
int v3;
_DEVICE_OBJECT *v6;
_DEVICE_OBJECT *v7;
int UserModeCallersCopy;
UINT64 v9;
_DEVICE_OBJECT *v10;
_DEVICE_OBJECT *v11;
_DEVICE_OBJECT *v12;
_DWORD *DeviceNode;
_DEVICE_OBJECT *v14;
_DWORD *v15;
UINT64 AllocateDestination;
UINT64 AllocateDestinationa;
PVOID P[3];
VOID *Src[2];
_UNICODE_STRING v21;
VOID *Destination;
v3 = Flags;
*(_OWORD *)Src = 0i64;
v21 = 0i64;
Destination = 0i64;
v6 = 0i64;
P[1] = 0i64;
P[0] = 0i64;
v7 = 0i64;
if( KeGetCurrentThread()->PreviousMode != 1 )
{
UserModeCallersCopy = -1073741790;
goto LABEL_35;
}
if( !SeSinglePrivilegeCheck(*(_QWORD *)&SeShutdownPrivilege, 1) )
{
UserModeCallersCopy = -1073741727;
goto LABEL_35;
}
v9 = 0x80000000i64;
if( v3 == 0x80000000 )
{
v10 = 0i64;
v11 = 0i64;
LABEL_7:
UserModeCallersCopy = IoReplacePartitionUnit(v11, v10, v9);
goto LABEL_35;
}
if( v3 )
{
UserModeCallersCopy = -1073741583;
goto LABEL_35;
}
if( ((unsigned __int8)SpareInstancePath & 7) != 0 )
ExRaiseDatatypeMisalignment();
if( (unsigned __int64)&SpareInstancePath[1] > 0x7FFFFFFF0000i64 || &SpareInstancePath[1] < SpareInstancePath )
MEMORY[0x7FFFFFFF0000] = 0;
if( ((unsigned __int8)TargetInstancePath & 7) != 0 )
ExRaiseDatatypeMisalignment();
if( (unsigned __int64)&TargetInstancePath[1] > 0x7FFFFFFF0000i64 || &TargetInstancePath[1] < TargetInstancePath )
MEMORY[0x7FFFFFFF0000] = 0;
*(_UNICODE_STRING *)Src = *SpareInstancePath;
v21 = *TargetInstancePath;
if( (unsigned __int16)(v21.Length - 1) > 0xC8u || (v21.MaximumLength & 1) != 0 )
goto LABEL_34;
if( (unsigned __int16)(LOWORD(Src[0]) - 1) > 0xC8u || (BYTE2(Src[0]) & 1) != 0 )
{
LABEL_33:
UserModeCallersCopy = -1073741584;
goto LABEL_35;
}
LODWORD(AllocateDestination) = 1;
UserModeCallersCopy = PiControlMakeUserModeCallersCopy(
&Destination,
Src[1],
LOWORD(Src[0]),
2ui64,
1,
AllocateDestination);
if( UserModeCallersCopy >= 0 )
{
LODWORD(AllocateDestinationa) = 1;
UserModeCallersCopy = PiControlMakeUserModeCallersCopy(P, v21.Buffer, v21.Length, 2ui64, 1, AllocateDestinationa);
if( UserModeCallersCopy >= 0 )
{
Src[1] = Destination;
WORD1(Src[0]) = Src[0];
v21.Buffer = (wchar_t *)P[0];
v21.MaximumLength = v21.Length;
v12 = (_DEVICE_OBJECT *)PnpDeviceObjectFromDeviceInstanceWithTag((__int64)Src, 0x746C6644u);
v6 = v12;
if( v12 )
{
DeviceNode = v12->DeviceObjectExtension->DeviceNode;
if( DeviceNode )
{
if( (DeviceNode[99] & 0x20000) == 0 )
{
v14 = (_DEVICE_OBJECT *)PnpDeviceObjectFromDeviceInstanceWithTag((__int64)&v21, 0x746C6644u);
v7 = v14;
if( v14 )
{
v15 = v14->DeviceObjectExtension->DeviceNode;
if( v15 )
{
if( (v15[99] & 0x20000) == 0 )
{
v9 = 0i64;
v10 = v6;
v11 = v7;
goto LABEL_7;
}
}
}
LABEL_34:
UserModeCallersCopy = -1073741585;
goto LABEL_35;
}
}
}
goto LABEL_33;
}
}
LABEL_35:
if( v6 )
ObfDereferenceObjectWithTag(v6, 0x746C6644ui64);
if( v7 )
ObfDereferenceObjectWithTag(v7, 0x746C6644ui64);
if( Destination )
ExFreePoolWithTag(Destination, 0);
if( P[0] )
ExFreePoolWithTag(P[0], 0);
return UserModeCallersCopy;
}Referenced by:
No references.