VrpUpdateKeyInformation

INT64 __fastcall VrpUpdateKeyInformation(
        _KEY_INFORMATION_CLASS KeyInformationClass,
        VOID *KeyInformation,
        UINT64 Length,
        UINT64 *ResultLength,
        _UNICODE_STRING *KeyName,
        UINT64 KeyFlags){
  unsigned int v6; 
  unsigned int v7; 
  UINT8 *v8; 
  unsigned int *v9; 
  unsigned int v10; 
  __int32 v11; 
  __int32 v12; 
  unsigned __int16 *p_Length; 
  unsigned int v14; 
  __int64 v15; 
  int *v16; 
  UINT8 *v17; 
  unsigned int v18; 
  __int32 v20; 
  unsigned __int64 v21; 
  wchar_t *v22; 
  __int64 v23; 
  __int16 v24; 
  __m128i v25; 
  unsigned __int64 v26; 
  _WORD *v27; 
  __int64 v28; 
  int v29; 
  _DWORD *v30; 
  __m128i v31; 
  v6 = 0;
  v7 = Length;
  v8 = 0i64;
  v9 = 0i64;
  v10 = 0;
  v31 = 0i64;
  if( KeyInformationClass == KeyBasicInformation )
  {
    v15 = 16i64;
    v16 = 0i64;
    v14 = 16;
    v23 = 12i64;
    goto LABEL_30;
  }
  v11 = KeyInformationClass - 1;
  if( !v11 )
  {
    v23 = 20i64;
    v9 = (unsigned int *)((char *)KeyInformation + 12);
    v16 = (int *)((char *)KeyInformation + 16);
    v14 = 24;
    v15 = 24i64;
LABEL_30:
    v24 = 0;
    v30 = (char *)KeyInformation + v23;
    v31 = *(__m128i *)KeyName;
    v25 = v31;
    v31.m128i_i16[0] = 0;
    v26 = (unsigned __int64)(unsigned __int16)_mm_cvtsi128_si32(v25) >> 1;
    if( v26 )
    {
      v27 = (_WORD *)(v25.m128i_i64[1] - 2 + 2 * v26);
      do
      {
        if( *v27 == 92 )
          break;
        v24 += 2;
        --v27;
        --v26;
      }
      while( v26 );
      v31.m128i_i16[0] = v24;
    }
    v31.m128i_i16[1] = v24;
    p_Length = (unsigned __int16 *)&v31;
    v31.m128i_i64[1] = v25.m128i_i64[1] + 2 * v26;
LABEL_5:
    v17 = (UINT8 *)KeyInformation + v15;
    if( v9 )
    {
      if( !KeyInformation )
      {
        *(_DWORD *)ResultLength += *p_Length;
        v18 = *(_DWORD *)ResultLength;
LABEL_8:
        if( v7 >= v14 )
        {
          if( v7 < v18 )
          {
            return(unsigned int)-2147483643;
          }
          else
          {
            if( v9 && *v16 )
            {
              memmove((UINT8 *)KeyInformation + v10, v8, (unsigned int)*v16);
              *v9 = v10;
            }
            memmove(v17, *((UINT8 **)p_Length + 1), *p_Length);
            *v30 = *p_Length;
          }
          return v6;
        }
        return(unsigned int)-1073741789;
      }
      v28 = *v9;
      *(_DWORD *)ResultLength = 24;
      v8 = (UINT8 *)KeyInformation + v28;
      v10 = *p_Length + 24;
      *(_DWORD *)ResultLength = v10;
      v29 = *v16;
      if( *v16 )
      {
        v10 = (v10 + 7) & 0xFFFFFFF8;
        *(_DWORD *)ResultLength = v10;
        v29 = *v16;
      }
      v18 = v10 + v29;
    }
    else
    {
      v18 = v15 + *p_Length;
    }
    *(_DWORD *)ResultLength = v18;
    goto LABEL_8;
  }
  v12 = v11 - 2;
  if( !v12 )
  {
    p_Length = &KeyName->Length;
    v14 = 4;
    v15 = 4i64;
    v30 = KeyInformation;
    v16 = 0i64;
    goto LABEL_5;
  }
  v20 = v12 - 1;
  if( v20 )
  {
    if( v20 != 4 )
      return(unsigned int)-1073741811;
    if( (unsigned int)Length >= 4 )
    {
      *(_DWORD *)KeyInformation = ((unsigned int)KeyFlags >> 1) & 1;
      return v6;
    }
    return(unsigned int)-1073741789;
  }
  v21 = (unsigned __int64)KeyName->Length >> 1;
  if( (unsigned int)Length < 0x28 )
    return(unsigned int)-1073741789;
  if( v21 )
  {
    v22 = &KeyName->Buffer[v21 - 1];
    do
    {
      if( *v22 == 92 )
        break;
      --v22;
      --v21;
    }
    while( v21 );
  }
  *((_DWORD *)KeyInformation + 8) = KeyName->Length - 2 * v21;
  return v6;
}

Referenced by:

VrpPostEnumerateKey
VrpPostQueryKey