CmpGetStateSepKeysRedirectionPathValue

INT64 __stdcall CmpGetStateSepKeysRedirectionPathValue(PVOID BugCheckParameter3, INT64 a2){
  __int64 v2; 
  __int64 v3; 
  __int64 v4; 
  INT64 result; 
  unsigned int SubKeyByName; 
  unsigned int v8; 
  unsigned int ValueByName; 
  __int64 v10; 
  unsigned __int16 v11; 
  unsigned __int16 i; 
  int v13[2]; 
  int v14[2]; 
  int v15[2]; 
  int v16[2]; 
  __int64 a4; 
  UINT realsize; 
  int v19; 
  _HV_GET_CELL_CONTEXT *CellContext; 
  v19 = HIDWORD(v2);
  v14[1] = 0;
  v15[1] = 0;
  v4 = v3;
  v16[1] = 0;
  v13[1] = 0;
  v14[0] = -1;
  v15[0] = -1;
  v16[0] = -1;
  realsize = 0;
  a4 = 0i64;
  v13[0] = -1;
  if( !CmpFindHiveSubKey((INT64)BugCheckParameter3, a2, (__int128 *)L"pr", &a4, (__int64)v13) )
    goto LABEL_2;
  SubKeyByName = CmpFindSubKeyByName(
                   (_HHIVE *)BugCheckParameter3,
                   (_CM_KEY_NODE *)a4,
                   (_UNICODE_STRING *)&CmpKeysString);
  result = (*((__int64(__fastcall **)(PVOID, int *))BugCheckParameter3 + 2))(BugCheckParameter3, v13);
  if( SubKeyByName == -1 )
    goto LABEL_2;
  result = (*((__int64(__fastcall **)(PVOID, _QWORD, int *))BugCheckParameter3 + 1))(
             BugCheckParameter3,
             SubKeyByName,
             v14);
  if( !result )
    goto LABEL_2;
  v8 = CmpFindSubKeyByName(
         (_HHIVE *)BugCheckParameter3,
         (_CM_KEY_NODE *)result,
         (_UNICODE_STRING *)&CmpDriverStateSourceIdName);
  result = (*((__int64(__fastcall **)(PVOID, int *))BugCheckParameter3 + 2))(BugCheckParameter3, v14);
  if( v8 == -1 )
    goto LABEL_2;
  result = (*((__int64(__fastcall **)(PVOID, _QWORD, int *))BugCheckParameter3 + 1))(BugCheckParameter3, v8, v15);
  if( result
    && (ValueByName = CmpFindValueByName(
                        (_HHIVE *)BugCheckParameter3,
                        (_CM_KEY_NODE *)result,
                        (_UNICODE_STRING *)&CmpTargetNtPathString),
        result = (*((__int64(__fastcall **)(PVOID, int *))BugCheckParameter3 + 2))(BugCheckParameter3, v15),
        ValueByName != -1)
    && (result = (*((__int64(__fastcall **)(PVOID, _QWORD, int *))BugCheckParameter3 + 1))(
                   BugCheckParameter3,
                   ValueByName,
                   v16)) != 0
    && (*(_QWORD *)(v4 + 8) = CmpValueToData(
                                (_HHIVE *)BugCheckParameter3,
                                ValueByName,
                                (_CM_KEY_VALUE *)result,
                                &realsize,
                                CellContext),
        result = (*((__int64(__fastcall **)(PVOID, int *))BugCheckParameter3 + 2))(BugCheckParameter3, v16),
        (v10 = *(_QWORD *)(v4 + 8)) != 0) )
  {
    v11 = realsize;
    *(_WORD *)(v4 + 2) = realsize;
    *(_WORD *)v4 = 0;
    if( v11 )
    {
      for( i = 0; i < v11; *(_WORD *)v4 = i )
      {
        result = (unsigned __int64)i >> 1;
        if( !*(_WORD *)(v10 + 2 * result) )
          break;
        i += 2;
      }
    }
    LOBYTE(result) = 1;
  }
  else
  {
LABEL_2:
    LOBYTE(result) = 0;
  }
  return result;
}

Referenced by:

CmpFindRedirectedDriverServiceStateNode