PpDevCfgProcessDeviceExtensions
NTSTATUS __stdcall PpDevCfgProcessDeviceExtensions(_DEVICE_NODE *DeviceNode){
wchar_t *v2;
wchar_t *v3;
int v4;
int inited;
wchar_t *Buffer;
WCHAR *PropertyLocaleName;
wchar_t *v8;
_PI_DEVCFG_DRIVER_NODE *v9;
NTSTATUS DriverConfiguration;
UINT8 v11;
_UNICODE_STRING *p_PropertySize;
int v13;
__int64 v14;
wchar_t *v15;
unsigned int v16;
_UNICODE_STRING *v17;
wchar_t *v18;
DEVPROPKEY *v19;
_PI_DEVCFG_DRIVER_NODE *v20;
_PI_DEVCFG_DRIVER_NODE *v21;
PI_DEVCFG_DRIVER_NODE *v22;
wchar_t *v23;
wchar_t *v24;
wchar_t *v25;
PI_DEVCFG_DEVICE_CONTEXT *v26;
int v27;
INT64 v29;
VOID *v30;
VOID *v31;
VOID *v32;
WCHAR *v33;
WCHAR *v34;
INT64 v35;
_DEVPROPKEY *PropertyKey;
_DEVPROPKEY *PropertyKeya;
UINT64 ConfigFlags;
_PI_DEVCFG_DRIVER_NODE *DriverNodeResult;
UINT64 CmRegPropType;
_UNICODE_STRING UnicodeString;
_UNICODE_STRING DestinationString;
_UNICODE_STRING v43;
_UNICODE_STRING v44;
_UNICODE_STRING PropertySize;
UINT64 PropertyCount;
__int64 v47;
_UNICODE_STRING *p_DestinationString;
int v49;
int v50;
__int64 v51;
_UNICODE_STRING MultiSz;
_UNICODE_STRING v53;
_UNICODE_STRING v54;
_UNICODE_STRING v55;
_PI_DEVCFG_DEVICE_CONTEXT DeviceContext[20];
_UNICODE_STRING *MultiSzAppend[2];
__int128 v58;
memset(DeviceContext, 0i64, 0x48u);
LODWORD(CmRegPropType) = 1;
*(_OWORD *)MultiSzAppend = 0i64;
*(_QWORD *)&DestinationString.Length = 0i64;
v2 = 0i64;
v58 = 0i64;
DestinationString.Buffer = 0i64;
v3 = 0i64;
DriverNodeResult = 0i64;
v4 = 0;
*(_QWORD *)&PropertySize.Length = 0i64;
PropertySize.Buffer = 0i64;
*(_QWORD *)&MultiSz.Length = 0i64;
MultiSz.Buffer = 0i64;
*(_QWORD *)&v53.Length = 0i64;
v53.Buffer = 0i64;
*(_QWORD *)&v54.Length = 0i64;
v54.Buffer = 0i64;
*(_QWORD *)&v55.Length = 0i64;
v55.Buffer = 0i64;
*(_QWORD *)&v43.Length = 0i64;
v43.Buffer = 0i64;
*(_QWORD *)&v44.Length = 0i64;
v44.Buffer = 0i64;
*(_QWORD *)&UnicodeString.Length = 0i64;
UnicodeString.Buffer = 0i64;
ConfigFlags = 0i64;
if( !PiDevCfgMode )
{
inited = 0;
goto LABEL_66;
}
Buffer = DeviceNode->InstancePath.Buffer;
if( !Buffer )
{
inited = -1073741808;
goto LABEL_66;
}
inited = PiDevCfgInitDeviceContext(Buffer, 0i64, DeviceContext);
if( inited < 0 )
goto LABEL_64;
PropertyLocaleName = *(WCHAR **)&DeviceContext[4];
v8 = DeviceNode->InstancePath.Buffer;
PropertyCount = (UINT64)&DEVPKEY_Device_PendingConfigurationIds;
LODWORD(v29) = 1;
p_DestinationString = &DestinationString;
v47 = 8210i64;
v49 = 0;
v51 = 0i64;
v50 = 6;
inited = PiDevCfgQueryObjectProperties(
(WCHAR *)1,
(PNP_OBJECT_TYPE)v8,
(VOID *)1,
*(PI_DEVCFG_QUERY_PROPERTY_PARAM **)&DeviceContext[4],
(UINT64)&PropertyCount,
v29);
if( inited < 0 )
goto LABEL_64;
if( (int)v51 < 0 )
RtlInitUnicodeString(&DestinationString, 0i64);
inited = PiDevCfgFindDeviceDriver(DeviceContext, DestinationString.Buffer, &DriverNodeResult);
if( inited < 0 )
goto LABEL_64;
v9 = (_PI_DEVCFG_DRIVER_NODE *)*((_QWORD *)DriverNodeResult + 26);
if( v9 == DriverNodeResult + 52 )
goto LABEL_48;
do
{
DriverConfiguration = PiDevCfgQueryDriverConfiguration(v9);
inited = DriverConfiguration;
if( DriverConfiguration == -1073740653 )
{
v11 = 1;
p_PropertySize = &PropertySize;
}
else
{
if( DriverConfiguration < 0 )
goto LABEL_64;
if( *((_QWORD *)v9 + 37) )
{
v9[46] &= ~1u;
goto LABEL_27;
}
if( *((_QWORD *)v9 + 39) )
{
inited = PiDevCfgAppendMultiSz(&MultiSz, 0i64, (const VOID **)v9 + 38, 0);
if( inited < 0 )
goto LABEL_64;
}
if( *((_QWORD *)v9 + 41) )
{
inited = PiDevCfgAppendMultiSz(&v53, 0i64, (const VOID **)v9 + 40, 0);
if( inited < 0 )
goto LABEL_64;
}
if( *((_QWORD *)v9 + 43) )
{
inited = PiDevCfgAppendMultiSz(&v54, 0i64, (const VOID **)v9 + 42, 0);
if( inited < 0 )
goto LABEL_64;
}
if( *((_QWORD *)v9 + 45) )
{
inited = PiDevCfgAppendMultiSz(&v55, 0i64, (const VOID **)v9 + 44, 0);
if( inited < 0 )
goto LABEL_64;
}
v4 |= v9[96];
inited = PiDevCfgAppendMultiSz(&v43, (const VOID **)v9 + 5, 0i64, 0);
if( inited < 0 )
goto LABEL_64;
v11 = 0;
p_PropertySize = &v44;
}
inited = PiDevCfgAppendMultiSz(p_PropertySize, (const VOID **)v9 + 49, 0i64, v11);
if( inited < 0 )
goto LABEL_64;
LABEL_27:
v13 = v4;
v9 = *(_PI_DEVCFG_DRIVER_NODE **)v9;
}
while( v9 != DriverNodeResult + 52 );
v14 = 0i64;
if( inited < 0 )
goto LABEL_64;
v15 = PropertySize.Buffer;
if( PropertySize.Buffer )
{
LODWORD(PropertyKey) = PropertySize.Length;
LODWORD(v33) = 8210;
inited = PiDevCfgSetObjectProperty(
*(&stru_140CF2E80 + 607),
DeviceContext,
(const PNP_OBJECT_TYPE)DeviceNode->InstancePath.Buffer,
(WCHAR *)1,
PropertyLocaleName,
v30,
(UINT64)&DEVPKEY_Device_RequestConfigurationIds,
v33,
(UINT64)PropertySize.Buffer,
PropertyKey);
if( inited >= 0 )
inited = -1073740653;
goto LABEL_64;
}
v16 = 0;
MultiSzAppend[0] = &MultiSz;
MultiSzAppend[1] = &v53;
*(_QWORD *)&v58 = &v54;
*((_QWORD *)&v58 + 1) = &v55;
do
{
v17 = MultiSzAppend[v14];
if( v17->Buffer )
{
v18 = DeviceNode->InstancePath.Buffer;
v19 = off_140D2C6C0[v14];
v49 = 0;
v51 = 0i64;
PropertyCount = (UINT64)v19;
p_DestinationString = &UnicodeString;
LODWORD(v30) = 1;
v47 = 8210i64;
v50 = 6;
inited = PiDevCfgQueryObjectProperties(
v15,
(PNP_OBJECT_TYPE)v18,
(VOID *)1,
(PI_DEVCFG_QUERY_PROPERTY_PARAM *)PropertyLocaleName,
(UINT64)&PropertyCount,
(UINT64)v30);
if( inited < 0 )
goto LABEL_64;
if( (int)v51 < 0 )
RtlInitUnicodeString(&UnicodeString, 0i64);
inited = PiDevCfgAppendMultiSz(&UnicodeString, 0i64, (const VOID **)v17, 0);
if( inited < 0 )
goto LABEL_64;
LODWORD(PropertyKey) = UnicodeString.Length;
LODWORD(v33) = 8210;
inited = PiDevCfgSetObjectProperty(
*(&stru_140CF2E80 + 607),
DeviceContext,
(const PNP_OBJECT_TYPE)DeviceNode->InstancePath.Buffer,
(WCHAR *)1,
PropertyLocaleName,
v31,
(UINT64)off_140D2C6C0[v14],
v33,
(UINT64)UnicodeString.Buffer,
PropertyKey);
if( inited < 0 )
goto LABEL_64;
RtlFreeAnsiString(&UnicodeString);
}
++v16;
++v14;
}
while( v16 < 4 );
v20 = DriverNodeResult;
v4 = v13;
v21 = DriverNodeResult + 52;
v22 = (PI_DEVCFG_DRIVER_NODE *)*((_QWORD *)DriverNodeResult + 26);
while( v22 != v21 )
{
if( (v22[46] & 1) != 0 )
{
inited = PiDevCfgConfigureDeviceDriver(DeviceNode, DeviceContext, v22, &ConfigFlags, 0i64);
if( inited < 0 )
goto LABEL_64;
v4 |= ConfigFlags;
v20 = DriverNodeResult;
}
v22 = *(PI_DEVCFG_DRIVER_NODE **)v22;
v21 = v20 + 52;
}
v2 = v43.Buffer;
v3 = v44.Buffer;
LABEL_48:
if( DestinationString.Buffer )
{
LODWORD(PropertyKey) = 0;
LODWORD(v33) = 0;
PiDevCfgSetObjectProperty(
*(&stru_140CF2E80 + 607),
DeviceContext,
(const PNP_OBJECT_TYPE)DeviceNode->InstancePath.Buffer,
(WCHAR *)1,
PropertyLocaleName,
v30,
(UINT64)&DEVPKEY_Device_PendingConfigurationIds,
v33,
0i64,
PropertyKey);
}
v23 = DeviceNode->InstancePath.Buffer;
if( v2 )
{
LODWORD(PropertyKey) = v43.Length;
LODWORD(v33) = 8210;
inited = PiDevCfgSetObjectProperty(
*(&stru_140CF2E80 + 607),
DeviceContext,
(const PNP_OBJECT_TYPE)v23,
(WCHAR *)1,
PropertyLocaleName,
v30,
(UINT64)&DEVPKEY_Device_DriverExtendedInfs,
v33,
(UINT64)v2,
PropertyKey);
if( inited < 0 )
goto LABEL_64;
}
else
{
LODWORD(PropertyKey) = 0;
LODWORD(v33) = 0;
PiDevCfgSetObjectProperty(
*(&stru_140CF2E80 + 607),
DeviceContext,
(const PNP_OBJECT_TYPE)v23,
(WCHAR *)1,
PropertyLocaleName,
v30,
(UINT64)&DEVPKEY_Device_DriverExtendedInfs,
v33,
0i64,
PropertyKey);
}
v24 = DeviceNode->InstancePath.Buffer;
if( v3 )
{
LODWORD(PropertyKeya) = v44.Length;
LODWORD(v34) = 8210;
inited = PiDevCfgSetObjectProperty(
*(&stru_140CF2E80 + 607),
DeviceContext,
(const PNP_OBJECT_TYPE)v24,
(WCHAR *)1,
PropertyLocaleName,
v32,
(UINT64)&DEVPKEY_Device_ExtendedConfigurationIds,
v34,
(UINT64)v3,
PropertyKeya);
if( inited < 0 )
goto LABEL_64;
}
else
{
LODWORD(PropertyKeya) = 0;
LODWORD(v34) = 0;
PiDevCfgSetObjectProperty(
*(&stru_140CF2E80 + 607),
DeviceContext,
(const PNP_OBJECT_TYPE)v24,
(WCHAR *)1,
PropertyLocaleName,
v32,
(UINT64)&DEVPKEY_Device_ExtendedConfigurationIds,
v34,
0i64,
PropertyKeya);
}
if( v4 )
{
v25 = DeviceNode->InstancePath.Buffer;
LODWORD(v35) = 0;
HIDWORD(ConfigFlags) = 4;
if( CmGetDeviceRegProp(
*(&stru_140CF2E80 + 607),
v25,
PropertyLocaleName,
11i64,
&CmRegPropType,
(UINT8 *)&ConfigFlags,
(UINT64 *)((char *)&ConfigFlags + 4),
v35) < 0
|| (_DWORD)CmRegPropType != 4
|| (v27 = ConfigFlags, HIDWORD(ConfigFlags) != 4) )
{
v27 = 0;
}
LODWORD(ConfigFlags) = v4 | v27;
PiDevCfgSetDeviceRegProp(v26, (_CM_REG_PROP)DeviceContext, 0xBui64, (UINT8 *)4, (UINT64)&ConfigFlags);
}
LABEL_64:
if( DriverNodeResult )
PiDevCfgFreeDriverNode(DriverNodeResult);
LABEL_66:
RtlFreeAnsiString(&DestinationString);
RtlFreeAnsiString(&MultiSz);
RtlFreeAnsiString(&v53);
RtlFreeAnsiString(&v54);
RtlFreeAnsiString(&v55);
RtlFreeAnsiString(&v43);
RtlFreeAnsiString(&v44);
RtlFreeAnsiString(&UnicodeString);
RtlFreeAnsiString(&PropertySize);
PiDevCfgFreeDeviceContext(DeviceContext);
return inited;
}Referenced by:
No references.