VrpUpdateKeyInformation

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