PnpQueryRebalanceWorker
__int64 __fastcall PnpQueryRebalanceWorker(
_DEVICE_NODE *DeviceNode,
__int64 a2,
_DWORD *a3,
_DEVICE_NODE **a4,
__int64 a5,
char a6){
int v6;
_PNP_DEVNODE_STATE State;
_DWORD *v9;
__int64 v11;
int StopDeviceNode;
unsigned int v14;
_DEVICE_OBJECT *PhysicalDeviceObject;
_DWORD *v16;
unsigned __int64 v17;
unsigned int v18;
int v19;
int v21;
_DWORD *v22;
v22 = a3;
v21 = 0;
v6 = 0;
State = DeviceNode->State;
v9 = (_DWORD *)a5;
v11 = a2;
if( State == DeviceNodeStarted )
{
if( (DeviceNode->Flags & 0x1000) == 0 )
{
LOBYTE(a2) = a6;
StopDeviceNode = PnpQueryStopDeviceNode(DeviceNode, a2, (INT64)a3);
v6 = StopDeviceNode;
if( StopDeviceNode < 0 )
{
PnpCancelStopDeviceNode(DeviceNode);
if( v9 )
*v9 = 1;
}
else
{
if( StopDeviceNode == 281 )
PipSetDevNodeFlags(DeviceNode, 0x400ui64);
v14 = *a3;
PhysicalDeviceObject = DeviceNode->PhysicalDeviceObject;
v16 = (_DWORD *)(v11 + ((unsigned __int64)v14 << 6));
memset(v16, 0i64, 0x40u);
*(_QWORD *)v16 = PhysicalDeviceObject;
v16[3] = 4;
PnpGetResourceRequirementsForAssignTable((unsigned __int64)v16, v11 + ((unsigned __int64)(v14 + 1) << 6), &v21);
v17 = (unsigned __int64)(unsigned int)*v22 << 6;
if( *(int *)(v17 + v11 + 56) < 0 )
{
v6 = *(_DWORD *)(v17 + v11 + 56);
PnpCancelStopDeviceNode(DeviceNode);
if( v9 )
*v9 = 2;
}
else if( (*(_DWORD *)(v17 + v11 + 8) & 0x20) == 0 )
{
++*v22;
}
}
goto LABEL_20;
}
goto LABEL_15;
}
v18 = State - 769;
if( v18 > 0x11 || (v19 = 196871, !_bittest(&v19, v18)) )
{
LABEL_15:
if( (DeviceNode->Flags & 0x40000) == 0 )
{
v6 = -1073741823;
if( a5 )
*(_DWORD *)a5 = 3;
goto LABEL_21;
}
}
if( !a5 )
goto LABEL_23;
*(_DWORD *)a5 = 4;
LABEL_20:
if( v6 < 0 )
{
LABEL_21:
if( a4 )
*a4 = DeviceNode;
return(unsigned int)v6;
}
LABEL_23:
if( a4 )
*a4 = 0i64;
if( v9 )
*v9 = 0;
return(unsigned int)v6;
}Referenced by:
PnpQueryRebalance