AdtpBuildUserAccountControlString

NTSTATUS __stdcall AdtpBuildUserAccountControlString(
        UINT64 UserAccountControlOld,
        UINT64 UserAccountControlNew,
        UNICODE_STRING *ResultantString1,
        UINT8 *FreeWhenDone1,
        UNICODE_STRING *ResultantString2,
        UINT8 *FreeWhenDone2,
        UNICODE_STRING *ResultantString3,
        UINT8 *FreeWhenDone3){
  NTSTATUS v8; 
  unsigned int v9; 
  int v12; 
  wchar_t *PoolWithTag; 
  wchar_t *v14; 
  ULONG v15; 
  WCHAR v16; 
  int v17; 
  int v18; 
  int v19; 
  unsigned __int16 v20; 
  wchar_t *v21; 
  unsigned int v22; 
  int v23; 
  struct _UNICODE_STRING String; 
  ULONG Value; 
  UINT8 *v27; 
  UINT8 *v28; 
  char v29; 
  v8 = 0;
  v9 = UserAccountControlOld;
  *FreeWhenDone1 = 0;
  v12 = 0;
  v28 = FreeWhenDone3;
  *FreeWhenDone2 = 0;
  *FreeWhenDone3 = 0;
  *(_DWORD *)&ResultantString1->Length = 1441792;
  Value = UserAccountControlNew;
  v27 = FreeWhenDone2;
  String.Buffer = (wchar_t *)&v29;
  *(_QWORD *)&String.Length = 1310720i64;
  PoolWithTag = (wchar_t *)ExAllocatePoolWithTag(PagedPool, 0x16ui64, 0x6B416553ui64);
  ResultantString1->Buffer = PoolWithTag;
  if( !PoolWithTag )
    return -1073741801;
  *FreeWhenDone1 = 1;
  *(_DWORD *)&ResultantString2->Length = 1441792;
  v14 = (wchar_t *)ExAllocatePoolWithTag(PagedPool, 0x16ui64, 0x6B416553ui64);
  ResultantString2->Buffer = v14;
  if( !v14 )
    return -1073741801;
  *v27 = 1;
  RtlAppendUnicodeToString(ResultantString1, (PWCHAR)L"0x");
  RtlIntegerToUnicodeString(v9, 0x10ui64, &String);
  RtlAppendUnicodeStringToString(ResultantString1, &String);
  RtlAppendUnicodeToString(ResultantString2, (PWCHAR)L"0x");
  v15 = Value;
  RtlIntegerToUnicodeString(Value, 0x10ui64, &String);
  RtlAppendUnicodeStringToString(ResultantString2, &String);
  v17 = v15 ^ v9;
  if( !v17 )
  {
    RtlInitUnicodeString(ResultantString3, L"-", v16);
    return v8;
  }
  v18 = 1;
  do
  {
    v19 = v12++;
    if( (v18 & v17) == 0 )
      v12 = v19;
    v18 *= 2;
  }
  while( v18 );
  v20 = 32 * v12 + 2;
  ResultantString3->Length = 0;
  ResultantString3->MaximumLength = v20;
  v21 = (wchar_t *)ExAllocatePoolWithTag(PagedPool, v20, 0x6B416553ui64);
  ResultantString3->Buffer = v21;
  if( !v21 )
    return -1073741801;
  v22 = 0;
  v23 = 1;
  *v28 = 1;
  do
  {
    if( !v23 )
      break;
    if( (v23 & v17) != 0 && RtlIntegerToUnicodeString(v22 + ((v15 & v23) != 0 ? 2080 : 2048), 0xAui64, &String) >= 0 )
    {
      RtlAppendUnicodeToString(ResultantString3, (PWCHAR)L"\r\n\t\t%%");
      RtlAppendUnicodeStringToString(ResultantString3, &String);
    }
    ++v22;
    v23 *= 2;
  }
  while( v22 < 0x20 );
  return v8;
}

Referenced by:

AdtpPackageParameters