PiDevCfgProcessDeviceCallback
__int64 __fastcall PiDevCfgProcessDeviceCallback(__int64 a1, __int64 a2){
__int64 *v4;
bool v5;
const wchar_t *v6;
int v7;
__int64 v9;
int v10;
int v11;
__int64 v12;
int v13;
UNICODE_STRING *PoolWithTag;
__int64 **v15;
_DEVICE_OBJECT *v16;
void *Handle[2];
__int64 result[16];
__int64 v19;
int v20;
int a5;
UINT64 v22;
v4 = 0i64;
memset((INT64)result, 0i64);
v5 = (*(_DWORD *)(a1 + 704) & 0x1000) == 0;
Handle[0] = 0i64;
LODWORD(v19) = 0;
LODWORD(v22) = 0;
a5 = 1;
v20 = 0;
if( v5
|| !*(_QWORD *)(a1 + 48)
|| (int)CmOpenDeviceRegKey(PiPnpRtlCtx, *(const wchar_t **)(a1 + 48), 16, 0, 983103, 0, (__int64)Handle, 0i64) < 0 )
{
goto LABEL_11;
}
v6 = *(const wchar_t **)(a1 + 48);
v20 = 4;
if( (int)CmGetDeviceRegProp(PiPnpRtlCtx, v6, (__int64)Handle[0], 11, (__int64)&a5, (__int64)&v19, (__int64)&v20, 0) >= 0
&& a5 == 4
&& v20 == 4 )
{
v7 = v19;
}
else
{
v7 = 0;
LODWORD(v19) = 0;
}
if( (v7 & 0x40000) != 0 )
{
if( (int)PiDevCfgInitDeviceContext(*(const wchar_t **)(a1 + 48), (__int64)Handle[0], result) < 0 )
goto LABEL_11;
LOBYTE(v9) = (PiDevCfgFlags & 2) != 0;
if( ((unsigned __int8)v9 & ((v19 & 0x400) != 0)) != 0 )
{
v10 = v19 & 0xFFFFFFDF;
}
else
{
v11 = PiDevCfgCheckDeviceNeedsUpdate((INT64)result, &v22);
v10 = v19;
if( v11 >= 0 )
v10 = v22 | v19;
}
LODWORD(v19) = v10 & 0xFFFBFFFF;
PiDevCfgSetDeviceRegProp(v9, (__int64)result, 11, 4, (__int64)&v19, 4);
LOBYTE(v7) = v19;
}
if( (v7 & 2) == 0 )
{
if( (v7 & 0x20) == 0 )
goto LABEL_11;
v16 = *(_DEVICE_OBJECT **)(a1 + 32);
if( (*(_DWORD *)(a1 + 396) & 0x6000) != 0 )
{
PnpRequestDeviceAction(v16, ClearDeviceProblem, 1u, 0i64, 0i64, 0i64);
PnpRequestDeviceAction(*(_DEVICE_OBJECT **)(a1 + 32), StartDevice, 1u, 0i64, 0i64, 0i64);
goto LABEL_11;
}
PnpSetTargetDeviceRemove(v16, 0, 0, 0, 0, 18, -1073740651, 0i64, 0i64, 0i64, 0i64, 0i64, 0i64, 0i64);
goto LABEL_31;
}
if( (unsigned int)PipAreDriversLoaded((_DEVICE_NODE *)a1) )
{
LODWORD(v19) = v13 & 0xFFFFFFFD;
PiDevCfgSetDeviceRegProp(v12, (__int64)result, 11, 4, (__int64)&v19, 4);
goto LABEL_11;
}
PoolWithTag = (UNICODE_STRING *)ExAllocatePoolWithTag(PagedPool, 0x20ui64, 0x63647050ui64);
v4 = (__int64 *)PoolWithTag;
if( PoolWithTag )
{
*PoolWithTag = 0i64;
PoolWithTag[1] = 0i64;
if( !PnpDuplicateUnicodeString(PoolWithTag + 1, (UNICODE_STRING *)(a1 + 40)) )
{
LABEL_31:
if( v4 )
ExFreePoolWithTag(v4, 0);
goto LABEL_11;
}
v15 = *(__int64 ***)(a2 + 8);
if( *v15 != (__int64 *)a2 )
__fastfail(3u);
*v4 = a2;
v4[1] = (__int64)v15;
*v15 = v4;
*(_QWORD *)(a2 + 8) = v4;
}
LABEL_11:
PiDevCfgFreeDeviceContext((INT64)result);
if( Handle[0] )
ZwClose(Handle[0]);
return 0i64;
}Referenced by:
No references.