DrvDbOpenObjectRegKey

INT64 __fastcall DrvDbOpenObjectRegKey(
        INT64 *a1,
        const UNICODE_STRING *rdx0,
        INT64 a3,
        WCHAR *r9,
        INT64 a5,
        CHAR a6,
        INT64 a7,
        INT64 a8,
        INT64 a9){
  int v9; 
  int ObjectDatabaseNode; 
  __int64 v13; 
  UNICODE_STRING *v14; 
  int Tree; 
  INT64 *i; 
  int v17; 
  __int64 v18; 
  int v20; 
  __int64 v21; 
  int v22; 
  char *v23; 
  UNICODE_STRING *v24; 
  int v25; 
  WCHAR *v26; 
  v26 = r9;
  v25 = a3;
  v23 = 0i64;
  v24 = 0i64;
  v9 = a3;
  ObjectDatabaseNode = DrvDbGetObjectDatabaseNode((INT64)a1, r9, &v26, (const UNICODE_STRING **)&v24);
  v14 = v24;
  Tree = ObjectDatabaseNode;
  if( ObjectDatabaseNode < 0 )
    goto LABEL_12;
  if( !v24 )
  {
    v14 = (UNICODE_STRING *)rdx0;
    if( !rdx0 )
    {
      for( i = (INT64 *)a1[2]; i != a1 + 2; i = (INT64 *)*i )
      {
        v14 = (UNICODE_STRING *)i;
        v17 = DrvDbAcquireDatabaseNodeBaseKey(a1, (__int64)i, v25, (void **)&v23);
        Tree = v17;
        if( v17 == -1073740697 )
        {
          Tree = -1073741772;
        }
        else
        {
          if( v17 < 0 )
            break;
          Tree = PnpCtxRegOpenKey(*a1, v23, v26, 0, a5, (void **)a7);
          DrvDbReleaseDatabaseNodeBaseKey((__int64)a1, (__int64)i, v18, v23);
          v23 = 0i64;
          if( Tree != -1073741772 )
            goto LABEL_9;
        }
      }
      if( Tree == -1073741772 )
      {
        if( !a6 )
          goto LABEL_12;
        v14 = (UNICODE_STRING *)a1[4];
        v22 = DrvDbAcquireDatabaseNodeBaseKey(a1, (__int64)v14, v25, (void **)&v23);
        Tree = v22;
        if( v22 < 0 )
        {
          if( v22 == -1073740697 )
            Tree = -1073741662;
          goto LABEL_12;
        }
        Tree = PnpCtxRegCreateTree(*a1, v23, v26, 0, a5, 0i64, a7, 0i64);
        if( Tree < 0 )
          goto LABEL_12;
      }
LABEL_9:
      if( Tree >= 0 && a9 )
        *(_QWORD *)a9 = v14;
      goto LABEL_12;
    }
  }
  v20 = DrvDbAcquireDatabaseNodeBaseKey(a1, (__int64)v14, v9, (void **)&v23);
  Tree = v20;
  if( v20 >= 0 )
  {
    v21 = *a1;
    if( a6 )
    {
      Tree = PnpCtxRegCreateTree(v21, v23, v26, 0, a5, 0i64, a7, a8);
    }
    else
    {
      Tree = PnpCtxRegOpenKey(v21, v23, v26, 0, a5, (void **)a7);
      if( Tree < 0 )
        goto LABEL_12;
      if( a8 )
        *(_DWORD *)a8 = 2;
    }
    goto LABEL_9;
  }
  if( v20 == -1073740697 )
    Tree = -1073741772;
LABEL_12:
  if( v23 )
    DrvDbReleaseDatabaseNodeBaseKey((__int64)a1, (__int64)v14, v13, v23);
  return(unsigned int)Tree;
}

Referenced by:

DrvDbCreateDatabaseNode
DrvDbGetDeviceIdMappedProperty
DrvDbGetDriverDatabaseMappedProperty
DrvDbGetDriverDatabaseMappedPropertyKeys
DrvDbGetDriverPackageMappedProperty
DrvDbGetObjectDatabaseNodeName
DrvDbOpenDeviceIdRegKey
DrvDbOpenDriverFileRegKey
DrvDbOpenDriverInfFileRegKey
DrvDbOpenDriverPackageRegKey
DrvDbSetDriverDatabaseMappedProperty