PpDevCfgProcessDeviceOperations

NTSTATUS __stdcall PpDevCfgProcessDeviceOperations(_DEVICE_NODE *DeviceNode, VOID *DeviceInstanceKeyHandle){
  INT64 v4; 
  NTSTATUS v5; 
  int inited; 
  __int64 v8; 
  VOID *v9; 
  int v10; 
  wchar_t *Buffer; 
  PI_DEVCFG_DEVICE_CONTEXT *v12; 
  int v13; 
  UINT64 *ConfigFlags; 
  UINT8 *PropertyBuffer; 
  UINT64 *PropertySize; 
  INT64 v17; 
  UINT64 v18; 
  UINT64 CmRegPropType; 
  VOID *KeyHandle; 
  __int128 v21; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  _PI_DEVCFG_DEVICE_CONTEXT DeviceContext[28]; 
  int v24; 
  UINT64 v25; 
  UINT64 v26; 

  KeyHandle = 0i64;
  v21 = 0i64;
  memset(DeviceContext, 0i64, 0x48u);
  v24 = 0;
  LODWORD(v26) = 0;
  LODWORD(CmRegPropType) = 0;
  LODWORD(v25) = 0;
  if( DeviceNode->InstancePath.Buffer )
  {
    *(&ObjectAttributes.Length + 1) = 0;
    memset(&ObjectAttributes.Attributes + 1, 0, 20);
    *((_QWORD *)&v21 + 1) = L"PendingConfiguration";
    ObjectAttributes.ObjectName = (_UNICODE_STRING *)&v21;
    LODWORD(v21) = 2752552;
    ObjectAttributes.Length = 48;
    ObjectAttributes.RootDirectory = DeviceInstanceKeyHandle;
    ObjectAttributes.Attributes = 576;
    v5 = ZwOpenKey(
           &KeyHandle,
           0x20019ui64,
           &ObjectAttributes,
           v4,
           (INT64)ConfigFlags,
           (INT64)PropertyBuffer,
           (INT64)PropertySize,
           v17);
    inited = v5;
    if( v5 == -1073741772 )
    {
      inited = 0;
    }
    else if( v5 >= 0 )
    {
      inited = PiDevCfgInitDeviceContext(DeviceNode->InstancePath.Buffer, DeviceInstanceKeyHandle, DeviceContext);
      if( inited >= 0 )
      {
        inited = PiDevCfgConfigureDeviceKeys(DeviceNode, DeviceContext, KeyHandle, 0xFFFFFFFFui64, &v26, 0i64);
        if( inited >= 0 )
        {
          if( *(&stru_140CF2E80 + 607) && (v8 = *(_QWORD *)(*(&stru_140CF2E80 + 607) + 224i64)) != 0 )
            v9 = *(VOID **)(v8 + 8);
          else
            v9 = 0i64;
          RegRtlDeleteTreeInternal(DeviceInstanceKeyHandle, (WCHAR *)L"PendingConfiguration", v9, 0);
          v10 = v26;
          if( (_DWORD)v26 )
          {
            LODWORD(v18) = 0;
            Buffer = DeviceNode->InstancePath.Buffer;
            LODWORD(v25) = 4;
            if( CmGetDeviceRegProp(
                   *(&stru_140CF2E80 + 607),
                   Buffer,
                   DeviceInstanceKeyHandle,
                   11i64,
                   &CmRegPropType,
                   (UINT8 *)&v24,
                   &v25,
                   v18) >= 0
              && (_DWORD)CmRegPropType == 4
              && (_DWORD)v25 == 4 )
            {
              v13 = v24;
            }
            else
            {
              v13 = 0;
            }
            v24 = v10 | v13;
            PiDevCfgSetDeviceRegProp(v12, (_CM_REG_PROP)DeviceContext, 0xBui64, (UINT8 *)4, (UINT64)&v24);
          }
        }
      }
    }
    if( KeyHandle )
      ZwClose((_HANDLE)KeyHandle);
  }
  else
  {
    inited = -1073741808;
  }
  PiDevCfgFreeDeviceContext(DeviceContext);
  return inited;
}

Referenced by:

IopInitializeDeviceInstanceKey
PiProcessNewDeviceNode