DrvDbGetConfigurationSubKeyCallback

INT64 __fastcall DrvDbGetConfigurationSubKeyCallback(INT64 a1, VOID *a2, const WCHAR *a3, INT64 a4){
  unsigned int v4; 
  __int64 v7; 
  int v8; 
  int v9; 
  __int64 v10; 
  __int64 v11; 
  __int64 v12; 
  int v13; 
  __int64 v14; 
  int v16; 
  int v17; 
  int v18; 
  void *v19; 
  int v20; 
  __int16 pszDest[12]; 
  v4 = 0;
  v19 = 0i64;
  v18 = 0;
  v20 = 0;
  v16 = 0;
  if( !a4 )
    return 3;
  v8 = PnpCtxRegOpenKey(a1, (char *)a2, a3, 0, 1u, &v19);
  if( v8 >= 0 )
  {
    v17 = 4;
    if( *(_BYTE *)(a4 + 16) )
    {
      v9 = PnpCtxRegQueryValue(v7, v19, L"ConfigScope", &v16, &v18, (__int64)&v17);
      v8 = v9;
      if( v9 < 0 || v16 != 4 || v17 != 4 )
      {
        if( v9 == -1073741772 )
          v8 = 0;
        goto LABEL_32;
      }
    }
    else
    {
      v8 = PnpCtxRegQueryValue(v7, v19, L"ConfigFlags", &v16, &v20, (__int64)&v17);
      if( v8 < 0 || v16 != 4 || v17 != 4 )
      {
        if( v8 == -1073741772 )
          v8 = 0;
        goto LABEL_32;
      }
    }
    v10 = -1i64;
    v11 = -1i64;
    do
      ++v11;
    while( a3[v11] );
    v12 = *(unsigned int *)(a4 + 12);
    if( *(_DWORD *)(a4 + 8) < (unsigned int)(v12 + v11) )
    {
      v8 = -1073741789;
    }
    else
    {
      memmove((UINT8 *)(*(_QWORD *)a4 + 2 * v12), (UINT8 *)a3, 2i64 * (unsigned int)v11);
      LODWORD(v12) = *(_DWORD *)(a4 + 12);
    }
    v7 = (unsigned int)(v11 + v12);
    *(_DWORD *)(a4 + 12) = v7;
    if( !*(_BYTE *)(a4 + 16) )
    {
LABEL_26:
      if( *(_DWORD *)(a4 + 8) < (unsigned int)(v7 + 1) )
      {
        v8 = -1073741789;
      }
      else
      {
        *(_WORD *)(*(_QWORD *)a4 + 2 * v7) = 0;
        v7 = *(unsigned int *)(a4 + 12);
      }
      *(_DWORD *)(a4 + 12) = v7 + 1;
      goto LABEL_32;
    }
    if( *(_DWORD *)(a4 + 8) >= (unsigned int)(v7 + 1) )
    {
      *(_WORD *)(*(_QWORD *)a4 + 2 * v7) = 58;
      LODWORD(v7) = *(_DWORD *)(a4 + 12);
    }
    *(_DWORD *)(a4 + 12) = v7 + 1;
    RtlStringCchPrintfW((WCHAR *)pszDest, 9ui64, (WCHAR *)L"%X");
    v8 = v13;
    if( v13 >= 0 )
    {
      do
        ++v10;
      while( pszDest[v10] );
      v14 = *(unsigned int *)(a4 + 12);
      if( *(_DWORD *)(a4 + 8) < (unsigned int)(v14 + v10) )
      {
        v8 = -1073741789;
      }
      else
      {
        memmove((UINT8 *)(*(_QWORD *)a4 + 2 * v14), (UINT8 *)pszDest, 2i64 * (unsigned int)v10);
        LODWORD(v14) = *(_DWORD *)(a4 + 12);
      }
      v7 = (unsigned int)(v10 + v14);
      *(_DWORD *)(a4 + 12) = v7;
      goto LABEL_26;
    }
  }
LABEL_32:
  if( v19 )
    PnpCtxRegCloseKey(v7, v19);
  if( v8 < 0 )
  {
    *(_DWORD *)(a4 + 20) = v8;
    if( v8 != -1073741789 )
      return 3;
  }
  return v4;
}

Referenced by:

No references.