PiPnpRtlSetDeviceRegProperty
NTSTATUS __stdcall PiPnpRtlSetDeviceRegProperty(
WCHAR *DeviceInstanceId,
const WCHAR *CmRegProp,
VOID *CmRegPropType,
_CM_REG_PROP PropertyBuffer,
UINT64 PropertySize,
UINT8 *Flags,
UINT64 a7,
UINT64 a8){
int v8;
UINT8 *v9;
unsigned int v13;
char v14;
NTSTATUS v15;
bool v17;
_ETHREAD *CurrentThread;
UINT64 CmRegPropTypea;
UINT64 v20;
UINT64 Flagsa;
UINT8 v22[4];
int DestinationString;
_UNICODE_STRING DestinationString_4;
UINT64 v26;
v8 = a7;
v9 = Flags;
LODWORD(v26) = 0;
DestinationString = 0;
*(_DWORD *)v22 = 0;
v13 = 0;
v14 = 0;
DestinationString_4 = 0i64;
if( PropertyBuffer < CM_REG_PROP_HARDWAREID )
goto LABEL_7;
if( PropertyBuffer <= CM_REG_PROP_COMPATIBLEIDS )
{
v17 = CmIsRootEnumeratedDevice((WCHAR *)CmRegProp) == 0;
}
else
{
if( PropertyBuffer == CM_REG_PROP_CONFIGFLAGS )
{
if( !Flags || (_DWORD)a7 != 4 )
return -1073741811;
if( SeAuditingWithTokenForSubcategory(137i64, 0i64) )
{
LODWORD(Flagsa) = 0;
LODWORD(v26) = 4;
if( CmGetDeviceRegProp(
(HPNPCTX *)DeviceInstanceId,
CmRegProp,
CmRegPropType,
11i64,
(UINT64 *)&DestinationString,
v22,
&v26,
Flagsa) < 0
|| (_DWORD)v26 != 4
|| DestinationString != 4 )
{
*(_DWORD *)v22 = 0;
}
v13 = *(_DWORD *)v9;
}
goto LABEL_7;
}
if( PropertyBuffer == CM_REG_PROP_CLASSGUID )
{
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
--CurrentThread->Tcb.KernelApcDisable;
v14 = 1;
ExAcquireResourceExclusiveLite((UINT64)&PnpReplaceEvent + 6688, 1, (INT64)CmRegPropType);
goto LABEL_7;
}
if( PropertyBuffer <= CM_REG_PROP_PHYSICAL_DEVICE_OBJECT_NAME )
goto LABEL_7;
if( PropertyBuffer <= CM_REG_PROP_UI_NUMBER || PropertyBuffer == CM_REG_PROP_ADDRESS )
return -1073741790;
v17 = PropertyBuffer == CM_REG_PROP_BASE_CONTAINERID;
}
if( v17 )
return -1073741790;
LABEL_7:
LODWORD(Flagsa) = a8;
LODWORD(v20) = v8;
LODWORD(CmRegPropTypea) = PropertySize;
v15 = CmSetDeviceRegProp(
(HPNPCTX *)DeviceInstanceId,
(WCHAR *)CmRegProp,
CmRegPropType,
PropertyBuffer,
CmRegPropTypea,
v9,
v20,
Flagsa);
if( PropertyBuffer == CM_REG_PROP_CONFIGFLAGS && SeAuditingWithTokenForSubcategory(137i64, 0i64) )
{
RtlInitUnicodeString(&DestinationString_4, CmRegProp);
PiAuditDeviceEnableDisableRequest(&DestinationString_4, *(unsigned int *)v22, v13, v15 >= 0);
}
if( v14 )
{
ExReleaseResourceLite((PERESOURCE)((char *)&PnpReplaceEvent + 6688));
KeLeaveCriticalRegionThread(KeGetCurrentThread());
}
return v15;
}Referenced by:
PiCMSetRegistryProperty
PiDevCfgSetDeviceRegProp