CmGetDeviceMappedPropertyFromRegProp
VOID __stdcall CmGetDeviceMappedPropertyFromRegProp(
_IRP *Irp,
_FILE_OBJECT *FileObject,
_REPARSE_DATA_BUFFER *ReparseBuffer){
__int64 v3;
UINT8 *PropertyBuffer;
_QWORD *v5;
unsigned int v6;
int v7;
DEVPROPKEY **v8;
unsigned int i;
DEVPROPKEY *v10;
DEVPROPKEY **v11;
__int64 v12;
unsigned int v13;
VOID *v14;
WCHAR *v15;
HPNPCTX *v16;
NTSTATUS v17;
NTSTATUS DeviceRegProp;
WCHAR *v19;
HPNPCTX *v20;
int v21;
UINT64 v22;
UINT8 *PoolWithTag;
const wchar_t *v24;
int v25;
unsigned int Len;
INT64 v27;
INT64 v28;
NTSTATUS v29;
UINT64 *CmRegPropType;
UINT64 Flags;
UINT64 Flagsa;
UINT64 v34;
HPNPCTX *hPnpCtx;
UINT8 v36[4];
WCHAR *DeviceInstanceId;
VOID *BaseKeyHandle;
UINT64 v39;
VOID *DeviceKey;
PVOID P;
_UNICODE_STRING DestinationString;
_GUID Guid;
UINT8 v44[76];
__int16 v45;
int *v46;
UINT8 *v47;
unsigned int v48;
UINT64 *PropertySize;
int v50;
PropertyBuffer = v47;
v5 = (_QWORD *)v3;
BaseKeyHandle = ReparseBuffer;
DeviceInstanceId = (WCHAR *)FileObject;
hPnpCtx = (HPNPCTX *)&Irp->Type;
LODWORD(v39) = 0;
v34 = 0i64;
*(_DWORD *)v36 = 0;
P = 0i64;
DeviceKey = 0i64;
DestinationString = 0i64;
Guid = 0i64;
if( (_WORD)v50 )
return;
*v46 = 0;
*(_DWORD *)PropertySize = 0;
if( v47 )
{
v6 = v48;
PropertyBuffer = (UINT8 *)(-(__int64)(v48 != 0) & (unsigned __int64)v47);
}
else
{
v6 = 0;
}
v7 = *(_DWORD *)(v3 + 16);
v8 = &CmDeviceRegPropMap;
for( i = 0; i < 0x21; ++i )
{
v10 = *v8;
v11 = v8;
if( v7 == (*v8)->pid )
{
v12 = *v5 - *(_QWORD *)&v10->fmtid.Data1;
if( *v5 == *(_QWORD *)&v10->fmtid.Data1 )
v12 = v5[1] - *(_QWORD *)v10->fmtid.Data4;
if( !v12 )
break;
}
v8 += 3;
v11 = 0i64;
}
if( !v11 )
return;
v13 = *((_DWORD *)v11 + 3);
switch( v13 )
{
case 9u:
goto LABEL_40;
case 0x19u:
return;
case 0x1Bu:
v19 = DeviceInstanceId;
LODWORD(Flags) = v50;
LODWORD(v34) = 4;
DeviceRegProp = CmGetDeviceRegProp(
hPnpCtx,
DeviceInstanceId,
BaseKeyHandle,
27i64,
(UINT64 *)((char *)&v34 + 4),
v36,
&v34,
Flags);
if( DeviceRegProp >= 0 )
{
if( HIDWORD(v34) != *((_DWORD *)v11 + 4) )
return;
*(_DWORD *)PropertySize = 1;
*v46 = *((_DWORD *)v11 + 2);
if( v6 < *(_DWORD *)PropertySize )
return;
*PropertyBuffer = -(*(_DWORD *)v36 != 0);
}
goto LABEL_20;
case 0x25u:
LABEL_40:
v27 = v13;
v19 = DeviceInstanceId;
LODWORD(Flags) = v50;
LODWORD(v34) = 78;
DeviceRegProp = CmGetDeviceRegProp(
hPnpCtx,
DeviceInstanceId,
BaseKeyHandle,
v27,
(UINT64 *)((char *)&v34 + 4),
v44,
&v34,
Flags);
if( DeviceRegProp >= 0 )
{
if( HIDWORD(v34) != *((_DWORD *)v11 + 4) )
return;
*(_DWORD *)PropertySize = 16;
*v46 = *((_DWORD *)v11 + 2);
if( v6 < *(_DWORD *)PropertySize )
return;
v45 = 0;
DeviceRegProp = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)v44);
if( DeviceRegProp >= 0 )
{
DeviceRegProp = RtlGUIDFromString(&DestinationString, &Guid);
if( DeviceRegProp >= 0 )
*(_GUID *)PropertyBuffer = Guid;
}
}
goto LABEL_20;
}
v14 = BaseKeyHandle;
v15 = DeviceInstanceId;
v16 = hPnpCtx;
LODWORD(Flags) = v50;
*(_DWORD *)PropertySize = v6;
v17 = CmGetDeviceRegProp(v16, v15, v14, v13, (UINT64 *)((char *)&v34 + 4), PropertyBuffer, PropertySize, Flags);
DeviceRegProp = v17;
if( v17 && v17 != -1073741789 )
goto LABEL_18;
if( HIDWORD(v34) != *((_DWORD *)v11 + 4) )
return;
v21 = *((_DWORD *)v11 + 2);
*v46 = v21;
if( v21 != 18 )
goto LABEL_18;
v22 = *(unsigned int *)PropertySize;
LODWORD(v34) = *(_DWORD *)PropertySize;
if( DeviceRegProp )
{
if( DeviceRegProp != -1073741789 )
goto LABEL_18;
PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(1ui64, v22, 1380994640i64);
if( !PoolWithTag )
return;
v28 = v13;
v19 = DeviceInstanceId;
v20 = hPnpCtx;
LODWORD(Flagsa) = v50;
v29 = CmGetDeviceRegProp(hPnpCtx, DeviceInstanceId, BaseKeyHandle, v28, &v39, PoolWithTag, &v34, Flagsa);
if( v29 < 0 )
{
DeviceRegProp = v29;
ExFreePoolWithTag(PoolWithTag, 0);
LABEL_21:
if( DeviceRegProp == -1073741810 )
{
LODWORD(CmRegPropType) = 1;
if( !CmOpenDeviceRegKey(
v20,
v19,
CM_KEY_TYPE_DEVICE_INSTANCE,
0i64,
(UINT64)CmRegPropType,
0,
&DeviceKey,
0i64) )
ZwClose((_HANDLE)DeviceKey);
}
return;
}
if( (unsigned int)v34 < 2 )
{
LABEL_31:
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
LABEL_18:
if( DeviceRegProp )
{
v19 = DeviceInstanceId;
LABEL_20:
v20 = hPnpCtx;
goto LABEL_21;
}
goto LABEL_33;
}
v24 = (const wchar_t *)PoolWithTag;
LABEL_28:
if( v24 && (PnpParseIndirectInfString(v24) || PnpParseIndirectResourceString((__int64)v24)) )
*v46 = 25;
goto LABEL_31;
}
if( v6 >= 2 )
{
PoolWithTag = (UINT8 *)P;
v24 = (const wchar_t *)PropertyBuffer;
goto LABEL_28;
}
LABEL_33:
v25 = *v46;
if( *v46 == 8210 )
{
Len = PnpMultiSzGetLen((const WCHAR *)PropertyBuffer);
if( 2 * (unsigned __int64)Len > *(unsigned int *)PropertySize )
{
*(_DWORD *)PropertySize = 0;
return;
}
*(_DWORD *)PropertySize = 2 * Len;
v25 = *v46;
}
if( v25 == 18 && !*(_DWORD *)PropertySize )
{
*(_DWORD *)PropertySize = 0;
*v46 = 0;
}
}Referenced by:
CmGetDeviceCompoundFilters
CmGetDeviceCompoundFiltersWorker
CmGetDeviceMappedProperty
CmGetDeviceMappedPropertyKeys