PiDevCfgConfigureDeviceInterface

INT64 __fastcall PiDevCfgConfigureDeviceInterface(WCHAR *a1, VOID *a2, INT64 a3){
  NTSTATUS v6; 
  WCHAR v7; 
  __int64 v8; 
  int v9; 
  INT64 v10; 
  NTSTATUS v11; 
  __int64 v12; 
  SIZE_T NumberOfBytes; 
  SIZE_T NumberOfBytesa; 
  UINT64 a7; 
  INT64 a11; 
  struct _UNICODE_STRING DestinationString; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  void *KeyHandle; 
  HANDLE Handle; 
  Handle = 0i64;
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, L"Device", a3);
  *(_QWORD *)&ObjectAttributes.Length = 48i64;
  ObjectAttributes.ObjectName = &DestinationString;
  *(_QWORD *)&ObjectAttributes.Attributes = 576i64;
  KeyHandle = 0i64;
  ObjectAttributes.RootDirectory = a2;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  v6 = ZwOpenKey(&KeyHandle, 0x20019u, &ObjectAttributes);
  v9 = v6;
  if( v6 != -1073741772 )
  {
    if( v6 < 0 )
      goto LABEL_12;
    v9 = CmOpenDeviceInterfaceRegKey(PiPnpRtlCtx, a1, 0x32u, v8, 983103, 1, (__int64)&Handle, 0i64);
    if( v9 < 0 )
      goto LABEL_12;
    v9 = PiDevCfgCopyDeviceKeys(KeyHandle, Handle, v10, a3);
    if( v9 < 0 )
      goto LABEL_12;
    ZwClose(KeyHandle);
    KeyHandle = 0i64;
    ZwClose(Handle);
    Handle = 0i64;
  }
  RtlInitUnicodeString(&DestinationString, L"Properties", v7);
  *(_QWORD *)&ObjectAttributes.Length = 48i64;
  ObjectAttributes.ObjectName = &DestinationString;
  *(_QWORD *)&ObjectAttributes.Attributes = 576i64;
  KeyHandle = 0i64;
  ObjectAttributes.RootDirectory = a2;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  v11 = ZwOpenKey(&KeyHandle, 0x20019u, &ObjectAttributes);
  v9 = v11;
  if( v11 == -1073741772 )
  {
    v9 = 0;
  }
  else if( v11 >= 0 )
  {
    v9 = CmOpenDeviceInterfaceRegKey(PiPnpRtlCtx, a1, 0x30u, v12, 983103, 0, (__int64)&Handle, 0i64);
    if( v9 >= 0 )
    {
      LODWORD(a11) = 0;
      LODWORD(a7) = 3;
      v9 = PiDevCfgCopyObjectProperties(
             PiPnpRtlCtx,
             0i64,
             0i64,
             a2,
             NumberOfBytes,
             (INT64)a1,
             a7,
             (__int64)Handle,
             0i64,
             0i64,
             a11);
      if( v9 >= 0 )
      {
        LODWORD(NumberOfBytesa) = 1;
        v9 = PiDevCfgCopyDeviceKey(KeyHandle, (INT64)Handle, (INT64)a1, 3ui64, NumberOfBytesa, 0i64, a3);
      }
    }
  }
LABEL_12:
  if( KeyHandle )
    ZwClose(KeyHandle);
  if( Handle )
    ZwClose(Handle);
  return(unsigned int)v9;
}

Referenced by:

PiDevCfgConfigureDeviceInterfaceCallback
PiDevCfgConfigureDeviceInterfaces