RtlpMuiRegLoadLicInformation

INT64 __fastcall RtlpMuiRegLoadLicInformation(INT64 a1){
  INT64 v1; 
  UINT8 *v2; 
  UINT8 *v3; 
  int v4; 
  UINT8 *v5; 
  unsigned int v6; 
  UINT8 *PoolWithTag; 
  const WCHAR *v8; 
  int v9; 
  WCHAR v10; 
  WCHAR v11; 
  PWCHAR v12; 
  PWCHAR v13; 
  unsigned int v14; 
  UINT8 *v15; 
  int v16; 
  const WCHAR *v17; 
  WCHAR v18; 
  WCHAR v19; 
  PWCHAR v20; 
  PWCHAR v21; 
  unsigned int v22; 
  UINT8 *v23; 
  int v24; 
  const WCHAR *v25; 
  WCHAR v26; 
  WCHAR v27; 
  PWCHAR v28; 
  PWCHAR v29; 
  WCHAR v30; 
  unsigned int v31; 
  INT64 result; 
  WCHAR v33; 
  WCHAR v34; 
  int v35; 
  int v36; 
  int v37; 
  int v38; 
  int v39; 
  int v40; 
  int v41; 
  int v42; 
  void *Src; 
  UINT8 *v44; 
  struct _UNICODE_STRING DestinationString; 
  size_t Size; 
  UINT64 Lcid; 
  UINT64 Type; 
  v42 = -1;
  LODWORD(Lcid) = 0;
  LODWORD(Type) = 0;
  v1 = a1;
  LODWORD(Size) = 0;
  v2 = 0i64;
  Src = 0i64;
  v3 = 0i64;
  v37 = 0;
  v4 = 0;
  v35 = 0;
  v5 = 0i64;
  v39 = 0;
  v41 = 0;
  DestinationString = 0i64;
  if( !a1 )
  {
    v31 = -1073741811;
    goto LABEL_58;
  }
  if( (int)RtlpGetWindowsPolicy(L"WindowsExcludedProcs", &Type, &Size, (UINT8 **)&Src) >= 0 )
  {
    v41 = 1;
    if( Src )
      ExFreeHeapPool(Src);
    Src = 0i64;
  }
  if( (int)RtlpGetWindowsPolicy(L"Kernel-MUI-Number-Allowed", &Type, &Size, (UINT8 **)&Src) >= 0 )
  {
    v42 = *(_DWORD *)Src;
    ExFreeHeapPool(Src);
    Src = 0i64;
  }
  if( (int)RtlpGetWindowsPolicy(L"Kernel-MUI-Language-Allowed", &Type, &Size, (UINT8 **)&Src) >= 0 )
  {
    v6 = Size;
    v38 = Size + 4;
    if( (_DWORD)Size != -4 )
    {
      PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(PagedPool, (unsigned int)(Size + 4), 0x72746C6Dui64);
      v2 = PoolWithTag;
      if( PoolWithTag )
        memset((INT64)PoolWithTag, 0i64);
      v6 = Size;
    }
    v44 = v2;
    if( !v2 )
    {
      v37 = 0;
      goto LABEL_65;
    }
    memmove(v2, (UINT8 *)Src, v6);
    v8 = (const WCHAR *)v2;
    v9 = 0;
    v12 = wcspbrk((PWCHAR)v2, (PWCHAR)L";", v10);
    LOWORD(v13) = 0;
    if( v12 )
    {
      do
      {
        *v12 = 0;
        RtlInitUnicodeString(&DestinationString, v8, v11);
        if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
          ++v9;
        v8 = v12 + 1;
        v13 = wcspbrk(v12 + 1, (PWCHAR)L";", v33);
        v12 = v13;
      }
      while( v13 );
      v1 = a1;
    }
    if( *v8 != (_WORD)v13 )
    {
      RtlInitUnicodeString(&DestinationString, v8, v11);
      if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
        ++v9;
    }
    if( !v9 )
      ExFreeHeapPool(v2);
    v37 = v9 != 0 ? v38 : 0;
    v2 = (UINT8 *)((unsigned __int64)v44 & -(__int64)(v9 != 0));
    if( Src )
      ExFreeHeapPool(Src);
    Src = 0i64;
    v4 = 0;
  }
  if( (int)RtlpGetWindowsPolicy(L"Kernel-MUI-Language-Disallowed", &Type, &Size, (UINT8 **)&Src) >= 0 )
  {
    v14 = Size;
    v36 = Size + 4;
    if( (_DWORD)Size == -4 )
    {
      v3 = 0i64;
    }
    else
    {
      v15 = (UINT8 *)ExAllocatePoolWithTag(PagedPool, (unsigned int)(Size + 4), 0x72746C6Dui64);
      v3 = v15;
      if( v15 )
        memset((INT64)v15, 0i64);
      v14 = Size;
    }
    v44 = v3;
    if( !v3 )
    {
      v4 = 0;
      goto LABEL_65;
    }
    memmove(v3, (UINT8 *)Src, v14);
    v16 = 0;
    v17 = (const WCHAR *)v3;
    v20 = wcspbrk((PWCHAR)v3, (PWCHAR)L";", v18);
    LOWORD(v21) = 0;
    if( v20 )
    {
      do
      {
        *v20 = 0;
        RtlInitUnicodeString(&DestinationString, v17, v19);
        if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
          ++v16;
        v17 = v20 + 1;
        v21 = wcspbrk(v20 + 1, (PWCHAR)L";", v34);
        v20 = v21;
      }
      while( v21 );
      v1 = a1;
    }
    if( *v17 != (_WORD)v21 )
    {
      RtlInitUnicodeString(&DestinationString, v17, v19);
      if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
        ++v16;
    }
    if( !v16 )
      ExFreeHeapPool(v3);
    v4 = v16 != 0 ? v36 : 0;
    v35 = v4;
    v3 = (UINT8 *)((unsigned __int64)v44 & -(__int64)(v16 != 0));
    if( Src )
      ExFreeHeapPool(Src);
    Src = 0i64;
  }
  if( (int)RtlpGetWindowsPolicy(L"Kernel-MUI-Language-SKU", &Type, &Size, (UINT8 **)&Src) >= 0 )
  {
    v22 = Size;
    v40 = Size + 4;
    if( (_DWORD)Size == -4 )
    {
      v5 = 0i64;
    }
    else
    {
      v23 = (UINT8 *)ExAllocatePoolWithTag(PagedPool, (unsigned int)(Size + 4), 0x72746C6Dui64);
      v5 = v23;
      if( v23 )
        memset((INT64)v23, 0i64);
      v22 = Size;
    }
    v44 = v5;
    if( v5 )
    {
      memmove(v5, (UINT8 *)Src, v22);
      v24 = 0;
      v25 = (const WCHAR *)v5;
      v28 = wcspbrk((PWCHAR)v5, (PWCHAR)L";", v26);
      LOWORD(v29) = 0;
      if( v28 )
      {
        do
        {
          *v28 = 0;
          RtlInitUnicodeString(&DestinationString, v25, v27);
          if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
            ++v24;
          v25 = v28 + 1;
          v29 = wcspbrk(v28 + 1, (PWCHAR)L";", v30);
          v28 = v29;
        }
        while( v29 );
        v1 = a1;
      }
      if( *v25 != (_WORD)v29 )
      {
        RtlInitUnicodeString(&DestinationString, v25, v27);
        if( RtlCultureNameToLCID(&DestinationString, &Lcid) )
          ++v24;
      }
      if( !v24 )
        ExFreeHeapPool(v5);
      v39 = v24 != 0 ? v40 : 0;
      v5 = (UINT8 *)((unsigned __int64)v44 & -(__int64)(v24 != 0));
      if( Src )
        ExFreeHeapPool(Src);
      v4 = v35;
      Src = 0i64;
      goto LABEL_54;
    }
    v39 = 0;
LABEL_65:
    v31 = -1073741801;
    goto LABEL_55;
  }
LABEL_54:
  v31 = 0;
LABEL_55:
  if( Src )
    ExFreeHeapPool(Src);
  if( v2 && v3 )
  {
    ExFreeHeapPool(v3);
    v3 = 0i64;
    v4 = 0;
  }
LABEL_58:
  *(_DWORD *)v1 |= 0x800u;
  *(_DWORD *)(v1 + 116) = v41;
  *(_DWORD *)(v1 + 120) = v42;
  *(_DWORD *)(v1 + 148) = v37;
  *(_DWORD *)(v1 + 144) = v39;
  result = v31;
  *(_QWORD *)(v1 + 128) = v2;
  *(_QWORD *)(v1 + 152) = v3;
  *(_DWORD *)(v1 + 160) = v4;
  *(_QWORD *)(v1 + 136) = v5;
  return result;
}

Referenced by:

RtlpMuiRegLoadRegistryInfo