CmSetDeviceMappedPropertyFromInstanceKeyRegValue
NTSTATUS __stdcall CmSetDeviceMappedPropertyFromInstanceKeyRegValue(
HPNPCTX *hPnpCtx,
WCHAR *DeviceInstanceId,
VOID *ObjectBaseKey,
_DEVPROPKEY *PropertyKey,
UINT64 PropertyType,
UINT8 *PropertyBuffer,
UINT64 PropertySize){
unsigned int pid;
int v8;
int v9;
VOID *v11;
DEVPROPKEY **v15;
unsigned int i;
DEVPROPKEY *v17;
DEVPROPKEY **v18;
__int64 v19;
const wchar_t *v20;
unsigned int v21;
__int64 v22;
NTSTATUS v23;
NTSTATUS v24;
UINT64 DesiredAccess;
int v27;
VOID *Handle;
pid = PropertyKey->pid;
v8 = 0;
v9 = 0;
v11 = 0i64;
v27 = 0;
Handle = 0i64;
v15 = &off_140983E70;
for( i = 0; i < 2; ++i )
{
v17 = *v15;
v18 = v15;
if( pid == (*v15)->pid )
{
v19 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&v17->fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&v17->fmtid.Data1 )
v19 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)v17->fmtid.Data4;
if( !v19 )
break;
}
v18 = 0i64;
v15 += 4;
}
if( !v18 )
return -1073741264;
if( (_DWORD)PropertyType != *((_DWORD *)v18 + 2) )
return -1073741811;
if( !ObjectBaseKey )
{
LODWORD(DesiredAccess) = 2;
v8 = CmOpenDeviceRegKey(
hPnpCtx,
DeviceInstanceId,
CM_KEY_TYPE_DEVICE_INSTANCE,
0i64,
DesiredAccess,
0,
&Handle,
0i64);
if( v8 < 0 )
goto LABEL_31;
v11 = Handle;
v9 = v27;
}
v20 = (const wchar_t *)v18[2];
v21 = *((_DWORD *)v18 + 6);
if( PropertyKey->pid != 2 )
goto LABEL_26;
v22 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&DEVPKEY_Device_Reported.fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&DEVPKEY_Device_Reported.fmtid.Data1 )
v22 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)DEVPKEY_Device_Reported.fmtid.Data4;
if( v22 )
{
LABEL_26:
if( ObjectBaseKey )
v11 = ObjectBaseKey;
LODWORD(DesiredAccess) = PropertySize;
v24 = RegRtlSetValue(v11, v20, v21, PropertyBuffer, DesiredAccess);
if( v24 != -1073741444 )
{
if( v24 < 0 )
v8 = v24;
goto LABEL_31;
}
}
else
{
LODWORD(DesiredAccess) = 4;
if( *PropertyBuffer == 0xFF )
v9 = 1;
v27 = v9;
if( ObjectBaseKey )
v11 = ObjectBaseKey;
v23 = RegRtlSetValue(v11, v20, v21, &v27, DesiredAccess);
if( v23 != -1073741444 )
{
if( v23 < 0 )
v8 = v23;
goto LABEL_31;
}
}
v8 = -1073741810;
LABEL_31:
if( Handle )
ZwClose((_HANDLE)Handle);
return v8;
}Referenced by:
CmSetDeviceMappedProperty