CmSetDeviceMappedProperty
NTSTATUS __stdcall CmSetDeviceMappedProperty(
HPNPCTX *hPnpCtx,
const WCHAR *DeviceInstanceId,
VOID *ObjectBaseKey,
const WCHAR *PropertyLocaleName,
const _DEVPROPKEY *PropertyKey,
UINT64 PropertyType,
UINT8 *PropertyBuffer,
UINT64 PropertySize){
NTSTATUS v11;
DEVPROPKEY **v12;
unsigned int v13;
DEVPROPKEY *v14;
DEVPROPKEY **v15;
unsigned int v16;
DEVPROPKEY *v17;
DEVPROPKEY **v18;
unsigned int v19;
DEVPROPKEY *v20;
DEVPROPKEY **v21;
unsigned int v22;
DEVPROPKEY *v23;
__int64 v25;
__int64 v26;
__int64 v27;
__int64 v28;
NTSTATUS v29;
UINT64 v30;
UINT64 v31;
UINT64 v32;
v11 = -1073741802;
if( !PropertyLocaleName )
{
if( !CmIsRootDevice((WCHAR *)DeviceInstanceId) )
{
v12 = &CmDeviceRegPropMap;
v13 = 0;
while( 1 )
{
v14 = *v12;
if( *v12 && PropertyKey->pid == v14->pid )
{
v26 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&v14->fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&v14->fmtid.Data1 )
v26 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)v14->fmtid.Data4;
if( !v26 )
break;
}
++v13;
v12 += 3;
if( v13 >= 0x21 )
goto LABEL_7;
}
LODWORD(v32) = PropertySize;
LODWORD(v30) = PropertyType;
v11 = CmSetDeviceMappedPropertyFromRegProp(
hPnpCtx,
(WCHAR *)DeviceInstanceId,
ObjectBaseKey,
(_DEVPROPKEY *)PropertyKey,
v30,
PropertyBuffer,
v32);
if( v11 != -1073741802 )
return v11;
LABEL_7:
v15 = &off_140986950;
v16 = 0;
while( 1 )
{
v17 = *v15;
if( PropertyKey->pid == (*v15)->pid )
{
v27 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&v17->fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&v17->fmtid.Data1 )
v27 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)v17->fmtid.Data4;
if( !v27 )
break;
}
++v16;
v15 += 4;
if( v16 >= 0xD )
goto LABEL_10;
}
if( (unsigned int)PropertyType < 2 )
{
CmDeleteDeviceMappedPropertyFromDriverKeyRegValue(
hPnpCtx,
(WCHAR *)DeviceInstanceId,
(_DEVPROPKEY *)PropertyKey);
}
else
{
LODWORD(v31) = PropertySize;
CmSetDeviceMappedPropertyFromDriverKeyRegValue(
hPnpCtx,
DeviceInstanceId,
PropertyKey,
(unsigned int)PropertyType,
PropertyBuffer,
v31);
}
v11 = -1073741802;
LABEL_10:
v18 = &off_140983E70;
v19 = 0;
while( 1 )
{
v20 = *v18;
if( PropertyKey->pid == (*v18)->pid )
{
v28 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&v20->fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&v20->fmtid.Data1 )
v28 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)v20->fmtid.Data4;
if( !v28 )
break;
}
++v19;
v18 += 4;
if( v19 >= 2 )
goto LABEL_13;
}
if( (unsigned int)PropertyType >= 2 )
{
LODWORD(v32) = PropertySize;
LODWORD(v30) = PropertyType;
v29 = CmSetDeviceMappedPropertyFromInstanceKeyRegValue(
hPnpCtx,
(WCHAR *)DeviceInstanceId,
ObjectBaseKey,
(_DEVPROPKEY *)PropertyKey,
v30,
PropertyBuffer,
v32);
}
else
{
v29 = CmDeleteDeviceMappedPropertyFromInstanceKeyRegValue(
hPnpCtx,
(WCHAR *)DeviceInstanceId,
ObjectBaseKey,
(_DEVPROPKEY *)PropertyKey);
}
v11 = v29;
if( v29 >= 0 )
PnpObjectRaisePropertyChangeEvent(
(__int64)hPnpCtx,
(INT64)DeviceInstanceId,
1i64,
(INT64)ObjectBaseKey,
0i64,
(__int64)PropertyKey);
if( v11 != -1073741802 )
return v11;
LABEL_13:
v21 = &off_140985E60;
v22 = 0;
while( 1 )
{
v23 = *v21;
if( PropertyKey->pid == (*v21)->pid )
{
v25 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&v23->fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&v23->fmtid.Data1 )
v25 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)v23->fmtid.Data4;
if( !v25 )
break;
}
++v22;
v21 += 2;
if( v22 >= 0x1B )
return v11;
}
}
return -1073741790;
}
return v11;
}Referenced by:
CmDeleteDeviceWorker
PnpDispatchDevice