PiDevCfgConfigureDeviceInterface

NTSTATUS __stdcall PiDevCfgConfigureDeviceInterface(
        WCHAR *InterfaceName,
        VOID *InterfaceKeyHandle,
        PI_DEVCFG_RESOLVE_CONTEXT *ResolveContext){
  INT64 v6; 
  NTSTATUS v7; 
  UINT64 v8; 
  int v9; 
  UINT64 v10; 
  INT64 v11; 
  NTSTATUS v12; 
  UINT64 v13; 
  INT64 DesiredAccess; 
  INT64 DesiredAccessa; 
  INT64 DesiredAccessb; 
  INT64 Create; 
  INT64 Createa; 
  INT64 Createb; 
  VOID **DeviceInterfaceKey; 
  VOID **DeviceInterfaceKeya; 
  UINT64 *Disposition; 
  UINT64 *Dispositiona; 
  _UNICODE_STRING DestinationString; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  VOID *KeyHandle; 
  VOID *TargetKeyHandle; 

  TargetKeyHandle = 0i64;
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, L"Device");
  *(_QWORD *)&ObjectAttributes.Length = 48i64;
  ObjectAttributes.ObjectName = &DestinationString;
  *(_QWORD *)&ObjectAttributes.Attributes = 576i64;
  KeyHandle = 0i64;
  ObjectAttributes.RootDirectory = InterfaceKeyHandle;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  v7 = ZwOpenKey(
         &KeyHandle,
         0x20019ui64,
         &ObjectAttributes,
         v6,
         DesiredAccess,
         Create,
         (INT64)DeviceInterfaceKey,
         (INT64)Disposition);
  v9 = v7;
  if( v7 != -1073741772 )
  {
    if( v7 < 0 )
      goto LABEL_12;
    LOBYTE(Createa) = 1;
    LODWORD(DesiredAccessa) = 983103;
    v9 = CmOpenDeviceInterfaceRegKey(
           *(&stru_140CF2E80 + 607),
           InterfaceName,
           50i64,
           v8,
           DesiredAccessa,
           Createa,
           &TargetKeyHandle,
           0i64);
    if( v9 < 0 )
      goto LABEL_12;
    v9 = PiDevCfgCopyDeviceKeys(KeyHandle, TargetKeyHandle, v10, ResolveContext);
    if( v9 < 0 )
      goto LABEL_12;
    ZwClose((_HANDLE)KeyHandle);
    KeyHandle = 0i64;
    ZwClose((_HANDLE)TargetKeyHandle);
    TargetKeyHandle = 0i64;
  }
  RtlInitUnicodeString(&DestinationString, L"Properties");
  *(_QWORD *)&ObjectAttributes.Length = 48i64;
  ObjectAttributes.ObjectName = &DestinationString;
  *(_QWORD *)&ObjectAttributes.Attributes = 576i64;
  KeyHandle = 0i64;
  ObjectAttributes.RootDirectory = InterfaceKeyHandle;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  v12 = ZwOpenKey(
          &KeyHandle,
          0x20019ui64,
          &ObjectAttributes,
          v11,
          DesiredAccessa,
          Createa,
          (INT64)DeviceInterfaceKeya,
          (INT64)Dispositiona);
  v9 = v12;
  if( v12 == -1073741772 )
  {
    v9 = 0;
  }
  else if( v12 >= 0 )
  {
    LOBYTE(Createb) = 0;
    LODWORD(DesiredAccessb) = 983103;
    v9 = CmOpenDeviceInterfaceRegKey(
           *(&stru_140CF2E80 + 607),
           InterfaceName,
           48i64,
           v13,
           DesiredAccessb,
           Createb,
           &TargetKeyHandle,
           0i64);
    if( v9 >= 0 )
    {
      v9 = PiDevCfgCopyObjectProperties(*(&stru_140CF2E80 + 607), 0i64, 0, InterfaceKeyHandle);
      if( v9 >= 0 )
        v9 = PiDevCfgCopyDeviceKey((_HANDLE)KeyHandle, (INT64)TargetKeyHandle, (INT64)InterfaceName, 3i64);
    }
  }
LABEL_12:
  if( KeyHandle )
    ZwClose((_HANDLE)KeyHandle);
  if( TargetKeyHandle )
    ZwClose((_HANDLE)TargetKeyHandle);
  return v9;
}

Referenced by:

PiDevCfgConfigureDeviceInterfaceCallback
PiDevCfgConfigureDeviceInterfaces