KsepRegistryEnumValue

NTSTATUS __stdcall KsepRegistryEnumValue(_HANDLE KeyHandle, ULONG Index, INT64 a3){
  VOID *v3; 
  VOID *v4; 
  VOID *v7; 
  NTSTATUS result; 
  unsigned int *Paged; 
  unsigned int *v10; 
  NTSTATUS v11; 
  __int64 v12; 
  __int64 v13; 
  UINT64 Length; 
  UINT64 Lengtha; 
  UINT64 Size[5]; 
  __int64 *v17; 

  v4 = v3;
  LODWORD(Length) = 0;
  LODWORD(Size[0]) = 0;
  v7 = *(VOID **)&KeyHandle;
  result = ZwEnumerateValueKey(*(VOID **)&KeyHandle, *(UINT64 *)&Index, KeyValueBasicInformation, 0i64, Length, Size);
  if( result == -1073741789 || result == -2147483643 )
  {
    Paged = (unsigned int *)KsepPoolAllocatePaged(LODWORD(Size[0]));
    v10 = Paged;
    if( Paged )
    {
      LODWORD(Lengtha) = Size[0];
      v11 = ZwEnumerateValueKey(v7, Index, KeyValueBasicInformation, Paged, Lengtha, Size);
      if( !v11 )
      {
        v12 = v10[2];
        v13 = v12 + 2;
        if( v12 + 2 <= (unsigned __int64)a3 )
        {
          memmove(v4, v10 + 3, v12);
          *((_WORD *)v4 + ((unsigned __int64)v10[2] >> 1)) = 0;
          v13 = v10[2] + 2i64;
        }
        else
        {
          v11 = -1073741789;
        }
        *v17 = v13;
      }
      KsepPoolFreePaged(v10);
      return v11;
    }
    else
    {
      return -1073741801;
    }
  }
  return result;
}

Referenced by:

KsepDbQueryRegistryDeviceDataList