WdipSemLoadNextEndEvent

__int64 __fastcall WdipSemLoadNextEndEvent(HANDLE KeyHandle, ULONG Index, GUID *Guid){
  int v6; 
  unsigned int v7; 
  __int64 v8; 
  __int16 v9; 
  __int64 v10; 
  unsigned int v11; 
  WCHAR *v12; 
  WCHAR v13; 
  WCHAR v14; 
  int v15; 
  char v16; 
  int v17; 
  __int64 v18; 
  int v19; 
  UINT64 Length; 
  UINT64 ResultLength; 
  int ReturnValue; 
  int v24; 
  HANDLE Handle; 
  __int64 v26; 
  struct _UNICODE_STRING DestinationString; 
  char KeyInformation[12]; 
  unsigned int v29; 
  WCHAR KeyName[72]; 
  __int16 SourceString[64]; 
  INT64 result[16]; 
  Handle = 0i64;
  ResultLength = 0i64;
  ReturnValue = 0;
  v24 = 0;
  v26 = 0i64;
  DestinationString = 0i64;
  if( !KeyHandle || !Guid )
    return(unsigned int)-1073741811;
  memset((INT64)KeyInformation, 0i64);
  LODWORD(Length) = 150;
  v6 = ZwEnumerateKey(KeyHandle, Index, KeyBasicInformation, KeyInformation, Length, &ResultLength);
  if( v6 >= 0 )
  {
    if( v29 >= 0x80 )
    {
      v6 = -2147483643;
      goto LABEL_31;
    }
    KeyName[(unsigned __int64)v29 >> 1] = 0;
    memset((INT64)SourceString, 0i64);
    memset((INT64)result, 0i64);
    v7 = 0;
    v8 = 0i64;
    while( 1 )
    {
      v9 = KeyName[v8];
      if( v9 == 59 )
        break;
      SourceString[v8] = v9;
      ++v7;
      ++v8;
      if( v7 >= 0x40 )
        goto LABEL_11;
    }
    if( 2 * (unsigned __int64)v7 >= 0x80 )
      _report_rangecheckfailure();
    SourceString[v7] = 0;
LABEL_11:
    if( v7 >= 0x40 )
      goto LABEL_38;
    v10 = v7 + 1;
    v11 = 0;
    if( (unsigned int)v10 >= 0x40 )
      goto LABEL_38;
    v12 = &KeyName[v10];
    do
    {
      v13 = *v12;
      *((_WORD *)result + v11) = *v12;
      if( !v13 )
        break;
      LODWORD(v10) = v10 + 1;
      ++v12;
      ++v11;
    }
    while( (unsigned int)v10 < 0x40 );
    if( (unsigned int)v10 >= 0x40 )
    {
LABEL_38:
      v6 = -1073741823;
      goto LABEL_31;
    }
    RtlInitUnicodeString(&DestinationString, (PCWSTR)SourceString, v11);
    v6 = RtlGUIDFromString(&DestinationString, Guid);
    if( v6 >= 0 )
    {
      RtlInitUnicodeString(&DestinationString, (PCWSTR)result, v14);
      v6 = RtlUnicodeStringToInteger(&DestinationString, 0xAui64, (UINT64 *)((char *)&ResultLength + 4));
      if( v6 >= 0 )
      {
        LOWORD(Guid[1].Data1) = WORD2(ResultLength);
        v6 = WdipSemOpenRegistryKey(KeyName, KeyHandle, &Handle);
        if( v6 >= 0 )
        {
          v15 = WdipSemQueryValueFromRegistry(Handle, (WCHAR *)L"Level", 4ui64, 4ui64, &ReturnValue, &ResultLength);
          v6 = v15;
          if( v15 < 0 )
          {
            if( v15 != -1073741772 )
              goto LABEL_31;
            BYTE2(Guid[1].Data1) = -1;
          }
          else
          {
            v16 = ReturnValue;
            if( !ReturnValue )
              v16 = -1;
            BYTE2(Guid[1].Data1) = v16;
          }
          v17 = WdipSemQueryValueFromRegistry(Handle, (WCHAR *)L"Keyword", 0xBui64, 8ui64, &v26, &ResultLength);
          v6 = v17;
          if( v17 >= 0 )
          {
            v18 = v26;
            if( !v26 )
              v18 = -1i64;
            *(_QWORD *)Guid[1].Data4 = v18;
            goto LABEL_28;
          }
          if( v17 == -1073741772 )
          {
            *(_QWORD *)Guid[1].Data4 = -1i64;
LABEL_28:
            v19 = WdipSemQueryValueFromRegistry(Handle, (WCHAR *)L"EnableProperty", 4ui64, 4ui64, &v24, &ResultLength);
            v6 = v19;
            if( v19 >= 0 )
            {
              *(_DWORD *)&Guid[2].Data2 = v24;
            }
            else if( v19 == -1073741772 )
            {
              v6 = 0;
              *(_DWORD *)&Guid[2].Data2 = 0;
            }
          }
        }
      }
    }
  }
LABEL_31:
  if( Handle )
    ZwClose(Handle);
  return(unsigned int)v6;
}

Referenced by:

WdipSemLoadNextScenario