CmGetDeviceInterfaceMappedPropertyFromComposite
NTSTATUS __stdcall CmGetDeviceInterfaceMappedPropertyFromComposite(
HPNPCTX *hPnpCtx,
WCHAR *DeviceInterfaceName,
VOID *ObjectBaseKey,
_DEVPROPKEY *PropertyKey,
UINT64 *PropertyType,
UINT8 *PropertyBuffer,
UINT64 BufferSize,
UINT64 *PropertySize){
unsigned __int64 v9;
int v10;
unsigned int v11;
unsigned int pid;
__int64 v13;
__int64 v15;
VOID **PoolWithTag;
VOID **v17;
__int64 v18;
NTSTATUS ObjectProperty;
__int64 v20;
NTSTATUS DeviceInterfaceReferenceString;
INT64 v22;
ULONG DeviceInterfaceNamea;
DeviceInterfaceNamea = (unsigned int)hPnpCtx;
v9 = (unsigned __int64)PropertyBuffer;
v10 = 0;
*(_DWORD *)PropertyType = 0;
*(_DWORD *)PropertySize = 0;
LODWORD(v22) = 0;
if( PropertyBuffer )
{
v11 = BufferSize;
v9 = -(__int64)((_DWORD)BufferSize != 0) & (unsigned __int64)PropertyBuffer;
}
else
{
v11 = 0;
}
pid = PropertyKey->pid;
if( pid < 2 )
return -1073741264;
switch( pid )
{
case 0xAu:
v18 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&DEVPKEY_NAME.fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&DEVPKEY_NAME.fmtid.Data1 )
v18 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)DEVPKEY_NAME.fmtid.Data4;
if( !v18 )
{
ObjectProperty = PnpGetObjectProperty(
(ULONG)hPnpCtx,
(INT64)DeviceInterfaceName,
3i64,
(INT64)ObjectBaseKey,
0i64,
(INT64)&DEVPKEY_DeviceInterface_FriendlyName,
(INT64)PropertyType,
v9);
v10 = ObjectProperty;
if( !ObjectProperty || ObjectProperty == -1073741789 )
*(_DWORD *)PropertySize = 0;
}
break;
case 4u:
v13 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&DEVPKEY_DeviceInterface_ClassGuid.fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&DEVPKEY_DeviceInterface_ClassGuid.fmtid.Data1 )
v13 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)DEVPKEY_DeviceInterface_ClassGuid.fmtid.Data4;
if( !v13 )
{
*(_DWORD *)PropertySize = 16;
*(_DWORD *)PropertyType = 13;
if( v11 < 0x10 )
return -1073741789;
else
return CmGetDeviceInterfaceClassGuid((WCHAR *)hPnpCtx, (_GUID *)DeviceInterfaceName);
}
break;
case 5u:
v20 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&DEVPKEY_DeviceInterface_ReferenceString.fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&DEVPKEY_DeviceInterface_ReferenceString.fmtid.Data1 )
v20 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)DEVPKEY_DeviceInterface_ReferenceString.fmtid.Data4;
if( !v20 )
{
DeviceInterfaceReferenceString = CmGetDeviceInterfaceReferenceString(
(WCHAR *)hPnpCtx,
DeviceInterfaceName,
v9,
(UINT64 *)(v11 >> 1));
v10 = DeviceInterfaceReferenceString;
if( DeviceInterfaceReferenceString == -1073741772 )
{
return -1073741275;
}
else if( !DeviceInterfaceReferenceString || DeviceInterfaceReferenceString == -1073741789 )
{
*(_DWORD *)PropertySize = 0;
*(_DWORD *)PropertyType = 18;
}
}
break;
case 2u:
v15 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&DEVPKEY_Device_ContainerId.fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&DEVPKEY_Device_ContainerId.fmtid.Data1 )
v15 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)DEVPKEY_Device_ContainerId.fmtid.Data4;
if( !v15 )
{
PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x190ui64, 1380994640i64);
v17 = PoolWithTag;
if( PoolWithTag )
{
v10 = PnpGetObjectProperty(
DeviceInterfaceNamea,
(INT64)DeviceInterfaceName,
3i64,
(INT64)ObjectBaseKey,
0i64,
(INT64)&DEVPKEY_Device_InstanceId,
(INT64)&v22,
(INT64)PoolWithTag);
if( v10 >= 0 )
{
if( (_DWORD)v22 != 18
|| (v10 = PnpGetObjectProperty(
DeviceInterfaceNamea,
(INT64)v17,
1i64,
0i64,
0i64,
(INT64)&DEVPKEY_Device_ContainerId,
(INT64)PropertyType,
v9),
v10 == -1073741772) )
{
v10 = -1073741275;
}
}
ExFreePoolWithTag(v17, 0);
if( !v10 || v10 == -1073741789 )
*(_DWORD *)PropertySize = 0;
}
else
{
return -1073741801;
}
}
break;
}
return v10;
}Referenced by:
CmGetDeviceInterfaceMappedProperty
CmGetDeviceInterfaceMappedPropertyKeys