PnpReallocateResources
void __fastcall PnpReallocateResources(ULONG_PTR a1){
_ETHREAD *CurrentThread;
int v3;
INT64 v4;
_DEVICE_OBJECT *v5;
unsigned int v6;
int v7;
int BestConfiguration;
int started;
int v10;
int v11;
INT64 v12;
int v13;
LIST_ENTRY ArbiterList;
_PNP_RESOURCE_REQUEST result;
_BYTE vars0[24];
UINT64 DeviceCount;
memset((INT64)&result, 0i64);
LODWORD(DeviceCount) = 0;
ArbiterList = 0i64;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
--*((_WORD *)CurrentThread + 242);
KeWaitForSingleObject(&PpRegistrySemaphore, DelayExecution, 0, 0, 0i64);
if( (*(_DWORD *)(a1 + 396) & 0x400) == 0 )
goto LABEL_17;
v3 = *(_DWORD *)(a1 + 396) & 0x100;
PipClearDevNodeFlags((_DEVICE_NODE *)a1, 0x100ui64);
if( (*(_DWORD *)(a1 + 396) & 0x800) != 0 )
{
v5 = *(_DEVICE_OBJECT **)(a1 + 32);
result.ResourceRequirements = 0i64;
result.Flags |= 0x280u;
result.PhysicalDevice = v5;
result.AllocationType = ArbiterRequestPnpEnumerated;
PnpGetResourceRequirementsForAssignTable(&result, (_PNP_RESOURCE_REQUEST *)vars0, &DeviceCount, v4);
v6 = DeviceCount;
BestConfiguration = v7;
if( !(_DWORD)DeviceCount )
goto LABEL_15;
if( *(_QWORD *)(a1 + 416) )
PnpReleaseResourcesInternal((_DEVICE_NODE *)a1);
BestConfiguration = PnpFindBestConfiguration((INT64)&result, v6, (INT64 **)&ArbiterList);
if( BestConfiguration < 0 || (BestConfiguration = IopCommitConfiguration(&ArbiterList), BestConfiguration < 0) )
{
v13 = PnpRestoreResourcesInternal(a1);
if( v13 < 0 )
{
PnpUpdateRebootRequiredReason(*(_QWORD *)(a1 + 48), v12, 0x4000i64);
v10 = v13;
v11 = 14;
goto LABEL_12;
}
}
else
{
PipClearDevNodeFlags((_DEVICE_NODE *)a1, 0xC00ui64);
PnpBuildCmResourceLists((UINT64)&result, (UINT64)vars0, 1);
started = PnpStartDeviceNode(a1, 1, 1);
BestConfiguration = started;
if( started < 0 )
{
v10 = started;
v11 = 12;
LABEL_12:
PnpRequestDeviceRemoval(a1, 0, v11, v10);
}
}
PnpFreeResourceRequirementsForAssignTable(&result, (_PNP_RESOURCE_REQUEST *)vars0);
goto LABEL_15;
}
BestConfiguration = PnpRebalance(a1, 0i64, 0i64, 0);
LABEL_15:
if( BestConfiguration < 0 )
{
PipClearDevNodeFlags((_DEVICE_NODE *)a1, 0x100ui64);
PipSetDevNodeFlags(a1, v3);
}
LABEL_17:
KeReleaseSemaphore(&PpRegistrySemaphore, 0i64, 1i64, 0);
KeLeaveCriticalRegion();
}Referenced by:
PiProcessResourceRequirementsChanged