CmDeleteDeviceMappedPropertyFromDriverKeyRegValue
NTSTATUS __stdcall CmDeleteDeviceMappedPropertyFromDriverKeyRegValue(
HPNPCTX *hPnpCtx,
WCHAR *DeviceInstanceId,
_DEVPROPKEY *PropertyKey){
unsigned int pid;
unsigned int v5;
DEVPROPKEY **v7;
DEVPROPKEY *v8;
DEVPROPKEY **v9;
__int64 v10;
NTSTATUS v11;
NTSTATUS v12;
WCHAR *v13;
VOID *v14;
NTSTATUS inited;
_OBJECT_TYPE *v16;
__int64 v18;
_OBJECT_TYPE *v19;
UINT64 DesiredAccess;
_UNICODE_STRING DestinationString;
VOID *KeyHandle;
KeyHandle = 0i64;
pid = PropertyKey->pid;
v5 = 0;
v7 = &off_140986950;
do
{
v8 = *v7;
v9 = v7;
if( pid == (*v7)->pid )
{
v10 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&v8->fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&v8->fmtid.Data1 )
v10 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)v8->fmtid.Data4;
if( !v10 )
break;
}
v9 = 0i64;
++v5;
v7 += 4;
}
while( v5 < 0xD );
if( !v9 )
return -1073741802;
LODWORD(DesiredAccess) = 2;
v11 = CmOpenDeviceRegKey(
hPnpCtx,
DeviceInstanceId,
CM_KEY_TYPE_DEVICE_SOFTWARE,
0i64,
DesiredAccess,
0,
&KeyHandle,
0i64);
v12 = v11;
if( v11 == -1073741772 )
{
v12 = 0;
}
else if( v11 >= 0 )
{
v13 = (WCHAR *)v9[2];
v14 = KeyHandle;
DestinationString = 0i64;
inited = RtlInitUnicodeStringEx(&DestinationString, v13);
if( inited >= 0 )
inited = ZwDeleteValueKey(v14, &DestinationString, v16);
if( inited == -1073741772 )
goto LABEL_16;
if( inited != -1073741444 )
{
if( inited >= 0 )
{
LABEL_16:
if( PropertyKey->pid == 2 )
{
v18 = *(_QWORD *)&PropertyKey->fmtid.Data1 - *(_QWORD *)&DEVPKEY_Device_DriverDate.fmtid.Data1;
if( *(_QWORD *)&PropertyKey->fmtid.Data1 == *(_QWORD *)&DEVPKEY_Device_DriverDate.fmtid.Data1 )
v18 = *(_QWORD *)PropertyKey->fmtid.Data4 - *(_QWORD *)DEVPKEY_Device_DriverDate.fmtid.Data4;
if( !v18 )
{
DestinationString = 0i64;
if( RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)L"DriverDate") >= 0 )
ZwDeleteValueKey(KeyHandle, &DestinationString, v19);
}
}
goto LABEL_17;
}
v12 = inited;
}
}
LABEL_17:
if( KeyHandle )
ZwClose((_HANDLE)KeyHandle);
return v12;
}Referenced by:
CmSetDeviceMappedProperty