PiDqDeleteUserObject

INT64 __fastcall PiDqDeleteUserObject(VOID *hKey, WCHAR *a2, INT64 a3){
  int v3; 
  int RelativeObjectRegPath; 
  __int64 v6; 
  __int64 v7; 
  unsigned int v8; 
  int v9; 
  unsigned int i; 
  WCHAR *v11; 
  __int64 v12; 
  __int64 v13; 
  wchar_t *Str; 
  v3 = a3;
  Str = 0i64;
  RelativeObjectRegPath = PiDqGetRelativeObjectRegPath(a2, (unsigned int)a3, (VOID **)&Str);
  if( RelativeObjectRegPath < 0 )
    goto LABEL_17;
  if( PiPnpRtlCtx && (v6 = *(_QWORD *)(PiPnpRtlCtx + 224)) != 0 )
    v7 = *(_QWORD *)(v6 + 8);
  else
    v7 = 0i64;
  RelativeObjectRegPath = RegRtlDeleteTreeInternal((char *)hKey, Str, v7, 0);
  v8 = 2;
  v9 = v3 - 1;
  if( !v9 )
    goto LABEL_8;
  if( v9 != 2 )
  {
    v8 = 0;
LABEL_8:
    if( !v8 )
      goto LABEL_17;
    goto LABEL_11;
  }
  v8 = 1;
LABEL_11:
  for( i = 0; i < v8; ++i )
  {
    v11 = wcsrchr(Str, 0x5Cu);
    if( v11 )
    {
      *v11 = 0;
      if( PiPnpRtlCtx && (v12 = *(_QWORD *)(PiPnpRtlCtx + 224)) != 0 )
        v13 = *(_QWORD *)(v12 + 8);
      else
        v13 = 0i64;
      if( (int)RegRtlDeleteKeyTransacted((char *)hKey, Str, v13) < 0 )
        break;
    }
  }
LABEL_17:
  if( Str )
    ExFreePoolWithTag(Str, 0x58706E50u);
  return(unsigned int)RelativeObjectRegPath;
}

Referenced by:

PiDqDeleteUserObjectFromLoadedHives