CmDeleteDeviceMappedPropertyFromInstanceKeyRegValue

__int64 __fastcall CmDeleteDeviceMappedPropertyFromInstanceKeyRegValue(
        __int64 a1,
        const wchar_t *a2,
        void *a3,
        __int64 a4){
  HANDLE v4; 
  DEVPROPKEY **v5; 
  int v6; 
  unsigned int i; 
  DEVPROPKEY *v11; 
  DEVPROPKEY **v12; 
  __int64 v13; 
  WCHAR *v14; 
  int inited; 
  HANDLE Handle; 
  struct _UNICODE_STRING DestinationString; 
  v4 = 0i64;
  v5 = &off_140983E70;
  v6 = 0;
  Handle = 0i64;
  for( i = 0; i < 2; ++i )
  {
    v11 = *v5;
    v12 = v5;
    if( *(_DWORD *)(a4 + 16) == (*v5)->pid )
    {
      v13 = *(_QWORD *)a4 - *(_QWORD *)&v11->fmtid.Data1;
      if( *(_QWORD *)a4 == *(_QWORD *)&v11->fmtid.Data1 )
        v13 = *(_QWORD *)(a4 + 8) - *(_QWORD *)v11->fmtid.Data4;
      if( !v13 )
        break;
    }
    v12 = 0i64;
    v5 += 4;
  }
  if( !v12 )
    return(unsigned int)-1073741264;
  if( a3 )
    goto LABEL_8;
  v6 = CmOpenDeviceRegKey(a1, a2, 16, 0, 2, 0, (__int64)&Handle, 0i64);
  if( v6 >= 0 )
  {
    v4 = Handle;
LABEL_8:
    v14 = (WCHAR *)v12[2];
    DestinationString = 0i64;
    if( a3 )
      v4 = a3;
    inited = RtlInitUnicodeStringEx(&DestinationString, v14);
    if( inited >= 0 )
      inited = ZwDeleteValueKey(v4, &DestinationString);
    if( inited != -1073741772 && inited != -1073741444 && inited < 0 )
      v6 = inited;
  }
  if( Handle )
    ZwClose(Handle);
  return(unsigned int)v6;
}

Referenced by:

CmSetDeviceMappedProperty