DrvDbGetDriverDatabaseMappedPropertyKeys

__int64 __fastcall DrvDbGetDriverDatabaseMappedPropertyKeys(
        __int64 a1,
        const WCHAR *a2,
        void *a3,
        __int64 a4,
        unsigned int a5,
        unsigned int *a6){
  unsigned int *v6; 
  unsigned int v7; 
  WCHAR *v8; 
  __int64 v9; 
  __int64 v10; 
  unsigned int v11; 
  signed int CompositeMappedPropertyKeys; 
  __int64 v13; 
  __int64 v14; 
  __int64 v15; 
  HANDLE v16; 
  __int64(**v17)[3]; 
  unsigned int v18; 
  const WCHAR *v19; 
  signed int Value; 
  __int64(*v21)[3]; 
  void *v22; 
  __int64 v23; 
  __int64(**v24)[3]; 
  unsigned int v25; 
  const WCHAR *v26; 
  signed int v27; 
  __int64(*v28)[3]; 
  __int64 v29; 
  unsigned int v30; 
  int v31; 
  INT64 a5a; 
  unsigned int *a6a; 
  __int64 v35; 
  const UNICODE_STRING *v36; 
  void *v37; 
  HANDLE KeyHandle; 
  HANDLE v39; 
  v6 = a6;
  v7 = a5;
  v8 = (WCHAR *)a2;
  a6a = a6;
  v9 = a4;
  v36 = 0i64;
  v37 = 0i64;
  v10 = a1;
  KeyHandle = 0i64;
  v11 = 0;
  *a6 = 0;
  CompositeMappedPropertyKeys = DrvDbGetCompositeMappedPropertyKeys(a1, (_OWORD **)off_140C02C70, 7u, a4, a5, a6a);
  if( CompositeMappedPropertyKeys < 0 )
    return(unsigned int)CompositeMappedPropertyKeys;
  v14 = *v6;
  if( (_DWORD)v14 )
  {
    if( v13 )
      v9 = v13 + 20 * v14;
    v7 = a5 - v14;
  }
  CompositeMappedPropertyKeys = DrvDbFindDatabaseNode(v10, v8, &v36);
  if( CompositeMappedPropertyKeys < 0 )
    return(unsigned int)CompositeMappedPropertyKeys;
  if( ((__int64)v36[3].Buffer & 0x10) != 0 )
  {
    LODWORD(a5a) = 1;
    CompositeMappedPropertyKeys = DrvDbOpenObjectRegKey(
                                    (INT64 *)v10,
                                    *(const UNICODE_STRING **)(v10 + 32),
                                    1i64,
                                    v8,
                                    a5a,
                                    0,
                                    (INT64)&KeyHandle,
                                    0i64,
                                    0i64);
    if( CompositeMappedPropertyKeys < 0 )
      goto LABEL_47;
    v16 = KeyHandle;
    v17 = &off_140009A30;
    LODWORD(a6) = 0;
    v39 = KeyHandle;
    v18 = 0;
    while( 1 )
    {
      v19 = (const WCHAR *)v17[2];
      LODWORD(v35) = 0;
      Value = RegRtlQueryValue(v16, v19, 0i64, 0i64, (__int64)&v35);
      CompositeMappedPropertyKeys = Value;
      if( Value != -1073741772 )
      {
        if( Value && Value != -1073741789 )
          goto LABEL_22;
        if( v9 && (unsigned int)a6 < v7 )
        {
          v21 = *v17;
          v15 = 5i64 * (unsigned int)a6;
          LODWORD(a6) = (_DWORD)a6 + 1;
          *(_OWORD *)(v9 + 4 * v15) = *(_OWORD *)v21;
          *(_DWORD *)(v9 + 4 * v15 + 16) = (*v21)[2];
        }
        if( v11 + 1 < v11 )
        {
          CompositeMappedPropertyKeys = -1073741675;
          v11 = 0;
          goto LABEL_22;
        }
        ++v11;
      }
      ++v18;
      v17 += 5;
      if( v18 >= 4 )
        break;
      v16 = v39;
    }
    CompositeMappedPropertyKeys = 0;
LABEL_22:
    if( CompositeMappedPropertyKeys < 0 )
      goto LABEL_47;
    if( v11 )
    {
      if( v9 )
      {
        v15 = 5i64 * v11;
        v9 += 20i64 * v11;
      }
      v7 -= v11;
    }
    if( ((__int64)v36[3].Buffer & 4) != 0 )
    {
      CompositeMappedPropertyKeys = 0;
      goto LABEL_47;
    }
    v10 = a1;
    v8 = (WCHAR *)a2;
  }
  v22 = a3;
  if( !a3 )
  {
    CompositeMappedPropertyKeys = DrvDbOpenDriverDatabaseRegKey((const UNICODE_STRING **)v10, v8, 1u, 0, &v37, 0i64);
    if( CompositeMappedPropertyKeys < 0 )
      goto LABEL_47;
    v22 = v37;
    a3 = v37;
  }
  v23 = 0i64;
  v24 = &off_140001FC0;
  v25 = 0;
  while( 1 )
  {
    v26 = (const WCHAR *)v24[2];
    LODWORD(a6) = 0;
    v27 = RegRtlQueryValue(v22, v26, 0i64, 0i64, (__int64)&a6);
    CompositeMappedPropertyKeys = v27;
    if( v27 == -1073741772 )
    {
      CompositeMappedPropertyKeys = 0;
      goto LABEL_44;
    }
    if( v27 && v27 != -1073741789 )
      goto LABEL_47;
    if( v9 && (unsigned int)v23 < v7 )
    {
      v28 = *v24;
      v29 = 5 * v23;
      v23 = (unsigned int)(v23 + 1);
      *(_OWORD *)(v9 + 4 * v29) = *(_OWORD *)*v24;
      *(_DWORD *)(v9 + 4 * v29 + 16) = (*v28)[2];
    }
    v30 = *v6;
    v31 = -1;
    v15 = *v6 + 1;
    if( (unsigned int)v15 >= *v6 )
      v31 = *v6 + 1;
    CompositeMappedPropertyKeys = (unsigned int)v15 < v30 ? 0xC0000095 : 0;
    *v6 = v31;
    if( (unsigned int)v15 < v30 )
      break;
LABEL_44:
    v22 = a3;
    ++v25;
    v24 += 5;
    if( v25 >= 0xC )
      goto LABEL_47;
  }
  *v6 = 0;
LABEL_47:
  if( v37 )
    PnpCtxRegCloseKey(v15, v37);
  if( KeyHandle )
    PnpCtxRegCloseKey(v15, KeyHandle);
  return(unsigned int)CompositeMappedPropertyKeys;
}

Referenced by:

DrvDbDispatchDriverDatabase