PpDevCfgProcessDeviceOperations

__int64 __fastcall PpDevCfgProcessDeviceOperations(__int64 a1, void *a2){
  NTSTATUS v4; 
  int inited; 
  __int64 v7; 
  __int64 v8; 
  int v9; 
  const wchar_t *v10; 
  __int64 v11; 
  int v12; 
  int v13; 
  void *KeyHandle; 
  __int128 v15; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  __int64 result[14]; 
  __int64 a6; 
  int v19; 
  int a5; 
  KeyHandle = 0i64;
  v15 = 0i64;
  memset((INT64)result, 0i64);
  LODWORD(a6) = 0;
  a5 = 0;
  v13 = 0;
  v19 = 0;
  if( *(_QWORD *)(a1 + 48) )
  {
    *(&ObjectAttributes.Length + 1) = 0;
    memset(&ObjectAttributes.Attributes + 1, 0, 20);
    *((_QWORD *)&v15 + 1) = L"PendingConfiguration";
    ObjectAttributes.ObjectName = (_UNICODE_STRING *)&v15;
    LODWORD(v15) = 2752552;
    ObjectAttributes.Length = 48;
    ObjectAttributes.RootDirectory = a2;
    ObjectAttributes.Attributes = 576;
    v4 = ZwOpenKey(&KeyHandle, 0x20019u, &ObjectAttributes);
    inited = v4;
    if( v4 == -1073741772 )
    {
      inited = 0;
    }
    else if( v4 >= 0 )
    {
      inited = PiDevCfgInitDeviceContext(*(const wchar_t **)(a1 + 48), (__int64)a2, result);
      if( inited >= 0 )
      {
        inited = PiDevCfgConfigureDeviceKeys(a1, (__int64)result, KeyHandle, -1, &a5, 0i64);
        if( inited >= 0 )
        {
          if( PiPnpRtlCtx && (v7 = *(_QWORD *)(PiPnpRtlCtx + 224)) != 0 )
            v8 = *(_QWORD *)(v7 + 8);
          else
            v8 = 0i64;
          RegRtlDeleteTreeInternal((char *)a2, L"PendingConfiguration", v8, 0);
          v9 = a5;
          if( a5 )
          {
            v10 = *(const wchar_t **)(a1 + 48);
            v19 = 4;
            if( (int)CmGetDeviceRegProp(
                        PiPnpRtlCtx,
                        v10,
                        (__int64)a2,
                        11,
                        (__int64)&v13,
                        (__int64)&a6,
                        (__int64)&v19,
                        0) >= 0
              && v13 == 4
              && v19 == 4 )
            {
              v12 = a6;
            }
            else
            {
              v12 = 0;
            }
            LODWORD(a6) = v9 | v12;
            PiDevCfgSetDeviceRegProp(v11, (__int64)result, 11, 4, (__int64)&a6, 4);
          }
        }
      }
    }
    if( KeyHandle )
      ZwClose(KeyHandle);
  }
  else
  {
    inited = -1073741808;
  }
  PiDevCfgFreeDeviceContext((INT64)result);
  return(unsigned int)inited;
}

Referenced by:

IopInitializeDeviceInstanceKey
PiProcessNewDeviceNode