CmDeleteDeviceInterfaceMappedPropertyFromRegValue
__int64 __fastcall CmDeleteDeviceInterfaceMappedPropertyFromRegValue(__int64 a1, const WCHAR *a2, char *a3, __int64 a4){
unsigned int v4;
int v5;
unsigned int v10;
DEVPROPKEY **v11;
DEVPROPKEY *v12;
DEVPROPKEY **v13;
__int64 v14;
int v15;
__int64 v16;
__int64 v17;
char *v18;
__int64 v19;
int inited;
__int64 v22;
__int64 v23;
HANDLE Handle;
struct _UNICODE_STRING DestinationString;
HANDLE KeyHandle;
v4 = *(_DWORD *)(a4 + 16);
v5 = 0;
Handle = 0i64;
KeyHandle = 0i64;
if( v4 < 2 )
return(unsigned int)-1073741264;
v10 = 0;
v11 = &off_140983A68;
do
{
v12 = *v11;
v13 = v11;
if( v4 == (*v11)->pid )
{
v14 = *(_QWORD *)a4 - *(_QWORD *)&v12->fmtid.Data1;
if( *(_QWORD *)a4 == *(_QWORD *)&v12->fmtid.Data1 )
v14 = *(_QWORD *)(a4 + 8) - *(_QWORD *)v12->fmtid.Data4;
if( !v14 )
break;
}
v13 = 0i64;
++v10;
v11 += 2;
}
while( v10 < 3 );
if( !v13 )
return(unsigned int)-1073741264;
if( a3 || (v5 = CmOpenDeviceInterfaceRegKey(a1, a2, 0x30u, (__int64)v12, 1, 0, (__int64)&Handle, 0i64), v5 >= 0) )
{
v15 = *(_DWORD *)(a4 + 16);
if( v15 == 2 )
{
v17 = *(_QWORD *)a4 - *(_QWORD *)&DEVPKEY_DeviceInterface_FriendlyName.fmtid.Data1;
if( *(_QWORD *)a4 == *(_QWORD *)&DEVPKEY_DeviceInterface_FriendlyName.fmtid.Data1 )
v17 = *(_QWORD *)(a4 + 8) - *(_QWORD *)DEVPKEY_DeviceInterface_FriendlyName.fmtid.Data4;
if( !v17 )
{
v18 = (char *)Handle;
if( a3 )
v18 = a3;
if( a1 )
v19 = *(_QWORD *)(a1 + 224);
else
v19 = 0i64;
inited = SysCtxRegOpenKey(v19, v18, L"Device Parameters", 0, 2u, &KeyHandle);
if( inited != -1073741772 && inited != -1073741444 )
{
if( inited < 0 )
goto LABEL_47;
DestinationString = 0i64;
inited = RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)L"FriendlyName");
if( inited >= 0 )
inited = ZwDeleteValueKey(KeyHandle, &DestinationString);
if( inited != -1073741772 && inited != -1073741444 && inited < 0 )
LABEL_47:
v5 = inited;
}
goto LABEL_38;
}
}
else
{
if( v15 == 3 )
{
v22 = *(_QWORD *)a4 - *(_QWORD *)&DEVPKEY_DeviceInterface_Enabled.fmtid.Data1;
if( *(_QWORD *)a4 == *(_QWORD *)&DEVPKEY_DeviceInterface_Enabled.fmtid.Data1 )
v22 = *(_QWORD *)(a4 + 8) - *(_QWORD *)DEVPKEY_DeviceInterface_Enabled.fmtid.Data4;
if( !v22 )
goto LABEL_37;
}
if( v15 == 4 )
{
v23 = *(_QWORD *)a4 - *(_QWORD *)&DEVPKEY_DeviceInterface_ClassGuid.fmtid.Data1;
if( *(_QWORD *)a4 == *(_QWORD *)&DEVPKEY_DeviceInterface_ClassGuid.fmtid.Data1 )
v23 = *(_QWORD *)(a4 + 8) - *(_QWORD *)DEVPKEY_DeviceInterface_ClassGuid.fmtid.Data4;
if( !v23 )
goto LABEL_37;
}
if( v15 == 256 )
{
v16 = *(_QWORD *)a4 - *(_QWORD *)&DEVPKEY_Device_InstanceId.fmtid.Data1;
if( *(_QWORD *)a4 == *(_QWORD *)&DEVPKEY_Device_InstanceId.fmtid.Data1 )
v16 = *(_QWORD *)(a4 + 8) - *(_QWORD *)DEVPKEY_Device_InstanceId.fmtid.Data4;
if( !v16 )
{
LABEL_37:
v5 = -1073741790;
goto LABEL_38;
}
}
}
v5 = -1073741264;
}
LABEL_38:
if( KeyHandle )
ZwClose(KeyHandle);
if( Handle )
ZwClose(Handle);
return(unsigned int)v5;
}Referenced by:
CmSetDeviceInterfaceMappedProperty