# CVE-2026-62712 — win32kfull.sys patch diff

`win32kfull.sys` 10.0.26100.8875 -> 10.0.26100.9168 (ghidriff).

## `xxxSetWindowLongPtr`  (modified)

```diff
--- xxxSetWindowLongPtr
+++ xxxSetWindowLongPtr
@@ -1,137 +1,196 @@
 

-/* WARNING: Variable defined which should be unmapped: param_5 */

+/* unsigned __int64 __cdecl xxxSetWindowLongPtr(struct tagWND * __ptr64,int,unsigned

+   __int64,int,int) */

 

 __uint64 __cdecl

 xxxSetWindowLongPtr(tagWND *param_1,int param_2,__uint64 param_3,int param_4,int param_5)

 

 {

-  longlong lVar1;

-  uint *puVar2;

-  tagTHREADINFO *ptVar3;

-  tagQ *ptVar4;

-  int iVar5;

-  char *in_RAX;

-  longlong lVar6;

-  __uint64 extraout_RAX;

-  __uint64 _Var7;

-  __uint64 extraout_RAX_00;

-  uint uVar8;

-  undefined4 uVar9;

-  longlong unaff_RBX;

-  int unaff_EBP;

-  tagMENU *unaff_RSI;

-  longlong unaff_R12;

-  longlong unaff_R13;

-  longlong *unaff_R14;

-  int unaff_R15D;

-  undefined8 in_stack_00000020;

-  undefined4 uVar10;

-  uint uStack0000000000000030;

-  uint uStack0000000000000038;

-  undefined4 uStack0000000000000040;

-  AtomicExecutionCheck in_stack_00000050;

-  undefined4 uStack00000000000000a0;

+  tagWND *ptVar1;

+  ushort uVar2;

+  ulonglong uVar3;

+  char cVar4;

+  bool bVar5;

+  longlong *plVar6;

+  __uint64 *p_Var7;

+  longlong lVar8;

+  longlong lVar9;

+  __uint64 _Var10;

+  int iVar11;

+  undefined8 uVar12;

+  uint *puVar13;

+  uint uVar14;

+  ulonglong uVar16;

+  undefined1 uVar17;

+  ulonglong uVar15;

   

-  uVar10 = (undefined4)((ulonglong)in_stack_00000020 >> 0x20);

-  *in_RAX = *in_RAX + (char)in_RAX;

-  HMAssignmentUnlock();

-  InputTraceLogging::Mouse::SetCapture((tagQ *)*unaff_R14,(tagWND *)0x0,SUB41(unaff_R15D,0));

-  lVar1 = *unaff_R14;

-  if (lVar1 != 0) {

-    lVar6 = *(longlong *)(unaff_R13 + 0x1f0);

-    if ((((*(uint *)(lVar6 + 0x30) & 0xc0) != 0) && (*(int *)(lVar6 + 200) == unaff_R15D)) &&

-       (((*(longlong *)(lVar6 + 0xc0) == unaff_RBX && (unaff_EBP != 2)) ||

-        ((*(longlong *)(lVar6 + 0xc0) == *(longlong *)(lVar1 + 0x80) &&

-         (*(int *)(lVar1 + 0xac) != 2)))))) {

-      in_stack_00000050 = SUB81(unaff_R12,0);

-      AtomicExecutionCheck::Arm(&stack0x00000050);

-      xxxCancelMouseMoveTracking

-                (*(undefined4 *)(lVar6 + 0x30),*(undefined8 *)(lVar6 + 0xc0),

-                 *(undefined4 *)(lVar6 + 200));

-      AtomicExecutionCheck::Disarm(&stack0x00000050);

+  uVar15 = 0;

+  bVar5 = false;

+  uVar17 = 0;

+  cVar4 = CanSetWindowLong();

+  if (cVar4 == '\0') {

+LAB_0:

+    UserSetLastError(5);

+    return 0;

+  }

+  if ((-1 < param_2) &&

+     ((ulonglong)*(uint *)(*(longlong *)(param_1 + 0x28) + 0xf8) < (longlong)param_2 + 8U)) {

+    plVar6 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar16 = 0;

+    if (plVar6 != (longlong *)0x0) {

+      uVar16 = (ulonglong)plVar6 & -(ulonglong)(*plVar6 != 0);

     }

-    unaff_RSI = (tagMENU *)LockCaptureWindow(lVar1);

-    *(int *)(lVar1 + 0xac) = unaff_EBP;

-    if (unaff_RBX != 0) {

-      lVar6 = *(longlong *)(unaff_RBX + 0x10);

-      iVar5 = IsMiPEnabledForThread(lVar6);

-      if (((iVar5 != 0) && (iVar5 = IsMiPEnabledForWindow(), iVar5 == 0)) &&

-         (puVar2 = *(uint **)(lVar6 + 0x600), puVar2 != (uint *)0x0)) {

-        uVar8 = *puVar2;

-        if ((((uVar8 & 4) == 0) && ((uVar8 & 2) == 0)) &&

-           (((uVar8 & 0x10) == 0 && ((byte)(SUB41(unaff_R15D,0) & (byte)uVar8) != 0)))) {

-          if (((uVar8 & 0x20) == 0) && ((puVar2[9] & 0x1f0) == 0)) {

-            uVar8 = uVar8 | 2;

+    uVar3 = *(ulonglong *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+    if (uVar3 != uVar16) {

+      plVar6 = (longlong *)PsGetCurrentProcessWin32Process(-uVar3);

+      uVar16 = 0;

+      if (plVar6 != (longlong *)0x0) {

+        uVar16 = (ulonglong)plVar6 & -(ulonglong)(*plVar6 != 0);

+      }

+      bVar5 = UIPrivilegeIsolation::CheckAccess

+                        ((tagUIPI_INFO *)(-(ulonglong)(uVar16 != 0) & uVar16 + 0x130),

+                         (tagUIPI_INFO *)(-(ulonglong)(uVar3 != 0) & uVar3 + 0x130),0);

+      if (!bVar5) {

+        plVar6 = (longlong *)PsGetCurrentProcessWin32Process();

+        uVar16 = 0;

+        if (plVar6 != (longlong *)0x0) {

+          uVar16 = (ulonglong)plVar6 & -(ulonglong)(*plVar6 != 0);

+        }

+        if (-1 < *(int *)(uVar16 + 0xc)) goto LAB_0;

+      }

+      KeAttachProcess(**(undefined8 **)(*(longlong *)(param_1 + 0x10) + 0x1d0));

+      bVar5 = true;

+      uVar17 = 1;

+    }

+  }

+  ptVar1 = param_1 + 0x28;

+  if ((*(ushort *)(*(longlong *)ptVar1 + 0x2a) & 0x2fff) == 0) {

+LAB_1:

+    if (param_2 < 0) {

+LAB_2:

+      _Var10 = xxxSetWindowData(param_1,param_2,param_3,param_4,uVar17);

+LAB_3:

+      if (bVar5) {

+        KeDetachProcess();

+        return _Var10;

+      }

+      return _Var10;

+    }

+LAB_4:

+    if ((ulonglong)(uint)param_2 + 8 <=

+        (ulonglong)

+        (uint)(*(int *)(*(longlong *)ptVar1 + 200) + *(int *)(*(longlong *)ptVar1 + 0xf8))) {

+      if ((param_5 != 0) &&

+         ((*(ushort *)(*(longlong *)(*(longlong *)(param_1 + 0x88) + 8) + 6) >> 8 & 1) != 0)) {

+        puVar13 = &gDefaultServerClasses;

+        do {

+          lVar9 = W32GetUserSessionState();

+          if (**(short **)(*(longlong *)(param_1 + 0x88) + 8) ==

+              *(short *)(*(longlong *)(lVar9 + 0x4e30) + 0x364 +

+                        (ulonglong)(*puVar13 >> 3 & 0x1f) * 2)) {

+            if (param_2 < *(int *)(&DAT_5 + uVar15 * 0x30)) {

+              if (((byte)*puVar13 & 0xf8) == 0xb0) {

+                MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x241);

+              }

+              uVar12 = 5;

+              goto LAB_6;

+            }

+            break;

           }

-          else {

-            uVar8 = uVar8 | 4;

+          uVar14 = (int)uVar15 + 1;

+          uVar15 = (ulonglong)uVar14;

+          puVar13 = puVar13 + 0xc;

+        } while (uVar14 < 5);

+      }

+      uVar14 = *(uint *)(*(longlong *)(param_1 + 0x28) + 0xf8);

+      lVar9 = (longlong)param_2;

+      if ((ulonglong)uVar14 < lVar9 + 8U) {

+        p_Var7 = (__uint64 *)

+                 ((longlong)(int)(param_2 - uVar14) +

+                 *(longlong *)(*(longlong *)(param_1 + 0x28) + 0x128));

+        _Var10 = *p_Var7;

+        *p_Var7 = param_3;

+      }

+      else {

+        _Var10 = *(__uint64 *)(lVar9 + *(longlong *)(param_1 + 0x118));

+        *(__uint64 *)(lVar9 + *(longlong *)(param_1 + 0x118)) = param_3;

+      }

+      goto LAB_3;

+    }

+  }

+  else {

+    p_Var7 = (__uint64 *)safe_cast_wf_to_PDIALOG(param_1);

+    if (p_Var7 != (__uint64 *)0x0) {

+      if (param_2 == 0) {

+        _Var10 = *p_Var7;

+        *p_Var7 = param_3;

+        goto LAB_3;

+      }

+      if (param_2 == 0x10) {

+        iVar11 = *(int *)(*(longlong *)ptVar1 + 0xf8);

+        if ((iVar11 == 0) && (0x1d < *(int *)(*(longlong *)ptVar1 + 200))) {

+          _Var10 = p_Var7[2];

+          p_Var7[2] = param_3;

+        }

+        else {

+          _Var10 = 0;

+          if (iVar11 != 0) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x1d9);

           }

-          *puVar2 = uVar8;

-          **(uint **)(lVar6 + 0x600) = **(uint **)(lVar6 + 0x600) & 0xffffffef;

+          if (*(int *)(*(longlong *)ptVar1 + 200) < 0x1e) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x1da);

+          }

         }

+        goto LAB_3;

+      }

+      if ((uint)param_2 < 0x1e) {

+        uVar12 = 0x587;

+        goto LAB_6;

+      }

+      goto LAB_1;

+    }

+    if (param_2 < 0) goto LAB_2;

+    lVar9 = W32GetUserSessionState();

+    lVar9 = *(longlong *)(lVar9 + 0x4e30);

+    uVar2 = *(ushort *)(*(longlong *)ptVar1 + 0x2a);

+    lVar8 = W32GetUserSessionState();

+    if ((int)((uint)*(ushort *)(lVar9 + 0x148 + (ulonglong)((uVar2 & 0xffff2fff) - 0x29a) * 2) -

+             (uint)*(ushort *)(lVar8 + 0x1171c)) <= param_2) goto LAB_1;

+    lVar9 = *(longlong *)ptVar1;

+    uVar14 = *(ushort *)(lVar9 + 0x2a) & 0xffff2fff;

+    if (0x2a6 < uVar14) {

+      iVar11 = uVar14 - 0x2a7;

+      if (iVar11 != 0) goto LAB_7;

+      if (param_2 != 8) goto LAB_8;

+      lVar9 = **(longlong **)(lVar9 + 0x128);

+LAB_9:

+      if ((lVar9 != 0) && (-1 < *(char *)(*(longlong *)ptVar1 + 0x13))) goto LAB_8;

+      goto LAB_4;

+    }

+    if (((uVar14 == 0x2a6) || (uVar14 == 0x2a1)) || (iVar11 = uVar14 - 0x2a2, iVar11 == 0)) {

+LAB_10:

+      if (param_2 == 0) {

+        if (*(int *)(lVar9 + 0xf8) == 0) {

+          lVar9 = **(longlong **)(lVar9 + 0x128);

+        }

+        else {

+          lVar9 = **(longlong **)(param_1 + 0x118);

+        }

+        goto LAB_9;

       }

     }

+    else {

+LAB_7:

+      if (((iVar11 == 1) || (iVar11 == 2)) || (iVar11 == 3)) goto LAB_10;

+    }

   }

-  lVar6 = W32GetUserSessionState();

-  *(int *)(lVar6 + 0x114d8) = *(int *)(lVar6 + 0x114d8) + unaff_R15D;

-  uVar8 = (uint)unaff_R12;

-  if (unaff_RBX == 0) {

-    if (unaff_RSI == (tagMENU *)0x0) goto LAB_0;

-    ptVar3 = *(tagTHREADINFO **)(unaff_RSI + 0x10);

-    if ((*(ulonglong *)(ptVar3 + 0x2b0) >> 0x3c & 1) != 0) {

-      ptVar4 = *(tagQ **)(ptVar3 + 0x1d8);

-      *(uint *)(ptVar4 + 0x214) = *(uint *)(ptVar4 + 0x214) | 0x20;

-      iVar5 = Feature_ConsistentPendingMouse2__private_IsEnabledDeviceUsageNoInline();

-      if (iVar5 == 0) {

-        SetSystemInputSource(ptVar4 + 0x22c);

-      }

-      else {

-        SetSystemPendingMouseMoveData(ptVar4);

-      }

-      WakeSomeone(ptVar4,ptVar3,0x200,(tagQMSG *)0x0);

-    }

-    GenerateMouseMove(0);

-LAB_1:

-    lVar6 = W32GetUserSessionState();

-    uVar9 = 3;

-    if (*(uint *)(lVar6 + 0x114d8) <= uVar8) {

-      uVar9 = 1;

-    }

-    xxxWindowEvent(9,unaff_RSI,0,0,CONCAT44(uVar10,uVar9));

-    if (unaff_RBX != 0) goto LAB_2;

+LAB_8:

+  uVar12 = 0x585;

+LAB_6:

+  UserSetLastError(uVar12);

+  if (bVar5) {

+    KeDetachProcess();

   }

-  else {

-    if (unaff_RSI != (tagMENU *)0x0) goto LAB_1;

-LAB_2:

-    W32GetUserSessionState();

-    xxxWindowEvent(8);

-  }

-  if ((unaff_RSI != (tagMENU *)0x0) &&

-     ((short)unaff_R12 <= *(short *)(*(longlong *)(unaff_RSI + 0x28) + 0x2a))) {

-    if ((*(longlong *)(unaff_R13 + 0x288) != unaff_R12) && (unaff_RBX != 0)) {

-      *(uint *)(lVar1 + 0x214) = *(uint *)(lVar1 + 0x214) | 0x100000;

-    }

-    Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

-              ((Win32HMThreadLockBase<tagMENU,0,0> *)&stack0x00000050,unaff_RSI);

-    zzzEndDeferWinEventNotify();

-    uStack0000000000000040 = 1;

-    uStack0000000000000030 = uVar8;

-    uStack0000000000000038 = uVar8;

-    xxxSendMessageCallback(unaff_RSI,0x215,0);

-    Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

-              ((Win32HMThreadLockBase<tagWND,0,0> *)&stack0x00000050);

-    lVar1 = *(longlong *)(unaff_R13 + 0x1d8);

-    _Var7 = extraout_RAX;

-    if (lVar1 == 0) {

-      uStack00000000000000a0 = 0x20000;

-      _Var7 = MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x16d);

-    }

-    puVar2 = (uint *)(lVar1 + 0x214);

-    *puVar2 = *puVar2 & 0xffefffff;

-    return _Var7;

-  }

-LAB_0:

-  zzzEndDeferWinEventNotify();

-  return extraout_RAX_00;

+  return 0;

 }
```

## `NtUserSetUserObjectCapability`  (modified)

```diff
--- NtUserSetUserObjectCapability
+++ NtUserSetUserObjectCapability
@@ -1,108 +1,57 @@
 

-undefined8

-NtUserSetUserObjectCapability

-          (tagWND *param_1,undefined4 param_2,undefined8 param_3,undefined8 *param_4,

-          undefined8 param_5,undefined8 param_6,byte param_7,longlong param_8)

+bool NtUserSetUserObjectCapability(void *param_1,ulong param_2,undefined8 param_3,int param_4)

 

 {

-  undefined8 uVar1;

-  longlong lVar2;

-  undefined8 uVar3;

-  undefined8 uVar4;

-  int iVar5;

-  tagTHREADINFO *ptVar6;

-  undefined8 uVar7;

-  longlong lVar8;

-  longlong local_res8;

-  int local_res10 [2];

-  LeaveEnterUserCritIfAcquired local_res18 [8];

-  undefined4 uStack_b0;

-  undefined4 uStack_ac;

-  undefined4 uStack_a8;

-  undefined4 uStack_a4;

-  Win32HMThreadLockBase<tagWND,1,0> aWStack_98 [16];

-  longlong lStack_88;

-  undefined4 uStack_80;

-  undefined4 uStack_7c;

-  undefined8 uStack_78;

-  undefined8 uStack_70;

-  undefined8 uStack_68;

-  undefined8 uStack_60;

-  undefined8 uStack_58;

+  undefined1 uVar1;

+  bool bVar2;

+  int iVar3;

+  longlong lVar4;

+  longlong lVar5;

+  longlong *plVar6;

+  longlong *plVar7;

+  void *local_38;

+  AtomicExecutionCheck local_30 [8];

+  undefined8 local_28;

   

-  local_res8 = 0;

-  local_res10[0] = 0;

-  ptVar6 = PtiCurrent();

-  if (param_1 == (tagWND *)0x0) {

-    lVar8 = 0;

+                    /* 0x23d290  2032  NtUserSetUserObjectCapability */

+  EnterCrit(0,0);

+  bVar2 = false;

+  local_30[0] = (AtomicExecutionCheck)0x0;

+  local_28 = 0;

+  AtomicExecutionCheck::Arm(local_30);

+  local_38 = (void *)0x0;

+  uVar1 = ExGetPreviousMode();

+  iVar3 = UserCaptureSid(param_3,uVar1,&local_38);

+  if (iVar3 < 0) goto LAB_0;

+  lVar4 = HMValidateHandleNoSecure(param_1,0xff);

+  if (lVar4 == 0) {

+LAB_1:

+    Win32FreePool(local_38);

   }

   else {

-    lVar8 = *(longlong *)(param_1 + 0x28) - *(longlong *)(ptVar6 + 0x200);

+    lVar5 = _HMPheFromObject(lVar4);

+    lVar4 = _HMPkheFromObject(lVar4);

+    plVar6 = (longlong *)PsGetCurrentProcessWin32Process();

+    if ((plVar6 != (longlong *)0x0) && (*plVar6 != 0)) {

+      if ((*(ushort *)(gahti_exref + (ulonglong)*(byte *)(lVar5 + 0x18) * 0x18 + 0xc) & 2) == 0) {

+        if (((*(ushort *)(gahti_exref + (ulonglong)*(byte *)(lVar5 + 0x18) * 0x18 + 0xc) & 1) == 0)

+           || (*(longlong *)(lVar4 + 8) == 0)) goto LAB_2;

+        plVar7 = *(longlong **)(*(longlong *)(lVar4 + 8) + 0x1d0);

+      }

+      else {

+        plVar7 = *(longlong **)(lVar4 + 8);

+      }

+      if (plVar7 == plVar6) {

+        bVar2 = UserSetUserObjectCapability(param_1,param_2,local_38,param_4 != 0);

+        goto LAB_1;

+      }

+    }

+LAB_2:

+    UserSetLastError(5);

   }

-  uStack_7c = 0;

-  uStack_70 = *param_4;

-  uStack_68 = param_5;

-  uStack_60 = param_6;

-  lStack_88 = lVar8;

-  uStack_80 = param_2;

-  uStack_78 = param_3;

-  Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>(aWStack_98,param_1);

-  lVar2 = *(longlong *)(ptVar6 + 0x208);

-  uVar3 = *(undefined8 *)(lVar2 + 0x40);

-  uVar4 = *(undefined8 *)(lVar2 + 0x48);

-  uVar1 = *(undefined8 *)(lVar2 + 0x50);

-  *(longlong *)(*(longlong *)(ptVar6 + 0x208) + 0x48) = lVar8;

-  if (param_1 == (tagWND *)0x0) {

-    uVar7 = 0;

-  }

-  else {

-    uVar7 = *(undefined8 *)param_1;

-  }

-  *(undefined8 *)(*(longlong *)(ptVar6 + 0x208) + 0x40) = uVar7;

-  if (param_1 == (tagWND *)0x0) {

-    uVar7 = 0;

-  }

-  else {

-    uVar7 = *(undefined8 *)(*(longlong *)(param_1 + 0x28) + 0xe0);

-  }

-  *(undefined8 *)(*(longlong *)(ptVar6 + 0x208) + 0x50) = uVar7;

-  LeaveEnterUserCritIfAcquired::LeaveEnterUserCritIfAcquired(local_res18);

-  EtwTraceBeginCallback(0x7e);

-  iVar5 = KeUserModeCallback(0x7e,&lStack_88,0x30,&local_res8,local_res10);

-  EtwTraceEndCallback(0x7e);

-  LeaveEnterUserCritIfAcquired::~LeaveEnterUserCritIfAcquired(local_res18);

-  Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>(aWStack_98);

-  lVar8 = *(longlong *)(ptVar6 + 0x208);

-  uStack_b0 = (undefined4)uVar3;

-  uStack_ac = (undefined4)((ulonglong)uVar3 >> 0x20);

-  uStack_a8 = (undefined4)uVar4;

-  uStack_a4 = (undefined4)((ulonglong)uVar4 >> 0x20);

-  *(undefined4 *)(lVar8 + 0x40) = uStack_b0;

-  *(undefined4 *)(lVar8 + 0x44) = uStack_ac;

-  *(undefined4 *)(lVar8 + 0x48) = uStack_a8;

-  *(undefined4 *)(lVar8 + 0x4c) = uStack_a4;

-  *(undefined8 *)(lVar8 + 0x50) = uVar1;

-  if ((-1 < iVar5) && (local_res10[0] == 0x18)) {

-    param_5 = 0;

-    RtlCopyFromUser(&param_5,local_res8,8);

-    uVar1 = param_5;

-    uStack_58 = param_5;

-    if ((param_8 != 0) && ((*(uint *)(param_8 + 0x54) & 5) != 0)) {

-      return param_5;

-    }

-    if ((param_7 & 2) != 0) {

-      return param_5;

-    }

-    ptVar6 = PtiCurrent();

-    lVar8 = *(longlong *)(ptVar6 + 0x228);

-    if (((lVar8 == 0) || ((*(uint *)(lVar8 + 0x54) & 1) == 0)) ||

-       (*(undefined8 **)(lVar8 + 0x60) != param_4)) {

-      param_6 = 0;

-      RtlCopyFromUser(&param_6,*(undefined8 *)(local_res8 + 0x10),8);

-      *param_4 = param_6;

-      return uVar1;

-    }

-  }

-  return 0;

+LAB_0:

+  AtomicExecutionCheck::Disarm(local_30);

+  UserSessionSwitchLeaveCrit();

+  return bVar2;

 }
```

## `xxxSetWindowWord`  (modified)

```diff
--- xxxSetWindowWord
+++ xxxSetWindowWord
@@ -1,10 +1,192 @@
+

+/* unsigned short __cdecl xxxSetWindowWord(struct tagWND * __ptr64,int,unsigned short) */

 

 ushort __cdecl xxxSetWindowWord(tagWND *param_1,int param_2,ushort param_3)

 

 {

-  undefined2 in_AX;

-  undefined1 in_ZF;

+  ulonglong uVar1;

+  char cVar2;

+  bool bVar3;

+  ushort uVar4;

+  longlong *plVar5;

+  longlong lVar6;

+  undefined8 uVar7;

+  longlong lVar8;

+  undefined4 *puVar9;

+  uint *puVar10;

+  uint uVar11;

+  ulonglong uVar12;

+  ulonglong uVar13;

   

-  return CONCAT11((char)((ushort)in_AX >> 8),in_ZF);

+  uVar13 = (ulonglong)param_2;

+  bVar3 = false;

+  cVar2 = CanSetWindowLong();

+  if (cVar2 == '\0') {

+LAB_0:

+    uVar7 = 5;

+LAB_1:

+    UserSetLastError(uVar7);

+    return 0;

+  }

+  lVar6 = *(longlong *)(param_1 + 0x28);

+  if ((*(byte *)(lVar6 + 0x12) & 1) == 0) {

+LAB_2:

+    if (param_2 == -0x15) {

+      uVar4 = *(ushort *)(lVar6 + 0xd8);

+      *(longlong *)(lVar6 + 0xd8) =

+           (longlong)CONCAT22((short)((uint)*(undefined4 *)(lVar6 + 0xd8) >> 0x10),param_3);

+      return uVar4;

+    }

+    if (param_2 == -0x10) {

+      uVar4 = *(ushort *)(lVar6 + 0x1c);

+      *(uint *)(lVar6 + 0x1c) = *(uint *)(lVar6 + 0x1c) & 0xffff0000 | (uint)param_3;

+      return uVar4;

+    }

+    if ((-1 < param_2) && ((ulonglong)*(uint *)(lVar6 + 0xf8) < uVar13 + 2)) {

+      plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

+      uVar12 = 0;

+      if (plVar5 != (longlong *)0x0) {

+        uVar12 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

+      }

+      uVar1 = *(ulonglong *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+      if (uVar1 != uVar12) {

+        plVar5 = (longlong *)PsGetCurrentProcessWin32Process(-uVar1);

+        uVar12 = 0;

+        if (plVar5 != (longlong *)0x0) {

+          uVar12 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

+        }

+        bVar3 = UIPrivilegeIsolation::CheckAccess

+                          ((tagUIPI_INFO *)(-(ulonglong)(uVar12 != 0) & uVar12 + 0x130),

+                           (tagUIPI_INFO *)(-(ulonglong)(uVar1 != 0) & uVar1 + 0x130),0);

+        if (!bVar3) {

+          plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

+          uVar12 = 0;

+          if (plVar5 != (longlong *)0x0) {

+            uVar12 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

+          }

+          if (-1 < *(int *)(uVar12 + 0xc)) goto LAB_0;

+        }

+        KeAttachProcess(**(undefined8 **)(*(longlong *)(param_1 + 0x10) + 0x1d0));

+        bVar3 = true;

+      }

+    }

+    if ((*(ushort *)(*(longlong *)(param_1 + 0x28) + 0x2a) & 0x2fff) != 0) {

+      if (param_2 < 0) goto LAB_3;

+      lVar6 = W32GetUserSessionState();

+      lVar6 = *(longlong *)(lVar6 + 0x4e30);

+      uVar4 = *(ushort *)(*(longlong *)(param_1 + 0x28) + 0x2a);

+      lVar8 = W32GetUserSessionState();

+      if (param_2 < (int)((uint)*(ushort *)

+                                 (lVar6 + 0x148 + (ulonglong)((uVar4 & 0xffff2fff) - 0x29a) * 2) -

+                         (uint)*(ushort *)(lVar8 + 0x1171c))) {

+        uVar4 = *(ushort *)(*(longlong *)(param_1 + 0x28) + 0x2a) & 0x2fff;

+        if (uVar4 == 0x2a1) {

+          if (param_2 != 0) goto LAB_3;

+          lVar6 = **(longlong **)(*(longlong *)(param_1 + 0x28) + 0x128);

+          if ((lVar6 == 0) || (lVar6 == -1)) {

+            if (bVar3) {

+              KeDetachProcess();

+            }

+            return 0;

+          }

+          puVar9 = (undefined4 *)(lVar6 + 8);

+          if (*(undefined4 **)MmUserProbeAddress_exref <= (undefined4 *)(lVar6 + 8)) {

+            puVar9 = *(undefined4 **)MmUserProbeAddress_exref;

+          }

+          uVar4 = (ushort)*puVar9;

+          *(uint *)(lVar6 + 8) = (uint)param_3;

+          goto LAB_4;

+        }

+        if ((uVar4 != 0x2a7) || (param_2 != 0)) goto LAB_3;

+      }

+    }

+  }

+  else {

+    if (((7 < uVar13) && (param_2 < 0)) || ((0x16 < uVar13 && (param_2 < 0x1e)))) {

+      uVar7 = 0x585;

+      goto LAB_1;

+    }

+    if ((*(ushort *)(lVar6 + 0x2a) & 0x2fff) != 0x2a4) goto LAB_2;

+    if (param_2 < 0) goto LAB_3;

+    if ((ulonglong)*(uint *)(lVar6 + 0xf8) < uVar13 + 2) {

+      plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

+      uVar12 = 0;

+      if (plVar5 != (longlong *)0x0) {

+        uVar12 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

+      }

+      uVar1 = *(ulonglong *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+      if (uVar1 != uVar12) {

+        plVar5 = (longlong *)PsGetCurrentProcessWin32Process(-uVar1);

+        uVar12 = 0;

+        if (plVar5 != (longlong *)0x0) {

+          uVar12 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

+        }

+        bVar3 = UIPrivilegeIsolation::CheckAccess

+                          ((tagUIPI_INFO *)(-(ulonglong)(uVar12 != 0) & uVar12 + 0x130),

+                           (tagUIPI_INFO *)(-(ulonglong)(uVar1 != 0) & uVar1 + 0x130),0);

+        if (!bVar3) {

+          plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

+          uVar12 = 0;

+          if (plVar5 != (longlong *)0x0) {

+            uVar12 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

+          }

+          if (-1 < *(int *)(uVar12 + 0xc)) goto LAB_0;

+        }

+        KeAttachProcess(**(undefined8 **)(*(longlong *)(param_1 + 0x10) + 0x1d0));

+        bVar3 = true;

+      }

+    }

+  }

+  if ((param_2 < 0) ||

+     ((ulonglong)

+      (uint)(*(int *)(*(longlong *)(param_1 + 0x28) + 200) +

+            *(int *)(*(longlong *)(param_1 + 0x28) + 0xf8)) < (ulonglong)(uint)param_2 + 2)) {

+LAB_3:

+    uVar7 = 0x585;

+LAB_5:

+    UserSetLastError(uVar7);

+    if (bVar3) {

+      KeDetachProcess();

+    }

+    return 0;

+  }

+  if ((*(ushort *)(*(longlong *)(*(longlong *)(param_1 + 0x88) + 8) + 6) >> 8 & 1) != 0) {

+    uVar11 = 0;

+    puVar10 = &gDefaultServerClasses;

+    do {

+      lVar6 = W32GetUserSessionState();

+      if (**(short **)(*(longlong *)(param_1 + 0x88) + 8) ==

+          *(short *)(*(longlong *)(lVar6 + 0x4e30) + 0x364 + (ulonglong)(*puVar10 >> 3 & 0x1f) * 2))

+      {

+        if (param_2 < *(int *)(&DAT_6 + (ulonglong)uVar11 * 0x30)) {

+          if (((byte)*puVar10 & 0xf8) == 0xb0) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x172);

+          }

+          uVar7 = 5;

+          goto LAB_5;

+        }

+        break;

+      }

+      uVar11 = uVar11 + 1;

+      puVar10 = puVar10 + 0xc;

+    } while (uVar11 < 5);

+  }

+  uVar11 = *(uint *)(*(longlong *)(param_1 + 0x28) + 0xf8);

+  if ((ulonglong)uVar11 < uVar13 + 2) {

+    lVar6 = *(longlong *)(*(longlong *)(param_1 + 0x28) + 0x128);

+    lVar8 = (longlong)(int)(param_2 - uVar11);

+    uVar4 = *(ushort *)(lVar8 + lVar6);

+    *(ushort *)(lVar8 + lVar6) = param_3;

+  }

+  else {

+    uVar4 = *(ushort *)(uVar13 + *(longlong *)(param_1 + 0x118));

+    *(ushort *)(uVar13 + *(longlong *)(param_1 + 0x118)) = param_3;

+  }

+LAB_4:

+  if (bVar3) {

+    KeDetachProcess();

+    return uVar4;

+  }

+  return uVar4;

 }
```

## `NtUserSetCalibrationData`  (modified)

```diff
--- NtUserSetCalibrationData
+++ NtUserSetCalibrationData
@@ -1,17 +1,136 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-longlong NtUserSetCalibrationData(void)

+longlong NtUserSetCalibrationData(longlong param_1,uint param_2,void *param_3,int param_4)

 

 {

-  longlong in_RAX;

-  int unaff_EBX;

-  AtomicExecutionCheck aAStackX_20 [8];

+  bool bVar1;

+  int iVar2;

+  tagTHREADINFO *ptVar3;

+  longlong lVar4;

+  longlong lVar5;

+  undefined8 uVar6;

+  ulonglong _Size;

+  undefined1 auStack_98 [32];

+  void *local_78;

+  void *local_70;

+  AtomicExecutionCheck local_60 [16];

+  undefined4 local_50;

+  undefined4 local_4c;

+  undefined4 local_48;

+  undefined4 local_40;

+  undefined4 local_3c;

+  undefined4 local_38;

+  ulonglong local_30;

   

-  EtwTraceUIPISystemError(*(undefined8 *)(in_RAX + 0x1d0),0,10);

-  UserSetLastError(5);

-  AtomicExecutionCheck::Disarm(aAStackX_20);

+                    /* 0x295ec0  1953  NtUserSetCalibrationData */

+  local_30 = __security_cookie ^ (ulonglong)auStack_98;

+  _Size = (ulonglong)param_2;

+  local_70 = (void *)0x0;

+  local_78 = param_3;

+  EnterCrit(0,0);

+  AtomicExecutionCheck::AtomicExecutionCheck(local_60);

+  if ((param_1 == 0) || (2 < param_4 - 1U)) {

+LAB_0:

+    uVar6 = 0x57;

+  }

+  else {

+    if (param_2 != 0) {

+      if (local_78 != (void *)0x0) {

+        if (param_2 == 0) goto LAB_1;

+        goto LAB_2;

+      }

+      goto LAB_0;

+    }

+LAB_1:

+    if ((local_78 != (void *)0x0) || ((param_2 == 0 && (param_4 == 1)))) goto LAB_0;

+LAB_2:

+    if (param_4 == 3) {

+LAB_3:

+      iVar2 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+      if (iVar2 == 0) {

+        local_40 = 0x2000;

+        local_3c = 0xffffffff;

+        local_38 = 0;

+        ptVar3 = PtiCurrent();

+        bVar1 = UIPrivilegeIsolation::CheckAccess

+                          ((tagUIPI_INFO *)(*(longlong *)(ptVar3 + 0x1d0) + 0x130),

+                           (tagUIPI_INFO *)&local_40,0);

+      }

+      else {

+        ptVar3 = PtiCurrent();

+        bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                          ((UIPIAccessor *)

+                           (-(ulonglong)(*(longlong *)(ptVar3 + 0x1d0) != 0) &

+                           *(longlong *)(ptVar3 + 0x1d0) + 0x130U),0x2000);

+      }

+      if (bVar1 != false) {

+LAB_4:

+        if (0xca0 < param_2) goto LAB_0;

+        lVar4 = HMValidateHandleWithDescriptor(param_1,0x13);

+        if (lVar4 == 0) {

+LAB_5:

+          UserSetLastError(6);

+          iVar2 = 0;

+        }

+        else if ((*(uint *)(lVar4 + 0xa8) & 0x2000) == 0) {

+          if ((-1 < (char)*(undefined4 *)(lVar4 + 0xb8)) ||

+             (*(int *)(*(longlong *)(lVar4 + 0x1c8) + 0x18) - 6U < 2)) goto LAB_5;

+          if (local_78 != (void *)0x0) {

+            lVar5 = PsGetCurrentProcessWow64Process();

+            ProbeForRead(local_78,_Size,(-(uint)(lVar5 != 0) & 0xfffffffd) + 4);

+            local_70 = (void *)Win32AllocPoolWithQuotaZInit(_Size,0x61637355);

+            if (local_70 == (void *)0x0) {

+                    /* WARNING: Subroutine does not return */

+              ExRaiseStatus(&DAT_6);

+            }

+            memcpy(local_70,local_78,_Size);

+          }

+          iVar2 = _SetCalibrationData(lVar4,_Size,local_70,param_4);

+        }

+        else {

+          UserSetLastError(6);

+          iVar2 = 0;

+          UserSetLastError(0);

+        }

+        if ((local_70 != (void *)0x0) && (iVar2 == 0)) {

+          Win32FreePool();

+        }

+        goto LAB_7;

+      }

+    }

+    else {

+      iVar2 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+      if (iVar2 == 0) {

+        local_50 = 0x3000;

+        local_4c = 0xffffffff;

+        local_48 = 0;

+        ptVar3 = PtiCurrent();

+        bVar1 = UIPrivilegeIsolation::CheckAccess

+                          ((tagUIPI_INFO *)(*(longlong *)(ptVar3 + 0x1d0) + 0x130),

+                           (tagUIPI_INFO *)&local_50,0);

+      }

+      else {

+        ptVar3 = PtiCurrent();

+        bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                          ((UIPIAccessor *)

+                           (-(ulonglong)(*(longlong *)(ptVar3 + 0x1d0) != 0) &

+                           *(longlong *)(ptVar3 + 0x1d0) + 0x130U),0x3000);

+      }

+      if (bVar1 != false) {

+        if (param_4 == 3) goto LAB_3;

+        goto LAB_4;

+      }

+    }

+    ptVar3 = PtiCurrent();

+    EtwTraceUIPISystemError(*(undefined8 *)(ptVar3 + 0x1d0),0,0xb);

+    uVar6 = 5;

+  }

+  iVar2 = 0;

+  UserSetLastError(uVar6);

+LAB_7:

+  AtomicExecutionCheck::Disarm(local_60);

   UserSessionSwitchLeaveCrit();

-  return (longlong)unaff_EBX;

+  return (longlong)iVar2;

 }
```

## `NtUserPostMessage`  (modified)

```diff
--- NtUserPostMessage
+++ NtUserPostMessage
@@ -1,364 +1,92 @@
 

-int * NtUserPostMessage(int param_1,int param_2,uint param_3,uint param_4)

+longlong NtUserPostMessage(longlong param_1,uint param_2,__uint64 param_3,__int64 param_4)

 

 {

-  uint *puVar1;

-  ushort *puVar2;

-  longlong lVar3;

-  ulonglong uVar4;

-  short sVar5;

-  int in_EAX;

-  uint uVar6;

-  int iVar7;

-  int iVar8;

-  int *piVar9;

-  uint uVar10;

-  uint uVar11;

-  uint uVar12;

-  int unaff_EBP;

-  int unaff_ESI;

-  uint unaff_EDI;

-  int *piVar13;

-  int *piVar14;

-  ushort uVar15;

-  ushort *puVar16;

-  ushort *puVar17;

-  ushort uVar18;

-  uint in_R10D;

-  int iVar19;

-  int iVar20;

-  int unaff_R13D;

-  uint uVar21;

-  int iVar22;

-  uint uStackX_20;

-  int iStackX_24;

-  int iStack0000000000000028;

-  int iStack000000000000002c;

-  uint uStack0000000000000030;

-  ulonglong uStack0000000000000038;

-  int iStack0000000000000040;

-  uint uStack0000000000000044;

-  undefined8 in_stack_00000048;

-  int iStack0000000000000050;

-  int iStack0000000000000054;

-  longlong lStack0000000000000058;

-  ulonglong uStack0000000000000068;

-  ulonglong uStack0000000000000070;

-  int *in_stack_000000e0;

-  int *in_stack_000000e8;

-  int in_stack_000000f0;

-  uint uStack00000000000000f8;

-  uint in_stack_00000100;

-  int *in_stack_00000108;

-  int *in_stack_00000110;

-  uint in_stack_00000118;

+  bool bVar1;

+  int iVar2;

+  uint uVar3;

+  tagWND *ptVar4;

+  tagQMSG *ptVar5;

+  tagWND *ptVar6;

+  tagTHREADINFO *ptVar7;

+  undefined8 uVar8;

   

-  uVar21 = uStackX_20;

-  iStack0000000000000050 = param_2;

-  if (-1 < in_EAX) {

-    iStack0000000000000050 = in_EAX;

+                    /* 0x1d230  1861  NtUserPostMessage */

+  EnterCrit(0,1);

+  if ((param_2 & 0xfffe0000) != 0) {

+    UserSetLastError(0x57);

+    uVar3 = 0;

+    goto LAB_0;

   }

-  if (in_stack_000000f0 < param_1) {

-    param_1 = in_stack_000000f0;

+  if ((param_2 < 0x400) && ((*(ushort *)(&MessageTable + (ulonglong)param_2 * 2) >> 0xd & 1) != 0))

+  {

+    uVar8 = 5;

   }

-  iStack0000000000000054 = *in_stack_00000108;

-  iStack000000000000002c = -1;

-  iStack0000000000000040 = iStack0000000000000054 + -1;

-  iStack0000000000000028 = *in_stack_00000110;

-  if (iStack0000000000000028 <= iStack0000000000000040) {

-    return (int *)0x0;

-  }

-  if (param_3 <= param_4) {

-    return (int *)0x0;

-  }

-  uVar10 = iStack0000000000000028 - iStack0000000000000040;

-  uStack00000000000000f8 = uVar10 + 1;

-  if (uStack00000000000000f8 < uVar10) {

-    return (int *)0x0;

-  }

-  uStack0000000000000068 = (ulonglong)param_3;

-  if (0xffffffff < uStack00000000000000f8 * uStack0000000000000068) {

-    return (int *)0x0;

-  }

-  uVar12 = (uint)(uStack00000000000000f8 * uStack0000000000000068);

-  uVar6 = (param_4 - 1) + uVar12;

-  if (uVar6 < uVar12) {

-    return (int *)0x0;

-  }

-  uVar6 = uVar6 / param_4;

-  uVar12 = uVar6 + 4;

-  if (uVar12 < uVar6) {

-    return (int *)0x0;

-  }

-  uStack0000000000000030 = param_3;

-  if (uVar12 <= param_3) {

-    uStack0000000000000030 = uVar12;

-  }

-  if (uStack0000000000000030 + 1 < uStack0000000000000030) {

-    return (int *)0x0;

-  }

-  uVar4 = (ulonglong)(uStack0000000000000030 + 1) * 2;

-  if (0xffffffff < uVar4) {

-    return (int *)0x0;

-  }

-  uVar6 = (uint)uVar4;

-  uVar12 = uVar6 + 8;

-  if (uVar12 < uVar6) {

-    return (int *)0x0;

-  }

-  uVar12 = uVar12 & 0xfffffff8;

-  uVar6 = uVar12 + 0x808;

-  if (uVar6 < uVar12) {

-    return (int *)0x0;

-  }

-  uStack0000000000000070 = ((ulonglong)param_4 << 0xd) / uStack0000000000000068;

-  uVar12 = uVar6;

-  if ((in_R10D & 0x4a80) != 0) {

-    if (uVar10 + 4 < uVar10) {

-      return (int *)0x0;

+  else {

+    uVar3 = 0;

+    ptVar4 = (tagWND *)0x0;

+    if (param_1 != 0) {

+      if ((param_1 == 0xffff) || (param_1 == -1)) {

+        ptVar4 = (tagWND *)0xffffffffffffffff;

+      }

+      else {

+        ptVar4 = (tagWND *)ValidateHwnd(param_1);

+        if (ptVar4 == (tagWND *)0x0) {

+          uVar3 = (uint)(param_2 == 0x3e1);

+          goto LAB_0;

+        }

+      }

     }

-    uVar4 = (ulonglong)(uVar10 + 4) * 2;

-    if (0xffffffff < uVar4) {

-      return (int *)0x0;

+    if (param_2 < 0x240) {

+      if ((param_2 - 0x119 & 0xfffffffd) != 0) {

+LAB_1:

+        if ((3 < param_2 - 0x241) && (iVar2 = IsPointerInputClientMessage(param_2), iVar2 == 0)) {

+          bVar1 = false;

+          if ((param_2 - 0x3e0 < 9) &&

+             (iVar2 = ValidateDDEConvPair(param_3,ptVar4), bVar1 = false, iVar2 != 0)) {

+            bVar1 = true;

+          }

+          if ((param_2 == 0x112) && (param_3 == 0xf030)) {

+            ptVar7 = PtiCurrent();

+            iVar2 = IAMThreadAccessGranted(ptVar7);

+            if (iVar2 != 0) {

+              bVar1 = true;

+            }

+          }

+          if ((ptVar4 + -1 < (tagWND *)0xfffffffffffffffe) && (!bVar1)) {

+            uVar8 = *(undefined8 *)(*(longlong *)(ptVar4 + 0x10) + 0x1d0);

+            ptVar6 = (tagWND *)PsGetCurrentProcessWin32Process();

+            if ((ptVar6 != (tagWND *)0x0) && (*(longlong *)ptVar6 == 0)) {

+              ptVar6 = (tagWND *)0x0;

+            }

+            iVar2 = CheckForMessageAccessCrossIL(ptVar6,uVar8,ptVar4,param_2,param_3,param_4);

+            if (iVar2 == 0) goto LAB_0;

+          }

+          ptVar5 = _PostTransformableMessageExtended

+                             (ptVar4,param_2,param_3,param_4,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

+          if (*(tagQMSG **)MmSystemRangeStart_exref <= ptVar5) {

+            ptVar5 = (tagQMSG *)(ulonglong)(ptVar5 != (tagQMSG *)0x0);

+          }

+          uVar3 = (uint)ptVar5;

+          goto LAB_0;

+        }

+      }

+      uVar8 = 0x3ea;

     }

-    uVar10 = (uint)uVar4;

-    uVar11 = uVar10 + 8;

-    if (uVar11 < uVar10) {

-      return (int *)0x0;

-    }

-    uVar11 = uVar11 & 0xfffffff8;

-    uVar12 = unaff_EDI;

-    unaff_EDI = uVar11;

-    if ((in_R10D >> 9 & 1) == 0) {

-      uVar12 = uVar6;

+    else {

+      if (0x240 < param_2) goto LAB_1;

+      if (ptVar4 + -1 < (tagWND *)0xfffffffffffffffe) {

+        ptVar7 = PtiCurrent();

+        uVar3 = ForwardTouchMessage(ptVar7,ptVar4,param_2,param_3,param_4,1,0,0,0);

+        goto LAB_0;

+      }

+      uVar8 = 0x578;

     }

   }

-  if (in_stack_00000118 + 8 < in_stack_00000118) {

-    return (int *)0x0;

-  }

-  uVar6 = in_stack_00000118 + 8 & 0xfffffff8;

-  uVar10 = uVar12 + unaff_EDI;

-  if (uVar10 < unaff_EDI) {

-    return (int *)0x0;

-  }

-  uVar11 = uVar10 + uVar6;

-  if (uVar11 < uVar10) {

-    return (int *)0x0;

-  }

-  if (uVar11 + 0xf0 < uVar11) {

-    return (int *)0x0;

-  }

-  uStack0000000000000044 = param_3;

-  piVar9 = (int *)EngAllocMem(1,uVar11 + 0xf0,0x35355448);

-  if (piVar9 == (int *)0x0) {

-    return (int *)0x0;

-  }

-  piVar13 = piVar9 + 0x3c;

-  if (uVar6 != 0) {

-    *(int **)(piVar9 + 8) = piVar13;

-    piVar13 = (int *)((longlong)piVar13 + (ulonglong)uVar6);

-  }

-  if (unaff_EDI != 0) {

-    puVar1 = (uint *)(piVar9 + 0xc);

-    *(int **)(piVar9 + 0x16) = piVar13;

-    *puVar1 = uStack0000000000000044;

-    piVar9[0xd] = in_stack_00000100;

-    piVar9[0x10] = iStack0000000000000050;

-    piVar9[0x11] = param_1;

-    piVar9[0x12] = iStack0000000000000054;

-    piVar9[0x13] = iStack0000000000000028;

-    lVar3 = (longlong)piVar13 + (longlong)(int)uStack00000000000000f8 * 2;

-    piVar13 = (int *)((longlong)piVar13 + (longlong)(int)unaff_EDI);

-    *(longlong *)(piVar9 + 0x18) = lVar3;

-    iVar8 = BuildRepData(puVar1,uStackX_20,unaff_R13D);

-    if (iVar8 == 0) goto LAB_0;

-    *(undefined8 *)(piVar9 + 0x1c) = *(undefined8 *)puVar1;

-    *(undefined8 *)(piVar9 + 0x1e) = *(undefined8 *)(piVar9 + 0xe);

-    *(undefined8 *)(piVar9 + 0x20) = *(undefined8 *)(piVar9 + 0x10);

-    *(undefined8 *)(piVar9 + 0x22) = *(undefined8 *)(piVar9 + 0x12);

-    *(undefined8 *)(piVar9 + 0x24) = *(undefined8 *)(piVar9 + 0x14);

-    *(undefined8 *)(piVar9 + 0x26) = *(undefined8 *)(piVar9 + 0x16);

-    *(undefined8 *)(piVar9 + 0x28) = *(undefined8 *)(piVar9 + 0x18);

-    *(undefined8 *)(piVar9 + 0x2a) = *(undefined8 *)(piVar9 + 0x1a);

-    *(undefined8 *)(piVar9 + 0x2c) = *(undefined8 *)(piVar9 + 0x1c);

-    *(undefined8 *)(piVar9 + 0x2e) = *(undefined8 *)(piVar9 + 0x1e);

-    *(undefined8 *)(piVar9 + 0x30) = *(undefined8 *)(piVar9 + 0x20);

-    *(undefined8 *)(piVar9 + 0x32) = *(undefined8 *)(piVar9 + 0x22);

-    piVar9[0x34] = piVar9[0x24];

-    piVar9[0x35] = piVar9[0x25];

-    piVar9[0x36] = piVar9[0x26];

-    piVar9[0x37] = piVar9[0x27];

-    *(undefined8 *)(piVar9 + 0x38) = *(undefined8 *)(piVar9 + 0x28);

-    *(undefined8 *)(piVar9 + 0x3a) = *(undefined8 *)(piVar9 + 0x2a);

-  }

-  if (uVar12 == 0) {

-    unaff_ESI = piVar9[0x11] + -1;

-    iStack000000000000002c = piVar9[0x10];

-    unaff_EBP = piVar9[0x13] + -1;

-    in_stack_00000048._4_4_ = piVar9[0x12];

-  }

-  else {

-    *(undefined2 *)(piVar9 + 3) = 1;

-    *(int **)(piVar9 + 6) = piVar13;

-    iVar8 = (int)uStack0000000000000070;

-    *(int **)(piVar9 + 10) = piVar13 + 0x200;

-    puVar2 = (ushort *)((longlong)(piVar13 + 0x200) + (ulonglong)uStack0000000000000030 * 2);

-    iVar7 = -iVar8;

-    iVar20 = -(iVar8 + 1);

-    piVar14 = piVar13;

-    do {

-      iVar7 = iVar7 + iVar8;

-      iVar20 = iVar20 + iVar8 + 1;

-      *piVar14 = iVar7;

-      piVar14[0x100] = iVar20;

-      piVar14 = piVar14 + 1;

-    } while (piVar14 < piVar13 + 0x100);

-    puVar16 = (ushort *)((longlong)piVar13 + 0x7fe);

-    uStackX_20 = uStack0000000000000044;

-    uStack0000000000000038 = 0;

-    lStack0000000000000058 = 0;

-    iVar7 = unaff_ESI;

-    if (uStack0000000000000044 != 0) {

-      uVar10 = uStack0000000000000044;

-      iVar19 = iStack000000000000002c;

-      iVar22 = -uStack0000000000000044;

-      do {

-        sVar5 = (short)uStack0000000000000038;

-        uStackX_20 = uStackX_20 - 1;

-        uStack0000000000000030 = uVar10 - in_stack_00000100;

-        iVar7 = iVar22 + in_stack_00000100;

-        if ((int)uStack0000000000000030 < 1) {

-          uStack0000000000000030 = uStack0000000000000030 + uStack0000000000000044;

-          iVar22 = iVar7 + -uStack0000000000000044;

-          unaff_R13D = unaff_R13D + 1;

-          uVar15 = 0x4000;

-          iVar20 = iVar7;

-        }

-        else {

-          uVar15 = 0;

-          iVar22 = iVar7;

-          uVar10 = in_stack_00000100;

-        }

-        if ((iStack0000000000000040 + -1 <= unaff_R13D) && (unaff_R13D <= iStack0000000000000028)) {

-          lStack0000000000000058 = lStack0000000000000058 + (longlong)(int)uVar10 * 0x2000;

-          uVar10 = (uint)(lStack0000000000000058 / (longlong)uStack0000000000000068);

-          uVar18 = uVar15 | 0x8000;

-          if ((int)uVar10 <= iVar8) {

-            uVar18 = uVar15;

-          }

-          uStack00000000000000f8 = CONCAT22(uStack00000000000000f8._2_2_,uVar18);

-          uStack0000000000000038 = (ulonglong)((int)uStack0000000000000038 + uVar10);

-          uVar15 = uVar18;

-          if ((uVar18 >> 0xe & 1) != 0) {

-            lStack0000000000000058 = (longlong)iVar20 << 0xd;

-            uStack0000000000000038 = lStack0000000000000058 / (longlong)uStack0000000000000068;

-            iVar20 = 0;

-            uVar15 = uVar18 | 0x8000;

-            if ((int)((int)uStack0000000000000038 + uVar10) <= iVar8) {

-              uVar15 = uVar18 & 0x7fff;

-            }

-          }

-          lStack0000000000000058 = lStack0000000000000058 % (longlong)uStack0000000000000068;

-          sVar5 = (short)uStack0000000000000038;

-        }

-        uVar18 = (ushort)uVar10;

-        if ((unaff_R13D < iStack0000000000000040) || (iStack0000000000000028 < unaff_R13D)) {

-          if (iVar19 != -1) {

-            puVar17 = puVar16 + 1;

-            if (puVar2 <= puVar16 + 1) {

-              puVar17 = puVar16;

-            }

-            *puVar17 = 0x2000U - sVar5 | 0x4000;

-            puVar16 = puVar17;

-            iVar7 = iStackX_24 + 1;

-            unaff_ESI = uVar21;

-            break;

-          }

-        }

-        else if (((int)uVar21 < iStack0000000000000050) || (param_1 <= (int)uVar21)) {

-          if (iVar19 != -1) {

-            puVar17 = puVar16 + 1;

-            if (puVar2 <= puVar16 + 1) {

-              puVar17 = puVar16;

-            }

-            if ((uVar15 & 0x4000) == 0) {

-              uVar18 = uVar18 + (0x2000 - sVar5);

-            }

-            *puVar17 = uVar18 | uVar15 | 0x4000;

-            uStackX_20 = 0;

-            iStackX_24 = iStackX_24 + 1;

-            puVar16 = puVar17;

-          }

-        }

-        else {

-          iStackX_24 = iStackX_24 + (uint)((uVar15 & 0x4000) != 0);

-          puVar17 = puVar16 + 1;

-          if (puVar2 <= puVar16 + 1) {

-            puVar17 = puVar16;

-          }

-          puVar16 = puVar17;

-          *puVar16 = uVar18 | uVar15;

-          iVar19 = iStack000000000000002c;

-          unaff_ESI = uVar21;

-          unaff_EBP = unaff_R13D;

-          if (iStack000000000000002c == -1) {

-            sVar5 = (short)uStack0000000000000038;

-            in_stack_00000048._4_4_ = unaff_R13D;

-            if ((uVar15 & 0x4000) == 0) {

-LAB_1:

-              sVar5 = sVar5 - uVar18;

-            }

-            else {

-              if (unaff_R13D != iStack0000000000000040) {

-                in_stack_00000048._4_4_ = unaff_R13D + -1;

-                sVar5 = 0x2000;

-                goto LAB_1;

-              }

-              *(undefined2 *)((longlong)piVar9 + 10) = 1;

-              iStackX_24 = iStackX_24 + -1;

-              puVar16 = puVar16 + -1;

-            }

-            *(short *)((longlong)piVar9 + 0xe) = sVar5;

-            iVar19 = uVar21;

-            iStack000000000000002c = uVar21;

-            unaff_EBP = in_stack_00000048._4_4_;

-          }

-        }

-        uVar21 = uVar21 + 1;

-        uVar10 = uStack0000000000000030;

-        iVar7 = iStackX_24;

-      } while (uStackX_20 != 0);

-    }

-    puVar16 = puVar16 + 1;

-    if ((iStack000000000000002c == -1) || (puVar16 == *(ushort **)(piVar9 + 10))) {

+  uVar3 = 0;

+  UserSetLastError(uVar8);

 LAB_0:

-      EngFreeMem(piVar9);

-      return (int *)0x0;

-    }

-    if (param_1 <= unaff_ESI) {

-      unaff_ESI = param_1 + -1;

-    }

-    if (in_stack_00000048._4_4_ < iStack0000000000000054) {

-      *(short *)(piVar9 + 3) = (short)piVar9[3] + 1;

-      in_stack_00000048._4_4_ = iStack0000000000000054;

-    }

-    if (iStack0000000000000028 <= unaff_EBP) {

-      unaff_EBP = iStack0000000000000028 + -1;

-    }

-    if ((*(short *)((longlong)piVar9 + 10) != 0) && (*(short *)((longlong)piVar9 + 0xe) == 0)) {

-      *(undefined2 *)((longlong)piVar9 + 10) = 0;

-      iStack000000000000002c = iStack000000000000002c + 1;

-    }

-    piVar9[5] = iVar7;

-    piVar9[4] = (int)((longlong)puVar16 - (longlong)*(ushort **)(piVar9 + 10) >> 1);

-    *puVar16 = 0;

-  }

-  *in_stack_000000e0 = iStack000000000000002c;

-  *in_stack_000000e8 = unaff_ESI;

-  *in_stack_00000108 = in_stack_00000048._4_4_;

-  *in_stack_00000110 = unaff_EBP;

-  *piVar9 = (unaff_ESI - iStack000000000000002c) + 1;

-  piVar9[1] = (unaff_EBP - in_stack_00000048._4_4_) + 1;

-  return piVar9;

+  UserSessionSwitchLeaveCrit();

+  return (longlong)(int)uVar3;

 }
```

## `UMPDDrvEscape`  (modified)

```diff
--- UMPDDrvEscape
+++ UMPDDrvEscape
@@ -1,14 +1,122 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* unsigned long __cdecl UMPDDrvEscape(struct _SURFOBJ * __ptr64,unsigned long,unsigned long,void *

+   __ptr64,unsigned long,void * __ptr64) */

 

 ulong __cdecl

 UMPDDrvEscape(_SURFOBJ *param_1,ulong param_2,ulong param_3,void *param_4,ulong param_5,

              void *param_6)

 

 {

-  code *pcVar1;

-  ulong uVar2;

+  uint uVar1;

+  int iVar2;

+  ulong uVar3;

+  uint uVar4;

+  UMPDOBJ *this;

+  int iVar5;

+  void *pvVar6;

+  undefined1 auStackY_118 [32];

+  int in_stack_ffffffffffffff08;

+  int *piVar7;

+  ulong local_d8;

+  int local_d4;

+  int local_d0 [2];

+  _XFORMOBJ *local_c8;

+  UMPDOBJ *local_c0;

+  uint local_b8 [2];

+  void *local_b0;

+  void *local_a8;

+  void *local_a0;

+  void *local_98;

+  _SURFOBJ *local_90;

+  undefined1 local_88 [4];

+  undefined4 local_84;

+  undefined8 local_78;

+  _SURFOBJ *local_70;

+  int local_68;

+  ulong local_64;

+  void *local_60;

+  ulong local_58;

+  void *local_50;

+  ulonglong local_48;

   

-  pcVar1 = (code *)swi(3);

-  uVar2 = (*pcVar1)();

-  return uVar2;

+  local_48 = __security_cookie ^ (ulonglong)auStackY_118;

+  local_c8 = (_XFORMOBJ *)CONCAT44(local_c8._4_4_,param_2);

+  local_b0 = param_6;

+  local_d8 = 0xffffffff;

+  local_98 = param_4;

+  local_90 = param_1;

+  XUMPDOBJ::XUMPDOBJ((XUMPDOBJ *)&local_c0);

+  iVar2 = 1;

+  local_d0[0] = 0;

+  local_d4 = 0;

+  local_a0 = (void *)0x0;

+  local_a8 = (void *)0x0;

+  memset(local_88,0,0x40);

+  uVar1 = local_b8[0];

+  if (local_c0 == (UMPDOBJ *)0x0) goto LAB_0;

+  iVar5 = 0;

+  if (local_c0[0x1c8] != (UMPDOBJ)0x0) {

+    if (param_3 + 7 < param_3) {

+LAB_0:

+      local_b8[0] = uVar1;

+      XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_c0);

+      return 0xffffffff;

+    }

+    if (param_5 + 7 < param_5) goto LAB_0;

+    uVar4 = (param_3 + 7 & 0xfffffff8) + 0x50;

+    if (uVar4 < 0x50) goto LAB_0;

+    local_b8[0] = (param_5 + 7 & 0xfffffff8) + uVar4;

+    uVar1 = 0xffffffff;

+    if (local_b8[0] < uVar4) goto LAB_0;

+    piVar7 = local_d0;

+    iVar2 = UMPDOBJ::bThunkLargeBitmap

+                      (local_c0,param_1,&local_a0,&local_a8,piVar7,&local_d4,local_b8);

+    in_stack_ffffffffffffff08 = (int)piVar7;

+    iVar5 = local_d4;

+  }

+  if (iVar2 == 0) goto LAB_1;

+  local_84 = 0x18;

+  local_88[0] = 0;

+  local_78 = *(undefined8 *)local_c0;

+  pvVar6 = (void *)(-(ulonglong)(param_3 != 0) & (ulonglong)local_98);

+  local_b0 = (void *)(-(ulonglong)(param_5 != 0) & (ulonglong)local_b0);

+  local_68 = (int)local_c8;

+  local_58 = param_5;

+  local_70 = param_1;

+  local_64 = param_3;

+  local_60 = pvVar6;

+  local_50 = local_b0;

+  if (((int)local_c8 == 0x19) && (*(int *)(*(longlong *)(param_1 + 0x18) + 0x710) < 0)) {

+    if (pvVar6 == (void *)0x0) goto LAB_1;

+    local_c8 = *(_XFORMOBJ **)((longlong)pvVar6 + 0x18);

+    iVar2 = UMPDOBJ::pxo(local_c0,&local_c8);

+    if (iVar2 == 0) goto LAB_1;

+    *(_XFORMOBJ **)((longlong)local_60 + 0x18) = local_c8;

+  }

+  if ((((param_3 == 0) ||

+       (this = local_c0, iVar2 = UMPDOBJ::bNeedThunk(local_c0,pvVar6), iVar2 == 0)) ||

+      (iVar2 = UMPDOBJ::ThunkMemBlock(this,&local_60,param_3), iVar2 != 0)) &&

+     (((param_5 == 0 ||

+       (local_50 = UMPDOBJ::_AllocUserMem(local_c0,param_5,1), local_50 != (void *)0x0)) &&

+      (iVar2 = UMPDOBJ::pso(local_c0,(_DDIOBJMAP *)(local_c0 + 0x50),&local_70,iVar5), iVar2 != 0)))

+     ) {

+    in_stack_ffffffffffffff08 = 4;

+    uVar3 = UMPDOBJ::Thunk(local_c0,local_88,0x40,&local_d8,4);

+    if (uVar3 != 0xffffffff) {

+      if (param_5 != 0) {

+        pvVar6 = UMPDOBJ::GetKernelPtr(local_c0,local_50);

+        memcpy(local_b0,pvVar6,(ulonglong)param_5);

+      }

+      goto LAB_1;

+    }

+  }

+  local_d8 = 0xffffffff;

+LAB_1:

+  if (local_d0[0] != 0) {

+    UMPDOBJ::RestoreBitmap(local_c0,param_1,local_a0,local_a8,in_stack_ffffffffffffff08,iVar5);

+  }

+  XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_c0);

+  return local_d8;

 }
```

## `xxxProcessHidInput`  (modified)

```diff
--- xxxProcessHidInput
+++ xxxProcessHidInput
@@ -1,85 +1,293 @@
 

-ulonglong xxxProcessHidInput(void)

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

+

+void xxxProcessHidInput(DEVICEINFO *param_1,void *param_2,ulong param_3)

 

 {

-  uint *puVar1;

-  uint uVar2;

-  uint in_EAX;

-  uint uVar4;

-  int iVar5;

-  longlong *plVar6;

-  longlong *plVar7;

-  longlong lVar8;

-  undefined8 uVar9;

-  longlong unaff_RBX;

-  ulonglong unaff_RDI;

-  ulonglong uVar10;

-  longlong unaff_R12;

-  longlong unaff_R14;

-  longlong unaff_R15;

-  uint uVar3;

+  ushort uVar1;

+  short sVar2;

+  tagWND *ptVar3;

+  undefined8 uVar4;

+  undefined1 auVar5 [16];

+  bool bVar6;

+  bool bVar7;

+  bool bVar8;

+  char cVar9;

+  int iVar10;

+  longlong lVar11;

+  tagPROCESS_HID_REQUEST *ptVar12;

+  tagTHREADINFO *ptVar13;

+  tagUIPI_INFO *ptVar14;

+  char cVar15;

+  char cVar16;

+  tagUIPI_INFO *ptVar17;

+  tagPROCESS_HID_TABLE *ptVar18;

+  bool bVar19;

+  ReEnterLeaveCrit local_res20 [8];

+  undefined8 in_stack_ffffffffffffff68;

+  undefined8 in_stack_ffffffffffffff88;

+  DEVICEINFO *pDVar20;

+  undefined4 uVar21;

+  undefined8 in_stack_ffffffffffffff90;

+  undefined4 uVar22;

+  longlong local_58;

+  undefined8 local_48;

+  undefined4 local_40;

   

-  uVar4 = in_EAX + 0xf6000001;

-  puVar1 = (uint *)(unaff_R14 * 2 + -0x383617b7);

-  uVar2 = *puVar1;

-  uVar3 = *puVar1;

-  *puVar1 = (uVar3 - uVar4) - (uint)(0x9fffffe < in_EAX);

-  plVar6 = (longlong *)

-           (ulonglong)

-           CONCAT31((int3)(uVar4 >> 8),

-                    (char)uVar4 - (uVar2 < uVar4 || uVar3 - uVar4 < (uint)(0x9fffffe < in_EAX)));

-  lVar8 = unaff_R12;

-  if (plVar6 != (longlong *)0x0) {

-    lVar8 = *plVar6;

-  }

-  LOCK();

-  if (*(int *)(lVar8 + 0x210) == 0) {

-    *(int *)(lVar8 + 0x210) = (int)unaff_R12;

-  }

-  UNLOCK();

-  iVar5 = ValidateHandleSecure();

-  uVar10 = unaff_RDI & -(ulonglong)(iVar5 != 0);

-  if (((*(char *)(unaff_RBX + 0x19) < (char)unaff_R12) &&

-      (plVar6 = (longlong *)PsGetCurrentProcessWin32Process(), plVar6 != (longlong *)0x0)) &&

-     (*plVar6 != unaff_R12)) {

-    if ((*(ushort *)(gahti_exref + (ulonglong)*(byte *)(unaff_RBX + 0x18) * 0x18 + 0xc) & 2) == 0) {

-      if (((*(ushort *)(gahti_exref + (ulonglong)*(byte *)(unaff_RBX + 0x18) * 0x18 + 0xc) & 1) == 0

-          ) || (*(longlong *)(unaff_R15 + 8) == 0)) goto LAB_0;

-      plVar7 = *(longlong **)(*(longlong *)(unaff_R15 + 8) + 0x1d0);

+  uVar22 = (undefined4)((ulonglong)in_stack_ffffffffffffff90 >> 0x20);

+                    /* 0xae8e0  2387  xxxProcessHidInput */

+  uVar21 = (undefined4)((ulonglong)in_stack_ffffffffffffff88 >> 0x20);

+  bVar7 = false;

+  local_58 = 0;

+  bVar19 = false;

+  cVar9 = '\0';

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0)) ||

+     (bVar6 = true, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+    bVar6 = bVar7;

+  }

+  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+     (bVar8 = true, *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+    bVar8 = bVar7;

+  }

+  if ((bVar6) || (bVar8 != false)) {

+    lVar11 = W32GetUserSessionState();

+    in_stack_ffffffffffffff68 = CONCAT71((int7)((ulonglong)in_stack_ffffffffffffff68 >> 8),5);

+    pDVar20 = param_1;

+    WPP_RECORDER_AND_TRACE_SF_q

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar6,bVar8,

+               *(undefined8 *)(lVar11 + 0x10f98),in_stack_ffffffffffffff68,0x14,0xf,

+               &WPP_401b4b7cf61139f03a47396ffc2b5e02_Traceguids,param_1);

+    uVar21 = (undefined4)((ulonglong)pDVar20 >> 0x20);

+  }

+  iVar10 = IsDeviceInputAllowed(param_1);

+  if (iVar10 == 0) {

+    return;

+  }

+  ReEnterLeaveCrit::ReEnterLeaveCrit(local_res20);

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0)) ||

+     (cVar15 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+    cVar15 = cVar9;

+  }

+  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+     (cVar16 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+    cVar16 = cVar9;

+  }

+  if ((cVar15 != '\0') || (cVar16 != '\0')) {

+    uVar1 = *(ushort *)(*(longlong *)(param_1 + 0x1b8) + 0x2c);

+    lVar11 = W32GetUserSessionState();

+    in_stack_ffffffffffffff68 = CONCAT71((int7)((ulonglong)in_stack_ffffffffffffff68 >> 8),5);

+    WPP_RECORDER_AND_TRACE_SF_Dd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar15,cVar16,

+               *(undefined8 *)(lVar11 + 0x10f98),in_stack_ffffffffffffff68,0x14,0x10,

+               &WPP_401b4b7cf61139f03a47396ffc2b5e02_Traceguids,CONCAT44(uVar21,(uint)uVar1),

+               CONCAT44(uVar22,param_3));

+  }

+  lVar11 = W32GetUserSessionState();

+  if (*(longlong *)(lVar11 + 0x4a50) == 0) {

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) != 0)) &&

+       (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+      cVar9 = '\x01';

+    }

+    if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+       (cVar15 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+      cVar15 = '\0';

+    }

+    if ((cVar9 != '\0') || (cVar15 != '\0')) {

+      lVar11 = W32GetUserSessionState();

+      in_stack_ffffffffffffff68 = CONCAT71((int7)((ulonglong)in_stack_ffffffffffffff68 >> 8),5);

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,cVar15,

+                 *(undefined8 *)(lVar11 + 0x10f98),in_stack_ffffffffffffff68,0x14,0x11,

+                 &WPP_401b4b7cf61139f03a47396ffc2b5e02_Traceguids);

+    }

+    bVar6 = true;

+  }

+  else {

+    lVar11 = W32GetUserSessionState();

+    lVar11 = PtiKbdFromQ(*(undefined8 *)(lVar11 + 0x4a50));

+    local_58 = *(longlong *)(lVar11 + 0x1d0);

+    ptVar12 = HidIsRequestedByThisProcess(param_1,*(tagPROCESS_HID_TABLE **)(local_58 + 0x340));

+    if (ptVar12 == (tagPROCESS_HID_REQUEST *)0x0) {

+      cVar15 = cVar9;

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) != 0)) &&

+         (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+        cVar15 = '\x01';

+      }

+      if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+         (cVar16 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+        cVar16 = cVar9;

+      }

+      if ((cVar15 != '\0') || (cVar16 != '\0')) {

+        lVar11 = W32GetUserSessionState();

+        PtiKbdFromQ(*(undefined8 *)(lVar11 + 0x4a50));

+        W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_DDq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar15);

+      }

+      bVar6 = true;

+      bVar7 = bVar19;

     }

     else {

-      plVar7 = *(longlong **)(unaff_R15 + 8);

-    }

-    if ((plVar7 != (longlong *)0x0) && (plVar7 != plVar6)) goto LAB_1;

+      lVar11 = W32GetUserSessionState();

+      ptVar3 = *(tagWND **)(ptVar12 + 0x20);

+      ptVar17 = *(tagUIPI_INFO **)(lVar11 + 0x4a50);

+      if (ptVar3 != (tagWND *)0x0) {

+        bVar6 = true;

+        ptVar17 = *(tagUIPI_INFO **)(*(longlong *)(ptVar3 + 0x10) + 0x1d8);

+        if (*(char *)(*(longlong *)(ptVar3 + 0x28) + 0x14) < '\0') goto LAB_0;

+      }

+      if (((*(uint *)(param_1 + 0xa8) & 0x20) != 0) &&

+         ((*(uint *)(*(longlong *)(param_1 + 0x1c8) + 0x170) & 0x10) == 0)) {

+        cVar9 = IsInputThread();

+        if (cVar9 == '\0') {

+          ptVar13 = PtiCurrent();

+          ptVar14 = (tagUIPI_INFO *)(*(longlong *)(ptVar13 + 0x1d0) + 0x130);

+        }

+        else {

+          ptVar14 = (tagUIPI_INFO *)(*(longlong *)(param_1 + 0x1c8) + 0x3c0);

+        }

+        bVar6 = true;

+        bVar8 = UIPrivilegeIsolation::CheckAccess(ptVar14,ptVar17,0);

+        bVar7 = bVar19;

+        if (!bVar8) goto LAB_0;

+      }

+      in_stack_ffffffffffffff68 = 0;

+      bVar6 = true;

+      iVar10 = PostHidInput(param_1,param_2,param_3,ptVar3,0);

+      bVar7 = bVar19;

+      if (iVar10 != 0) {

+        bVar6 = false;

+        bVar7 = true;

+      }

+    }

   }

 LAB_0:

-  if (uVar10 != 0) {

-    return uVar10;

-  }

+  lVar11 = W32GetUserSessionState();

+  ptVar18 = *(tagPROCESS_HID_TABLE **)(lVar11 + 0xd8);

+  lVar11 = W32GetUserSessionState();

+  if (ptVar18 != (tagPROCESS_HID_TABLE *)(lVar11 + 0xd8)) {

+    do {

+      if ((((0 < *(int *)(ptVar18 + 0x50)) &&

+           (ptVar12 = HidIsRequestedByThisProcess(param_1,ptVar18),

+           ptVar12 != (tagPROCESS_HID_REQUEST *)0x0)) && ((*(uint *)(ptVar12 + 0x14) & 1) != 0)) &&

+         (((*(uint *)(ptVar12 + 0x14) & 2) == 0 || (bVar6)))) {

+        if (*(code **)(ptVar12 + 0x28) == (code *)0x0) {

+          ptVar3 = *(tagWND **)(ptVar12 + 0x20);

+          if (((*(longlong *)(*(longlong *)(ptVar3 + 0x10) + 0x1d0) != local_58) &&

+              (lVar11 = W32GetUserSessionState(),

+              *(longlong *)(ptVar3 + 0x18) == *(longlong *)(lVar11 + 0x4b58))) &&

+             ((-1 < *(char *)(*(longlong *)(ptVar3 + 0x28) + 0x14) &&

+              (-1 < *(char *)(*(longlong *)(ptVar3 + 0x28) + 0x13))))) {

+            uVar1 = *(ushort *)(*(longlong *)(param_1 + 0x1c0) + 0x10);

+            sVar2 = *(short *)(*(longlong *)(param_1 + 0x1c0) + 0x12);

+            if (uVar1 == 0xc) {

+              bVar19 = sVar2 == 1;

 LAB_1:

-  iVar5 = (int)unaff_R14;

-  if (iVar5 == 1) {

-    uVar9 = 0x578;

-  }

-  else if (iVar5 == 2) {

-    uVar9 = 0x579;

-  }

-  else if (iVar5 == 3) {

-    uVar9 = 0x57a;

-  }

-  else if (iVar5 == 4) {

-    uVar9 = 0x57d;

-  }

-  else if (iVar5 == 5) {

-    uVar9 = 0x57c;

-  }

-  else if (iVar5 == 8) {

-    uVar9 = 0x57b;

-  }

-  else {

-    uVar9 = 6;

-  }

-  UserSetLastError(uVar9);

-  return 0;

+              if (!bVar19) {

+LAB_2:

+                lVar11 = W32GetUserSessionState();

+                if (*(longlong *)(lVar11 + 0x4a50) != 0) {

+                  lVar11 = W32GetUserSessionState();

+                  bVar19 = UIPrivilegeIsolation::CheckAccess

+                                     (*(tagUIPI_INFO **)(*(longlong *)(ptVar3 + 0x10) + 0x1d8),

+                                      *(tagUIPI_INFO **)(lVar11 + 0x4a50),0);

+                  uVar21 = (undefined4)((ulonglong)in_stack_ffffffffffffff68 >> 0x20);

+                  if ((!bVar19) &&

+                     (-1 < *(int *)(*(longlong *)(*(longlong *)(ptVar3 + 0x10) + 0x1d0) + 0xc))) {

+                    lVar11 = W32GetUserSessionState();

+                    uVar4 = **(undefined8 **)(lVar11 + 0x4a50);

+                    uVar22 = *(undefined4 *)(*(undefined8 **)(lVar11 + 0x4a50) + 1);

+                    lVar11 = W32GetUserSessionState();

+                    in_stack_ffffffffffffff68 = CONCAT44(uVar21,5);

+                    local_48 = uVar4;

+                    local_40 = uVar22;

+                    EtwTraceUIPIInputError

+                              (*(undefined8 *)(ptVar3 + 0x10),0,*(undefined8 *)(lVar11 + 0x4a50),

+                               &local_48,in_stack_ffffffffffffff68);

+                    goto LAB_3;

+                  }

+                }

+                lVar11 = W32GetUserSessionState();

+                lVar11 = lVar11 + 0x30;

+                RIMLockShared(lVar11);

+                if ((*(uint *)(param_1 + 0xa8) & 0x2000) != 0) {

+                  if (*(longlong *)(*(longlong *)(param_1 + 0x170) + 0x58) == 0) {

+LAB_4:

+                    RIMUnlockShared(lVar11);

+                    goto LAB_3;

+                  }

+                  if (-1 < *(int *)(*(longlong *)(*(longlong *)(param_1 + 0x170) + 0x58) + 0xc)) {

+                    ptVar17 = *(tagUIPI_INFO **)(*(longlong *)(ptVar3 + 0x10) + 0x1d8);

+                    cVar9 = IsInputThread();

+                    if ((cVar9 == '\0') || (-1 < (char)*(undefined4 *)(param_1 + 0xb8))) {

+                      ptVar13 = PtiCurrent();

+                      ptVar14 = (tagUIPI_INFO *)(*(longlong *)(ptVar13 + 0x1d0) + 0x130);

+                    }

+                    else {

+                      ptVar14 = (tagUIPI_INFO *)(*(longlong *)(param_1 + 0x1c8) + 0x3c0);

+                    }

+                    bVar19 = UIPrivilegeIsolation::CheckAccess(ptVar14,ptVar17,0);

+                    if (!bVar19) goto LAB_4;

+                  }

+                }

+                RIMUnlockShared(lVar11);

+              }

+            }

+            else {

+              if (uVar1 == 1) {

+                bVar19 = sVar2 == 9;

+                goto LAB_1;

+              }

+              if (uVar1 < 0xff00) goto LAB_2;

+            }

+            cVar9 = '\0';

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0)) ||

+               (cVar15 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+              cVar15 = cVar9;

+            }

+            if (((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED) &&

+               (*(short *)(WPP_GLOBAL_Control + 0x48) != 0)) {

+              cVar9 = '\x01';

+            }

+            if ((cVar15 != '\0') || (cVar9 != '\0')) {

+              uVar4 = *(undefined8 *)(*(longlong *)(ptVar3 + 0x10) + 0x1d8);

+              lVar11 = W32GetUserSessionState();

+              WPP_RECORDER_AND_TRACE_SF_qq

+                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar15,cVar9,

+                         *(undefined8 *)(lVar11 + 0x10f98),5,0x14,0x13,

+                         &WPP_401b4b7cf61139f03a47396ffc2b5e02_Traceguids,ptVar3,uVar4);

+            }

+            in_stack_ffffffffffffff68 = 0;

+            iVar10 = PostHidInput(param_1,param_2,param_3,ptVar3,1);

+            if (iVar10 == 0) break;

+            bVar7 = true;

+          }

+        }

+        else {

+          (**(code **)(ptVar12 + 0x28))(param_1);

+        }

+      }

+LAB_3:

+      ptVar18 = *(tagPROCESS_HID_TABLE **)ptVar18;

+      lVar11 = W32GetUserSessionState();

+    } while (ptVar18 != (tagPROCESS_HID_TABLE *)(lVar11 + 0xd8));

+  }

+  if ((bVar7) && ((*(uint *)(param_1 + 0xb8) & 0x40) == 0)) {

+    lVar11 = W32GetUserSessionState();

+    auVar5._8_8_ = 0;

+    auVar5._0_8_ = _DAT_5 << 8;

+    CInputGlobals::UpdateInputGlobals

+              (*(CInputGlobals **)(lVar11 + 0xbf0),

+               SUB168(auVar5 * (ZEXT416(_DAT_6) << 0x20),8),4,0,0,0);

+  }

+  if (local_res20[0] == (ReEnterLeaveCrit)0x0) {

+    UserSessionSwitchLeaveCritWithNonPaged();

+  }

+  return;

 }
```

## `ApiSetpGetContractKeyInfo`  (modified)

```diff
--- ApiSetpGetContractKeyInfo
+++ ApiSetpGetContractKeyInfo
@@ -1,37 +1,160 @@
 

-ulonglong ApiSetpGetContractKeyInfo(void)

+ulonglong ApiSetpGetContractKeyInfo

+                    (ulonglong *param_1,ushort param_2,undefined8 param_3,undefined8 *param_4)

 

 {

-  void *_Src;

-  longlong lVar1;

-  char cVar2;

-  ulonglong in_RAX;

-  W32_PUSH_LOCK *unaff_RBX;

-  byte unaff_BPL;

-  longlong unaff_RSI;

-  ulonglong unaff_RDI;

-  int unaff_R12D;

-  undefined4 *unaff_R14;

-  undefined1 *unaff_R15;

+  char *pcVar1;

+  byte bVar2;

+  char cVar3;

+  bool bVar4;

+  bool bVar5;

+  bool bVar6;

+  bool bVar7;

+  bool bVar8;

+  bool bVar9;

+  char *pcVar10;

+  bool bVar11;

+  ulonglong uVar12;

+  ulonglong uVar13;

+  ushort uVar14;

+  short sVar15;

+  ulonglong uVar16;

+  uint uVar17;

+  uint uVar18;

+  byte *pbVar19;

   

-  if (in_RAX == *(uint *)(unaff_RBX + 0x20)) {

-    cVar2 = func_0x00014033e6f4();

-    if (cVar2 == '\0') {

-      unaff_RDI = (ulonglong)unaff_BPL;

+  uVar16 = (ulonglong)param_2;

+  uVar12 = 0;

+  *param_4 = 0;

+  param_4[1] = 0;

+  param_4[2] = 0;

+  param_4[3] = 0;

+  param_4[4] = 0;

+  if (((param_2 < 5) || (uVar12 = (ulonglong)(ushort)(param_2 * 2), (ushort)(param_2 * 2) < 8)) ||

+     ((uVar12 = *param_1 & 0xffffffdfffdfffdf, uVar12 != 0x2d004900500041 &&

+      (uVar12 != 0x2d005400580045)))) {

+LAB_0:

+    return uVar12 & 0xffffffffffffff00;

+  }

+  *param_4 = param_1;

+  *(ushort *)(param_4 + 1) = param_2;

+  *(undefined1 *)((longlong)param_4 + 10) = 1;

+  pbVar19 = (byte *)((longlong)param_1 + uVar16 * 2);

+  bVar8 = false;

+  bVar9 = false;

+  uVar18 = 0;

+  uVar17 = 1;

+  uVar13 = (ulonglong)param_2;

+  bVar4 = false;

+  bVar7 = true;

+  do {

+    uVar12 = 0xffff;

+    pbVar19 = pbVar19 + -2;

+    uVar14 = (short)uVar13 - 1;

+    uVar13 = (ulonglong)uVar14;

+    bVar2 = *pbVar19;

+    bVar5 = true;

+    bVar6 = false;

+    sVar15 = (short)uVar16;

+    bVar11 = bVar6;

+    if (bVar2 == 0x2d) {

+      if (bVar4) {

+        if (!bVar9) {

+          *(short *)(param_4 + 3) = (short)uVar18;

+          bVar9 = true;

+          uVar18 = 0;

+          *(undefined4 *)((longlong)param_4 + 0xc) = 3;

+          *(ushort *)((longlong)param_4 + 0x12) = uVar14;

+          bVar6 = bVar5;

+          goto LAB_1;

+        }

+      }

+      else {

+        *(undefined4 *)((longlong)param_4 + 0xc) = 1;

+        *(short *)((longlong)param_4 + 0x12) = sVar15;

+        uVar13 = uVar16;

+      }

+LAB_2:

+      uVar14 = (ushort)uVar13;

+      *(ushort *)((longlong)param_4 + 0x14) = uVar14;

+      if ((((7 < uVar14) && (((char)param_1[1] + 0xb3U & 0xdf) == 0)) &&

+          ((*(char *)((longlong)param_1 + 10) + 0xadU & 0xdf) == 0)) &&

+         (*(char *)((longlong)param_1 + 0xc) == '-')) {

+        *(undefined4 *)((longlong)param_4 + 0x1a) = 0x60004;

+      }

+      bVar2 = 0;

+      pcVar10 = (char *)(uVar13 * 2 + (longlong)param_1);

+      uVar16 = uVar13;

+      break;

+    }

+    if (bVar2 == 0x7e) {

+      if (!bVar9) {

+        *(short *)((longlong)param_4 + 0x12) = sVar15;

+        *(undefined4 *)((longlong)param_4 + 0xc) = 2;

+        *(ushort *)((longlong)param_4 + 0x16) = (sVar15 - uVar14) + -1;

+        goto LAB_2;

+      }

       goto LAB_0;

     }

+    if (bVar2 == 0x2e) {

+      if ((bVar9) || (bVar8)) goto LAB_0;

+      bVar8 = true;

+      uVar16 = uVar13;

+      bVar6 = true;

+    }

+    else {

+      bVar11 = false;

+      if ((byte)(bVar2 - 0x30) < 10) {

+        if (bVar7) {

+          uVar18 = bVar2 - 0x30;

+          uVar17 = 10;

+          bVar11 = bVar5;

+        }

+        else {

+          bVar11 = bVar4;

+          if (bVar4) {

+            uVar12 = (ulonglong)(uVar18 & 0xffff);

+            uVar18 = (bVar2 - 0x30) * uVar17 + (uVar18 & 0xffff);

+            if (0xffff < uVar18) goto LAB_0;

+            uVar18 = uVar18 & 0xffff;

+            uVar17 = uVar17 * 10;

+            if (0xffff < uVar17) {

+              uVar17 = 0x10000;

+            }

+          }

+        }

+      }

+    }

+LAB_1:

+    bVar4 = bVar11;

+    uVar12 = 0xffff;

+    bVar7 = bVar6;

+    if (uVar14 < 2) goto LAB_0;

+  } while( true );

+joined_r0x00014033fc11:

+  if (uVar14 < 5) {

+LAB_3:

+    return CONCAT71((int7)(uVar13 >> 8),1);

   }

-  _Src = (void *)(*(longlong *)(unaff_RBX + 0x30) + unaff_RSI * 8);

-  memcpy((void *)((longlong)_Src + 8),_Src,(*(longlong *)(unaff_RBX + 0x28) - unaff_RSI) * 8);

-  lVar1 = *(longlong *)(unaff_RBX + 0x30);

-  *(undefined4 *)(lVar1 + unaff_RSI * 8) = *unaff_R14;

-  *(undefined1 *)(lVar1 + 4 + unaff_RSI * 8) = *unaff_R15;

-  *(ulonglong *)(unaff_RBX + 0x28) = *(longlong *)(unaff_RBX + 0x28) + unaff_RDI;

-LAB_0:

-  LOCK();

-  *(int *)(unaff_RBX + 0x1c) = *(int *)(unaff_RBX + 0x1c) + unaff_R12D;

-  UNLOCK();

-  W32ReleasePushLockExclusive(unaff_RBX);

-  return unaff_RDI & 0xff;

+  pcVar1 = pcVar10 + -2;

+  sVar15 = (short)uVar16;

+  uVar14 = sVar15 - 1;

+  uVar16 = (ulonglong)uVar14;

+  cVar3 = *pcVar1;

+  uVar13 = CONCAT71((int7)(uVar13 >> 8),cVar3 - 0x30U);

+  if (9 < (byte)(cVar3 - 0x30U)) {

+    if (((bVar6) && ((cVar3 + 0xb4U & 0xdf) == 0)) && (sVar15 = sVar15 + -2, pcVar10[-4] == '-')) {

+      *(short *)((longlong)param_4 + 0x1e) = sVar15;

+      *(ushort *)(param_4 + 4) = bVar2 + 1 + sVar15;

+    }

+    goto LAB_3;

+  }

+  bVar4 = !bVar6;

+  pcVar10 = pcVar1;

+  bVar6 = bVar5;

+  if ((bVar4) && (cVar3 == '1')) {

+    bVar2 = 1;

+  }

+  goto joined_r0x00014033fc11;

 }
```

## `xxxInterSendMsgEx`  (modified)

```diff
--- xxxInterSendMsgEx
+++ xxxInterSendMsgEx
@@ -1,244 +1,876 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Type propagation algorithm not settling */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

 

-int xxxInterSendMsgEx(undefined8 param_1,int param_2,size_t param_3)

+tagTHREADINFO *

+xxxInterSendMsgEx(tagWND *param_1,uint param_2,ulonglong param_3,tagTHREADINFO *param_4,int param_5,

+                 tagTHREADINFO *param_6,uint *param_7,int param_8,int param_9)

 

 {

-  longlong lVar1;

-  bool bVar2;

-  int iVar3;

-  int iVar4;

-  undefined1 *puVar5;

-  int iVar6;

-  ulonglong uVar7;

-  _RECTL *unaff_RBX;

-  int iVar8;

-  longlong unaff_RSI;

-  byte unaff_DIL;

-  longlong *plVar9;

-  longlong *plVar10;

-  undefined8 *puVar11;

-  code *unaff_R12;

-  uint uVar12;

-  int iVar13;

-  undefined4 uVar14;

-  int *piStack0000000000000028;

-  int iStack0000000000000060;

-  int iStack0000000000000068;

-  longlong *in_stack_00000070;

-  undefined8 in_stack_00000078;

-  undefined4 in_stack_00000080;

-  undefined8 *in_stack_000000b0;

-  undefined1 *in_stack_000000f0;

-  undefined4 uStack00000000000000f8;

-  undefined4 uStack00000000000000fc;

-  undefined8 *in_stack_00000100;

-  undefined4 uStack0000000000000108;

-  undefined4 uStack000000000000010c;

-  longlong in_stack_00000110;

-  longlong in_stack_00000118;

-  byte in_stack_000007c0;

+  HWND__ *pHVar1;

+  longlong *plVar2;

+  undefined8 *puVar3;

+  code *pcVar4;

+  ulonglong uVar5;

+  bool bVar6;

+  bool bVar7;

+  ulong uVar8;

+  int iVar9;

+  ulong uVar10;

+  undefined4 uVar11;

+  longlong *plVar12;

+  undefined8 *puVar13;

+  tagTHREADINFO *ptVar14;

+  tagTHREADINFO *ptVar15;

+  longlong lVar16;

+  undefined8 uVar17;

+  tagTHREADINFO *_Dst;

+  tagHIDDATA *ptVar18;

+  tagHIDDATA *ptVar19;

+  longlong *plVar20;

+  uint uVar21;

+  uint uVar22;

+  undefined8 uVar23;

+  char cVar24;

+  tagTHREADINFO *ptVar26;

+  uint uVar27;

+  undefined1 *_Size;

+  tagTHREADINFO *ptVar28;

+  tagTHREADINFO *ptVar29;

+  undefined8 extraout_XMM0_Qa;

+  undefined8 extraout_XMM0_Qa_00;

+  ulonglong local_res18;

+  tagTHREADINFO *local_res20;

+  uint local_f4;

+  tagTHREADINFO *local_e8;

+  uint local_e0;

+  int local_dc;

+  int local_d8;

+  undefined1 local_d0 [16];

+  tagTHREADINFO *local_c0;

+  undefined8 local_b8;

+  tagTHREADINFO *local_b0;

+  undefined8 local_a8;

+  longlong local_a0;

+  tagTHREADINFO *local_98;

+  tagTHREADINFO *local_90;

+  undefined8 local_88;

+  longlong *local_80;

+  tagTHREADINFO *local_78;

+  tagTHREADINFO *local_70;

+  longlong *local_68;

+  tagWND *local_60;

+  CKernelStackSwapAuto local_48 [16];

+  ulong uVar25;

   

-  memset((void *)((ulonglong)&stack0x000000b0 & 0xffffffff),param_2,param_3);

-  if ((unaff_DIL & 1) != 0) {

-    plVar10 = (longlong *)(unaff_RSI + 0x30);

-    if (*plVar10 != 0) {

-      if (unaff_RBX == (_RECTL *)0x0) {

-        (*unaff_R12)(*plVar10,*(undefined4 *)(unaff_RSI + 0x38));

-        return 1;

-      }

-      iVar13 = 0;

-      for (uVar12 = 0; uVar12 < *(uint *)(unaff_RSI + 0x38); uVar12 = uVar12 + 1) {

-        lVar1 = *plVar10;

-        uVar7 = (ulonglong)uVar12;

-        in_stack_00000100 =

-             (undefined8 *)

-             CONCAT44(*(undefined4 *)(lVar1 + 4 + uVar7 * 0x10),

-                      *(undefined4 *)(lVar1 + uVar7 * 0x10));

-        uStack0000000000000108 = *(undefined4 *)(lVar1 + 8 + uVar7 * 0x10);

-        uStack000000000000010c = *(undefined4 *)(lVar1 + 0xc + uVar7 * 0x10);

-        if ((((*(int *)unaff_RBX < *(int *)(lVar1 + uVar7 * 0x10)) &&

-             (*(int *)(unaff_RBX + 4) < *(int *)(lVar1 + 4 + uVar7 * 0x10))) &&

-            (*(int *)(lVar1 + 8 + uVar7 * 0x10) < *(int *)(unaff_RBX + 8))) &&

-           (*(int *)(lVar1 + 0xc + uVar7 * 0x10) < *(int *)(unaff_RBX + 0xc))) {

-          iVar13 = iVar13 + 1;

+  ptVar28 = (tagTHREADINFO *)0x0;

+  local_88 = 0;

+  uVar10 = 0;

+  local_98 = (tagTHREADINFO *)0x0;

+  local_90 = (tagTHREADINFO *)0x0;

+  local_d0 = ZEXT816(0);

+  local_c0 = (tagTHREADINFO *)0x0;

+  local_d8 = 0;

+  local_res18 = param_3;

+  local_res20 = param_4;

+  plVar12 = (longlong *)PsGetCurrentProcessWin32Process();

+  if ((plVar12 != (longlong *)0x0) && (*plVar12 == 0)) {

+    plVar12 = (longlong *)0x0;

+  }

+  puVar13 = (undefined8 *)PsGetCurrentThreadWin32Thread();

+  ptVar14 = ptVar28;

+  if (puVar13 != (undefined8 *)0x0) {

+    ptVar14 = (tagTHREADINFO *)*puVar13;

+  }

+  ptVar26 = ptVar14;

+  if (param_5 == 0) {

+    ptVar26 = ptVar28;

+  }

+  if (ptVar26 != (tagTHREADINFO *)0x0) {

+    LOCK();

+    uVar27 = *(uint *)(ptVar26 + 0x210);

+    if (uVar27 == 0) {

+      *(int *)(ptVar26 + 0x210) = 0;

+      uVar27 = 0;

+    }

+    UNLOCK();

+    param_3 = local_res18;

+    param_4 = local_res20;

+    if ((uVar27 & 1) != 0) {

+      return (tagTHREADINFO *)0x0;

+    }

+  }

+  local_a8 = 0;

+  local_a0 = 0;

+  local_e8 = ptVar26;

+  local_70 = ptVar26;

+  IoGetStackLimits(&local_a0,&local_a8);

+  if ((ulonglong)((longlong)&local_a8 - local_a0) < 0x2000) {

+    return (tagTHREADINFO *)0x0;

+  }

+  uVar25 = 0;

+  if (param_1 != (tagWND *)0x0) {

+    uVar8 = uVar10;

+    if (*(longlong **)(*(longlong *)(param_1 + 0x10) + 0x1d0) != plVar12) {

+      if (param_2 < 0xd1) {

+        if (param_2 != 0xd0) {

+          switch(param_2) {

+          case 0xd:

+          case 0xc4:

+          case 0xcc:

+            lVar16 = W32GetUserSessionState();

+            if ((*(short *)(*(longlong *)(lVar16 + 0x4e30) + 0x366) ==

+                 *(short *)(*(longlong *)(*(longlong *)(param_1 + 0x88) + 8) + 2)) &&

+               ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1c) & 0x20) != 0)) {

+              UserSetLastError(5);

+              goto switchD_140100b28_caseD_4e;

+            }

+            break;

+          case 0x4e:

+switchD_140100b28_caseD_4e:

+            uVar8 = 1;

+            goto LAB_0;

+          }

+        }

+      }

+      else if (param_2 == 0x110) goto switchD_140100b28_caseD_4e;

+      uVar8 = uVar25;

+    }

+LAB_0:

+    if (uVar8 != 0) {

+      UserSetLastError(5);

+      return (tagTHREADINFO *)0x0;

+    }

+  }

+  if (param_8 == 0) {

+    if (param_1 == (tagWND *)0x0) {

+      ptVar15 = param_6;

+      ptVar29 = ptVar28;

+      if (param_6 != (tagTHREADINFO *)0x0) goto LAB_1;

+    }

+    else {

+      ptVar15 = *(tagTHREADINFO **)(param_1 + 0x10);

+LAB_1:

+      ptVar29 = *(tagTHREADINFO **)(ptVar15 + 0x1d0);

+    }

+    iVar9 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+    if (iVar9 == 0) {

+      iVar9 = CheckForMessageAccessCrossIL(plVar12,ptVar29,param_1,param_2,param_3,param_4);

+      if ((iVar9 == 0) &&

+         (bVar6 = UserCheckForMessageAccessWithWindowCapability(param_1,param_2), !bVar6)) {

+        return (tagTHREADINFO *)0x0;

+      }

+    }

+    else {

+      iVar9 = CheckForMessageAccessCrossIL(plVar12,ptVar29,param_1,param_2,param_3,param_4);

+      if (iVar9 == 0) {

+        return (tagTHREADINFO *)0x0;

+      }

+    }

+  }

+  if (param_2 == 0x240) {

+    uVar23 = 0x14;

+LAB_2:

+    lVar16 = HMValidateHandleWithDescriptor(param_4,uVar23);

+    if (lVar16 == 0) {

+      return (tagTHREADINFO *)0x0;

+    }

+  }

+  else if (param_2 == 0x119) {

+    uVar23 = 0x15;

+    goto LAB_2;

+  }

+  bVar6 = tagPROCESSINFO::SyncAndTestFreeze(*(tagPROCESSINFO **)(param_6 + 0x1d0));

+  if (bVar6) {

+    if (param_7 == (uint *)0x0) {

+LAB_3:

+      if (ptVar26 != (tagTHREADINFO *)0x0) {

+        uVar23 = **(undefined8 **)(param_6 + 0x1d0);

+        uVar17 = PsGetCurrentProcess();

+        lVar16 = PsGetProcessCommonJob(uVar17,uVar23);

+        if (lVar16 == 0) {

+          return (tagTHREADINFO *)0x0;

+        }

+        goto LAB_4;

+      }

+LAB_5:

+      if (param_7 == (uint *)0x0) {

+        if (param_2 == 0x219) {

+          return (tagTHREADINFO *)0x0;

+        }

+        iVar9 = ProcessSuspendedSendMessage(param_6,param_1,param_2,param_3,param_4);

+        if (iVar9 == 0) {

+          return (tagTHREADINFO *)0x0;

+        }

+      }

+    }

+    else {

+      if ((param_7[8] & 0x40) == 0) {

+        if (((param_7 != (uint *)0x0) && (*param_7 == 2)) && (param_7[9] != 0)) {

+          return (tagTHREADINFO *)0x0;

+        }

+        goto LAB_3;

+      }

+LAB_4:

+      if (ptVar26 == (tagTHREADINFO *)0x0) goto LAB_5;

+    }

+    if ((ptVar26 == (tagTHREADINFO *)0x0) && (10000 < *(uint *)(param_6 + 0x240))) {

+      return (tagTHREADINFO *)0x0;

+    }

+  }

+  lVar16 = W32GetUserSessionState();

+  plVar12 = (longlong *)Win32AllocateFromPagedLookasideList(*(undefined8 *)(lVar16 + 0x10f50));

+  if (plVar12 == (longlong *)0x0) {

+    return (tagTHREADINFO *)0x0;

+  }

+  plVar12[0xf] = 0;

+  local_f4 = 0;

+  _Size = (undefined1 *)0x0;

+  *(undefined4 *)(plVar12 + 0x10) = *(undefined4 *)(ptVar14 + 0x65c);

+  local_80 = plVar12;

+  local_78 = param_4;

+  if ((param_7 == (uint *)0x0) || (*param_7 != 0x21)) {

+    ptVar26 = param_4;

+    ptVar15 = param_4;

+    if (0x143 < param_2) {

+      if (param_2 < 0x284) {

+        if (param_2 == 0x283) {

+          if (local_res18 == 0x18) {

+            _Size = (undefined1 *)(ulonglong)(*(int *)param_4 * 0x200 + 4);

+          }

         }

         else {

-          ERECTL::operator*=((ERECTL *)&stack0x00000100,unaff_RBX);

-          if (iVar13 != 0) {

-            (*unaff_R12)((ulonglong)(uVar12 - iVar13) * 0x10 + lVar1,iVar13);

-            iVar13 = 0;

-          }

-          iVar3 = ERECTL::bEmpty((ERECTL *)&stack0x00000100);

-          if (iVar3 == 0) {

-            (*unaff_R12)(&stack0x00000100,1);

-          }

-        }

-      }

-      if (iVar13 == 0) {

-        return 1;

-      }

-      (*unaff_R12)((ulonglong)(*(uint *)(unaff_RSI + 0x38) - iVar13) * 0x10 + *plVar10,iVar13);

-      return 1;

-    }

-  }

-  if ((unaff_DIL & 3) == 2) {

-    plVar10 = (longlong *)(unaff_RSI + 0x40);

-    if (*plVar10 != 0) {

-      if (unaff_RBX == (_RECTL *)0x0) {

-        (*unaff_R12)(*plVar10,*(undefined4 *)(unaff_RSI + 0x3c));

+          switch(param_2) {

+          case 0x145:

+          case 0x18d:

+          case 0x196:

+            goto switchD_140100e36_caseD_1b;

+          case 0x148:

+          case 0x189:

+            goto switchD_140100e36_caseD_d;

+          case 0x14a:

+          case 0x14c:

+          case 0x14d:

+          case 0x158:

+          case 0x180:

+          case 0x181:

+          case 0x18c:

+          case 399:

+          case 0x1a2:

+            goto switchD_140100f61_caseD_14a;

+          case 0x191:

+          case 0x192:

+            goto switchD_140100e36_caseD_cb;

+          case 0x218:

+            if ((((param_4 != (tagTHREADINFO *)0x0) && ((local_res18 & 0x8000) != 0)) &&

+                ((param_4 < *(tagTHREADINFO **)MmSystemRangeStart_exref ||

+                 (local_e8 == (tagTHREADINFO *)0x0)))) &&

+               (_Size = (undefined1 *)(ulonglong)(*(int *)(param_4 + 0x10) + 0x14U),

+               *(int *)(param_4 + 0x10) + 0x14U < 0x14)) {

+              lVar16 = W32GetUserSessionState();

+              Win32FreeToPagedLookasideList(*(undefined8 *)(lVar16 + 0x10f50),plVar12);

+              return (tagTHREADINFO *)&DAT_6;

+            }

+            break;

+          case 0x219:

+            if (((param_4 != (tagTHREADINFO *)0x0) && ((local_res18 & 0x8000) != 0)) &&

+               ((param_4 < *(tagTHREADINFO **)MmSystemRangeStart_exref ||

+                (local_e8 == (tagTHREADINFO *)0x0)))) goto switchD_140100e36_caseD_53;

+            break;

+          case 0x220:

+            _Size = (undefined1 *)

+                    (ulonglong)

+                    ((*(uint *)(param_4 + 0x4c) & 0x7fffffff) +

+                    (*(uint *)(param_4 + 0x3c) & 0x7fffffff));

+            local_90 = param_4;

+          }

+        }

+      }

+      else if (param_2 == 0x30c) {

+switchD_140100e36_caseD_d:

+        local_d0 = *(undefined1 (*) [16])param_4;

+        local_d8 = (-1 < local_d0._0_8_) + 1;

+        local_res20 = (tagTHREADINFO *)local_d0;

+        ptVar26 = local_res20;

+        if ((local_d0._8_8_ < *(ulonglong *)MmSystemRangeStart_exref) ||

+           (local_e8 == (tagTHREADINFO *)0x0)) {

+          _Size = (undefined1 *)(ulonglong)(local_d0._4_4_ & 0x7fffffff);

+        }

+      }

+      else if (param_2 == 0x341) {

+        _Size = (undefined1 *)0x68;

+        local_f4 = 0x68;

       }

       else {

-        iVar13 = 0;

-        for (uVar12 = 0; uVar12 < *(uint *)(unaff_RSI + 0x3c); uVar12 = uVar12 + 1) {

-          lVar1 = *plVar10;

-          uVar7 = (ulonglong)uVar12;

-          iVar3 = *(int *)(lVar1 + uVar7 * 0x10);

-          if (((*(int *)unaff_RBX < iVar3) &&

-              (*(int *)(unaff_RBX + 4) < *(int *)(lVar1 + 4 + uVar7 * 0x10))) &&

-             ((*(int *)(lVar1 + 8 + uVar7 * 0x10) < *(int *)(unaff_RBX + 8) &&

-              (*(int *)(lVar1 + 0xc + uVar7 * 0x10) < *(int *)(unaff_RBX + 0xc))))) {

-            iVar13 = iVar13 + 1;

+        if (param_2 == 0x342) {

+          _Size = (undefined1 *)0x50;

+          goto LAB_7;

+        }

+        if (param_2 == 0x344) {

+          _Size = (undefined1 *)0x4b4;

+          local_f4 = 0x4b4;

+        }

+        else if (param_2 == 0x346) {

+          _Size = &DAT_8;

+        }

+      }

+      goto switchD_140100e36_caseD_2;

+    }

+    if (param_2 == 0x143) {

+switchD_140100f61_caseD_14a:

+      if (*(int *)(ptVar14 + 0x65c) != 1) goto switchD_140100e36_caseD_1b;

+      goto switchD_140100e36_caseD_2;

+    }

+    switch(param_2) {

+    case 1:

+    case 0x81:

+      UserSetLastError(5);

+      lVar16 = W32GetUserSessionState();

+      Win32FreeToPagedLookasideList(*(undefined8 *)(lVar16 + 0x10f50),plVar12);

+      return (tagTHREADINFO *)0x0;

+    case 0xc:

+    case 0x1a:

+    case 0xc2:

+      if (param_4 != (tagTHREADINFO *)0x0) goto switchD_140100e36_caseD_1b;

+      break;

+    case 0xd:

+    case 0xc4:

+      goto switchD_140100e36_caseD_d;

+    case 0x1b:

+switchD_140100e36_caseD_1b:

+      local_d0 = *(undefined1 (*) [16])param_4;

+      if (((*(ulonglong *)(param_4 + 8) < *(ulonglong *)MmSystemRangeStart_exref) ||

+          (local_e8 == (tagTHREADINFO *)0x0)) &&

+         (uVar27 = (uint)*(undefined8 *)param_4 + 0x12, _Size = (undefined1 *)(ulonglong)uVar27,

+         uVar27 < (uint)*(undefined8 *)param_4)) {

+        lVar16 = W32GetUserSessionState();

+        Win32FreeToPagedLookasideList(*(undefined8 *)(lVar16 + 0x10f50),plVar12);

+        return (tagTHREADINFO *)&DAT_6;

+      }

+      break;

+    case 0x38:

+      _Size = (undefined1 *)(ulonglong)*(ushort *)param_4;

+      break;

+    case 0x46:

+    case 0x47:

+      _Size = (undefined1 *)0x28;

+      local_f4 = 0x28;

+      break;

+    case 0x49:

+      _Size = (undefined1 *)(local_res18 & 0xffffffff);

+      break;

+    case 0x4a:

+      local_98 = param_4;

+      if (*(longlong *)(param_4 + 0x10) != 0) {

+        _Size = (undefined1 *)(ulonglong)(*(int *)(param_4 + 8) + 0x18U);

+        if (*(int *)(param_4 + 8) + 0x18U < 0x18) {

+          lVar16 = W32GetUserSessionState();

+          Win32FreeToPagedLookasideList(*(undefined8 *)(lVar16 + 0x10f50),plVar12);

+          return (tagTHREADINFO *)0x0;

+        }

+        break;

+      }

+      _Size = &DAT_9;

+      goto LAB_7;

+    case 0x53:

+switchD_140100e36_caseD_53:

+      _Size = (undefined1 *)(ulonglong)*(uint *)param_4;

+      break;

+    case 0x83:

+      _Size = &DAT_8;

+      if (local_res18 == 0) {

+        _Size = &DAT_10;

+      }

+      local_f4 = (uint)_Size;

+      break;

+    case 0xcb:

+switchD_140100e36_caseD_cb:

+      _Size = (undefined1 *)(ulonglong)(uint)((int)local_res18 * 4);

+    }

+switchD_140100e36_caseD_2:

+    uVar27 = 0;

+    ptVar15 = ptVar26;

+    if ((int)_Size != 0) {

+LAB_7:

+      uVar27 = (uint)_Size;

+      _Dst = (tagTHREADINFO *)Win32AllocPoolWithQuotaZInit(_Size,0x63737355);

+      ptVar29 = local_90;

+      plVar12[0xf] = (longlong)_Dst;

+      ptVar26 = ptVar15;

+      if (_Dst != (tagTHREADINFO *)0x0) {

+        ptVar26 = _Dst;

+        local_c0 = ptVar15;

+        if (0x143 < param_2) {

+          if (0x30c < param_2) goto switchD_1401011fe_caseD_e;

+          if (param_2 != 0x30c) {

+            switch(param_2) {

+            case 0x145:

+            case 0x14a:

+            case 0x14c:

+            case 0x14d:

+            case 0x158:

+            case 0x180:

+            case 0x181:

+            case 0x18c:

+            case 0x18d:

+            case 399:

+            case 0x196:

+            case 0x1a2:

+              goto switchD_1401011fe_caseD_c;

+            case 0x148:

+            case 0x189:

+              goto switchD_1401011fe_caseD_d;

+            case 0x191:

+              local_f4 = uVar27;

+            default:

+switchD_1401011fe_caseD_e:

+              memcpy(_Dst,param_4,(size_t)_Size);

+              break;

+            case 0x220:

+              if (*(void **)(local_90 + 0x50) != (void *)0x0) {

+                memcpy(_Dst,*(void **)(local_90 + 0x50),

+                       (ulonglong)(*(uint *)(local_90 + 0x4c) & 0x7fffffff));

+                *(longlong *)ptVar29 = plVar12[0xf];

+              }

+              ptVar26 = ptVar15;

+              if (*(int *)(ptVar29 + 0x38) != 0) {

+                ptVar26 = (tagTHREADINFO *)

+                          ((ulonglong)(*(uint *)(ptVar29 + 0x4c) & 0x7fffffff) + plVar12[0xf]);

+                local_78 = ptVar26;

+                memcpy(ptVar26,*(void **)(ptVar29 + 0x40),

+                       (ulonglong)(*(uint *)(ptVar29 + 0x3c) & 0x7fffffff));

+                *(tagTHREADINFO **)(ptVar29 + 8) = ptVar26;

+                ptVar26 = ptVar15;

+              }

+              goto LAB_11;

+            }

+            goto LAB_12;

+          }

+          goto switchD_1401011fe_caseD_d;

+        }

+        if (param_2 == 0x143) {

+switchD_1401011fe_caseD_c:

+          uVar22 = *(uint *)(_Dst + 4) & 0x7fffffff | local_d0._4_4_ & 0x80000000;

+          *(uint *)(_Dst + 4) = uVar22;

+          *(undefined4 *)_Dst = local_d0._0_4_;

+          *(tagTHREADINFO **)(_Dst + 8) = _Dst + 0x10;

+          uVar22 = (uVar27 - 0x10 ^ uVar22) & 0x7fffffff ^ uVar22;

+          *(uint *)(_Dst + 4) = uVar22;

+          local_res20 = _Dst;

+          memcpy(_Dst + 0x10,(void *)local_d0._8_8_,(ulonglong)(uVar22 & 0x7fffffff));

+        }

+        else {

+          switch(param_2) {

+          case 0xc:

+          case 0x1a:

+          case 0x1b:

+          case 0xc2:

+            goto switchD_1401011fe_caseD_c;

+          default:

+            goto switchD_1401011fe_caseD_e;

+          case 0x4a:

+            uVar23 = *(undefined8 *)(local_98 + 8);

+            *(undefined8 *)_Dst = *(undefined8 *)local_98;

+            *(undefined8 *)(_Dst + 8) = uVar23;

+            *(undefined8 *)(_Dst + 0x10) = *(undefined8 *)(local_98 + 0x10);

+            local_res20 = _Dst;

+            if (*(longlong *)(local_98 + 0x10) != 0) {

+              *(tagTHREADINFO **)(_Dst + 0x10) = _Dst + 0x18;

+              memcpy(_Dst + 0x18,*(void **)(local_98 + 0x10),(ulonglong)*(uint *)(local_98 + 8));

+            }

+            break;

+          case 0x83:

+            if (local_res18 == 0) goto switchD_1401011fe_caseD_e;

+            uVar23 = *(undefined8 *)(param_4 + 8);

+            *(undefined8 *)_Dst = *(undefined8 *)param_4;

+            *(undefined8 *)(_Dst + 8) = uVar23;

+            uVar23 = *(undefined8 *)(param_4 + 0x18);

+            *(undefined8 *)(_Dst + 0x10) = *(undefined8 *)(param_4 + 0x10);

+            *(undefined8 *)(_Dst + 0x18) = uVar23;

+            uVar23 = *(undefined8 *)(param_4 + 0x28);

+            *(undefined8 *)(_Dst + 0x20) = *(undefined8 *)(param_4 + 0x20);

+            *(undefined8 *)(_Dst + 0x28) = uVar23;

+            *(undefined8 *)(_Dst + 0x30) = *(undefined8 *)(param_4 + 0x30);

+            lVar16 = plVar12[0xf];

+            *(undefined8 **)(_Dst + 0x30) = (undefined8 *)(lVar16 + 0x38);

+            puVar13 = *(undefined8 **)(param_4 + 0x30);

+            uVar23 = puVar13[1];

+            *(undefined8 *)(lVar16 + 0x38) = *puVar13;

+            *(undefined8 *)(lVar16 + 0x40) = uVar23;

+            uVar23 = puVar13[3];

+            *(undefined8 *)(lVar16 + 0x48) = puVar13[2];

+            *(undefined8 *)(lVar16 + 0x50) = uVar23;

+            *(undefined8 *)(lVar16 + 0x58) = puVar13[4];

+LAB_12:

+            ptVar26 = (tagTHREADINFO *)plVar12[0xf];

+            local_res20 = (tagTHREADINFO *)plVar12[0xf];

+            break;

+          case 0xc4:

+            *(undefined2 *)_Dst = *(undefined2 *)local_d0._8_8_;

+          case 0xd:

+switchD_1401011fe_caseD_d:

+            local_c0 = (tagTHREADINFO *)local_d0._8_8_;

+            local_d0._8_8_ = plVar12[0xf];

+            ptVar26 = ptVar15;

+            local_f4 = uVar27;

+          }

+        }

+      }

+    }

+LAB_11:

+    param_4 = ptVar26;

+    if ((uVar27 != 0) && (plVar12[0xf] == 0)) {

+      lVar16 = W32GetUserSessionState();

+      Win32FreeToPagedLookasideList(*(undefined8 *)(lVar16 + 0x10f50),plVar12);

+      return (tagTHREADINFO *)0x0;

+    }

+    if (((param_9 != 0) && (param_1 != (tagWND *)0x0)) &&

+       ((iVar9 = IsWindowDesktopComposed(param_1), iVar9 != 0 &&

+        (iVar9 = IsPointerInputMessage(param_2), iVar9 == 0)))) {

+      TransformMessageBetweenCoordinateSpaces

+                (extraout_XMM0_Qa,1,&local_res18,&local_res20,param_1,0);

+      param_4 = local_res20;

+    }

+  }

+  local_68 = plVar12 + 0xe;

+  *local_68 = 0;

+  plVar12[2] = 0;

+  local_60 = param_1;

+  HMAssignmentLock(&local_68,0);

+  uVar5 = local_res18;

+  *(uint *)(plVar12 + 0xd) = param_2;

+  plVar12[0xb] = local_res18;

+  plVar12[0xc] = (longlong)param_4;

+  *(undefined4 *)((longlong)plVar12 + 0x54) = 0;

+  plVar12[9] = 0;

+  if ((param_2 == 0x240) || (param_2 == 0x119)) {

+    lVar16 = _HMObjectFromHandle(param_4);

+    if (lVar16 != 0) {

+      HMChangeOwnerThread(lVar16,param_6);

+    }

+  }

+  else if ((((param_2 == 0xff) &&

+            (ptVar18 = (tagHIDDATA *)HMValidateHandleNoSecure(param_4,0x12),

+            ptVar18 != (tagHIDDATA *)0x0)) && (*(tagHIDDATA **)(ptVar14 + 0x478) == ptVar18)) &&

+          (param_1 != (tagWND *)0x0)) {

+    ptVar19 = (tagHIDDATA *)

+              AllocateHidData(*(undefined8 *)(ptVar18 + 0x40),*(undefined4 *)(ptVar18 + 0x38),

+                              *(int *)(ptVar18 + 0x3c) + -0x18,uVar5,param_1);

+    if (ptVar19 != (tagHIDDATA *)0x0) {

+      memcpy(ptVar19 + 0x38,ptVar18 + 0x38,(ulonglong)*(uint *)(ptVar19 + 0x3c));

+      pHVar1 = *(HWND__ **)param_1;

+      if (*(undefined8 **)(ptVar19 + 0x10) != (undefined8 *)0x0) {

+        uVar10 = PsGetThreadId(**(undefined8 **)(ptVar19 + 0x10));

+      }

+      InputTraceLogging::RawInput::CopyHidData(ptVar18,ptVar19,uVar10,pHVar1);

+    }

+    if (ptVar19 != (tagHIDDATA *)0x0) {

+      *(uint *)(ptVar19 + 0x30) = *(uint *)(ptVar19 + 0x30) & 0xfffffffe;

+      ExpInterlockedPushEntrySList(param_6 + 0x480,ptVar19 + 0x20);

+      local_res20 = *(tagTHREADINFO **)ptVar19;

+      plVar12[0xc] = (longlong)local_res20;

+    }

+  }

+  lVar16 = W32GetUserSessionState();

+  ptVar26 = local_e8;

+  plVar20 = (longlong *)(lVar16 + 0x10f30);

+  lVar16 = *plVar20;

+  if (*(longlong **)(lVar16 + 8) == plVar20) {

+    *plVar12 = lVar16;

+    plVar12[1] = (longlong)plVar20;

+    *(longlong **)(lVar16 + 8) = plVar12;

+    *plVar20 = (longlong)plVar12;

+    *(int *)(plVar12 + 10) = (int)((ulonglong)_DAT_13 * _DAT_fffff78000000320 >> 0x18)

+    ;

+    plVar12[5] = (longlong)param_6;

+    plVar12[4] = (longlong)local_e8;

+    uVar11 = W32GetCurrentThreadDpiAwarenessContext();

+    *(undefined4 *)((longlong)plVar12 + 0x84) = uVar11;

+    plVar12[8] = 0;

+    if ((param_7 != (uint *)0x0) && ((*param_7 & 1) != 0)) {

+      uVar21 = *param_7 & 0x100;

+      uVar27 = *(uint *)((longlong)plVar12 + 0x54);

+      uVar22 = 0x400;

+      if (uVar21 == 0) {

+        uVar22 = 0x800;

+      }

+      *(uint *)((longlong)plVar12 + 0x54) = uVar22 | uVar27;

+      plVar12[6] = *(longlong *)(param_7 + 2);

+      plVar12[7] = *(longlong *)(param_7 + 4);

+      if ((*param_7 & 0x20) == 0) {

+        uVar22 = 0x500;

+        if (uVar21 == 0) {

+          uVar22 = 0x900;

+        }

+        *(uint *)((longlong)plVar12 + 0x54) = uVar22 | uVar27;

+        plVar12[8] = (longlong)ptVar14;

+      }

+      else {

+        uVar22 = 0x600;

+        if (uVar21 == 0) {

+          uVar22 = 0xa00;

+        }

+        *(uint *)((longlong)plVar12 + 0x54) = uVar22 | uVar27;

+        plVar12[9] = *(longlong *)(param_7 + 6);

+      }

+    }

+    if (param_9 != 0) {

+      *(uint *)((longlong)plVar12 + 0x54) = *(uint *)((longlong)plVar12 + 0x54) | 0x10000;

+    }

+    plVar20 = plVar12 + 2;

+    plVar2 = *(longlong **)(param_6 + 0x238);

+    if ((tagTHREADINFO *)*plVar2 == param_6 + 0x230) {

+      *plVar20 = (longlong)(param_6 + 0x230);

+      plVar12[3] = (longlong)plVar2;

+      *plVar2 = (longlong)plVar20;

+      *(longlong **)(param_6 + 0x238) = plVar20;

+      *(int *)(param_6 + 0x240) = *(int *)(param_6 + 0x240) + 1;

+      if (ptVar26 == (tagTHREADINFO *)0x0) {

+        *(uint *)((longlong)plVar12 + 0x54) = *(uint *)((longlong)plVar12 + 0x54) | 8;

+      }

+      else {

+        local_88 = *(undefined8 *)(ptVar26 + 0x220);

+        *(longlong **)(ptVar26 + 0x220) = plVar12;

+      }

+      if (((*(uint *)((longlong)plVar12 + 0x54) & 0x200) == 0) &&

+         ((iVar9 = IsPointerInputMessageWithState(param_2), iVar9 != 0 ||

+          (iVar9 = IsPointerParentNotify(extraout_XMM0_Qa_00,local_res18), iVar9 != 0)))) {

+        lVar16 = W32GetUserSessionState();

+        CTouchProcessor::ReferenceMsgDataExternal

+                  (*(CTouchProcessor **)(lVar16 + 0xcb8),(__uint64)local_res20,6,plVar12);

+      }

+      EtwTraceBeginSendMessage(plVar12,ptVar26,param_7);

+      if (ptVar26 == (tagTHREADINFO *)0x0) {

+        SetWakeBit(param_6,0x40);

+        EtwTraceEndSendMessage(plVar12);

+        return (tagTHREADINFO *)0x1;

+      }

+      local_e0 = 0;

+      iVar9 = 0x200;

+      local_dc = 0x200;

+      bVar6 = false;

+      SetWakeBit(param_6,0x40);

+      if (param_7 != (uint *)0x0) {

+        local_e0 = param_7[9];

+        iVar9 = (param_7[8] & 1) * 0x8000 + 0x200;

+        local_dc = iVar9;

+      }

+      CKernelStackSwapAuto::CKernelStackSwapAuto(local_48);

+      if (*(longlong *)(local_e8 + 0x1d8) == *(longlong *)(param_6 + 0x1d8)) {

+        LOCK();

+        uVar27 = *(uint *)(local_e8 + 0x210);

+        if (uVar27 == 0) {

+          *(int *)(local_e8 + 0x210) = 0;

+          uVar27 = 0;

+        }

+        UNLOCK();

+        if ((uVar27 >> 0x10 & 1) == 0) {

+          LOCK();

+          *(uint *)(local_e8 + 0x210) = *(uint *)(local_e8 + 0x210) | 0x10000;

+          UNLOCK();

+          bVar6 = true;

+        }

+      }

+      ptVar14 = ptVar28;

+      if (((param_2 == 0x314) && (local_res20 != (tagTHREADINFO *)0x0)) &&

+         (ptVar14 = *(tagTHREADINFO **)local_res20, (*(uint *)(local_res20 + 0x18) & 1) != 0)) {

+        *(uint *)((longlong)plVar12 + 0x54) = *(uint *)((longlong)plVar12 + 0x54) | 0x60000;

+        plVar12[0xf] = *(longlong *)ptVar14;

+      }

+      uVar27 = *(uint *)((longlong)plVar12 + 0x54);

+      ptVar26 = ptVar28;

+      ptVar15 = local_e8;

+      while (local_e8 = ptVar15, (uVar27 & 1) == 0) {

+        cVar24 = (char)ptVar26;

+        uVar25 = (ulong)ptVar26;

+        if (uVar25 != 0) break;

+        ptVar26 = param_6;

+        Win32HMOptionalThreadLockAlways<tagMENU>::Win32HMOptionalThreadLockAlways<tagMENU>

+                  ((Win32HMOptionalThreadLockAlways<tagMENU> *)&local_b8);

+        LOCK();

+        *(uint *)(*(longlong *)(ptVar15 + 0x1e8) + 4) =

+             *(uint *)(*(longlong *)(ptVar15 + 0x1e8) + 4) & 0xfffffdff;

+        UNLOCK();

+        if ((((ptVar14 != (tagTHREADINFO *)0x0) &&

+             ((*(int *)(ptVar14 + 0x30) == 0xd || (*(int *)(ptVar14 + 0x30) == 0xe)))) &&

+            (*(uint *)(ptVar26 + 0x2a0) < 0x502)) && (*(int *)(ptVar26 + 0x2b0) != 0)) {

+          puVar13 = (undefined8 *)PsGetCurrentThreadWin32Thread();

+          ptVar26 = ptVar28;

+          if (puVar13 != (undefined8 *)0x0) {

+            ptVar26 = (tagTHREADINFO *)*puVar13;

+          }

+          local_b8 = *(undefined8 *)(ptVar26 + 0x1c8);

+          *(undefined8 **)(ptVar26 + 0x1c8) = &local_b8;

+          local_b0 = ptVar14;

+          HMLockObject(ptVar14);

+          cVar24 = '\x01';

+        }

+        iVar9 = xxxSleepThread2(iVar9,local_e0,0,0,0);

+        ptVar26 = (tagTHREADINFO *)(ulonglong)(iVar9 == 0);

+        if (cVar24 != '\0') {

+          if (iVar9 == 0) {

+            uVar27 = *(uint *)(ptVar14 + 0x40);

+            *(uint *)(ptVar14 + 0x40) = uVar27 | 0x4000;

+            if (((uVar27 & 0x10) == 0) &&

+               (ptVar14[0x61] = (tagTHREADINFO)((char)ptVar14[0x61] + '\x01'),

+               10 < (byte)ptVar14[0x61])) {

+              *(uint *)(ptVar14 + 0x40) = uVar27 | 0x4010;

+            }

           }

           else {

-            in_stack_000000f0 =

-                 (undefined1 *)CONCAT44(*(undefined4 *)(lVar1 + 4 + uVar7 * 0x10),iVar3);

-            uStack00000000000000f8 = *(undefined4 *)(lVar1 + 8 + uVar7 * 0x10);

-            uStack00000000000000fc = *(undefined4 *)(lVar1 + 0xc + uVar7 * 0x10);

-            ERECTL::operator*=((ERECTL *)&stack0x000000f0,unaff_RBX);

-            if (iVar13 != 0) {

-              (*unaff_R12)((ulonglong)(uVar12 - iVar13) * 0x10 + lVar1,iVar13);

-              iVar13 = 0;

+            *(uint *)(ptVar14 + 0x40) = *(uint *)(ptVar14 + 0x40) & 0xffffbfff;

+          }

+          puVar13 = (undefined8 *)PsGetCurrentThreadWin32Thread();

+          ptVar15 = ptVar28;

+          if (puVar13 != (undefined8 *)0x0) {

+            ptVar15 = (tagTHREADINFO *)*puVar13;

+          }

+          Win32HM_UnlockFromThread<1>(ptVar15,(_Win32HMThreadLockItem *)&local_b8);

+          local_b0 = (tagTHREADINFO *)0x0;

+          local_b8 = 0xffffffffffffffff;

+        }

+        if ((iVar9 == 0) && (param_7 != (uint *)0x0)) {

+          if ((((param_7[8] & 0x10) != 0) || ((*(uint *)((longlong)plVar12 + 0x54) & 0x20) != 0)) &&

+             ((*(uint *)((longlong)plVar12 + 0x54) & 0x10) != 0)) {

+            local_e0 = 0;

+            ptVar26 = (tagTHREADINFO *)0x0;

+          }

+          if ((param_7[8] & 8) != 0) {

+            lVar16 = W32GetUserSessionState();

+            bVar7 = IsThreadHungTimeCheck(param_6,*(ulong *)(lVar16 + 0x10f68));

+            if (!bVar7) {

+              ptVar26 = ptVar28;

             }

-            iVar3 = ERECTL::bEmpty((ERECTL *)&stack0x000000f0);

-            if (iVar3 == 0) {

-              (*unaff_R12)(&stack0x000000f0,1);

+          }

+          if ((int)ptVar26 == 0) {

+            EtwTraceConvertTimeOutToBlocking();

+          }

+        }

+        uVar25 = (ulong)ptVar26;

+        Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

+                  ((Win32HMOptionalThreadLock<tagHOOK> *)&local_b8);

+        iVar9 = local_dc;

+        ptVar15 = local_e8;

+        uVar27 = *(uint *)((longlong)plVar12 + 0x54);

+      }

+      CKernelStackSwapAuto::~CKernelStackSwapAuto(local_48);

+      if (bVar6) {

+        LOCK();

+        *(uint *)(ptVar15 + 0x210) = *(uint *)(ptVar15 + 0x210) & 0xfffeffff;

+        UNLOCK();

+        MergeDeferredMessagesOfThreadOnQueue(ptVar15);

+      }

+      SetWakeBit(ptVar15,0x200);

+      ptVar14 = local_c0;

+      if (uVar25 == 0) {

+        if (local_f4 == 0) {

+          if ((((param_2 == 0x33f) && (param_9 != 0)) && (param_1 != (tagWND *)0x0)) &&

+             (iVar9 = IsWindowDesktopComposed(param_1), iVar9 != 0)) {

+            TransformMessageBetweenCoordinateSpaces(0x33f,1,&local_res18,&local_res20,0,param_1);

+          }

+        }

+        else {

+          local_e8 = local_c0;

+          if (param_2 == 0x83) {

+            if (((param_9 != 0) && (param_1 != (tagWND *)0x0)) &&

+               (iVar9 = IsWindowDesktopComposed(param_1), iVar9 != 0)) {

+              TransformMessageBetweenCoordinateSpaces(0x83,1,&local_res18,&local_e8,0,param_1);

+              ptVar14 = local_e8;

             }

-          }

-        }

-        if (iVar13 != 0) {

-          (*unaff_R12)((ulonglong)(*(uint *)(unaff_RSI + 0x3c) - iVar13) * 0x10 + *plVar10,iVar13);

-        }

-      }

-      return 1;

-    }

-  }

-  if (*(uint *)(unaff_RSI + 4) < 0x15) {

-    puVar5 = &stack0x00000260;

-    bVar2 = false;

-  }

-  else {

-    uVar7 = (ulonglong)*(uint *)(unaff_RSI + 4) << 6;

-    if ((0xffffffff < uVar7) ||

-       (puVar5 = (undefined1 *)func_0x0001401093cc(uVar7,0x67646547), puVar5 == (undefined1 *)0x0))

-    {

-      return 0;

-    }

-    bVar2 = true;

-  }

-  piStack0000000000000028 = (int *)&stack0x00000120;

-  iVar13 = 0;

-  uVar14 = 0;

-  iStack0000000000000060 = 0;

-  iStack0000000000000068 = 0;

-  in_stack_00000110 = 0;

-  in_stack_00000118 = 0;

-  if (unaff_RBX == (_RECTL *)0x0) {

-    puVar11 = (undefined8 *)0x0;

-  }

-  else {

-    uVar14 = *(undefined4 *)unaff_RBX;

-    iStack0000000000000060 = (int)*(undefined8 *)unaff_RBX;

-    iStack0000000000000068 = (int)*(undefined8 *)(unaff_RBX + 8);

-    in_stack_00000110 = (ulonglong)(uint)(*(int *)(unaff_RBX + 4) << 4) << 0x20;

-    in_stack_00000118 = (ulonglong)(uint)(*(int *)(unaff_RBX + 0xc) << 4) << 0x20;

-    puVar11 = &stack0x00000110;

-  }

-  in_stack_00000100 = &stack0x000000b0;

-  in_stack_000000f0 = puVar5;

-  iVar3 = bConstructGET(uVar14,&stack0x000000b0,puVar5,puVar11);

-  if (iVar3 != 0) {

-    iVar8 = -0x80000000;

-    plVar10 = (longlong *)&stack0x00000070;

-    in_stack_00000070 = plVar10;

-    in_stack_00000080 = 0;

-    in_stack_00000078._4_4_ = 0x7fffffff;

-    do {

-      if (((longlong **)plVar10 == &stack0x00000070) ||

-         (vAdvanceAETEdges(&stack0x00000070), plVar10 = in_stack_00000070,

-         (longlong **)in_stack_00000070 == &stack0x00000070)) {

-        if (in_stack_000000b0 == in_stack_00000100) goto LAB_0;

-        iVar8 = *(int *)(in_stack_000000b0 + 2);

-      }

-      else if ((longlong **)*in_stack_00000070 != &stack0x00000070) {

-        vXSortAETEdges(&stack0x00000070);

-        plVar10 = in_stack_00000070;

-      }

-      plVar9 = plVar10;

-      if (*(int *)(in_stack_000000b0 + 2) == iVar8) {

-        vMoveNewEdges(&stack0x000000b0,&stack0x00000070,iVar8);

-        plVar9 = in_stack_00000070;

-        plVar10 = in_stack_00000070;

-      }

-      do {

-        iVar6 = *(int *)((longlong)plVar9 + 0xc);

-        if ((in_stack_000007c0 & 2) == 0) {

-          plVar9 = (longlong *)*plVar9;

+            puVar13 = (undefined8 *)plVar12[0xf];

+            uVar23 = puVar13[1];

+            if (local_res18 == 0) {

+              *(undefined8 *)ptVar14 = *puVar13;

+              *(undefined8 *)(ptVar14 + 8) = uVar23;

+            }

+            else {

+              puVar3 = *(undefined8 **)(ptVar14 + 0x30);

+              *(undefined8 *)ptVar14 = *puVar13;

+              *(undefined8 *)(ptVar14 + 8) = uVar23;

+              uVar23 = puVar13[3];

+              *(undefined8 *)(ptVar14 + 0x10) = puVar13[2];

+              *(undefined8 *)(ptVar14 + 0x18) = uVar23;

+              uVar23 = puVar13[5];

+              *(undefined8 *)(ptVar14 + 0x20) = puVar13[4];

+              *(undefined8 *)(ptVar14 + 0x28) = uVar23;

+              *(undefined8 **)(ptVar14 + 0x30) = puVar3;

+              puVar13 = (undefined8 *)puVar13[6];

+              if (puVar13 != (undefined8 *)0x0) {

+                uVar23 = puVar13[1];

+                *puVar3 = *puVar13;

+                puVar3[1] = uVar23;

+                uVar23 = puVar13[3];

+                puVar3[2] = puVar13[2];

+                puVar3[3] = uVar23;

+                puVar3[4] = puVar13[4];

+              }

+            }

+          }

+          else if (local_d8 == 0) {

+            memcpy(local_c0,(void *)plVar12[0xf],(ulonglong)local_f4);

+          }

+          else if (local_d8 == 1) {

+            strncpycch();

+          }

+          else {

+            wcsncpycch(local_c0,(void *)plVar12[0xf],local_f4 >> 1);

+          }

+        }

+      }

+      EtwTraceEndSendMessage(plVar12);

+      *(undefined8 *)(ptVar15 + 0x220) = local_88;

+      if (param_7 == (uint *)0x0) {

+        ptVar28 = (tagTHREADINFO *)plVar12[9];

+      }

+      else {

+        **(longlong **)(param_7 + 10) = plVar12[9];

+        if (((param_7[8] & 0x20) == 0) || ((*(uint *)((longlong)plVar12 + 0x54) & 0x8000) == 0)) {

+          ptVar28 = (tagTHREADINFO *)(ulonglong)(uVar25 == 0);

         }

         else {

-          iVar4 = (int)plVar9[7];

-          do {

-            plVar9 = (longlong *)*plVar9;

-            iVar4 = iVar4 + (int)plVar9[7];

-          } while (iVar4 != 0);

-        }

-        if (iVar6 < *(int *)((longlong)plVar9 + 0xc)) {

-          if (unaff_RBX == (_RECTL *)0x0) {

-            *piStack0000000000000028 = iVar6;

-            piStack0000000000000028[2] = *(int *)((longlong)plVar9 + 0xc);

-            piStack0000000000000028[1] = iVar8;

-            piStack0000000000000028[3] = iVar8 + 1;

-LAB_1:

-            iVar13 = iVar13 + 1;

-            piStack0000000000000028 = piStack0000000000000028 + 4;

-          }

-          else {

-            iVar4 = iStack0000000000000060;

-            if (iStack0000000000000060 <= iVar6) {

-              iVar4 = iVar6;

-            }

-            *piStack0000000000000028 = iVar4;

-            iVar6 = iStack0000000000000068;

-            if (*(int *)((longlong)plVar9 + 0xc) <= iStack0000000000000068) {

-              iVar6 = *(int *)((longlong)plVar9 + 0xc);

-            }

-            piStack0000000000000028[2] = iVar6;

-            piStack0000000000000028[1] = iVar8;

-            piStack0000000000000028[3] = iVar8 + 1;

-            if (iVar4 < iVar6) goto LAB_1;

-          }

-          if (iVar13 == 0x14) {

-            (*unaff_R12)(&stack0x00000120,0x14);

-            piStack0000000000000028 = (int *)&stack0x00000120;

-            iVar13 = 0;

-            plVar10 = in_stack_00000070;

-          }

-        }

-        plVar9 = (longlong *)*plVar9;

-      } while ((longlong **)plVar9 != &stack0x00000070);

-      iVar8 = iVar8 + 1;

-    } while( true );

-  }

-LAB_2:

-  if (bVar2) {

-    Win32FreePool(puVar5);

-  }

-  return iVar3;

-LAB_0:

-  if (iVar13 != 0) {

-    (*unaff_R12)(&stack0x00000120,iVar13);

-  }

-  goto LAB_2;

+          UserSetLastError(0x578);

+        }

+      }

+      if (((param_7 != (uint *)0x0) || (uVar25 != 0)) &&

+         (uVar27 = *(uint *)((longlong)plVar12 + 0x54), (uVar27 & 1) == 0)) {

+        *(uint *)((longlong)plVar12 + 0x54) = uVar27 | 1;

+        if ((uVar27 & 0x4000) == 0) {

+          *(int *)(param_6 + 0x240) = *(int *)(param_6 + 0x240) + -1;

+          plVar20 = plVar12 + 2;

+          lVar16 = *plVar20;

+          plVar2 = (longlong *)plVar12[3];

+          if ((*(longlong **)(lVar16 + 8) != plVar20) || ((longlong *)*plVar2 != plVar20))

+          goto LAB_14;

+          *plVar2 = lVar16;

+          *(longlong **)(lVar16 + 8) = plVar2;

+          plVar12[2] = 0;

+          *(uint *)((longlong)plVar12 + 0x54) = *(uint *)((longlong)plVar12 + 0x54) | 0x10;

+        }

+        else {

+          *(uint *)((longlong)plVar12 + 0x54) = uVar27 | 9;

+        }

+      }

+      uVar27 = *(uint *)((longlong)plVar12 + 0x54);

+      uVar22 = uVar27 & 0xfffdffff;

+      *(uint *)((longlong)plVar12 + 0x54) = uVar22;

+      if ((uVar27 & 0x4010) != 0x10) {

+        uVar22 = uVar22 | 8;

+        *(uint *)((longlong)plVar12 + 0x54) = uVar22;

+      }

+      if ((uVar22 & 0x8008) != 8) {

+        UnlinkSendListSms(plVar12);

+        return ptVar28;

+      }

+      return ptVar28;

+    }

+  }

+LAB_14:

+  pcVar4 = (code *)swi(0x29);

+  (*pcVar4)(3);

+  ptVar28 = local_78;

+  Win32FreePool(*(undefined8 *)(local_78 + 0x78));

+  lVar16 = W32GetUserSessionState();

+  Win32FreeToPagedLookasideList(*(undefined8 *)(lVar16 + 0x10f50),ptVar28);

+  return (tagTHREADINFO *)0x0;

 }
```

## `xxxSwitchDesktop`  (modified)

```diff
--- xxxSwitchDesktop
+++ xxxSwitchDesktop
@@ -1,10 +1,479 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void xxxSwitchDesktop(void)

+int xxxSwitchDesktop(longlong param_1,tagWINDOWSTATION *param_2,ulonglong param_3,undefined4 param_4

+                    )

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  uint *puVar1;

+  uint uVar2;

+  void *pvVar3;

+  tagTHREADINFO *ptVar4;

+  char cVar5;

+  int iVar6;

+  int iVar7;

+  longlong lVar8;

+  undefined8 *puVar9;

+  longlong lVar10;

+  tagTHREADINFO *ptVar11;

+  undefined8 uVar12;

+  tagWND *ptVar13;

+  uint uVar14;

+  tagWND *ptVar15;

+  char cVar16;

+  uint uVar17;

+  undefined8 uVar18;

+  bool bVar19;

+  uint local_res10;

+  ulonglong uVar20;

+  uint in_stack_ffffffffffffff10;

+  undefined4 uVar21;

+  undefined8 in_stack_ffffffffffffff28;

+  undefined4 uVar22;

+  tagDSR_DESKTOP_TYPE local_c8;

+  undefined8 local_c0;

+  longlong local_b8;

+  undefined8 local_b0;

+  tagTHREADINFO *local_a8 [2];

+  longlong local_98 [2];

+  void *local_88;

+  undefined8 local_80;

+  undefined8 local_78;

+  code *local_70;

+  longlong local_68;

+  undefined8 local_60;

+  Win32RawLockedNtObject<tagWINDOWSTATION> local_58 [16];

+  longlong local_48;

+  

+  local_a8[0] = PtiCurrent();

+  local_res10 = 0;

+  local_c0 = 0;

+  local_c8 = 0;

+  iVar6 = Feature_TSR61092462__private_IsEnabledDeviceUsageNoInline();

+  if (iVar6 != 0) {

+    lVar8 = W32GetUserSessionState();

+    local_c8 = ClassifyDesktop(*(tagDESKTOP **)(lVar8 + 0x4b58));

+  }

+  if (param_2 == (tagWINDOWSTATION *)0x0) {

+    return -0x3fffffff;

+  }

+  lVar8 = W32GetUserSessionState();

+  if (param_2 == *(tagWINDOWSTATION **)(lVar8 + 0x4b58)) {

+    return 0;

+  }

+  if ((*(uint *)(param_2 + 0x30) & 8) != 0) {

+    return -0x3ffffff3;

+  }

+  if (param_1 == 0) {

+    param_1 = *(longlong *)(param_2 + 0x28);

+  }

+  if ((*(uint *)(param_1 + 0x40) & 4) != 0) {

+    return -0x3ffffff3;

+  }

+  local_98[0] = *(longlong *)(param_1 + 0x38);

+  cVar16 = '\x01';

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) ||

+     (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    cVar5 = '\0';

+  }

+  bVar19 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((cVar5 != '\0') || (bVar19)) {

+    lVar8 = ObQueryNameInfo(param_2);

+    in_stack_ffffffffffffff28 = 0;

+    if ((lVar8 != 0) && (lVar8 = ObQueryNameInfo(param_2), lVar8 != -8)) {

+      lVar8 = ObQueryNameInfo(param_2);

+      if (lVar8 == 0) {

+        puVar9 = (undefined8 *)&DAT_0;

+      }

+      else {

+        lVar8 = ObQueryNameInfo(param_2);

+        puVar9 = (undefined8 *)(lVar8 + 0x10);

+      }

+      in_stack_ffffffffffffff28 = *puVar9;

+    }

+    lVar8 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_SL

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar19,

+               *(undefined8 *)(lVar8 + 0x10f98));

+  }

+  lVar8 = W32GetUserSessionState();

+  if (*(longlong *)(lVar8 + 0x4b58) != 0) {

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) ||

+       (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+      cVar5 = '\0';

+    }

+    bVar19 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    uVar18 = 0;

+    if ((cVar5 != '\0') || (bVar19)) {

+      lVar8 = ObQueryNameInfo(param_2);

+      if ((lVar8 != 0) && (lVar8 = ObQueryNameInfo(param_2), lVar8 != -8)) {

+        lVar8 = ObQueryNameInfo(param_2);

+        if (lVar8 == 0) {

+          puVar9 = (undefined8 *)&DAT_0;

+        }

+        else {

+          lVar8 = ObQueryNameInfo(param_2);

+          puVar9 = (undefined8 *)(lVar8 + 0x10);

+        }

+        uVar18 = *puVar9;

+      }

+      lVar8 = W32GetUserSessionState();

+      in_stack_ffffffffffffff10 = 0;

+      WPP_RECORDER_AND_TRACE_SF_S

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar19,

+                 *(undefined8 *)(lVar8 + 0x10f98),4,3,0x1b,

+                 &WPP_699b5675da3832e296a577bc53d65da7_Traceguids,uVar18);

+      in_stack_ffffffffffffff28 = uVar18;

+    }

+  }

+  pvVar3 = SystemReserved1[0xf];

+  local_88 = SystemReserved1[0xf];

+  lVar8 = W32GetUserSessionState();

+  if ((((param_2 != *(tagWINDOWSTATION **)(lVar8 + 0xf690)) &&

+       (cVar5 = PsIsSystemThread(pvVar3), cVar5 == '\0')) &&

+      (lVar8 = W32GetUserSessionState(), param_2 != *(tagWINDOWSTATION **)(lVar8 + 0xf688))) &&

+     (((*(uint *)(param_1 + 0x40) & 1) != 0 && ((param_3 & 2) == 0)))) {

+    lVar8 = W32GetUserSessionState();

+    lVar8 = *(longlong *)(lVar8 + 0xf8c0);

+    lVar10 = PsGetThreadProcessId(pvVar3);

+    if (lVar10 != lVar8) {

+      return -0x3fffffde;

+    }

+  }

+  lVar8 = W32GetUserSessionState();

+  if ((*(int *)(lVar8 + 0xf5f8) != 0) &&

+     ((lVar8 = W32GetUserSessionState(), *(longlong *)(lVar8 + 0xf690) == 0 ||

+      (lVar8 = W32GetUserSessionState(), param_2 != *(tagWINDOWSTATION **)(lVar8 + 0xf690))))) {

+    if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+       ((-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c) ||

+        ((byte)WPP_GLOBAL_Control[0x29] < 4)))) {

+      cVar16 = '\0';

+    }

+    bVar19 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar16 != '\0') || (bVar19)) {

+      lVar8 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar16,bVar19,

+                 *(undefined8 *)(lVar8 + 0x10f98),4,8,0x1c,

+                 &WPP_699b5675da3832e296a577bc53d65da7_Traceguids);

+    }

+    lVar8 = W32GetUserSessionState();

+    LockObjectAssignment(lVar8 + 0x4b60,param_2);

+    return 0;

+  }

+  Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

+            (local_58,param_2);

+  puVar9 = &local_c0;

+  uVar20 = *(ulonglong *)ExDesktopObjectType_exref;

+  ObOpenObjectByPointer

+            (param_2,0x200,0,0x1f0003,uVar20,in_stack_ffffffffffffff10 & 0xffffff00,puVar9);

+  uVar18 = local_c0;

+  uVar21 = (undefined4)((ulonglong)puVar9 >> 0x20);

+  ptVar11 = PtiCurrent();

+  ptVar4 = local_a8[0];

+  local_80 = *(undefined8 *)(ptVar11 + 0x180);

+  *(undefined8 **)(ptVar11 + 0x180) = &local_80;

+  local_70 = AllowDesktopDestruction;

+  local_78 = uVar18;

+  if (*(longlong *)(local_a8[0] + 0x1f0) != 0) {

+    zzzDesktopSwitchSideEffects();

+    ResetPointerDevices(1);

+    W32GetUserSessionState();

+  }

+  lVar8 = W32GetUserSessionState();

+  if (((*(longlong *)(lVar8 + 0x4b58) != 0) &&

+      (lVar8 = W32GetUserSessionState(),

+      *(longlong *)(*(longlong *)(*(longlong *)(lVar8 + 0x4b58) + 8) + 0x18) != 0)) &&

+     (lVar8 = W32GetUserSessionState(), *(longlong *)(lVar8 + 0x4a50) != 0)) {

+    lVar8 = W32GetUserSessionState();

+    lVar8 = *(longlong *)(lVar8 + 0x4b58);

+    lVar10 = W32GetUserSessionState();

+    tagUNIQUE_WINDOW_HANDLE::Set

+              ((tagUNIQUE_WINDOW_HANDLE *)(lVar8 + 0x58),

+               *(tagWND **)(*(longlong *)(lVar10 + 0x4a50) + 0x90));

+    xxxSetForegroundWindow2((tagWND *)0x0,ptVar4,0x20);

+  }

+  uVar17 = 1;

+  UpdateKeyboardStateOnDesktopSwitch(1);

+  lVar8 = W32GetUserSessionState();

+  if ((*(longlong *)(lVar8 + 0x4b58) != 0) &&

+     (lVar8 = W32GetUserSessionState(),

+     (*(uint *)(**(longlong **)(*(longlong *)(lVar8 + 0x4b58) + 8) + 0x40) & 1) != 0)) {

+    lVar8 = W32GetUserSessionState();

+    if (*(longlong *)(lVar8 + 0xa880) != 0) {

+      StopFade();

+    }

+    lVar8 = W32GetUserSessionState();

+    bSetDevDragRect(*(undefined8 *)(*(longlong *)(lVar8 + 0xdf10) + 0x30),0);

+    lVar8 = W32GetUserSessionState();

+    ComposeWindow(*(undefined8 *)(*(longlong *)(*(longlong *)(lVar8 + 0x4b58) + 8) + 0x18),6);

+    lVar8 = W32GetUserSessionState();

+    uVar18 = *(undefined8 *)(*(longlong *)(lVar8 + 0xdf10) + 0x30);

+    GreLockDynamicModeChange(uVar18);

+    GreUnlockDynamicModeChange(uVar18);

+    local_res10 = uVar17;

+    if (*(longlong *)(param_1 + 0x78) != 0) {

+      EraseBitmap();

+    }

+  }

+  lVar8 = W32GetUserSessionState();

+  if ((*(longlong *)(lVar8 + 0x4b58) != 0) &&

+     (lVar8 = W32GetUserSessionState(), *(longlong *)(*(longlong *)(lVar8 + 0x4b58) + 0xf8) != 0)) {

+    lVar8 = W32GetUserSessionState();

+    Edgy::FreeEdgyFrameData(*(tagEDGY_DATA **)(*(longlong *)(lVar8 + 0x4b58) + 0xf8));

+  }

+  lVar8 = W32GetUserSessionState();

+  ResetWindowKeyProcessing(*(tagDESKTOP **)(lVar8 + 0x4b58));

+  lVar8 = W32GetUserSessionState();

+  if (*(longlong *)(lVar8 + 0x4b58) != 0) {

+    lVar8 = W32GetUserSessionState();

+    puVar1 = (uint *)(*(longlong *)(lVar8 + 0x4b58) + 0x30);

+    *puVar1 = *puVar1 | 0x1000;

+  }

+  iVar6 = Feature_PreserveActiveHklInDesktopSwitching__private_IsEnabledDeviceUsageNoInline();

+  if (iVar6 != 0) {

+    lVar8 = W32GetUserSessionState();

+    if (param_2 == *(tagWINDOWSTATION **)(lVar8 + 0xf688)) {

+      lVar8 = W32GetUserSessionState();

+      if (*(longlong *)(lVar8 + 0x3798) != 0) {

+        lVar8 = W32GetUserSessionState();

+        lVar8 = _HMPheFromObject(*(undefined8 *)(lVar8 + 0x3798));

+        if ((*(byte *)(lVar8 + 0x19) & 1) == 0) {

+          lVar8 = W32GetUserSessionState();

+          uVar18 = *(undefined8 *)(lVar8 + 0x3798);

+          local_68 = W32GetUserSessionState();

+          local_68 = local_68 + 0x37a0;

+          local_60 = uVar18;

+          HMAssignmentLock(&local_68,0);

+        }

+      }

+      lVar8 = W32GetUserSessionState();

+      if (*(longlong *)(lVar8 + 0x37b8) != 0) {

+        lVar8 = W32GetUserSessionState();

+        lVar8 = _HMPheFromObject(*(undefined8 *)(lVar8 + 0x37b8));

+        if ((*(byte *)(lVar8 + 0x19) & 1) == 0) {

+          lVar8 = W32GetUserSessionState();

+          uVar18 = *(undefined8 *)(lVar8 + 0x37b8);

+          local_b8 = W32GetUserSessionState();

+          local_b8 = local_b8 + 0x3798;

+          local_b0 = uVar18;

+          HMAssignmentLock(&local_b8,0);

+        }

+      }

+    }

+    else {

+      lVar8 = W32GetUserSessionState();

+      lVar8 = *(longlong *)(lVar8 + 0x4b58);

+      lVar10 = W32GetUserSessionState();

+      if ((lVar8 == *(longlong *)(lVar10 + 0xf688)) &&

+         (lVar8 = W32GetUserSessionState(), *(longlong *)(lVar8 + 0x37a0) != 0)) {

+        lVar8 = W32GetUserSessionState();

+        lVar8 = _HMPheFromObject(*(undefined8 *)(lVar8 + 0x37a0));

+        if ((*(byte *)(lVar8 + 0x19) & 1) == 0) {

+          lVar8 = W32GetUserSessionState();

+          uVar18 = *(undefined8 *)(lVar8 + 0x37a0);

+          local_b8 = W32GetUserSessionState();

+          local_b8 = local_b8 + 0x3798;

+          local_b0 = uVar18;

+          HMAssignmentLock(&local_b8,0);

+          lVar8 = W32GetUserSessionState();

+          HMAssignmentUnlock(lVar8 + 0x37a0);

+        }

+      }

+    }

+  }

+  lVar8 = W32GetUserSessionState();

+  LockObjectAssignment(lVar8 + 0x4b58,param_2);

+  lVar8 = W32GetUserSessionState();

+  uVar18 = *(undefined8 *)**(undefined8 **)(*(longlong *)(lVar8 + 0x4b58) + 8);

+  lVar8 = W32GetUserSessionState();

+  *(undefined8 *)(lVar8 + 0x4978) = uVar18;

+  SynchronizeContext();

+  UpdateInUserCritUpdatedPointerRedirectedGlobalsOnDesktopSwitch();

+  CitDesktopSwitch();

+  if ((*(uint *)(**(longlong **)(param_2 + 8) + 0x40) & 1) != 0) {

+    ComposeWindow((*(longlong **)(param_2 + 8))[3],5);

+  }

+  FreeAllSpbs();

+  lVar8 = W32GetUserSessionState();

+  iVar6 = zzzSetDesktop(*(undefined8 *)(lVar8 + 0x4970),param_2);

+  lVar8 = local_98[0];

+  uVar22 = (undefined4)((ulonglong)in_stack_ffffffffffffff28 >> 0x20);

+  if (iVar6 < 0) goto LAB_1;

+  if (*(longlong *)(*(longlong *)(local_98[0] + 0x10) + 0x1d8) != *(longlong *)(local_98[0] + 0x18))

+  {

+    iVar6 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+    if (iVar6 == 0) {

+      AllocQueue(0,*(undefined8 *)(lVar8 + 0x18));

+    }

+    else {

+      tagQ::Reinitialize(*(tagQ **)(lVar8 + 0x18),*(tagTHREADINFO **)(lVar8 + 0x10));

+    }

+    tagQ::zzzAttachToQueue

+              (*(tagQ **)(lVar8 + 0x18),*(tagTHREADINFO **)(lVar8 + 0x10),(tagQ *)0x0,false);

+  }

+  iVar6 = zzzSetDesktop(*(undefined8 *)(lVar8 + 0x10),param_2,0);

+  uVar22 = (undefined4)((ulonglong)in_stack_ffffffffffffff28 >> 0x20);

+  if (iVar6 < 0) goto LAB_1;

+  lVar10 = W32GetUserSessionState();

+  if (*(longlong *)(*(longlong *)(lVar8 + 0x10) + 0x1f0) != *(longlong *)(lVar10 + 0x4b58)) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x1142);

+  }

+  lVar8 = W32GetUserSessionState();

+  if (param_2 != *(tagWINDOWSTATION **)(lVar8 + 0x4b58)) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x1143);

+  }

+  if ((*(uint *)(**(longlong **)(param_2 + 8) + 0x40) & 1) != 0) {

+    UserSessionSwitchLeaveCrit();

+    uVar18 = *(undefined8 *)**(undefined8 **)(param_2 + 8);

+    uVar12 = UserReferenceDwmApiPort();

+    DwmSyncDesktopSwitch(uVar12,uVar18,param_4);

+    EnterCrit(1,0);

+  }

+  if ((*(int *)gbIgnoreStressedOutStuff_exref == 0) &&

+     (lVar8 = W32GetUserSessionState(), param_2 != *(tagWINDOWSTATION **)(lVar8 + 0x4b58))) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x1151);

+  }

+  if ((local_res10 == 0) ||

+     (lVar8 = W32GetUserSessionState(),

+     (*(uint *)(**(longlong **)(*(longlong *)(lVar8 + 0x4b58) + 8) + 0x40) & 1) == 0)) {

+    uVar18 = 0;

+  }

+  else {

+    uVar18 = 1;

+  }

+  uVar2 = *(uint *)(**(longlong **)(param_2 + 8) + 0x40);

+  lVar8 = W32GetUserSessionState();

+  GreDesktopSwitch(*(undefined8 *)(*(longlong *)(lVar8 + 0xdf10) + 0x30),uVar2 & 1,uVar18);

+  lVar8 = W32GetUserSessionState();

+  if (local_res10 == (*(uint *)(**(longlong **)(*(longlong *)(lVar8 + 0x4b58) + 8) + 0x40) & 1)) {

+    ResetCursorPointerInternal();

+  }

+  else {

+    zzzEnableDwmPointerSupport(*(uint *)(**(longlong **)(param_2 + 8) + 0x40) & 1,0);

+  }

+  ptVar4 = local_a8[0];

+  Win32HM_LockIntoThread<1>

+            (local_a8[0],*(_HEAD **)(*(longlong *)(param_2 + 8) + 0x18),

+             (_Win32HMThreadLockItem *)local_98);

+  GreLddmProcessDesktopSwitch();

+  uVar2 = *(uint *)(**(longlong **)(param_2 + 8) + 0x40);

+  if (local_res10 == 0) {

+LAB_2:

+    uVar14 = uVar17;

+  }

+  else {

+    lVar8 = W32GetUserSessionState();

+    uVar14 = 9;

+    if ((*(uint *)(**(longlong **)(*(longlong *)(lVar8 + 0x4b58) + 8) + 0x40) & 1) == 0)

+    goto LAB_2;

+  }

+  uVar14 = (uVar2 & 1) << 2 | uVar14;

+  lVar8 = W32GetUserSessionState();

+  GreSuspendDirectDraw(*(undefined8 *)(*(longlong *)(lVar8 + 0xdf10) + 0x30),uVar14);

+  uVar20 = uVar20 & 0xffffffff00000000;

+  xxxSetWindowPos(*(undefined8 *)(*(longlong *)(param_2 + 8) + 0x18),0,0,0,uVar20,0,

+                  CONCAT44(uVar21,0x153));

+  if ((*(int *)gbIgnoreStressedOutStuff_exref == 0) &&

+     (lVar8 = W32GetUserSessionState(), param_2 != *(tagWINDOWSTATION **)(lVar8 + 0x4b58))) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x118f);

+  }

+  lVar8 = W32GetUserSessionState();

+  GreResumeDirectDraw(*(undefined8 *)(*(longlong *)(lVar8 + 0xdf10) + 0x30),uVar14);

+  ptVar13 = tagUNIQUE_WINDOW_HANDLE::Get((tagUNIQUE_WINDOW_HANDLE *)(param_2 + 0x58));

+  cVar5 = <lambda_85111b926b7bd580f47be7d620445ac6>::operator()();

+  if (cVar5 == '\0') {

+LAB_3:

+    ptVar15 = *(tagWND **)(*(longlong *)(*(longlong *)(param_2 + 8) + 0x18) + 0x70);

+    while( true ) {

+      uVar22 = (undefined4)((ulonglong)in_stack_ffffffffffffff28 >> 0x20);

+      uVar21 = (undefined4)(uVar20 >> 0x20);

+      ptVar13 = ptVar15;

+      if (ptVar15 == (tagWND *)0x0) break;

+      iVar7 = IsWindowUnderActiveLockScreen(ptVar15);

+      uVar22 = (undefined4)((ulonglong)in_stack_ffffffffffffff28 >> 0x20);

+      uVar21 = (undefined4)(uVar20 >> 0x20);

+      ptVar13 = (tagWND *)0x0;

+      if (iVar7 != 0) break;

+      cVar5 = <lambda_85111b926b7bd580f47be7d620445ac6>::operator()();

+      uVar22 = (undefined4)((ulonglong)in_stack_ffffffffffffff28 >> 0x20);

+      uVar21 = (undefined4)(uVar20 >> 0x20);

+      ptVar13 = ptVar15;

+      if (cVar5 != '\0') break;

+      ptVar15 = *(tagWND **)(ptVar15 + 0x58);

+    }

+  }

+  else {

+    iVar7 = IsWindowUnderActiveLockScreen(ptVar13);

+    uVar22 = (undefined4)((ulonglong)in_stack_ffffffffffffff28 >> 0x20);

+    uVar21 = (undefined4)(uVar20 >> 0x20);

+    if (iVar7 != 0) goto LAB_3;

+  }

+  Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

+            ((Win32HMThreadLockBase<tagWND,1,0> *)local_98);

+  tagUNIQUE_WINDOW_HANDLE::Clear((tagUNIQUE_WINDOW_HANDLE *)(param_2 + 0x58));

+  UpdateKeyboardStateOnDesktopSwitch(0);

+  if (ptVar13 == (tagWND *)0x0) {

+    xxxSetForegroundWindow2((tagWND *)0x0,(tagTHREADINFO *)0x0,0x20);

+  }

+  else {

+    if ((*(int *)gbIgnoreStressedOutStuff_exref == 0) &&

+       (lVar8 = W32GetUserSessionState(),

+       *(longlong *)(*(longlong *)(ptVar13 + 0x10) + 0x1f0) != *(longlong *)(lVar8 + 0x4b58))) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x11e4);

+    }

+    Win32HM_LockIntoThread<0>(ptVar4,(_HEAD *)ptVar13,(_Win32HMThreadLockItem *)local_a8);

+    xxxSetForegroundWindowWithOptions(ptVar13,0x1f,0x20,0);

+    Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+              ((Win32HMThreadLockBase<tagWND,0,0> *)local_a8);

+  }

+  lVar8 = W32GetUserSessionState();

+  if (*(longlong *)(lVar8 + 0x4b10) != 0) {

+    IPostQuitMessage(*(longlong *)(lVar8 + 0x4b10),0);

+  }

+  lVar8 = W32GetUserSessionState();

+  KePulseEvent(*(undefined8 *)(lVar8 + 0xf680),1,0);

+  xxxWindowEvent(0x20,0,0,0,CONCAT44(uVar21,6));

+  iVar7 = Feature_TSR61092462__private_IsEnabledDeviceUsageNoInline();

+  if (iVar7 != 0) {

+    ReportDesktopSwitch(local_c8,(tagDESKTOP *)param_2);

+  }

+  zzzUpdateCursorImage();

+  lVar8 = W32GetUserSessionState();

+  if (param_2 == *(tagWINDOWSTATION **)(lVar8 + 0xf688)) {

+    lVar8 = W32GetUserSessionState();

+    lVar8 = *(longlong *)(lVar8 + 0xf8c0);

+    lVar10 = PsGetThreadProcessId(local_88);

+    if ((lVar10 == lVar8) && ((*(uint *)(*(longlong *)(param_2 + 0x28) + 0x40) & 1) != 0)) {

+      SetTimerCoalescingTolerance(3);

+    }

+  }

+  if ((((*(uint *)(param_2 + 0x30) & 0x20) != 0) && (*(longlong *)(param_2 + 8) != 0)) &&

+     (*(longlong *)(*(longlong *)(param_2 + 8) + 0x18) != 0)) {

+    *(uint *)(param_2 + 0x30) = *(uint *)(param_2 + 0x30) & 0xffffffdf;

+    xxxBroadcastDisplaySettingsChange(param_2,1,0,0);

+  }

+  DrvOcclusionStateChangeNotify();

+  xxxRefreshDisplayOrientation();

+LAB_1:

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    cVar16 = '\0';

+  }

+  bVar19 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((cVar16 != '\0') || (bVar19)) {

+    lVar8 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_d

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar16,bVar19,

+               *(undefined8 *)(lVar8 + 0x10f98),4,3,0x1d,

+               &WPP_699b5675da3832e296a577bc53d65da7_Traceguids,CONCAT44(uVar22,iVar6));

+  }

+  PopAndFreeW32ThreadLock(&local_80);

+  local_70 = (code *)0xffffffffffffffff;

+  if (local_48 != -1) {

+    PopAndFreeW32ThreadLock(local_58);

+    return iVar6;

+  }

+  return iVar6;

 }
```

## `UMPDDrvCopyBits`  (modified)

```diff
--- UMPDDrvCopyBits
+++ UMPDDrvCopyBits
@@ -1,15 +1,139 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl UMPDDrvCopyBits(struct _SURFOBJ * __ptr64,struct _SURFOBJ * __ptr64,struct _CLIPOBJ *

+   __ptr64,struct _XLATEOBJ * __ptr64,struct _RECTL * __ptr64,struct _POINTL * __ptr64) */

 

 int __cdecl

 UMPDDrvCopyBits(_SURFOBJ *param_1,_SURFOBJ *param_2,_CLIPOBJ *param_3,_XLATEOBJ *param_4,

                _RECTL *param_5,_POINTL *param_6)

 

 {

-  int unaff_ESI;

-  undefined8 in_stack_00000080;

-  undefined8 in_stack_00000088;

+  int iVar1;

+  int iVar2;

+  ulong uVar3;

+  int iVar4;

+  UMPDOBJ *this;

+  int iVar5;

+  int iVar6;

+  void *pvVar7;

+  undefined1 auStackY_1a8 [32];

+  ulong local_118;

+  int local_114;

+  int local_110;

+  int local_10c;

+  int local_108 [2];

+  _SURFOBJ *local_100;

+  void *local_f8;

+  void *local_f0;

+  void *local_e8;

+  void *local_e0;

+  UMPDOBJ *local_d8;

+  _XLATEOBJ *local_d0;

+  _CLIPOBJ *local_c8;

+  _RECTL *local_c0;

+  _POINTL *local_b8;

+  UMPDOBJ local_a8 [4];

+  undefined4 local_a4;

+  undefined8 local_98;

+  _SURFOBJ *local_90;

+  _SURFOBJ *local_88;

+  _CLIPOBJ *local_80;

+  _XLATEOBJ *local_78;

+  _RECTL *local_70;

+  _POINTL *local_68 [2];

+  ulonglong local_58;

   

-  ZwUnmapViewOfSection(param_1,in_stack_00000088);

-  FreeThreadBufferWithTag(in_stack_00000080);

-  return unaff_ESI;

+  local_58 = __security_cookie ^ (ulonglong)auStackY_1a8;

+  local_c0 = param_5;

+  local_b8 = param_6;

+  local_118 = 1;

+  local_114 = 0;

+  local_108[0] = 0;

+  local_110 = 0;

+  local_10c = 0;

+  local_100 = param_2;

+  local_d0 = param_4;

+  local_c8 = param_3;

+  XUMPDOBJ::XUMPDOBJ((XUMPDOBJ *)&local_d8);

+  local_f8 = (void *)0x0;

+  local_e8 = (void *)0x0;

+  this = local_a8;

+  local_e0 = (void *)0x0;

+  local_f0 = (void *)0x0;

+  memset(this,0,0x48);

+  if ((local_d8 == (UMPDOBJ *)0x0) ||

+     (iVar1 = UMPDOBJ::bPrepareBitmapsForClient(this,&local_100,(_SURFOBJ **)0x0), iVar1 == 0)) {

+    iVar2 = 0;

+    goto LAB_0;

+  }

+  pvVar7 = (void *)0x0;

+  iVar5 = 0;

+  iVar6 = 0;

+  iVar1 = 0;

+  if (local_d8[0x1c8] == (UMPDOBJ)0x0) {

+LAB_1:

+    local_a4 = 0x13;

+    local_a8[0] = (UMPDOBJ)0x0;

+    local_98 = *(undefined8 *)local_d8;

+    local_88 = local_100;

+    local_80 = local_c8;

+    local_70 = local_c0;

+    local_68[0] = local_b8;

+    local_90 = param_1;

+    local_78 = param_4;

+    iVar2 = UMPDOBJ::pso(local_d8,(_DDIOBJMAP *)(local_d8 + 0x50),&local_90,iVar1);

+    if (((((iVar2 == 0) ||

+          (iVar2 = UMPDOBJ::pso(local_d8,(_DDIOBJMAP *)(local_d8 + 0x60),&local_88,iVar6),

+          iVar2 == 0)) ||

+         (iVar2 = UMPDOBJ::ThunkDDIOBJ

+                            (local_d8,(_DDIOBJMAP *)(local_d8 + 0x80),&local_80,0x18,(void *)0x0),

+         iVar2 == 0)) ||

+        ((iVar2 = UMPDOBJ::pxlo(local_d8,&local_78), iVar2 == 0 ||

+         (iVar2 = UMPDOBJ::ThunkMemBlock(local_d8,&local_70,0x10), iVar2 == 0)))) ||

+       ((iVar2 = UMPDOBJ::ThunkMemBlock(local_d8,local_68,8), iVar2 == 0 ||

+        ((uVar3 = UMPDOBJ::Thunk(local_d8,local_a8,0x48,&local_118,4), uVar3 == 0xffffffff ||

+         (local_118 == 0)))))) {

+      iVar2 = 0;

+    }

+    else {

+      iVar2 = 1;

+    }

+  }

+  else {

+    if (param_4 == (_XLATEOBJ *)0x0) {

+      local_118 = 0x80;

+    }

+    else {

+      local_118 = (*(int *)(param_4 + 0xc) * 4 + 7U & 0xfffffff8) + 0x98;

+    }

+    local_118 = UMPDOBJ::bThunkLargeBitmaps

+                          (local_d8,param_1,local_100,(_SURFOBJ *)0x0,&local_f8,&local_e0,&local_e8,

+                           &local_f0,(void **)0x0,(void **)0x0,&local_114,&local_110,local_108,

+                           &local_10c,(int *)0x0,(int *)0x0,&local_118);

+    iVar2 = 0;

+    param_4 = local_d0;

+    pvVar7 = local_f8;

+    iVar1 = local_110;

+    iVar6 = local_10c;

+    iVar5 = local_114;

+    if (local_118 != 0) goto LAB_1;

+  }

+  if (local_d8[0x1c8] != (UMPDOBJ)0x0) {

+    iVar4 = Feature_2705031480__private_IsEnabledDeviceUsageNoInline();

+    if ((iVar4 == 0) || (iVar2 != 0)) {

+      if (iVar1 == 0) {

+        UMPDOBJ::BackPropagateSmallBitmapBits(local_d8,param_1,pvVar7,iVar5);

+      }

+      else {

+        UMPDOBJ::BackPropagateLargeBitmapBits(local_d8,param_1,pvVar7,iVar5);

+      }

+    }

+    UMPDOBJ::RestoreBitmaps

+              (local_d8,param_1,local_100,(_SURFOBJ *)0x0,pvVar7,local_e0,local_e8,local_f0,

+               (void *)0x0,(void *)0x0,iVar5,iVar1,local_108[0],iVar6,0,0);

+  }

+LAB_0:

+  XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_d8);

+  return iVar2;

 }
```

## `vSetPointer`  (modified)

```diff
--- vSetPointer
+++ vSetPointer
@@ -1,8 +1,366 @@
+

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* void __cdecl vSetPointer(struct HDEV__ * __ptr64,struct _CURSINFO * __ptr64,unsigned

+   long,unsigned long,unsigned long) */

 

 void __cdecl

 vSetPointer(HDEV__ *param_1,_CURSINFO *param_2,ulong param_3,ulong param_4,ulong param_5)

 

 {

+  short sVar1;

+  int iVar2;

+  int iVar3;

+  code *pcVar4;

+  int iVar5;

+  uint uVar6;

+  int iVar7;

+  _TRACING_CURSOR_USAGE_TYPE _Var8;

+  uint uVar9;

+  SESSION_GLOBALS *pSVar10;

+  ulonglong uVar11;

+  ulonglong uVar12;

+  _SURFOBJ *p_Var13;

+  longlong lVar14;

+  longlong lVar15;

+  undefined8 uVar16;

+  uint uVar17;

+  uint uVar18;

+  bool bVar19;

+  undefined8 uVar20;

+  undefined1 auStackY_1e8 [32];

+  int local_170;

+  PALETTE *local_168 [2];

+  undefined8 local_158;

+  undefined8 uStack_150;

+  longlong local_148;

+  undefined8 local_140;

+  ulong local_138;

+  uint local_134;

+  uint local_130;

+  longlong local_128;

+  undefined8 local_120;

+  int local_118;

+  int iStack_114;

+  int iStack_110;

+  int iStack_10c;

+  SURFREF local_108 [32];

+  longlong local_e8;

+  UnexpectedThreadTerminationHandler<SURFREF> local_e0 [32];

+  longlong local_c0;

+  UnexpectedThreadTerminationHandler<SURFREF> local_b8 [32];

+  longlong local_98;

+  undefined4 local_90;

+  undefined4 local_8c;

+  int local_88;

+  int local_84;

+  undefined8 local_78;

+  undefined8 uStack_70;

+  ulonglong local_68;

+  

+  local_68 = __security_cookie ^ (ulonglong)auStackY_1e8;

+  local_138 = param_4;

+  pSVar10 = Gre::Base::Globals();

+  lVar15 = 0;

+  uVar17 = param_3 & 0x10;

+  local_134 = param_3 & 0x20;

+  if ((*(uint *)(param_1 + 0x28) >> 10 & 1) != 0) {

+    return;

+  }

+  if (param_2 == (_CURSINFO *)0x0) {

+    if ((*(uint *)(param_1 + 0x28) & 4) != 0) {

+      EngSetPointerShape(-(ulonglong)(*(longlong *)(param_1 + 0x9f0) != 0) &

+                         *(longlong *)(param_1 + 0x9f0) + 0x18U,0,0,0);

+    }

+    if (((*(uint *)(param_1 + 0x28) & 2) != 0) && (*(code **)(param_1 + 0xb68) != (code *)0x0)) {

+      (**(code **)(param_1 + 0xb68))

+                (-(ulonglong)(*(longlong *)(param_1 + 0x9f0) != 0) &

+                 *(longlong *)(param_1 + 0x9f0) + 0x18U,0xffffffff,0xffffffff,0);

+    }

+    do {

+      uVar17 = *(uint *)(param_1 + 0x28);

+      LOCK();

+      bVar19 = uVar17 == *(uint *)(param_1 + 0x28);

+      if (bVar19) {

+        *(uint *)(param_1 + 0x28) = uVar17 & 0xfffffffd;

+      }

+      UNLOCK();

+    } while (!bVar19);

+    do {

+      uVar17 = *(uint *)(param_1 + 0x28);

+      LOCK();

+      bVar19 = uVar17 == *(uint *)(param_1 + 0x28);

+      if (bVar19) {

+        *(uint *)(param_1 + 0x28) = uVar17 & 0xfffffffb;

+      }

+      UNLOCK();

+    } while (!bVar19);

+    do {

+      uVar17 = *(uint *)(param_1 + 0x28);

+      LOCK();

+      bVar19 = uVar17 == *(uint *)(param_1 + 0x28);

+      if (bVar19) {

+        *(uint *)(param_1 + 0x28) = uVar17 & 0xffefffff;

+      }

+      UNLOCK();

+    } while (!bVar19);

+    return;

+  }

+  SURFREF::SURFREF(local_108,*(HSURF__ **)(param_2 + 8),pSVar10);

+  if (local_e8 == 0) goto LAB_0;

+  uVar9 = 1;

+  if ((*(int *)(local_e8 + 0x60) != 1) || ((*(uint *)(local_e8 + 0x3c) & 1) != 0))

+  goto LAB_0;

+  local_128 = 0;

+  local_148 = 0;

+  local_120 = 0;

+  local_140 = 0;

+  UnexpectedThreadTerminationHandler<SURFREF>::UnexpectedThreadTerminationHandler<SURFREF>(local_e0)

+  ;

+  local_c0 = 0;

+  UnexpectedThreadTerminationHandler<SURFREF>::UnexpectedThreadTerminationHandler<SURFREF>(local_b8)

+  ;

+  uVar16 = 0;

+  uVar20 = 0;

+  local_98 = 0;

+  local_168[0] = (PALETTE *)0x0;

+  local_158 = 0;

+  uStack_150 = 0;

+  uVar11 = -(ulonglong)(*(longlong *)(param_1 + 0x9f0) != 0) &

+           *(longlong *)(param_1 + 0x9f0) + 0x18U;

+  if ((*(longlong *)(param_2 + 0x10) == 0) && (uVar6 = 0, *(longlong *)(param_2 + 0x30) == 0)) {

+LAB_1:

+    if (*(int *)(param_2 + 0x2c) == 0) {

+LAB_2:

+      if (lVar15 == 0) {

+        p_Var13 = (_SURFOBJ *)0x0;

+      }

+      else {

+        p_Var13 = (_SURFOBJ *)(lVar15 + 0x18);

+      }

+      vProcessCursorShape((HDEV__ *)(local_e8 + 0x18),uVar17,uVar6,

+                          (_SURFOBJ *)(-(ulonglong)(local_e8 != 0) & (ulonglong)(local_e8 + 0x18)),

+                          p_Var13,local_168[0],(_RECTL *)(param_2 + 0x20),

+                          (HBITMAP__ **)(param_2 + 0x18));

+      if (uVar17 == 0) {

+        uVar6 = *(uint *)param_2 & 0xfffffbff;

+      }

+      else {

+        uVar6 = *(uint *)param_2 | 0x400;

+      }

+      *(uint *)param_2 = uVar6;

+    }

+    else if ((*(uint *)param_2 & 0x400) == 0) {

+      if (uVar17 != 0) goto LAB_2;

+    }

+    else if (uVar17 == 0) goto LAB_2;

+    iVar5 = *(int *)(param_2 + 0x20);

+    iVar7 = *(int *)(param_2 + 0x28);

+    if (iVar5 <= iVar7) {

+      iVar2 = *(int *)(param_2 + 0x24);

+      iVar3 = *(int *)(param_2 + 0x2c);

+      if (iVar2 <= iVar3) {

+        local_118 = iVar5;

+        iStack_114 = iVar2;

+        iStack_110 = iVar7;

+        iStack_10c = iVar3;

+        if ((*(longlong *)(param_2 + 0x18) != 0) && (3 < *(uint *)(param_1 + 0x82c))) {

+          local_98 = HmgShareLockCheck(*(longlong *)(param_2 + 0x18),5);

+        }

+        if (local_98 == 0) {

+          iVar5 = *(int *)(local_e8 + 0x38);

+          if ((local_c0 != 0) && (*(int *)(local_c0 + 0x38) <= iVar5)) {

+            iVar5 = *(int *)(local_c0 + 0x38);

+          }

+          iVar7 = Feature_3861105976__private_IsEnabledDeviceUsageNoInline();

+          if (((iVar7 != 0) && (local_c0 != 0)) &&

+             (*(int *)(local_e8 + 0x38) < *(int *)(local_c0 + 0x38))) {

+            local_88 = 0;

+            local_90 = 0x3afd659;

+            local_8c = 1;

+            RtlLogUnexpectedCodepath(&local_90);

+          }

+          lVar15 = local_e8;

+          local_90 = 0;

+          local_8c = 0;

+          local_84 = *(int *)(local_e8 + 0x3c) >> 1;

+          local_88 = iVar5;

+          ERECTL::operator*=((ERECTL *)&local_118,(_RECTL *)&local_90);

+        }

+        else {

+          uStack_150 = *(undefined8 *)(param_2 + 0x28);

+          local_148 = local_98;

+          local_158 = *(undefined8 *)(param_2 + 0x20);

+          if (uVar17 != 0) {

+            local_158 = CONCAT44(*(int *)(param_2 + 0x24) + 1,*(int *)(param_2 + 0x20) + 1);

+            uStack_150 = CONCAT44(*(int *)(param_2 + 0x2c) + 6,*(int *)(param_2 + 0x28) + 8);

+          }

+          local_88 = *(int *)(local_98 + 0x38);

+          local_90 = 0;

+          local_8c = 0;

+          local_84 = *(int *)(local_98 + 0x3c);

+          ERECTL::operator*=((ERECTL *)&local_158,(_RECTL *)&local_90);

+          lVar15 = local_e8;

+          uVar16 = local_158;

+          uVar20 = uStack_150;

+        }

+        local_78 = 0;

+        uStack_70 = 0;

+        local_130 = -(uint)(uVar17 != 0) & 3;

+        if ((*(uint *)(param_1 + 0x28) & 0x400) == 0) {

+          uVar17 = 0;

+          sVar1 = *(short *)(param_2 + 6);

+          *(int *)(param_1 + 0x48) = (int)*(short *)(param_2 + 4);

+          bVar19 = false;

+          *(int *)(param_1 + 0x4c) = (int)sVar1;

+          local_170 = 0;

+          if ((local_138 != 0) && (param_5 != 0)) {

+            bVar19 = true;

+            local_170 = 1;

+          }

+          if (local_134 == 0) {

+            pcVar4 = *(code **)(param_1 + 0xb60);

+            if (pcVar4 == (code *)0x0) {

+              _Var8 = 2;

+              goto LAB_3;

+            }

+            if ((bVar19) && ((*(uint *)(param_1 + 0x840) & 0x200) == 0)) {

+              _Var8 = 3;

+              goto LAB_3;

+            }

+            if (local_148 == 0) {

+              local_78 = CONCAT44(iStack_114,local_118);

+              uStack_70 = CONCAT44(iStack_10c,iStack_110);

+              lVar14 = local_128;

+              if (local_128 != 0) {

+                lVar14 = local_128 + 0x18;

+              }

+              uVar6 = (*pcVar4)(uVar11,-(ulonglong)(lVar15 != 0) & lVar15 + 0x18U,lVar14,local_120);

+              if (uVar6 == 3) {

+                if (*(code **)(param_1 + 0xb68) != (code *)0x0) {

+                  (**(code **)(param_1 + 0xb68))(uVar11,0xffffffff,0xffffffff,0);

+                }

+                uVar6 = 0;

+LAB_4:

+                uVar17 = 0;

+              }

+              else {

+                if ((uVar6 & 2) == 0) goto LAB_4;

+                uVar17 = 1;

+              }

+              uVar9 = uVar17 ^ 1;

+              if ((uVar6 & 4) == 0) {

+LAB_5:

+                iVar5 = 0;

+              }

+              else {

+                iVar5 = 1;

+              }

+LAB_6:

+              if (uVar9 != 0) goto LAB_7;

+              _Var8 = 0;

+            }

+            else {

+              uVar17 = 0;

+              if ((*(uint *)(param_1 + 0x840) & 0x20) != 0) {

+                local_78 = uVar16;

+                uStack_70 = uVar20;

+                uVar6 = (*pcVar4)(uVar11,0,local_148 + 0x18,0);

+                if (uVar6 == 3) {

+                  uVar9 = 1;

+                  goto LAB_5;

+                }

+                uVar17 = uVar6 >> 1 & 1;

+                uVar9 = uVar17 ^ 1;

+                if ((uVar6 & 4) == 0) goto LAB_5;

+                iVar5 = 1;

+                goto LAB_6;

+              }

+              iVar5 = 0;

+              uVar9 = 1;

+LAB_7:

+              _Var8 = 4;

+            }

+          }

+          else {

+            _Var8 = 1;

+LAB_3:

+            iVar5 = 0;

+          }

+          InputTraceLogging::GreCursor::CursorTypeUsage(_Var8);

+          if (uVar9 == 0) {

+            if ((*(uint *)(param_1 + 0x28) & 4) != 0) {

+              EngSetPointerShape(-(ulonglong)(*(longlong *)(param_1 + 0x9f0) != 0) &

+                                 *(longlong *)(param_1 + 0x9f0) + 0x18U,0,0,0);

+            }

+          }

+          else {

+            if (local_148 == 0) {

+              if (local_128 == 0) {

+                lVar15 = 0;

+              }

+              else {

+                lVar15 = local_128 + 0x18;

+              }

+              uVar12 = -(ulonglong)(local_e8 != 0) & local_e8 + 0x18U;

+              uVar16 = local_120;

+            }

+            else {

+              lVar15 = local_148 + 0x18;

+              uVar12 = 0;

+              uVar16 = 0;

+            }

+            EngSetPointerShape(uVar11,uVar12,lVar15,uVar16);

+          }

+          if (((uVar17 == 0) && ((*(uint *)(param_1 + 0x28) & 2) != 0)) &&

+             (*(code **)(param_1 + 0xb68) != (code *)0x0)) {

+            (**(code **)(param_1 + 0xb68))(uVar11,0xffffffff,0xffffffff,0);

+          }

+          SETFLAG(uVar9,(ulong *)(param_1 + 0x28),4);

+          SETFLAG(uVar17,(ulong *)(param_1 + 0x28),2);

+          SETFLAG(local_170,(ulong *)(param_1 + 0x28),0x100000);

+          SETFLAG(iVar5,(ulong *)(param_1 + 0x28),0x200000);

+        }

+      }

+    }

+  }

+  else {

+    lVar14 = *(longlong *)(param_2 + 0x30);

+    if (lVar14 == 0) {

+      local_c0 = HmgShareLockCheck(*(longlong *)(param_2 + 0x10),5);

+    }

+    else {

+      local_c0 = HmgShareLockCheck();

+    }

+    bVar19 = lVar14 != 0;

+    uVar18 = (uint)bVar19;

+    uVar6 = uVar18;

+    if (local_c0 == 0) goto LAB_1;

+    if ((*(int *)(local_c0 + 0x3c) == *(int *)(local_e8 + 0x3c) >> 1) &&

+       (*(int *)(local_e8 + 0x38) <= *(int *)(local_c0 + 0x38))) {

+      local_168[0] = *(PALETTE **)(local_c0 + 0x80);

+      if ((local_168[0] == (PALETTE *)0x0) && (*(HDEV__ **)(param_1 + 0x18) != param_1)) {

+        local_168[0] = *(PALETTE **)(*(HDEV__ **)(param_1 + 0x18) + 0x700);

+      }

+      iVar5 = bIsCompatible(local_168,local_168[0],local_c0,param_1);

+      if (iVar5 != 0) {

+        iVar5 = EXLATEOBJ::bInitXlateObj((EXLATEOBJ *)&local_140,0);

+        uVar6 = (uint)bVar19;

+        if (iVar5 != 0) {

+          local_120 = local_140;

+          local_128 = local_c0;

+          lVar15 = local_c0;

+          uVar6 = uVar18;

+        }

+        goto LAB_1;

+      }

+    }

+  }

+  COLORSPACEREF::~COLORSPACEREF((COLORSPACEREF *)local_b8);

+  COLORSPACEREF::~COLORSPACEREF((COLORSPACEREF *)local_e0);

+  EXLATEOBJ::vAltUnlock((EXLATEOBJ *)&local_140);

+LAB_0:

+  COLORSPACEREF::~COLORSPACEREF((COLORSPACEREF *)local_108);

   return;

 }
```

## `xxxExecuteAck`  (modified)

```diff
--- xxxExecuteAck
+++ xxxExecute
@@ -1,9 +1,157 @@
 

-ulong __cdecl xxxExecuteAck(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

+/* WARNING: Instruction at (ram,0x0001402ab4ce) overlaps instruction at (ram,0x0001402ab4cc)

+    */

+/* WARNING: Control flow encountered bad instruction data */

+

+ulong __cdecl xxxExecute(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

-  ulong in_EAX;

+  char *pcVar1;

+  _HEAD *p_Var2;

+  int iVar3;

+  ulong extraout_EAX;

+  tagMONITOR *ptVar4;

+  ulonglong uVar5;

+  longlong in_RAX;

+  tagTHREADINFO *ptVar6;

+  longlong lVar7;

+  tagDDECONV *ptVar8;

+  undefined8 uVar9;

+  tagXSTATE *ptVar10;

+  uint unaff_EBX;

+  longlong unaff_RBP;

+  tagMONITOR *unaff_RDI;

+  __uint64 _Var11;

+  longlong unaff_R12;

+  longlong unaff_R14;

+  bool bVar12;

   

-  return in_EAX;

+  pcVar1 = (char *)(in_RAX + -0x77);

+  *pcVar1 = *pcVar1 + (char)param_1;

+  if (*pcVar1 != '\0') {

+                    /* WARNING: Bad instruction - Truncating control flow here */

+    halt_baddata();

+  }

+  do {

+    *(code **)(unaff_RBP + 0x1f) = xxxFreeListFree;

+    do {

+      *(longlong *)(unaff_RBP + 7) = unaff_R12;

+      *(undefined8 *)(unaff_RBP + -9) = 0;

+      *(undefined8 *)(unaff_RBP + -1) = 0;

+      if (unaff_R14 != 0) {

+        ptVar6 = PtiCurrent();

+        *(undefined8 *)(unaff_RBP + -9) = *(undefined8 *)(ptVar6 + 0x180);

+        *(longlong *)(ptVar6 + 0x180) = unaff_RBP + -9;

+        *(longlong *)(unaff_RBP + -1) = unaff_R14;

+        *(code **)(unaff_RBP + 7) = xxxFreeListFree;

+      }

+      if ((((*(uint *)(unaff_RDI + 0x50) & 2) == 0) || (unaff_EBX == 0)) &&

+         ((*(uint *)(unaff_RDI + 0x50) & 4) == 0)) {

+        UnlinkConv((tagDDECONV *)unaff_RDI);

+        Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                  ((Win32HMThreadLockBase<tagXSTATE,0,1> *)(unaff_RBP + -0x29));

+      }

+      else {

+        iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+        if (iVar3 == 0) {

+          lVar7 = _HMPheFromObject(unaff_RDI);

+          bVar12 = (*(byte *)(lVar7 + 0x19) & 1) == 0;

+        }

+        else {

+          ptVar8 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)unaff_RDI,10);

+          bVar12 = ptVar8 == (tagDDECONV *)unaff_RDI;

+        }

+        if (bVar12) {

+          uVar9 = xxxFreeDdeConv(*(undefined8 *)(unaff_RDI + 0x20));

+          *(undefined8 *)(unaff_RDI + 0x20) = uVar9;

+        }

+        ptVar10 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                            ((Win32HMThreadLockBase<tagXSTATE,0,1> *)(unaff_RBP + -0x29));

+        if (ptVar10 != (tagXSTATE *)0x0) {

+          xxxFreeDdeConv(ptVar10);

+        }

+      }

+      unaff_RDI = Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

+                            ((Win32HMThreadLockBase<tagMONITOR,1,1> *)(unaff_RBP + -0x19));

+      if (*(longlong *)(unaff_RBP + 7) != unaff_R12) {

+        PopAndFreeW32ThreadLock(unaff_RBP + -9);

+        *(longlong *)(unaff_RBP + 7) = unaff_R12;

+      }

+      if (*(longlong *)(unaff_RBP + 0x1f) != unaff_R12) {

+        PopAndFreeW32ThreadLock(unaff_RBP + 0xf);

+        *(longlong *)(unaff_RBP + 0x1f) = unaff_R12;

+      }

+      Win32HMThreadLockBase<tagDDECONV,0,1>::~Win32HMThreadLockBase<tagDDECONV,0,1>

+                ((Win32HMThreadLockBase<tagDDECONV,0,1> *)(unaff_RBP + -0x29));

+      Win32HMThreadLockBase<tagMONITOR,1,1>::~Win32HMThreadLockBase<tagMONITOR,1,1>

+                ((Win32HMThreadLockBase<tagMONITOR,1,1> *)(unaff_RBP + -0x19));

+      if (unaff_RDI == (tagMONITOR *)0x0) {

+        return extraout_EAX;

+      }

+      iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+      if (iVar3 != 0) {

+        iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+        if (iVar3 == 0) {

+          ptVar4 = (tagMONITOR *)_HMPheFromObject(unaff_RDI);

+          bVar12 = ((byte)ptVar4[0x19] & 1) == 0;

+        }

+        else {

+          ptVar4 = (tagMONITOR *)HMValidateHandleNoSecure(*(undefined8 *)unaff_RDI,10);

+          bVar12 = ptVar4 == unaff_RDI;

+        }

+        if (!bVar12) {

+          return (ulong)ptVar4;

+        }

+      }

+      p_Var2 = *(_HEAD **)(unaff_RDI + 0x18);

+      unaff_R14 = 0;

+      ptVar6 = PtiCurrent();

+      Win32HM_LockIntoThread<1>(ptVar6,p_Var2,(_Win32HMThreadLockItem *)(unaff_RBP + -0x19));

+      ptVar6 = PtiCurrent();

+      Win32HM_LockIntoThread<0>

+                (ptVar6,(_HEAD *)unaff_RDI,(_Win32HMThreadLockItem *)(unaff_RBP + -0x29));

+      if (((*(uint *)(unaff_RDI + 0x50) & 2) == 0) &&

+         (((uVar5 = GetAppCompatFlags2(0x400), (uVar5 & 0x20) == 0 ||

+           (*(longlong *)(unaff_RDI + 0x30) == 0)) ||

+          ((lVar7 = *(longlong *)(*(longlong *)(unaff_RDI + 0x30) + 0x10),

+           0x400 < *(uint *)(lVar7 + 0x2a0) || ((*(uint *)(lVar7 + 0x2b0) & 0x20) == 0)))))) {

+        iVar3 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

+        if (iVar3 != 0) {

+          *(uint *)(unaff_RDI + 0x50) = *(uint *)(unaff_RDI + 0x50) | 2;

+        }

+        if (*(__uint64 **)(unaff_RDI + 0x28) == (__uint64 *)0x0) {

+          _Var11 = 0;

+        }

+        else {

+          _Var11 = **(__uint64 **)(unaff_RDI + 0x28);

+        }

+        _PostTransformableMessageExtended

+                  (*(tagWND **)(unaff_RDI + 0x30),0x3e1,_Var11,0,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

+      }

+      lVar7 = *(longlong *)(unaff_RDI + 0x20);

+      if (lVar7 == 0) {

+        unaff_EBX = 1;

+      }

+      else {

+        bVar12 = (*(uint *)(lVar7 + 0x50) & 10) != 0;

+        if (bVar12) {

+          unaff_R14 = *(longlong *)(lVar7 + 0x48);

+          *(undefined8 *)(lVar7 + 0x48) = 0;

+        }

+        unaff_EBX = (uint)bVar12;

+        *(uint *)(*(longlong *)(unaff_RDI + 0x20) + 0x50) =

+             *(uint *)(*(longlong *)(unaff_RDI + 0x20) + 0x50) | 6;

+      }

+      lVar7 = *(longlong *)(unaff_RDI + 0x48);

+      *(undefined8 *)(unaff_RDI + 0x48) = 0;

+      *(longlong *)(unaff_RBP + 0x1f) = unaff_R12;

+      *(undefined8 *)(unaff_RBP + 0xf) = 0;

+      *(undefined8 *)(unaff_RBP + 0x17) = 0;

+    } while (lVar7 == 0);

+    ptVar6 = PtiCurrent();

+    *(undefined8 *)(unaff_RBP + 0xf) = *(undefined8 *)(ptVar6 + 0x180);

+    *(longlong *)(ptVar6 + 0x180) = unaff_RBP + 0xf;

+    *(longlong *)(unaff_RBP + 0x17) = lVar7;

+  } while( true );

 }
```

## `SizeOfDib`  (modified)

```diff
--- SizeOfDib
+++ xxxGetDummyDibV5
@@ -1,45 +1,70 @@
 

-/* unsigned long __cdecl SizeOfDib(struct tagBITMAPINFOHEADER * __ptr64) */

+/* void * __ptr64 __cdecl xxxGetDummyDibV5(struct tagWINDOWSTATION * __ptr64,struct tagGETCLIPBDATA

+   * __ptr64) */

 

-ulong __cdecl SizeOfDib(tagBITMAPINFOHEADER *param_1)

+void * __cdecl xxxGetDummyDibV5(tagWINDOWSTATION *param_1,tagGETCLIPBDATA *param_2)

 

 {

-  int iVar1;

-  ulong uVar2;

-  uint uVar3;

-  uint uVar4;

-  ulonglong uVar5;

+  ulong uVar1;

+  int iVar2;

+  tagCLIP *ptVar3;

+  longlong lVar4;

+  BITMAPV5HEADER *pBVar5;

+  HBITMAP__ *pHVar6;

+  HPALETTE__ *pHVar7;

+  void *pvVar8;

   

-  iVar1 = Feature_2204870969__private_IsEnabledDeviceUsageNoInline();

-  if (iVar1 == 0) {

-    uVar2 = SizeOfDibColorTable(param_1);

-    iVar1 = -*(int *)(param_1 + 8);

-    if (-*(int *)(param_1 + 8) < 0) {

-      iVar1 = *(int *)(param_1 + 8);

+  ptVar3 = FindClipFormat(param_1,8,1);

+  if ((((ptVar3 == (tagCLIP *)0x0) || (*(longlong *)(ptVar3 + 8) == 2)) ||

+      (lVar4 = xxxGetClipboardData(param_1,8,param_2), lVar4 == 0)) ||

+     ((lVar4 = HMValidateHandleNoRip(lVar4,6), lVar4 == 0 ||

+      (pBVar5 = DIBtoDIBV5((tagBITMAPINFOHEADER *)(lVar4 + 0x14),*(ulong *)(lVar4 + 0x10)),

+      pBVar5 == (BITMAPV5HEADER *)0x0)))) {

+    ptVar3 = FindClipFormat(param_1,2,1);

+    if (ptVar3 == (tagCLIP *)0x0) {

+      return (void *)0x0;

     }

-    uVar2 = uVar2 + iVar1 * ((int)((uint)*(ushort *)(param_1 + 0xe) * *(int *)(param_1 + 4) + 0x1f)

-                             >> 3 & 0xfffffffcU) + *(int *)param_1;

+    if (*(longlong *)(ptVar3 + 8) == 2) {

+      return (void *)0x0;

+    }

+    pHVar6 = (HBITMAP__ *)xxxGetClipboardData(param_1,2,param_2);

+    if (pHVar6 == (HBITMAP__ *)0x0) {

+      return (void *)0x0;

+    }

+    pHVar7 = (HPALETTE__ *)0x0;

+    lVar4 = W32GetUserSessionState();

+    if (((*(uint *)(*(longlong *)(lVar4 + 0x4e30) + 0x1b5c) & 1) != 0) &&

+       (pHVar7 = (HPALETTE__ *)xxxGetClipboardData(param_1,9,param_2), pHVar7 == (HPALETTE__ *)0x0))

+    {

+      return (void *)0x0;

+    }

+    pBVar5 = xxxBMPtoDIBV5(pHVar6,pHVar7);

+    if (pBVar5 == (BITMAPV5HEADER *)0x0) {

+      return (void *)0x0;

+    }

   }

-  else {

-    if (((ulonglong)*(ushort *)(param_1 + 0xe) * (ulonglong)*(uint *)(param_1 + 4) < 0x100000000) &&

-       (uVar3 = (uint)((ulonglong)*(ushort *)(param_1 + 0xe) * (ulonglong)*(uint *)(param_1 + 4)),

-       uVar4 = uVar3 + 0x1f, uVar3 <= uVar4)) {

-      uVar3 = -*(int *)(param_1 + 8);

-      if (-*(int *)(param_1 + 8) < 0) {

-        uVar3 = *(uint *)(param_1 + 8);

-      }

-      uVar5 = (ulonglong)uVar3 * (ulonglong)(uVar4 >> 3 & 0x1ffffffc);

-      if (uVar5 < 0x100000000) {

-        uVar3 = *(uint *)param_1;

-        uVar2 = SizeOfDibColorTable(param_1);

-        uVar4 = uVar2 + uVar3;

-        if ((uVar3 <= uVar4) && (uVar3 = uVar4 + (int)uVar5, uVar4 <= uVar3)) {

-          return uVar3;

-        }

-      }

+  uVar1 = SizeOfDib((tagBITMAPINFOHEADER *)pBVar5);

+  iVar2 = Feature_2204870969__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar2 != 0) && (uVar1 == 0)) {

+    Win32FreePool(pBVar5);

+    return (void *)0x0;

+  }

+  pvVar8 = (void *)_ConvertMemHandle(pBVar5,uVar1);

+  Win32FreePool(pBVar5);

+  if (pvVar8 == (void *)0x0) {

+    return (void *)0x0;

+  }

+  ptVar3 = FindClipFormat(param_1,0x11,1);

+  if (ptVar3 == (tagCLIP *)0x0) {

+    lVar4 = HMValidateHandleNoRip(pvVar8,6);

+    if (lVar4 != 0) {

+      HMUnlockDestroyObject(lVar4);

     }

-    uVar2 = 0;

+    return (void *)0x0;

   }

-  return uVar2;

+  UT_FreeCBFormat(ptVar3);

+  *(void **)(ptVar3 + 8) = pvVar8;

+  *(undefined4 *)param_2 = 0x11;

+  return pvVar8;

 }
```

## `InternalSetClipboardData`  (modified)

```diff
--- InternalSetClipboardData
+++ InternalSetClipboardData
@@ -1,15 +1,86 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl InternalSetClipboardData(struct tagWINDOWSTATION * __ptr64,unsigned int,void *

+   __ptr64,int,int) */

 

 int __cdecl

 InternalSetClipboardData

           (tagWINDOWSTATION *param_1,uint param_2,void *param_3,int param_4,int param_5)

 

 {

-  char *unaff_RDI;

+  int iVar1;

+  tagCLIP *ptVar2;

+  longlong lVar3;

+  longlong *plVar4;

+  ulonglong uVar5;

+  tagTHREADINFO *ptVar6;

+  uint uVar7;

+  undefined1 auStack_248 [32];

+  undefined1 local_228 [512];

+  ulonglong local_28;

   

-  *unaff_RDI = *unaff_RDI + (char)param_1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  local_28 = __security_cookie ^ (ulonglong)auStack_248;

+  if ((*(longlong *)(param_1 + 0x50) == 0) || (param_2 == 0)) {

+    UserSetLastError(0x58a);

+  }

+  else {

+    ptVar2 = FindClipFormat(param_1,param_2,2);

+    if (ptVar2 != (tagCLIP *)0x0) {

+      UT_FreeCBFormat(ptVar2);

+LAB_0:

+      *(void **)(ptVar2 + 8) = param_3;

+      *(int *)(ptVar2 + 0x10) = param_4;

+      plVar4 = (longlong *)PsGetCurrentProcessWin32Process();

+      uVar5 = 0;

+      if (plVar4 != (longlong *)0x0) {

+        uVar5 = (ulonglong)plVar4 & -(ulonglong)(*plVar4 != 0);

+      }

+      *(undefined4 *)(ptVar2 + 0x14) = *(undefined4 *)(uVar5 + 0x130);

+      plVar4 = (longlong *)PsGetCurrentProcessWin32Process();

+      uVar5 = 0;

+      if (plVar4 != (longlong *)0x0) {

+        uVar5 = (ulonglong)plVar4 & -(ulonglong)(*plVar4 != 0);

+      }

+      *(undefined4 *)(ptVar2 + 0x18) = *(undefined4 *)(uVar5 + 0x134);

+      if ((param_5 != 0) &&

+         (*(uint *)(param_1 + 0x40) = *(uint *)(param_1 + 0x40) | 0x40,

+         -1 < (char)*(undefined4 *)(param_1 + 0x40))) {

+        *(int *)(param_1 + 0x90) = *(int *)(param_1 + 0x90) + 1;

+      }

+      if (((*(longlong *)(param_1 + 0x70) == 0) ||

+          (ptVar6 = PtiCurrent(),

+          *(tagTHREADINFO **)(*(longlong *)(param_1 + 0x70) + 0x10) != ptVar6)) && (param_5 != 0)) {

+        *(int *)(param_1 + 0x8c) = *(int *)(param_1 + 0x8c) + 1;

+      }

+      return 1;

+    }

+    if (*(longlong *)(param_1 + 0x80) == 0) {

+      lVar3 = Win32AllocPoolZInit(0x20,0x62637355);

+    }

+    else {

+      uVar5 = (ulonglong)*(uint *)(param_1 + 0x88) << 5;

+      if (0xffffffff < uVar5) {

+        return 0;

+      }

+      uVar7 = (uint)uVar5 + 0x20;

+      if (uVar7 < (uint)uVar5) {

+        return 0;

+      }

+      lVar3 = UserReAllocPool(*(longlong *)(param_1 + 0x80),uVar5 & 0xffffffff,uVar7,0x62637355);

+    }

+    if (lVar3 != 0) {

+      *(longlong *)(param_1 + 0x80) = lVar3;

+      iVar1 = UserGetAtomName(param_2 & 0xffff,local_228,0x100);

+      if (iVar1 != 0) {

+        UserAddAtomEx(local_228,0,2);

+        uVar7 = *(uint *)(param_1 + 0x88);

+        *(uint *)(param_1 + 0x88) = uVar7 + 1;

+        ptVar2 = (tagCLIP *)(lVar3 + (ulonglong)uVar7 * 0x20);

+        *(uint *)ptVar2 = param_2;

+        goto LAB_0;

+      }

+    }

+  }

+  return 0;

 }
```

## `xxxExecute`  (modified)

```diff
--- xxxExecute
+++ xxxExecute
@@ -1,157 +1,59 @@
 

-/* WARNING: Instruction at (ram,0x0001402ab4ce) overlaps instruction at (ram,0x0001402ab4cc)

-    */

-/* WARNING: Control flow encountered bad instruction data */

+/* unsigned long __cdecl xxxExecute(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

+   __ptr64) */

 

 ulong __cdecl xxxExecute(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

-  char *pcVar1;

-  _HEAD *p_Var2;

-  int iVar3;

-  ulong extraout_EAX;

-  tagMONITOR *ptVar4;

-  ulonglong uVar5;

-  longlong in_RAX;

-  tagTHREADINFO *ptVar6;

-  longlong lVar7;

-  tagDDECONV *ptVar8;

-  undefined8 uVar9;

-  tagXSTATE *ptVar10;

-  uint unaff_EBX;

-  longlong unaff_RBP;

-  tagMONITOR *unaff_RDI;

-  __uint64 _Var11;

-  longlong unaff_R12;

-  longlong unaff_R14;

-  bool bVar12;

+  ulong uVar1;

+  int iVar2;

+  tagDDECONV *ptVar3;

+  longlong lVar4;

+  void *pvVar5;

+  bool bVar6;

+  ulong local_res18 [2];

+  tagINTDDEINFO *local_res20;

+  void *local_28 [2];

   

-  pcVar1 = (char *)(in_RAX + -0x77);

-  *pcVar1 = *pcVar1 + (char)param_1;

-  if (*pcVar1 != '\0') {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-    halt_baddata();

+  local_res20 = (tagINTDDEINFO *)0x0;

+  local_28[0] = (void *)0x0;

+  local_res18[0] = 0x800;

+  if (((*(byte *)(*(longlong *)(*(longlong *)(param_3 + 0x28) + 0x28) + 0x12) & 8) == 0) &&

+     (local_res18[0] = 0x800,

+     (*(byte *)(*(longlong *)(*(longlong *)(param_3 + 0x30) + 0x28) + 0x12) & 8) == 0)) {

+    local_res18[0] = 0x10800;

   }

-  do {

-    *(code **)(unaff_RBP + 0x1f) = xxxFreeListFree;

-    do {

-      *(longlong *)(unaff_RBP + 7) = unaff_R12;

-      *(undefined8 *)(unaff_RBP + -9) = 0;

-      *(undefined8 *)(unaff_RBP + -1) = 0;

-      if (unaff_R14 != 0) {

-        ptVar6 = PtiCurrent();

-        *(undefined8 *)(unaff_RBP + -9) = *(undefined8 *)(ptVar6 + 0x180);

-        *(longlong *)(ptVar6 + 0x180) = unaff_RBP + -9;

-        *(longlong *)(unaff_RBP + -1) = unaff_R14;

-        *(code **)(unaff_RBP + 7) = xxxFreeListFree;

-      }

-      if ((((*(uint *)(unaff_RDI + 0x50) & 2) == 0) || (unaff_EBX == 0)) &&

-         ((*(uint *)(unaff_RDI + 0x50) & 4) == 0)) {

-        UnlinkConv((tagDDECONV *)unaff_RDI);

-        Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

-                  ((Win32HMThreadLockBase<tagXSTATE,0,1> *)(unaff_RBP + -0x29));

-      }

-      else {

-        iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-        if (iVar3 == 0) {

-          lVar7 = _HMPheFromObject(unaff_RDI);

-          bVar12 = (*(byte *)(lVar7 + 0x19) & 1) == 0;

-        }

-        else {

-          ptVar8 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)unaff_RDI,10);

-          bVar12 = ptVar8 == (tagDDECONV *)unaff_RDI;

-        }

-        if (bVar12) {

-          uVar9 = xxxFreeDdeConv(*(undefined8 *)(unaff_RDI + 0x20));

-          *(undefined8 *)(unaff_RDI + 0x20) = uVar9;

-        }

-        ptVar10 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

-                            ((Win32HMThreadLockBase<tagXSTATE,0,1> *)(unaff_RBP + -0x29));

-        if (ptVar10 != (tagXSTATE *)0x0) {

-          xxxFreeDdeConv(ptVar10);

-        }

-      }

-      unaff_RDI = Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

-                            ((Win32HMThreadLockBase<tagMONITOR,1,1> *)(unaff_RBP + -0x19));

-      if (*(longlong *)(unaff_RBP + 7) != unaff_R12) {

-        PopAndFreeW32ThreadLock(unaff_RBP + -9);

-        *(longlong *)(unaff_RBP + 7) = unaff_R12;

-      }

-      if (*(longlong *)(unaff_RBP + 0x1f) != unaff_R12) {

-        PopAndFreeW32ThreadLock(unaff_RBP + 0xf);

-        *(longlong *)(unaff_RBP + 0x1f) = unaff_R12;

-      }

-      Win32HMThreadLockBase<tagDDECONV,0,1>::~Win32HMThreadLockBase<tagDDECONV,0,1>

-                ((Win32HMThreadLockBase<tagDDECONV,0,1> *)(unaff_RBP + -0x29));

-      Win32HMThreadLockBase<tagMONITOR,1,1>::~Win32HMThreadLockBase<tagMONITOR,1,1>

-                ((Win32HMThreadLockBase<tagMONITOR,1,1> *)(unaff_RBP + -0x19));

-      if (unaff_RDI == (tagMONITOR *)0x0) {

-        return extraout_EAX;

-      }

-      iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-      if (iVar3 != 0) {

-        iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-        if (iVar3 == 0) {

-          ptVar4 = (tagMONITOR *)_HMPheFromObject(unaff_RDI);

-          bVar12 = ((byte)ptVar4[0x19] & 1) == 0;

-        }

-        else {

-          ptVar4 = (tagMONITOR *)HMValidateHandleNoSecure(*(undefined8 *)unaff_RDI,10);

-          bVar12 = ptVar4 == unaff_RDI;

-        }

-        if (!bVar12) {

-          return (ulong)ptVar4;

-        }

-      }

-      p_Var2 = *(_HEAD **)(unaff_RDI + 0x18);

-      unaff_R14 = 0;

-      ptVar6 = PtiCurrent();

-      Win32HM_LockIntoThread<1>(ptVar6,p_Var2,(_Win32HMThreadLockItem *)(unaff_RBP + -0x19));

-      ptVar6 = PtiCurrent();

-      Win32HM_LockIntoThread<0>

-                (ptVar6,(_HEAD *)unaff_RDI,(_Win32HMThreadLockItem *)(unaff_RBP + -0x29));

-      if (((*(uint *)(unaff_RDI + 0x50) & 2) == 0) &&

-         (((uVar5 = GetAppCompatFlags2(0x400), (uVar5 & 0x20) == 0 ||

-           (*(longlong *)(unaff_RDI + 0x30) == 0)) ||

-          ((lVar7 = *(longlong *)(*(longlong *)(unaff_RDI + 0x30) + 0x10),

-           0x400 < *(uint *)(lVar7 + 0x2a0) || ((*(uint *)(lVar7 + 0x2b0) & 0x20) == 0)))))) {

-        iVar3 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

-        if (iVar3 != 0) {

-          *(uint *)(unaff_RDI + 0x50) = *(uint *)(unaff_RDI + 0x50) | 2;

-        }

-        if (*(__uint64 **)(unaff_RDI + 0x28) == (__uint64 *)0x0) {

-          _Var11 = 0;

-        }

-        else {

-          _Var11 = **(__uint64 **)(unaff_RDI + 0x28);

-        }

-        _PostTransformableMessageExtended

-                  (*(tagWND **)(unaff_RDI + 0x30),0x3e1,_Var11,0,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

-      }

-      lVar7 = *(longlong *)(unaff_RDI + 0x20);

-      if (lVar7 == 0) {

-        unaff_EBX = 1;

-      }

-      else {

-        bVar12 = (*(uint *)(lVar7 + 0x50) & 10) != 0;

-        if (bVar12) {

-          unaff_R14 = *(longlong *)(lVar7 + 0x48);

-          *(undefined8 *)(lVar7 + 0x48) = 0;

-        }

-        unaff_EBX = (uint)bVar12;

-        *(uint *)(*(longlong *)(unaff_RDI + 0x20) + 0x50) =

-             *(uint *)(*(longlong *)(unaff_RDI + 0x20) + 0x50) | 6;

-      }

-      lVar7 = *(longlong *)(unaff_RDI + 0x48);

-      *(undefined8 *)(unaff_RDI + 0x48) = 0;

-      *(longlong *)(unaff_RBP + 0x1f) = unaff_R12;

-      *(undefined8 *)(unaff_RBP + 0xf) = 0;

-      *(undefined8 *)(unaff_RBP + 0x17) = 0;

-    } while (lVar7 == 0);

-    ptVar6 = PtiCurrent();

-    *(undefined8 *)(unaff_RBP + 0xf) = *(undefined8 *)(ptVar6 + 0x180);

-    *(longlong *)(ptVar6 + 0x180) = unaff_RBP + 0xf;

-    *(longlong *)(unaff_RBP + 0x17) = lVar7;

-  } while( true );

+  uVar1 = xxxCopyDdeIn((void *)*param_2,local_res18,local_28,&local_res20);

+  iVar2 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 == 0) {

+    lVar4 = _HMPheFromObject(param_3);

+    bVar6 = (bool)(~*(byte *)(lVar4 + 0x19) & 1);

+  }

+  else {

+    ptVar3 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

+    bVar6 = ptVar3 == param_3;

+  }

+  if (bVar6 == false) {

+    uVar1 = 3;

+    if (local_res20 != (tagINTDDEINFO *)0x0) {

+      Win32FreePool();

+    }

+  }

+  else if (uVar1 == 2) {

+    *param_1 = *param_1 | 0x80000000;

+    pvVar5 = AnticipatePost(*(tagDDECONV **)(param_3 + 0x20),xxxExecuteAck,local_28[0],(void *)0x0,

+                            local_res20,local_res18[0]);

+    *param_2 = (__int64)pvVar5;

+    if (pvVar5 == (void *)0x0) {

+      uVar1 = 3;

+    }

+    else {

+      tagTHREADINFO::SetForegroundActivate

+                (*(tagTHREADINFO **)(*(longlong *)(param_3 + 0x28) + 0x10),2);

+      tagTHREADINFO::SetForegroundActivate

+                (*(tagTHREADINFO **)(*(longlong *)(param_3 + 0x30) + 0x10),2);

+    }

+  }

+  return uVar1;

 }
```

## `NtUserCheckProcessForClipboardAccess`  (modified)

```diff
--- NtUserCheckProcessForClipboardAccess
+++ NtUserCheckProcessForClipboardAccess
@@ -1,9 +1,86 @@
 

-undefined4 NtUserCheckProcessForClipboardAccess(void)

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

+

+undefined4

+NtUserCheckProcessForClipboardAccess(uint param_1,uint *param_2,undefined8 param_3,ulong param_4)

 

 {

-  undefined4 unaff_EDI;

+  char cVar1;

+  uint uVar2;

+  tagPROCESSINFO *ptVar3;

+  longlong *plVar4;

+  int *piVar5;

+  uint uVar6;

+  _tlgProvider_t *p_Var7;

+  tagTHREADINFO *ptVar8;

+  void *pvVar9;

+  undefined4 uVar10;

+  uint local_res8 [2];

+  tagPROCESSINFO *local_res18;

+  undefined8 local_res20;

+  __uint64 in_stack_ffffffffffffff70;

+  EnterLeaveCritShared local_88 [16];

+  CLockProcessByPid local_78 [24];

+  longlong local_60;

   

-  return unaff_EDI;

+                    /* 0x236840  1549  NtUserCheckProcessForClipboardAccess */

+  uVar2 = 0;

+  uVar10 = 1;

+  EnterLeaveCritShared::EnterLeaveCritShared(local_88,1);

+  CLockProcessByPid::CLockProcessByPid

+            (local_78,(void *)(ulonglong)param_1,0x400,param_4,1,in_stack_ffffffffffffff70);

+  if (local_60 != 0) {

+    ptVar3 = CLockProcessByPid::GetProcessInfo(local_78);

+    if (ptVar3 != (tagPROCESSINFO *)0x0) {

+      CLockProcessByPid::~CLockProcessByPid(local_78);

+      for (ptVar8 = *(tagTHREADINFO **)(ptVar3 + 0x158); ptVar8 != (tagTHREADINFO *)0x0;

+          ptVar8 = *(tagTHREADINFO **)(ptVar8 + 0x2c0)) {

+        uVar2 = InForegroundQueue(ptVar8,1);

+        if (uVar2 != 0) break;

+      }

+      if (uVar2 == 0) {

+        plVar4 = (longlong *)PsGetCurrentProcessWin32Process();

+        pvVar9 = (void *)0x0;

+        if (plVar4 != (longlong *)0x0) {

+          pvVar9 = (void *)((ulonglong)plVar4 & -(ulonglong)(*plVar4 != 0));

+        }

+        piVar5 = (int *)((longlong)pvVar9 + 0x134);

+        if (pvVar9 == (void *)0x0) {

+          piVar5 = (int *)&DAT_0;

+        }

+        if (*piVar5 == 0) {

+          uVar6 = (uint)((ulonglong)_DAT_1 * _DAT_fffff78000000320 >> 0x18);

+          if (*(uint *)(ptVar3 + 0x42c) <= uVar6) {

+            uVar2 = (uint)(uVar6 - *(uint *)(ptVar3 + 0x42c) < 0x1f5);

+          }

+          if (5 < DAT_2) {

+            p_Var7 = (_tlgProvider_t *)&DAT_2;

+            cVar1 = _tlgKeywordOn(&DAT_2,0x400000000000);

+            if (cVar1 != '\0') {

+              local_res18 = ptVar3 + 0x3d0;

+              local_res20 = 1;

+              local_res8[0] = uVar2;

+              _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+              ::Write<_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                        (p_Var7,&DAT_3,pvVar9,(_tlgWrapperByVal<8> *)&local_res20,

+                         (_tlgWrapperByVal<4> *)local_res8,

+                         (_tlgWrapSz<unsigned_short> *)&local_res18);

+            }

+          }

+        }

+      }

+      if (*(uint **)MmUserProbeAddress_exref <= param_2) {

+        param_2 = *(uint **)MmUserProbeAddress_exref;

+      }

+      *param_2 = uVar2;

+      goto LAB_4;

+    }

+  }

+  UserSetLastError(0x57);

+  CLockProcessByPid::~CLockProcessByPid(local_78);

+  uVar10 = 0;

+LAB_4:

+  UserSessionSwitchLeaveCrit();

+  return uVar10;

 }
```

## `FindClipFormat`  (modified)

```diff
--- FindClipFormat
+++ FindClipFormat
@@ -1,10 +1,60 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* struct tagCLIP * __ptr64 __cdecl FindClipFormat(struct tagWINDOWSTATION * __ptr64,unsigned

+   int,unsigned long) */

 

 tagCLIP * __cdecl FindClipFormat(tagWINDOWSTATION *param_1,uint param_2,ulong param_3)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  undefined8 uVar1;

+  int iVar2;

+  longlong *plVar3;

+  ulonglong uVar4;

+  tagCLIP *ptVar5;

+  undefined8 local_28;

+  undefined4 local_20;

+  undefined8 local_18;

+  int local_10;

+  

+  if ((param_2 != 0) && (ptVar5 = *(tagCLIP **)(param_1 + 0x80), ptVar5 != (tagCLIP *)0x0)) {

+    iVar2 = *(int *)(param_1 + 0x88);

+    while (iVar2 != 0) {

+      iVar2 = iVar2 + -1;

+      if (*(uint *)ptVar5 == param_2) {

+        if ((param_3 & 1) == 0) {

+          return ptVar5;

+        }

+        plVar3 = (longlong *)PsGetCurrentProcessWin32Process();

+        uVar4 = 0;

+        if (plVar3 != (longlong *)0x0) {

+          uVar4 = (ulonglong)plVar3 & -(ulonglong)(*plVar3 != 0);

+        }

+        local_28 = *(undefined8 *)(uVar4 + 0x130);

+        local_20 = *(undefined4 *)(uVar4 + 0x138);

+        local_18 = *(undefined8 *)(ptVar5 + 0x14);

+        local_10 = *(int *)(ptVar5 + 0x1c);

+        iVar2 = CheckClipboardAccessForIntegrityLevel(&local_18,&local_28);

+        if (iVar2 == 0) {

+          iVar2 = IsFmtBlocked(param_2);

+          if (iVar2 != 0) {

+            uVar1 = *(undefined8 *)(ptVar5 + 0x14);

+            iVar2 = *(int *)(ptVar5 + 0x1c);

+            plVar3 = (longlong *)PsGetCurrentProcessWin32Process();

+            uVar4 = 0;

+            if (plVar3 != (longlong *)0x0) {

+              uVar4 = (ulonglong)plVar3 & -(ulonglong)(*plVar3 != 0);

+            }

+            local_18 = uVar1;

+            local_10 = iVar2;

+            EtwTraceUIPIClipboardError(0,uVar4,param_2,&local_18);

+            return (tagCLIP *)0x0;

+          }

+          return ptVar5;

+        }

+        return ptVar5;

+      }

+      ptVar5 = ptVar5 + 0x20;

+    }

+  }

+  return (tagCLIP *)0x0;

 }
```

## `xxxRequestAck`  (modified)

```diff
--- xxxRequestAck
+++ xxxRequestAck
@@ -1,10 +1,147 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* unsigned long __cdecl xxxRequestAck(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

+   __ptr64) */

 

 ulong __cdecl xxxRequestAck(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  tagINTDDEINFO *ptVar1;

+  ulong uVar2;

+  uint uVar3;

+  int iVar4;

+  tagDDECONV *ptVar5;

+  longlong lVar6;

+  tagPUBOBJ *ptVar7;

+  void *pvVar8;

+  tagXSTATE *ptVar9;

+  longlong lVar10;

+  uint uVar11;

+  bool bVar12;

+  ulong local_res8 [2];

+  tagINTDDEINFO *local_48;

+  void *local_40;

+  

+  pvVar8 = (void *)0x0;

+  local_48 = (tagINTDDEINFO *)0x0;

+  local_40 = (void *)0x0;

+  if (*param_1 == 0x3e4) {

+    uVar2 = xxxCopyAckIn(param_1,param_2,param_3,&local_48);

+    iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+    if (iVar4 == 0) {

+      lVar10 = _HMPheFromObject(param_3);

+      bVar12 = (bool)(~*(byte *)(lVar10 + 0x19) & 1);

+    }

+    else {

+      ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

+      bVar12 = ptVar5 == param_3;

+    }

+    if (bVar12 == false) {

+      return 0;

+    }

+    if (uVar2 != 2) {

+      return uVar2;

+    }

+    PopState(param_3);

+    return 2;

+  }

+  if (*param_1 != 0x3e5) {

+    uVar2 = xxxUnexpectedServerPost(param_1,param_2,param_3);

+    return uVar2;

+  }

+  lVar10 = *(longlong *)(param_3 + 0x38);

+  local_res8[0] = 0x83;

+  uVar3 = xxxClientGetDDEFlags(*param_2);

+  iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+  if (iVar4 == 0) {

+    lVar6 = _HMPheFromObject(param_3);

+    bVar12 = (bool)(~*(byte *)(lVar6 + 0x19) & 1);

+  }

+  else {

+    ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

+    bVar12 = ptVar5 == param_3;

+  }

+  if ((bVar12 == false) || (*(longlong *)(param_3 + 0x38) != lVar10)) {

+LAB_0:

+    uVar2 = 3;

+  }

+  else {

+    if ((uVar3 >> 0xc & 1) == 0) {

+      uVar2 = xxxAdviseData(param_1,param_2,param_3);

+      return uVar2;

+    }

+    uVar2 = xxxCopyDdeIn((void *)*param_2,local_res8,&local_40,&local_48);

+    iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+    if (iVar4 == 0) {

+      lVar6 = _HMPheFromObject(param_3);

+      bVar12 = (bool)(~*(byte *)(lVar6 + 0x19) & 1);

+    }

+    else {

+      ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

+      bVar12 = ptVar5 == param_3;

+    }

+    ptVar1 = local_48;

+    if ((bVar12 == false) || (*(longlong *)(param_3 + 0x38) != lVar10)) {

+      if (local_48 == (tagINTDDEINFO *)0x0) {

+        return 3;

+      }

+      Win32FreePool();

+      return 3;

+    }

+    if (uVar2 != 2) {

+      return uVar2;

+    }

+    if ((*(ushort *)(local_48 + 0x48) & 0xa000) == 0) {

+      *(ushort *)(local_48 + 0x48) = *(ushort *)(local_48 + 0x48) | 0x2000;

+    }

+    if ((uVar3 & 0x2000) == 0) {

+      iVar4 = AddPublicObject((uint)*(ushort *)(local_48 + 0x4a),*(void **)(local_48 + 0x30),

+                              *(ulong *)(*(longlong *)

+                                          (*(longlong *)(*(longlong *)(param_3 + 0x28) + 0x10) +

+                                          0x1d0) + 0x38));

+      uVar11 = local_res8[0];

+      if (iVar4 != 0) {

+        uVar11 = local_res8[0] | 0x2000;

+      }

+    }

+    else {

+      ptVar7 = IsObjectPublic(*(void **)(local_48 + 0x30));

+      if (ptVar7 != (tagPUBOBJ *)0x0) {

+        Win32FreePool(ptVar1);

+        goto LAB_0;

+      }

+      iVar4 = GiveObject((uint)*(ushort *)(ptVar1 + 0x4a),*(void **)(ptVar1 + 0x30),

+                         *(ulong *)(*(longlong *)

+                                     (*(longlong *)(*(longlong *)(param_3 + 0x30) + 0x10) + 0x1d0) +

+                                   0x38));

+      uVar2 = local_res8[0];

+      if (iVar4 != 0) {

+        uVar2 = local_res8[0] | 0x4000;

+      }

+      uVar11 = uVar2 | 0x400;

+    }

+    *param_1 = *param_1 | 0x80000000;

+    if ((uVar3 & 0x8000) == 0) {

+      FreeListAdd(param_3,local_40,uVar11 & 0xfffffffe);

+      ptVar9 = Createpxs((_func_ulong_ulong_ptr___int64_ptr_tagDDECONV_ptr *)0x0,(void *)0x0,

+                         (void *)0x0,ptVar1,uVar11 | 0x200);

+      if (ptVar9 != (tagXSTATE *)0x0) {

+        pvVar8 = *(void **)ptVar9;

+        *(undefined8 *)(ptVar9 + 0x10) = *(undefined8 *)(*(longlong *)(param_3 + 0x30) + 0x10);

+      }

+    }

+    else {

+      pvVar8 = AnticipatePost(*(tagDDECONV **)(param_3 + 0x20),xxxAdviseDataAck,(void *)0x0,local_40

+                              ,ptVar1,uVar11);

+    }

+    *param_2 = (__int64)pvVar8;

+    if (pvVar8 == (void *)0x0) {

+      uVar2 = 3;

+    }

+    else {

+      PopState(param_3);

+      uVar2 = 2;

+    }

+  }

+  return uVar2;

 }
```

## `UmfdEscPATHOBJ_bCommonTo`  (modified)

```diff
--- UmfdEscPATHOBJ_bCommonTo
+++ UmfdEscPATHOBJ_bCommonTo
@@ -1,12 +1,40 @@
+

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* int __cdecl UmfdEscPATHOBJ_bCommonTo(int (__cdecl*)(struct _PATHOBJ * __ptr64,struct _POINTFIX *

+   __ptr64,unsigned long),struct _PATHOBJ * __ptr64,struct _POINTFIX * __ptr64,unsigned long) */

 

 int __cdecl

 UmfdEscPATHOBJ_bCommonTo

           (_func_int__PATHOBJ_ptr__POINTFIX_ptr_ulong *param_1,_PATHOBJ *param_2,_POINTFIX *param_3,

           ulong param_4)

 

 {

-  undefined4 in_EAX;

+  _PATHOBJ *p_Var1;

+  int iVar2;

+  UmfdTls *pUVar3;

+  _POINTFIX *_Dst;

+  ulonglong uVar4;

   

-  return CONCAT31((int3)((uint)in_EAX >> 8),(char)in_EAX + '|');

+  uVar4 = (ulonglong)param_4 << 3;

+  if (((uVar4 < 0x100000000) && (pUVar3 = UmfdTls::EnsureTls(), pUVar3 != (UmfdTls *)0x0)) &&

+     (p_Var1 = *(_PATHOBJ **)(pUVar3 + 0x30), p_Var1 != (_PATHOBJ *)0x0)) {

+    if ((int)uVar4 == 0) {

+      _Dst = (_POINTFIX *)0x0;

+    }

+    else {

+      _Dst = (_POINTFIX *)Win32AllocPool(uVar4 & 0xffffffff,0x6b644647);

+    }

+    if (_Dst != (_POINTFIX *)0x0) {

+      if (((int)uVar4 != 0) && (((ulonglong)param_3 & 3) != 0)) {

+                    /* WARNING: Subroutine does not return */

+        ExRaiseDatatypeMisalignment();

+      }

+      memcpy(_Dst,param_3,uVar4 & 0xffffffff);

+      iVar2 = (*param_1)(p_Var1,_Dst,param_4);

+      Win32FreePool(_Dst);

+      return iVar2;

+    }

+  }

+  return 0;

 }
```

## `xxxBMPtoDIB`  (modified)

```diff
--- xxxBMPtoDIB
+++ xxxBMPtoDIB
@@ -1,12 +1,153 @@
+

+/* struct tagBITMAPINFOHEADER * __ptr64 __cdecl xxxBMPtoDIB(struct HBITMAP__ * __ptr64,struct

+   HPALETTE__ * __ptr64,unsigned long * __ptr64) */

 

 tagBITMAPINFOHEADER * __cdecl xxxBMPtoDIB(HBITMAP__ *param_1,HPALETTE__ *param_2,ulong *param_3)

 

 {

-  code *pcVar1;

-  tagBITMAPINFOHEADER *ptVar2;

+  ushort uVar1;

+  ulonglong uVar2;

+  int iVar3;

+  uint uVar4;

+  tagBITMAPINFOHEADER *ptVar5;

+  longlong lVar6;

+  HDC hdc;

+  tagTHREADINFO *ptVar7;

+  HPALETTE hPal;

+  ushort uVar8;

+  uint uVar9;

+  ulonglong uVar10;

+  ulonglong uVar11;

+  ulonglong uVar12;

+  undefined4 local_78;

+  uint uStack_74;

+  undefined4 uStack_70;

+  undefined2 uStack_6c;

+  ushort uStack_6a;

+  uint local_68;

+  uint uStack_64;

+  uint uStack_60;

+  uint uStack_5c;

+  undefined4 uStack_58;

+  undefined4 uStack_54;

+  undefined8 local_50;

+  ulonglong uStack_48;

+  undefined8 local_40;

+  undefined8 uStack_38;

   

-  pcVar1 = (code *)swi(3);

-  ptVar2 = (tagBITMAPINFOHEADER *)(*pcVar1)();

-  return ptVar2;

+  local_50 = 0;

+  uStack_48 = 0;

+  local_40 = 0;

+  uStack_38 = 0;

+  iVar3 = GreExtGetObjectW(0,0x20);

+  uVar11 = 0;

+  if (iVar3 != 0) {

+    uVar1 = local_40._2_2_ * (short)local_40;

+    if (uVar1 < 2) {

+      uVar8 = 1;

+    }

+    else {

+      uVar8 = 4;

+      if (4 < uVar1) {

+        if (uVar1 < 9) {

+          uVar8 = 8;

+        }

+        else {

+          ptVar7 = PtiCurrent();

+          if (*(ushort *)(ptVar7 + 0x2a0) < 0x400) {

+            uVar8 = 0x18;

+          }

+          else if (uVar1 < 0x11) {

+            uVar8 = 0x10;

+          }

+          else {

+            uVar8 = 0x18;

+            if (0x18 < uVar1) {

+              uVar8 = 0x20;

+            }

+          }

+        }

+      }

+    }

+    uVar2 = uStack_48;

+    uVar4 = local_50._4_4_;

+    uVar10 = (ulonglong)local_50._4_4_;

+    uVar12 = uStack_48 & 0xffffffff;

+    uStack_64 = 0;

+    uStack_60 = 0;

+    uStack_5c = 0;

+    uStack_58 = 0;

+    uStack_74 = local_50._4_4_;

+    uStack_70 = (undefined4)uStack_48;

+    uStack_54 = 0;

+    local_78 = 0x28;

+    uStack_6c = 1;

+    local_68 = 0;

+    uStack_6a = uVar8;

+    iVar3 = Feature_3532623161__private_IsEnabledDeviceUsageNoInline();

+    if ((((iVar3 == 0) ||

+         (((ulonglong)uVar4 * (ulonglong)uVar8 < 0x100000000 &&

+          ((uint)((ulonglong)uVar4 * (ulonglong)uVar8) < 0xffffffe1)))) &&

+        (uVar10 * uVar8 < 0x100000000)) &&

+       (uVar12 = ((int)(uVar10 * uVar8) + 0x1fU >> 3 & 0x1ffffffc) * uVar12, uVar12 < 0x100000000))

+    {

+      if (uVar8 < 9) {

+        uVar11 = (ulonglong)(uint)((1 << ((byte)uVar8 & 0x1f)) << 2);

+      }

+      else if ((uVar8 - 0x10 & 0xffef) == 0) {

+        uVar11 = 0xc;

+        local_68 = 3;

+      }

+      uVar4 = (int)uVar11 + 0x28;

+      uVar9 = uVar4 + (int)uVar12;

+      if ((uVar4 <= uVar9) &&

+         (ptVar5 = (tagBITMAPINFOHEADER *)Win32AllocPoolZInit(uVar9,0x62637355),

+         ptVar5 != (tagBITMAPINFOHEADER *)0x0)) {

+        if (param_3 != (ulong *)0x0) {

+          *param_3 = uVar9;

+        }

+        *(ulonglong *)ptVar5 = CONCAT44(uStack_74,local_78);

+        *(ulonglong *)(ptVar5 + 8) = CONCAT26(uStack_6a,CONCAT24(uStack_6c,uStack_70));

+        *(uint *)(ptVar5 + 0x10) = local_68;

+        *(uint *)(ptVar5 + 0x14) = uStack_64;

+        *(uint *)(ptVar5 + 0x18) = uStack_60;

+        *(uint *)(ptVar5 + 0x1c) = uStack_5c;

+        *(ulonglong *)(ptVar5 + 0x20) = CONCAT44(uStack_54,uStack_58);

+        lVar6 = W32GetUserSessionState();

+        hdc = (HDC)GreCreateCompatibleDC(*(undefined8 *)(*(longlong *)(lVar6 + 0xdf10) + 0x40));

+        if (hdc != (HDC)0x0) {

+          hPal = (HPALETTE)0x0;

+          ptVar7 = PtiCurrent();

+          local_78 = (undefined4)*(undefined8 *)(ptVar7 + 0x180);

+          uStack_74 = (uint)((ulonglong)*(undefined8 *)(ptVar7 + 0x180) >> 0x20);

+          *(undefined4 **)(ptVar7 + 0x180) = &local_78;

+          local_68 = (uint)Win32FreePool_exref;

+          uStack_64 = (uint)((ulonglong)Win32FreePool_exref >> 0x20);

+          uStack_70 = SUB84(ptVar5,0);

+          uStack_6c = (undefined2)((ulonglong)ptVar5 >> 0x20);

+          uStack_6a = (ushort)((ulonglong)ptVar5 >> 0x30);

+          if (param_2 != (HPALETTE__ *)0x0) {

+            hPal = _SelectPalette(hdc,param_2,0);

+            xxxRealizePalette(hdc);

+          }

+          iVar3 = GreGetDIBitsInternal

+                            (hdc,param_1,ptVar5 + uVar11 + *(uint *)ptVar5,uVar2 & 0xffffffff,

+                             ptVar5 + uVar11 + *(uint *)ptVar5,ptVar5);

+          if (hPal != (HPALETTE)0x0) {

+            _SelectPalette(hdc,hPal,0);

+            xxxRealizePalette(hdc);

+          }

+          GreDeleteDC(hdc);

+          ptVar7 = PtiCurrent();

+          *(ulonglong *)(ptVar7 + 0x180) = CONCAT44(uStack_74,local_78);

+          if (iVar3 != 0) {

+            return ptVar5;

+          }

+        }

+        Win32FreePool(ptVar5);

+      }

+    }

+  }

+  return (tagBITMAPINFOHEADER *)0x0;

 }
```

## `NtGdiFONTOBJ_pQueryGlyphAttrs`  (modified)

```diff
--- NtGdiFONTOBJ_pQueryGlyphAttrs
+++ NtGdiFONTOBJ_pQueryGlyphAttrs
@@ -1,106 +1,59 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* WARNING: This function may have set the stack pointer */

 

-undefined4 NtGdiFONTOBJ_pQueryGlyphAttrs(char param_1)

+void * NtGdiFONTOBJ_pQueryGlyphAttrs(_FONTOBJ *param_1,uint param_2)

 

 {

-  undefined4 *puVar1;

-  byte *pbVar2;

-  UMPDOBJ *this;

-  bool bVar3;

-  int iVar4;

-  int *in_RAX;

-  _CLIPOBJ *p_Var5;

-  ulong unaff_EBX;

-  undefined4 uVar6;

-  longlong unaff_RBP;

-  undefined4 *unaff_RSI;

-  undefined4 *unaff_RDI;

-  ulong unaff_R12D;

-  _SURFOBJ *unaff_R13;

-  _TRIVERTEX *unaff_R14;

+  uint uVar1;

+  int iVar2;

+  _GRETHREAD *p_Var3;

+  _FONTOBJ *p_Var4;

+  uint *_Src;

+  void *_Dst;

+  void *pvVar5;

+  undefined1 auStackY_e8 [32];

+  PUBLIC_PFTOBJ local_b8 [16];

+  UMPDENGCALL local_a8 [32];

+  UMPDOBJ *local_88;

+  UMPDOBJ *local_38;

+  undefined4 local_30;

+  ulonglong local_28;

   

-  iVar4 = (int)in_RAX;

-  *in_RAX = *in_RAX + iVar4;

-  *(char *)(unaff_RBP + -0x7b) = *(char *)(unaff_RBP + -0x7b) + param_1;

-  pbVar2 = (byte *)(unaff_RDI + 1);

-  puVar1 = unaff_RSI + 1;

-  *unaff_RDI = *unaff_RSI;

-  *in_RAX = *in_RAX + iVar4;

-  *(char *)((longlong)in_RAX + -0x7b) = *(char *)((longlong)in_RAX + -0x7b) + param_1;

-  *pbVar2 = *pbVar2 >> 4 | *pbVar2 << 4;

-  *in_RAX = *in_RAX + iVar4;

-  *(char *)((longlong)in_RAX + -0x7d) = *(char *)((longlong)in_RAX + -0x7d) + param_1;

-  *(char *)in_RAX = (char)*in_RAX + (char)in_RAX;

-  if (((char)*in_RAX == '\0') || (lRam00000000000098c4 == 0)) {

-    uVar6 = 0;

-    goto LAB_0;

+                    /* 0x33a4c0  1325  NtGdiFONTOBJ_pQueryGlyphAttrs */

+  local_28 = __security_cookie ^ (ulonglong)auStackY_e8;

+  p_Var3 = GreGetCurrentThread();

+  UMPDOBJ::UMPDENGCALL::UMPDENGCALL(local_a8,p_Var3);

+  local_38 = local_88;

+  if ((local_88 != (UMPDOBJ *)0x0) &&

+     (p_Var4 = UMPDOBJ::GetDDIOBJ<_FONTOBJ>(local_88,param_1), p_Var4 != (_FONTOBJ *)0x0)) {

+    iVar2 = Feature_1355787579__private_IsEnabledDeviceUsageNoInline();

+    if ((iVar2 == 0) || (param_2 < 2)) {

+      _Dst = (void *)0x0;

+      pvVar5 = *(void **)(local_88 + 0x160);

+      if (pvVar5 == (void *)0x0) {

+        PUBLIC_PFTOBJ::PUBLIC_PFTOBJ(local_b8,(PFT *)p_Var4);

+        UMPDAcquireRFONTSem((RFONTOBJ *)local_b8,local_88,0,0,(int *)0x0);

+        _Src = (uint *)FONTOBJ_pQueryGlyphAttrs(p_Var4,param_2);

+        if (_Src != (uint *)0x0) {

+          uVar1 = *_Src;

+          _Dst = UMPDOBJ::_AllocUserMem(local_88,uVar1,0);

+          if (_Dst != (void *)0x0) {

+            memcpy(_Dst,_Src,(ulonglong)uVar1);

+            *(void **)(local_88 + 0x160) = _Dst;

+          }

+        }

+        UMPDReleaseRFONTSem((RFONTOBJ *)local_b8,local_88,(ulong *)0x0,(ulong *)0x0,(int **)0x0);

+        RFONTTMPOBJ::~RFONTTMPOBJ((RFONTTMPOBJ *)local_b8);

+        pvVar5 = _Dst;

+      }

+      UMPDOBJ::UMPDENGCALL::~UMPDENGCALL(local_a8);

+      return pvVar5;

+    }

+    local_38 = (UMPDOBJ *)0x3b76d7f;

+    local_30 = 0;

+    RtlLogUnexpectedCodepath(&local_38);

   }

-  uRam000000000000981c = 0x1403392bd;

-  CaptureRECTL((_RECTL **)0x98b4,(_RECTL *)0x99b4);

-  uRam000000000000981c = 0x1403392d2;

-  CapturePOINTL((_POINTL **)0x98ac,(_POINTL *)0x98cc);

-  uRam000000000000981c = 0x1403392e4;

-  CaptureBits(unaff_R14,pvRam0000000000009884,uRam0000000000009878);

-  uRam000000000000981c = 0x1403392f4;

-  CaptureBits(puVar1,pvRam000000000000988c,unaff_EBX);

-  if (iRam0000000000009874 == 0) {

-LAB_1:

-    bVar3 = false;

-  }

-  else {

-    uRam0000000000009844 = uRam0000000000009b0c;

-    uRam000000000000981c = 0x14033935f;

-    iVar4 = bValidVertexMeshData(unaff_R14,puVar1,unaff_R12D,(ulong)pbVar2,uRam0000000000009b0c);

-    if (iVar4 == 0) goto LAB_1;

-    bVar3 = true;

-  }

-  this = pURam000000000000989c;

-  uVar6 = 0;

-  if (!bVar3) goto LAB_0;

-  uRam000000000000981c = 0x14033938a;

-  p_Var5 = UMPDOBJ::GetDDIOBJ(pURam000000000000989c,p_Ram0000000000009894,

-                              (tagSIZE *)(unaff_R13 + 0x20));

-  uRam000000000000981c = 0x1403393a0;

-  ECLIPOBJTMPBOUNDED::ECLIPOBJTMPBOUNDED

-            ((ECLIPOBJTMPBOUNDED *)0x99c4,unaff_R13,p_Var5,(_RECTL *)0x0);

-  uRam000000000000981c = 0x1403393ad;

-  bVar3 = ECLIPOBJTMPBOUNDED::bValid((ECLIPOBJTMPBOUNDED *)0x99c4);

-  if (bVar3) {

-    uRam000000000000981c = 0x1403393c1;

-    UMPDOBJ::GetDDIOBJ<_XLATEOBJ>(this,p_Ram00000000000098a4);

-    uRam000000000000986c = uRam0000000000009b0c;

-    uRam0000000000009864 = uRam00000000000098ac;

-    uRam000000000000985c = uRam00000000000098b4;

-    uRam000000000000981c = 0x14033940a;

-    uRam0000000000009844 = unaff_R12D;

-    puRam000000000000984c = puVar1;

-    uRam0000000000009854 = (ulong)pbVar2;

-    iVar4 = EngGradientFill();

-    if (iVar4 == 0) goto LAB_2;

-    uVar6 = 1;

-  }

-  else {

-LAB_2:

-    uVar6 = 0;

-  }

-  uRam000000000000981c = 0x140339424;

-  ECLIPOBJTMPBOUNDED::~ECLIPOBJTMPBOUNDED((ECLIPOBJTMPBOUNDED *)0x99c4);

-LAB_0:

-  if (unaff_R14 != (_TRIVERTEX *)0x0) {

-    uRam000000000000981c = 0x140339437;

-    Win32FreePool();

-  }

-  if (puVar1 != (undefined4 *)0x0) {

-    uRam000000000000981c = 0x14033944b;

-    Win32FreePool(puVar1);

-  }

-  uRam000000000000981c = 0x14033945d;

-  UMPDSURFOBJ::~UMPDSURFOBJ((UMPDSURFOBJ *)0x9904);

-  uRam000000000000981c = 0x14033946a;

-  UMPDOBJ::UMPDENGCALL::~UMPDENGCALL((UMPDENGCALL *)0x9944);

-  uRam000000000000981c = 0x1403394bb;

-  return uVar6;

+  UMPDOBJ::UMPDENGCALL::~UMPDENGCALL(local_a8);

+  return (void *)0x0;

 }
```

## `xxxRealDefWindowProc`  (modified)

```diff
--- xxxRealDefWindowProc
+++ xxxRealDefWindowProc
@@ -1,7 +1,1117 @@
 

-void xxxRealDefWindowProc(void)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+

+HICON__ * xxxRealDefWindowProc

+                    (tagWND *param_1,uint param_2,HWND__ *param_3,tagDRAWITEMSTRUCT *param_4)

 

 {

-  return;

+  tagDRAWITEMSTRUCT *ptVar1;

+  ProtectedLargeUnicodeStringWNDstrName *this;

+  char cVar2;

+  byte bVar3;

+  bool bVar4;

+  SHORT SVar5;

+  int iVar6;

+  int iVar7;

+  _LARGE_UNICODE_STRING *p_Var8;

+  longlong lVar9;

+  tagHOTKEYSTRUCT **pptVar10;

+  tagTHREADINFO *ptVar11;

+  HWINSTA pHVar12;

+  tagMENU *ptVar13;

+  HDC pHVar14;

+  HDC pHVar15;

+  tagWND *ptVar16;

+  tagXSTATE *ptVar17;

+  longlong lVar18;

+  tagMENU *ptVar19;

+  tagTHREADINFO *ptVar20;

+  byte bVar21;

+  ushort uVar22;

+  uint uVar23;

+  HMENU pHVar24;

+  Win32HMThreadLockBase<tagWND,0,0> *pWVar25;

+  short sVar26;

+  undefined8 uVar27;

+  undefined8 uVar28;

+  UINT uItem;

+  HICON__ *pHVar29;

+  longlong *plVar30;

+  longlong lVar31;

+  ushort uVar32;

+  __int64 *p_Var33;

+  ulonglong uVar34;

+  short sVar35;

+  longlong lVar36;

+  undefined4 uVar37;

+  undefined1 auStackY_158 [32];

+  tagDRAWITEMSTRUCT *local_f0;

+  tagMENU *local_e8;

+  undefined8 uStack_e0;

+  undefined8 *local_d8 [2];

+  HMENU local_c8;

+  ulonglong local_c0 [2];

+  Win32HMThreadLockAlways<tagWND> local_b0 [16];

+  undefined8 local_a0;

+  undefined8 uStack_98;

+  undefined8 local_90;

+  undefined8 uStack_88;

+  undefined8 local_80;

+  undefined8 uStack_78;

+  Win32HMThreadLockAlways<tagWND> local_68 [16];

+  undefined4 local_58;

+  undefined8 local_54;

+  undefined8 uStack_4c;

+  ulonglong local_40;

+  

+  local_40 = __security_cookie ^ (ulonglong)auStackY_158;

+  local_e8 = (tagMENU *)param_1;

+  uVar37 = SmartObjStackRef<tagMENU>::SmartObjStackRef<tagMENU>

+                     ((SmartObjStackRef<tagMENU> *)local_d8);

+  if ((param_1 == (tagWND *)0xffffffffffffffff) || (0x400 < param_2)) goto LAB_0;

+  uVar22 = (ushort)param_3;

+  sVar35 = (short)param_4;

+  uVar32 = (ushort)((ulonglong)param_4 >> 0x10);

+  if (param_2 < 0xad) {

+    if (param_2 != 0xac) {

+      if (param_2 < 0x3c) {

+        if (param_2 == 0x3b) {

+          iVar6 = xxxClientShutdown(param_1,param_3);

+        }

+        else if (param_2 < 0x1a) {

+          if (param_2 == 0x19) goto LAB_1;

+          if (param_2 < 0x10) {

+            if (param_2 != 0xf) {

+              if (param_2 != 6) {

+                if (param_2 == 0xb) {

+                  xxxDWP_SetRedraw(param_1,(uint)(param_3 != (HWND__ *)0x0));

+                }

+                else {

+                  if (param_2 == 0xc) {

+                    iVar6 = DefSetText(param_1,param_4);

+                    pHVar29 = (HICON__ *)(longlong)iVar6;

+                    if (iVar6 != 0) {

+                      xxxRedrawTitle(param_1,8);

+                      xxxWindowEvent(0x800c,param_1,0,0);

+                    }

+                    goto LAB_2;

+                  }

+                  if (param_2 == 0xd) {

+                    if (param_3 != (HWND__ *)0x0) {

+                      this = (ProtectedLargeUnicodeStringWNDstrName *)(param_1 + 0xb8);

+                      if (*(longlong *)this != 0) {

+                        local_e8 = (tagMENU *)0x0;

+                        uStack_e0 = 0;

+                        p_Var8 = tagWND::ProtectedLargeUnicodeStringWNDstrName::getStrName

+                                           (this,(_LARGE_UNICODE_STRING *)&local_e8);

+                        DesktopVerifyHeapLargeUnicodeString(*(undefined8 *)(param_1 + 0x18),p_Var8);

+                      }

+                      ptVar1 = param_4 + 8;

+                      if (*(uint *)(*(longlong *)(param_1 + 0x28) + 0xb8) != 0) {

+                        if (*(int *)(param_4 + 4) < 0) {

+                          iVar6 = WCSToMBEx(0,*(undefined8 *)this,

+                                            *(uint *)(*(longlong *)(param_1 + 0x28) + 0xb8) >> 1,

+                                            ptVar1);

+                          *(undefined1 *)((longlong)iVar6 + *(longlong *)ptVar1) = 0;

+                          iVar7 = iVar6;

+                        }

+                        else {

+                          local_e8 = (tagMENU *)0x0;

+                          uStack_e0 = 0;

+                          p_Var8 = tagWND::ProtectedLargeUnicodeStringWNDstrName::getStrName

+                                             (this,(_LARGE_UNICODE_STRING *)&local_e8);

+                          iVar7 = TextCopy(p_Var8,*(longlong *)ptVar1,

+                                           (ulonglong)param_3 & 0xffffffff);

+                          iVar6 = iVar7 * 2;

+                        }

+                        *(int *)param_4 = iVar6;

+                        SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                                  ((SmartObjStackRef<tagMENU> *)local_d8);

+                        return (HICON__ *)(longlong)iVar7;

+                      }

+                      if (*(int *)(param_4 + 4) < 0) {

+                        *(undefined1 *)*(undefined2 **)ptVar1 = 0;

+                      }

+                      else {

+                        **(undefined2 **)ptVar1 = 0;

+                      }

+                    }

+                  }

+                  else if ((param_2 == 0xe) &&

+                          (uVar23 = *(uint *)(*(longlong *)(param_1 + 0x28) + 0xb8), uVar23 != 0)) {

+                    uVar34 = (ulonglong)local_f0 >> 0x20;

+                    local_f0 = (tagDRAWITEMSTRUCT *)((ulonglong)local_f0 & 0xffffffff00000000);

+                    if (param_4 == (tagDRAWITEMSTRUCT *)0x0) {

+                      uVar23 = uVar23 >> 1;

+                      local_f0 = (tagDRAWITEMSTRUCT *)CONCAT44((int)uVar34,uVar23);

+                    }

+                    else {

+                      RtlUnicodeToMultiByteSize(&local_f0,*(undefined8 *)(param_1 + 0xb8),uVar23);

+                      uVar23 = (uint)local_f0;

+                    }

+                    pHVar29 = (HICON__ *)(ulonglong)uVar23;

+                    goto LAB_3;

+                  }

+                }

+                goto LAB_0;

+              }

+              if (param_3 != (HWND__ *)0x0) {

+                xxxSetFocus(param_1);

+              }

+              if ((-1 < *(char *)(*(longlong *)(param_1 + 0x28) + 0xe8)) ||

+                 (ptVar19 = *(tagMENU **)(*(longlong *)(param_1 + 0x10) + 0x650),

+                 ptVar19 == (tagMENU *)0x0)) goto LAB_0;

+              Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+                        ((Win32HMThreadLockBase<tagMENU,0,0> *)&local_e8,ptVar19);

+              xxxSendNotifyMessage(ptVar19,0x349,param_3,0);

+              goto LAB_4;

+            }

+LAB_5:

+            xxxDWP_Paint(param_1);

+            goto LAB_0;

+          }

+          if (param_2 == 0x10) {

+            xxxDestroyWindow(param_1);

+            goto LAB_0;

+          }

+          if ((param_2 == 0x11) || (param_2 == 0x13)) goto LAB_6;

+          if (param_2 != 0x14) {

+            if ((param_2 == 0x18) && (sVar35 != 0)) {

+              bVar21 = *(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f);

+              if ((((bVar21 & 0xc0) + 0x80 & 0xbf) == 0) || (*(longlong *)(param_1 + 0x78) != 0)) {

+                if (param_3 == (HWND__ *)0x0) {

+                  bVar21 = bVar21 & 0x10;

+                }

+                else {

+                  if ((bVar21 & 0x10) != 0) goto LAB_0;

+                  bVar21 = *(byte *)(*(longlong *)(param_1 + 0x28) + 0x11) & 0x40;

+                }

+                if (bVar21 != 0) {

+                  SetOrClrWF(0,param_1,0x140,1);

+                  if (param_3 == (HWND__ *)0x0) {

+                    SetOrClrWF(1,param_1,0x140,1);

+                  }

+                  lVar9 = W32GetUserSessionState();

+                  xxxShowWindowEx(param_1,-(param_3 != (HWND__ *)0x0) & 4,

+                                  *(MinMaxOptions *)(lVar9 + 0x10650) & 0x10000);

+                }

+              }

+            }

+            goto LAB_0;

+          }

+LAB_7:

+          iVar6 = xxxDWP_EraseBkgnd(param_1,param_2,param_3);

+        }

+        else {

+          if (0x2b < param_2) {

+            if ((param_2 == 0x2e) || (param_2 == 0x2f)) {

+              pHVar29 = (HICON__ *)0xffffffffffffffff;

+              goto LAB_3;

+            }

+            if (param_2 != 0x32) {

+              if (param_2 == 0x33) {

+                pptVar10 = HotKeyHelper(param_1);

+                iVar6 = 0;

+                if (*pptVar10 != (tagHOTKEYSTRUCT *)0x0) {

+                  iVar6 = *(int *)(*pptVar10 + 8);

+                }

+                SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                          ((SmartObjStackRef<tagMENU> *)local_d8);

+                return (HICON__ *)(longlong)iVar6;

+              }

+              if (param_2 == 0x35) {

+                pHVar29 = (HICON__ *)

+                          ((ulonglong)(*(byte *)(*(longlong *)(param_1 + 0x28) + 0x10) >> 6) & 1);

+                goto LAB_2;

+              }

+              goto LAB_0;

+            }

+            iVar6 = DWP_SetHotKey(param_1,(ulonglong)param_3 & 0xffffffff);

+            goto LAB_8;

+          }

+          if (param_2 == 0x2b) {

+            DWP_DrawItem(param_4);

+            goto LAB_0;

+          }

+          if (param_2 == 0x1f) {

+            xxxDWP_DoCancelMode(param_1);

+            goto LAB_0;

+          }

+          if (param_2 != 0x20) {

+            if (param_2 == 0x21) {

+              ptVar19 = (tagMENU *)0x0;

+              if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) == 0x40) {

+                ptVar19 = *(tagMENU **)(param_1 + 0x68);

+              }

+              if (ptVar19 != (tagMENU *)0x0) {

+                Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+                          ((Win32HMThreadLockBase<tagMENU,0,0> *)&local_e8,ptVar19);

+                pHVar29 = (HICON__ *)

+                          xxxSendTransformableMessageTimeout(ptVar19,0x21,param_3,param_4);

+                if (pHVar29 != (HICON__ *)0x0) {

+                  Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+                            ((Win32HMThreadLockBase<tagWND,0,0> *)&local_e8);

+                  goto LAB_3;

+                }

+                Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+                          ((Win32HMThreadLockBase<tagWND,0,0> *)&local_e8);

+              }

+              if ((sVar35 != 2) || (pHVar29 = (HICON__ *)0x3, uVar32 != 0x201)) {

+                pHVar29 = (HICON__ *)0x1;

+              }

+              goto LAB_3;

+            }

+            if (param_2 != 0x26) {

+              if (param_2 != 0x27) goto LAB_0;

+              goto LAB_7;

+            }

+            goto LAB_5;

+          }

+          iVar6 = xxxDWP_SetCursor(param_1,param_3,(int)sVar35,

+                                   (uint)((ulonglong)param_4 >> 0x10) & 0xffff);

+        }

+LAB_9:

+        pHVar29 = (HICON__ *)(longlong)iVar6;

+        goto LAB_3;

+      }

+      if (param_2 < 0x81) {

+        if (param_2 == 0x80) {

+          pHVar29 = xxxDWP_SetIcon(param_1,(__uint64)param_3,(HICON__ *)param_4);

+          goto LAB_2;

+        }

+        if (param_2 < 0x51) {

+          if (param_2 != 0x50) {

+            if (param_2 == 0x46) {

+              if ((*(uint *)(param_4 + 0x20) & 1) == 0) {

+                xxxAdjustSize(param_1,param_4 + 0x18,param_4 + 0x1c);

+              }

+              goto LAB_0;

+            }

+            if (param_2 == 0x47) {

+              xxxHandleWindowPosChanged(param_1,param_4);

+              goto LAB_0;

+            }

+            if (param_2 == 0x49) {

+              pHVar29 = (HICON__ *)SfnCOPYGLOBALDATA(0,0,param_3,param_4);

+              goto LAB_2;

+            }

+            if (param_2 == 0x4d) {

+              GetContextHelpId(param_1);

+              if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) == 0x40) {

+                uVar37 = *(undefined4 *)(*(longlong *)(param_1 + 0x28) + 0x140);

+              }

+              else {

+                uVar37 = 0;

+              }

+              xxxSendHelpMessage(param_1,1,uVar37,*(undefined8 *)param_1);

+              goto LAB_0;

+            }

+            if ((param_2 != 0x4f) || (lVar9 = ValidateHwnd(param_3), lVar9 == 0))

+            goto LAB_0;

+LAB_6:

+            pHVar29 = (HICON__ *)0x1;

+            goto LAB_3;

+          }

+          ptVar11 = PtiCurrent();

+          ptVar19 = *(tagMENU **)(*(longlong *)(ptVar11 + 0x1d8) + 0x88);

+          local_e8 = ptVar19;

+          if (((ptVar19 == (tagMENU *)0x0) || (ptVar19 == (tagMENU *)param_1)) ||

+             (lVar9 = *(longlong *)(param_1 + 0x88), lVar36 = W32GetUserSessionState(),

+             **(short **)(lVar9 + 8) == *(short *)(*(longlong *)(lVar36 + 0x4e30) + 0x388))) {

+            iVar6 = Feature_KeyboardSettings_InputProfileHotKeys__private_IsEnabledDeviceUsageNoInline

+                              ();

+            uVar37 = 0x100;

+            if (iVar6 != 0) {

+              ptVar11 = PtiCurrent();

+              lVar9 = W32GetUserSessionState();

+              if (ptVar11 != *(tagTHREADINFO **)(lVar9 + 0x4a60)) {

+                ptVar11 = PtiCurrent();

+                cVar2 = IsKeyboardDelegationTarget(ptVar11);

+                if (cVar2 == '\0') goto LAB_10;

+              }

+              uVar37 = 0;

+            }

+LAB_10:

+            pHVar12 = _GetProcessWindowStation();

+            lVar9 = xxxActivateKeyboardLayout(pHVar12,param_4,uVar37,param_1);

+            if (lVar9 == 0) {

+              UserSetLastError(0x5b1);

+            }

+            goto LAB_0;

+          }

+          Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+                    ((Win32HMThreadLockBase<tagMENU,0,0> *)local_c0,ptVar19);

+          xxxSendTransformableMessageTimeout(local_e8,0x50,param_3,param_4);

+          pWVar25 = (Win32HMThreadLockBase<tagWND,0,0> *)local_c0;

+        }

+        else {

+          if (param_2 == 0x51) {

+            lVar9 = BuildHwndList(*(undefined8 *)(param_1 + 0x70),2,0,1);

+            if (lVar9 != 0) {

+              plVar30 = (longlong *)(lVar9 + 0x20);

+              lVar36 = *plVar30;

+              while (lVar36 != 1) {

+                local_e8 = (tagMENU *)HMValidateHandleNoSecure(lVar36,1);

+                if (local_e8 != (tagMENU *)0x0) {

+                  Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+                            ((Win32HMThreadLockBase<tagMENU,0,0> *)local_c0,local_e8);

+                  xxxSendTransformableMessageTimeout(local_e8,0x51,param_3,param_4);

+                  Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+                            ((Win32HMThreadLockBase<tagWND,0,0> *)local_c0);

+                }

+                plVar30 = plVar30 + 1;

+                lVar36 = *plVar30;

+              }

+              FreeHwndList(lVar9);

+            }

+            goto LAB_0;

+          }

+          if (param_2 == 0x53) {

+            if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) == 0x40) {

+              ptVar19 = *(tagMENU **)(param_1 + 0x68);

+            }

+            else {

+              ptVar19 = *(tagMENU **)(param_1 + 0x78);

+            }

+            if ((ptVar19 == (tagMENU *)0x0) ||

+               (ptVar13 = (tagMENU *)GetThreadDesktopWindow(0), ptVar19 == ptVar13))

+            goto LAB_0;

+            Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+                      ((Win32HMThreadLockBase<tagMENU,0,0> *)local_c0,ptVar19);

+            pHVar29 = (HICON__ *)xxxSendTransformableMessageTimeout(ptVar19,0x53,param_3,param_4);

+            pWVar25 = (Win32HMThreadLockBase<tagWND,0,0> *)local_c0;

+            goto LAB_11;

+          }

+          if (param_2 == 0x55) {

+            if (param_4 == (tagDRAWITEMSTRUCT *)0x3) {

+              bVar21 = *(byte *)(*(longlong *)(param_1 + 0x28) + 0x13);

+              SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                        ((SmartObjStackRef<tagMENU> *)local_d8);

+              return (HICON__ *)(2 - (ulonglong)((bVar21 & 0x20) != 0));

+            }

+            goto LAB_0;

+          }

+          if (param_2 != 0x7b) {

+            if (param_2 == 0x7f) {

+              pHVar29 = (HICON__ *)DWP_GetIcon(param_1,(ulonglong)param_3 & 0xffffffff);

+              goto LAB_2;

+            }

+            goto LAB_0;

+          }

+          iVar6 = FindNCHit(param_1,(ulonglong)param_4 & 0xffffffff);

+          if (iVar6 == 6 || iVar6 == 7) {

+            ptVar11 = PtiCurrent();

+            iVar6 = _IsDescendant(*(undefined8 *)(*(longlong *)(ptVar11 + 0x1d8) + 0x90),param_1);

+            if (iVar6 != 0) {

+              iVar6 = Feature_UserModeNonClientScrollBars2__private_IsEnabledDeviceUsageNoInline();

+              if ((iVar6 == 0) ||

+                 (bVar4 = Scrollbar::NonClient::UserModeSupportsUserModeScrollBars(), !bVar4)) {

+                xxxDoScrollMenu(param_1);

+              }

+              else {

+                xxxClientDoScrollMenu(*(undefined8 *)param_1);

+              }

+            }

+            goto LAB_0;

+          }

+          if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) != 0x40) {

+            ptVar11 = PtiCurrent();

+            if (param_1 != *(tagWND **)(*(longlong *)(ptVar11 + 0x1d8) + 0x90)) goto LAB_0;

+            if (iVar6 == 2) goto LAB_12;

+            if (iVar6 != 3) goto LAB_0;

+LAB_13:

+            uItem = 0xf060;

+            goto LAB_14;

+          }

+          Win32HMThreadLockAlways<tagWND>::

+          Win32HMThreadLockAlways<tagWND><tagWND::SharedUserObjPointerFieldspwndParent>

+                    ((Win32HMThreadLockAlways<tagWND> *)&local_e8,

+                     (SharedUserObjPointerFieldspwndParent<tagWND> *)(param_1 + 0x68));

+          xxxSendTransformableMessageTimeout

+                    (*(undefined8 *)(param_1 + 0x68),0x7b,*(undefined8 *)param_1,param_4);

+LAB_4:

+          pWVar25 = (Win32HMThreadLockBase<tagWND,0,0> *)&local_e8;

+        }

+LAB_15:

+        Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>(pWVar25);

+        goto LAB_0;

+      }

+      if (0x88 < param_2) {

+        if (((param_2 == 0xa1) || (param_2 == 0xa2)) || (param_2 == 0xa3)) {

+          xxxDWP_NCMouse(param_1,param_2,(uint)param_3,(__int64)param_4);

+        }

+        else if (param_2 == 0xa4) {

+          local_a0 = 0;

+          uStack_98 = 0;

+          local_90 = 0;

+          uStack_88 = 0;

+          local_80 = 0;

+          uStack_78 = 0;

+          ptVar11 = PtiCurrent();

+          iVar6 = FindNCHit(param_1,(ulonglong)param_4 & 0xffffffff);

+          if (iVar6 == 6 || iVar6 == 7) {

+            iVar6 = _IsDescendant(*(undefined8 *)(*(longlong *)(ptVar11 + 0x1d8) + 0x90),param_1);

+            if (iVar6 == 0) goto LAB_0;

+          }

+          else if ((iVar6 != 2 && iVar6 != 3) ||

+                  (param_1 != *(tagWND **)(*(longlong *)(ptVar11 + 0x1d8) + 0x90)))

+          goto LAB_0;

+          xxxSetCapture(param_1);

+          while ((iVar6 = xxxInternalGetMessage(&local_a0,0), iVar6 == 0 ||

+                 ((int)uStack_98 != 0x205))) {

+            if ((param_1 != *(tagWND **)(*(longlong *)(ptVar11 + 0x1d8) + 0x80)) ||

+               (iVar6 = xxxSleepThread2(6,0,1,0), iVar6 == 0)) goto LAB_0;

+          }

+          xxxReleaseCapture();

+          iVar7 = CONCAT22((undefined2)uStack_78,local_80._4_2_);

+          iVar6 = FindNCHit(param_1,iVar7);

+          if ((iVar6 - 2U & 0xfffffffa) == 0) {

+            if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0xe8) & 0x40) != 0) {

+              if (iVar6 == 2) goto LAB_12;

+              if (iVar6 == 3) goto LAB_13;

+            }

+            uVar34 = (ulonglong)iVar7;

+            goto LAB_16;

+          }

+        }

+        goto LAB_0;

+      }

+      if (param_2 == 0x88) {

+        SetOrClrWF(0,param_1,0x280,1);

+        xxxInternalDoSyncPaint(param_1,(ulonglong)param_3 & 0xffffffff);

+        goto LAB_0;

+      }

+      if (param_2 != 0x81) {

+        if (param_2 == 0x83) {

+          xxxCalcClientRect(param_1,param_4,0);

+          goto LAB_0;

+        }

+        if (param_2 != 0x84) {

+          if (param_2 == 0x85) {

+            SetOrClrWF(1,param_1,0x180,1);

+            pHVar14 = _GetDCEx((HWND)param_1,(HRGN)param_3,0x50481);

+            uVar28 = 0;

+            if (pHVar14 != (HDC)0x0) {

+              if (((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x10) & 0x40) != 0) &&

+                 (lVar9 = W32GetUserSessionState(),

+                 *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d8) ==

+                 *(longlong *)(lVar9 + 0x4a50))) {

+                uVar28 = 1;

+              }

+              pHVar15 = pHVar14;

+              xxxDrawWindowFrame(param_1,pHVar14,uVar28);

+              _ReleaseDC((HWND)pHVar14,pHVar15);

+            }

+            SetOrClrWF(0,param_1,0x180,1);

+            goto LAB_0;

+          }

+          if (param_2 != 0x86) goto LAB_0;

+          xxxDWP_DoNCActivate(param_1,uVar22 != 0,param_4);

+          goto LAB_6;

+        }

+        iVar6 = FindNCHit(param_1,(ulonglong)param_4 & 0xffffffff);

+        goto LAB_9;

+      }

+      if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1e) & 0x30) != 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+          cVar2 = '\0';

+        }

+        else {

+          cVar2 = '\x01';

+        }

+        bVar4 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar2 != '\0') || (bVar4)) {

+          lVar9 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_qDll

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar2,bVar4,

+                     *(undefined8 *)(lVar9 + 0x10f98));

+        }

+        iVar6 = Feature_UserModeNonClientScrollBars2__private_IsEnabledDeviceUsageNoInline();

+        if ((iVar6 == 0) ||

+           (bVar4 = Scrollbar::NonClient::UserModeSupportsUserModeScrollBars(), !bVar4)) {

+          lVar9 = _InitPwSB(param_1);

+          if (lVar9 != 0) goto LAB_17;

+          iVar6 = 0;

+        }

+        else {

+          iVar6 = xxxClientInitPSBInfo(*(undefined8 *)param_1);

+        }

+        if (iVar6 == 0) goto LAB_0;

+      }

+LAB_17:

+      pHVar29 = (HICON__ *)0x1;

+      if (param_4 != (tagDRAWITEMSTRUCT *)0x0) {

+        local_f0 = param_4 + 0x50;

+        if (((*(longlong *)(param_1 + 0x18) == 0) || (local_f0 == (tagDRAWITEMSTRUCT *)0x0)) ||

+           (*(longlong *)(param_4 + 0x58) == 0)) {

+          *(undefined4 *)(*(longlong *)(param_1 + 0x28) + 0xb8) = 0;

+          goto LAB_3;

+        }

+        if ((((*(int *)(param_4 + 0x54) < 0) && (*(uint *)local_f0 != 0)) &&

+            (**(char **)(param_4 + 0x58) == -1)) ||

+           (((-1 < *(int *)(param_4 + 0x54) && (1 < *(uint *)local_f0)) &&

+            (**(short **)(param_4 + 0x58) == -1)))) {

+          SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                    ((SmartObjStackRef<tagMENU> *)local_d8);

+          return (HICON__ *)0x1;

+        }

+      }

+      SetOrClrWF(1,param_1,0x202,1);

+      iVar6 = DefSetText(param_1,param_4 + 0x50);

+      goto LAB_8;

+    }

+LAB_18:

+    uVar22 = 0;

+    uVar23 = (uint)((ulonglong)param_3 >> 0x10) & 0xffff;

+    if (uVar23 == 1) {

+      uVar22 = 1;

+LAB_19:

+      if (uVar22 == 0) goto LAB_0;

+    }

+    else {

+      if (uVar23 != 2) goto LAB_19;

+      uVar22 = 2;

+    }

+    if (param_2 != 0x20c) {

+      ptVar11 = PtiCurrent();

+      uVar23 = GetMouseKeyFlags(*(undefined8 *)(ptVar11 + 0x1d8));

+      param_3 = (HWND__ *)(ulonglong)uVar23;

+    }

+    uVar34 = (ulonglong)(uVar22 | 0x8000) << 0x10 | (ulonglong)param_3 & 0xffff;

+    uVar27 = 0x319;

+LAB_20:

+    uVar28 = *(undefined8 *)param_1;

+  }

+  else {

+    if (0x205 < param_2) {

+      if (param_2 < 0x246) {

+        if (param_2 != 0x245) {

+          if (param_2 < 0x22b) {

+            if (param_2 == 0x22a) {

+              SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                        ((SmartObjStackRef<tagMENU> *)local_d8);

+              return (HICON__ *)0x454c4946;

+            }

+            if (param_2 != 0x20a) {

+              if (param_2 == 0x20c) goto LAB_18;

+              if (param_2 != 0x20e) {

+                if ((param_2 != 0x218) && (param_2 != 0x219)) goto LAB_0;

+                goto LAB_6;

+              }

+            }

+            if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) != 0x40)

+            goto LAB_0;

+            Win32HMThreadLockAlways<tagWND>::

+            Win32HMThreadLockAlways<tagWND><tagWND::SharedUserObjPointerFieldspwndParent>

+                      (local_b0,(SharedUserObjPointerFieldspwndParent<tagWND> *)(param_1 + 0x68));

+LAB_21:

+            xxxSendTransformableMessageTimeout

+                      (*(undefined8 *)(param_1 + 0x68),param_2,param_3,param_4);

+            pWVar25 = (Win32HMThreadLockBase<tagWND,0,0> *)local_b0;

+            goto LAB_15;

+          }

+          if (param_2 == 0x22b) {

+            bVar21 = *(byte *)(*(longlong *)(param_1 + 0x28) + 0x18);

+            SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                      ((SmartObjStackRef<tagMENU> *)local_d8);

+            return (HICON__ *)((ulonglong)(bVar21 >> 4) & 1);

+          }

+          if (param_2 == 0x240) {

+            ptVar11 = PtiCurrent();

+            if (*(tagDRAWITEMSTRUCT **)(ptVar11 + 0x4a8) == param_4) {

+              ptVar11 = PtiCurrent();

+              *(undefined8 *)(ptVar11 + 0x4a8) = 0;

+            }

+            _FreeTouchInputInfo(param_4,1);

+            goto LAB_0;

+          }

+          if (((param_2 != 0x241) && (param_2 != 0x242)) && (param_2 != 0x243)) goto LAB_0;

+        }

+LAB_22:

+        pHVar29 = (HICON__ *)xxxDefPointerProc(uVar37,param_2,param_3,0);

+        goto LAB_2;

+      }

+      if (param_2 < 0x318) {

+        if (param_2 != 0x317) {

+          if ((((param_2 == 0x246) || (param_2 == 0x247)) || (param_2 == 0x24e)) ||

+             (param_2 == 0x24f)) goto LAB_22;

+          if (((param_2 != 0x313) || ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 8) != 0))

+             || ((lVar9 = W32GetUserSessionState(),

+                 *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d8) !=

+                 *(longlong *)(lVar9 + 0x4a50) &&

+                 (bVar4 = xxxSetForegroundWindowWithOptions(param_1,2,0,0), !bVar4))))

+          goto LAB_0;

+LAB_12:

+          uItem = (-(uint)((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0x21) != 0) & 0xf0) +

+                  0xf030;

+LAB_14:

+          ptVar19 = (tagMENU *)xxxGetSysMenu(param_1,1);

+          local_c8 = (HMENU)0x0;

+          SmartObjStackRefBase<tagMENU>::operator=

+                    ((SmartObjStackRefBase<tagMENU> *)local_d8,ptVar19);

+          bVar4 = SmartObjStackRef<tagMENU>::operator==

+                            ((SmartObjStackRef<tagMENU> *)local_d8,(int)ptVar19);

+          if (bVar4) goto LAB_0;

+          iVar6 = IsInsideUserApiHook();

+          if (iVar6 != 0) {

+            pHVar24 = local_c8;

+            if (local_c8 == (HMENU)0x0) {

+              pHVar24 = (HMENU)*local_d8[0];

+            }

+            MNClearCachedPopupSizes(pHVar24);

+          }

+          pHVar24 = local_c8;

+          if (local_c8 == (HMENU)0x0) {

+            pHVar24 = (HMENU)*local_d8[0];

+          }

+          _SetMenuDefaultItem(pHVar24,uItem,0);

+          PostShellHookMessagesEx(9,*(undefined8 *)param_1);

+          Win32HMThreadLockAlways<tagMENU>::Win32HMThreadLockAlways<tagMENU><SmartObjStackRef>

+                    ((Win32HMThreadLockAlways<tagMENU> *)local_b0,

+                     (SmartObjStackRef<tagMENU> *)local_d8);

+          if (param_4 == (tagDRAWITEMSTRUCT *)0xffffffff) {

+            lVar9 = W32GetUserSessionState();

+            if ((*(uint *)(*(longlong *)(lVar9 + 0x4e30) + 0x848) & 8) != 0) {

+              local_54 = 0;

+              uStack_4c = 0;

+              local_58 = 0x14;

+              iVar6 = xxxSendMinRectMessages(param_1,&local_54);

+              if (iVar6 != 0) {

+                uVar28 = 0x240;

+                iVar6 = (int)local_54;

+                iVar7 = local_54._4_4_;

+                goto LAB_23;

+              }

+            }

+          }

+          else {

+            iVar7 = (int)(short)uVar32;

+            iVar6 = (int)sVar35;

+            uVar28 = 0x202;

+LAB_23:

+            xxxTrackPopupMenuEx(local_d8,uVar28,iVar6,iVar7);

+          }

+          Win32HMThreadLockAlways<tagMENU>::~Win32HMThreadLockAlways<tagMENU>

+                    ((Win32HMThreadLockAlways<tagMENU> *)local_b0);

+          goto LAB_0;

+        }

+        iVar6 = xxxDWPPrint(param_1,(HDC__ *)param_3,(__int64)param_4);

+      }

+      else {

+        if (param_2 == 0x319) {

+          if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) != 0x40) {

+            ptVar16 = (tagWND *)_GetDesktopWindow();

+            if (param_1 != ptVar16) {

+              bVar4 = false;

+              ptVar11 = PtiCurrent();

+              ptVar20 = PtiCurrent();

+              if (((*(uint *)(**(longlong **)(ptVar20 + 0x1f8) + 0x10) | *(uint *)(ptVar11 + 0x2d0))

+                   >> 0xb & 1) != 0) {

+                iVar6 = xxxCallHook(0xc,(__uint64)param_3,(__int64)param_4,10);

+                bVar4 = iVar6 != 0;

+              }

+              if (!bVar4) {

+                PostShellHookMessagesEx(0xc,param_4);

+              }

+            }

+            goto LAB_0;

+          }

+          Win32HMThreadLockAlways<tagWND>::

+          Win32HMThreadLockAlways<tagWND><tagWND::SharedUserObjPointerFieldspwndParent>

+                    ((Win32HMThreadLockAlways<tagWND> *)&local_58,

+                     (SharedUserObjPointerFieldspwndParent<tagWND> *)(param_1 + 0x68));

+          pHVar29 = (HICON__ *)

+                    xxxSendTransformableMessageTimeout

+                              (*(undefined8 *)(param_1 + 0x68),0x319,param_3,param_4);

+          pWVar25 = (Win32HMThreadLockBase<tagWND,0,0> *)&local_58;

+LAB_11:

+          Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>(pWVar25);

+          goto LAB_3;

+        }

+        if (param_2 == 0x31b) {

+          iVar6 = IsInsideUserApiHook();

+          if (iVar6 == 0) goto LAB_0;

+          ptVar11 = PtiCurrent();

+          LOCK();

+          uVar23 = *(uint *)(ptVar11 + 0x210);

+          if (uVar23 == 0) {

+            *(uint *)(ptVar11 + 0x210) = 0;

+            uVar23 = 0;

+          }

+          UNLOCK();

+          if ((uVar23 & 1) != 0) goto LAB_0;

+          iVar6 = xxxLoadUserApiHook();

+        }

+        else {

+          if (param_2 != 0x33f) {

+            if ((param_2 == 0x349) && (lVar9 = 0, param_3 != (HWND__ *)0x0)) {

+              if (*(longlong *)(param_1 + 0x68) != 0) {

+                lVar9 = *(longlong *)(*(longlong *)(param_1 + 0x68) + 0x10);

+              }

+              if ((lVar9 != 0) && (*(tagWND **)(lVar9 + 0x650) == param_1)) {

+                xxxSetFocus(param_1);

+              }

+            }

+            goto LAB_0;

+          }

+          iVar6 = xxxGetTitleBarInfoEx(param_1,param_4);

+        }

+      }

+LAB_8:

+      pHVar29 = (HICON__ *)(longlong)iVar6;

+      goto LAB_2;

+    }

+    if (param_2 == 0x205) {

+      lVar9 = *(longlong *)(param_1 + 0x28);

+      sVar26 = uVar32 + *(short *)(lVar9 + 0x6c);

+      if ((*(byte *)(lVar9 + 0x1a) & 0x40) == 0) {

+        uVar34 = (ulonglong)CONCAT22(sVar26,sVar35 + *(short *)(lVar9 + 0x68));

+      }

+      else {

+        uVar34 = (ulonglong)CONCAT22(sVar26,*(short *)(lVar9 + 0x70) - sVar35);

+      }

+LAB_16:

+      uVar27 = 0x7b;

+      goto LAB_20;

+    }

+    if (0x11c < param_2) {

+      if (param_2 < 0x135) {

+        if (param_2 != 0x134) {

+          if (param_2 == 0x127) {

+            local_e8 = (tagMENU *)((ulonglong)param_3 & 0xffff);

+            local_c0[0] = (ulonglong)param_3 >> 0x10;

+            if ((((local_c0[0] & 0xfff8) != 0) || (uVar32 = 3, 3 < uVar22)) ||

+               (param_4 != (tagDRAWITEMSTRUCT *)0x0)) goto LAB_0;

+            bVar21 = 0;

+            if (uVar22 == 3) {

+              local_c0[0] = ((ulonglong)param_3 >> 0x20) << 0x10;

+              lVar9 = W32GetUserSessionState();

+              if ((((char)**(undefined4 **)(lVar9 + 0x4e30) < '\0') ||

+                  (lVar9 = W32GetUserSessionState(),

+                  (*(uint *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b5c) & 0x20) != 0)) ||

+                 ((lVar9 = W32GetUserSessionState(),

+                  -1 < *(int *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b5c) ||

+                  (bVar3 = GetAppCompatFlags2(0x400), (bVar3 & 2) != 0)))) goto LAB_24;

+              lVar9 = W32GetUserSessionState();

+              uVar22 = ((**(uint **)(lVar9 + 0x4e30) & 0x40) != 0) + 1;

+              param_3 = (HWND__ *)((ulonglong)uVar22 | 0x30000);

+            }

+            else {

+              lVar9 = W32GetUserSessionState();

+              if ((((char)**(undefined4 **)(lVar9 + 0x4e30) < '\0') ||

+                  (lVar9 = W32GetUserSessionState(),

+                  (*(uint *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b5c) & 0x20) != 0)) ||

+                 ((lVar9 = W32GetUserSessionState(),

+                  -1 < *(int *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b5c) ||

+                  (bVar3 = GetAppCompatFlags2(0x400), (bVar3 & 2) != 0)))) {

+                local_c0[0] = (ulonglong)((uint6)((ulonglong)param_3 >> 0x10) & 0xfffffffffffc);

+              }

+LAB_24:

+              uVar22 = (ushort)local_e8;

+              uVar32 = (ushort)local_c0[0];

+            }

+            if (uVar32 != 0) {

+              if ((uVar32 & 1) != 0) {

+                bVar21 = *(byte *)(*(longlong *)(param_1 + 0x28) + 0x1b) >> 7 ^ uVar22 == 1;

+              }

+              if ((uVar32 & 2) != 0) {

+                bVar21 = bVar21 | *(byte *)(*(longlong *)(param_1 + 0x28) + 0x1b) >> 6 & 1 ^

+                                  uVar22 == 1;

+              }

+              if ((uVar32 & 4) != 0) {

+                bVar21 = bVar21 | *(byte *)(*(longlong *)(param_1 + 0x28) + 0x1b) >> 2 & 1 ^

+                                  uVar22 == 1;

+              }

+              if (bVar21 != 0) {

+                if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) == 0x40) {

+                  Win32HMThreadLockAlways<tagWND>::

+                  Win32HMThreadLockAlways<tagWND><tagWND::SharedUserObjPointerFieldspwndParent>

+                            (local_b0,(SharedUserObjPointerFieldspwndParent<tagWND> *)

+                                      (param_1 + 0x68));

+                  pHVar29 = (HICON__ *)

+                            xxxSendTransformableMessageTimeout

+                                      (*(undefined8 *)(param_1 + 0x68),0x127,param_3,0);

+                  Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+                            ((Win32HMThreadLockBase<tagWND,0,0> *)local_b0);

+                }

+                else {

+                  pHVar29 = (HICON__ *)xxxSendTransformableMessageTimeout(param_1,0x128,param_3,0);

+                }

+LAB_2:

+                SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                          ((SmartObjStackRef<tagMENU> *)local_d8);

+                return pHVar29;

+              }

+            }

+            goto LAB_0;

+          }

+          if (param_2 == 0x128) {

+            pHVar29 = (HICON__ *)xxxDWP_UpdateUIState(param_1,param_3,param_4);

+            goto LAB_2;

+          }

+          if (param_2 == 0x129) {

+            bVar21 = *(byte *)(*(longlong *)(param_1 + 0x28) + 0x1b);

+            SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                      ((SmartObjStackRef<tagMENU> *)local_d8);

+            return (HICON__ *)

+                   ((ulonglong)(bVar21 & 4) |

+                   ((ulonglong)(bVar21 >> 2) | (ulonglong)(bVar21 & 0x40)) >> 5);

+          }

+          if (param_2 == 0x132) goto LAB_25;

+          if (param_2 != 0x133) goto LAB_0;

+        }

+LAB_1:

+        lVar9 = 0x11ec;

+        lVar31 = 0x11f8;

+        lVar36 = 0x1280;

+      }

+      else if (param_2 == 0x135) {

+        lVar9 = 0x1214;

+        lVar36 = 0x12d0;

+LAB_26:

+        lVar31 = 0x1220;

+      }

+      else {

+        if (param_2 != 0x136) {

+          if (param_2 == 0x137) {

+            lVar9 = W32GetUserSessionState();

+            if (7 < *(ushort *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b54)) {

+              lVar9 = W32GetUserSessionState();

+              iVar6 = *(int *)(*(longlong *)(lVar9 + 0x4e30) + 0x1228);

+              lVar9 = W32GetUserSessionState();

+              if (iVar6 == *(int *)(*(longlong *)(lVar9 + 0x4e30) + 0x11d8)) {

+                lVar9 = W32GetUserSessionState();

+                iVar6 = *(int *)(*(longlong *)(lVar9 + 0x4e30) + 0x1228);

+                lVar9 = W32GetUserSessionState();

+                if (iVar6 != *(int *)(*(longlong *)(lVar9 + 0x4e30) + 0x11ec)) {

+                  lVar9 = 0x1228;

+                  lVar36 = 0x12f8;

+                  goto LAB_26;

+                }

+              }

+            }

+            lVar9 = W32GetUserSessionState();

+            GreSetBkColor(param_3,*(undefined4 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1228));

+            lVar9 = W32GetUserSessionState();

+            GreSetTextColor(param_3,*(undefined4 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1214));

+            lVar9 = W32GetUserSessionState();

+            pHVar29 = *(HICON__ **)(*(longlong *)(lVar9 + 0x4e30) + 0x1350);

+            goto LAB_3;

+          }

+          if (param_2 != 0x138) goto LAB_0;

+        }

+LAB_25:

+        lVar9 = 0x1214;

+        lVar31 = 0x11f8;

+        lVar36 = 0x12d0;

+      }

+      lVar18 = W32GetUserSessionState();

+      GreSetBkColor(param_3,*(undefined4 *)(lVar9 + *(longlong *)(lVar18 + 0x4e30)));

+      lVar9 = W32GetUserSessionState();

+      GreSetTextColor(param_3,*(undefined4 *)(lVar31 + *(longlong *)(lVar9 + 0x4e30)));

+      lVar9 = W32GetUserSessionState();

+      pHVar29 = *(HICON__ **)(lVar36 + *(longlong *)(lVar9 + 0x4e30));

+LAB_3:

+      SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>((SmartObjStackRef<tagMENU> *)local_d8);

+      return pHVar29;

+    }

+    if (param_2 == 0x11c) goto LAB_0;

+    if (param_2 < 0x106) {

+      if (param_2 == 0x105) {

+LAB_27:

+        ptVar11 = PtiCurrent();

+        if ((((param_3 == (HWND__ *)0x12) &&

+             (bVar21 = (byte)*(undefined4 *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214),

+             -1 < (char)bVar21)) && ((bVar21 & 0xc) == 8)) ||

+           ((param_3 == (HWND__ *)0x79 &&

+            ((*(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) & 0x10) != 0)))) {

+          ptVar16 = (tagWND *)GetNonChildAncestor(param_1);

+          Win32HMOptionalThreadLock<tagWND>::Win32HMOptionalThreadLock<tagWND>

+                    ((Win32HMOptionalThreadLock<tagWND> *)&local_e8,ptVar11,ptVar16);

+          if (param_3 == (HWND__ *)0x79) {

+            xxxDrawMenuBarUnderlines(param_1,1);

+          }

+          xxxSendTransformableMessageTimeout(ptVar16,0x112,0xf100,0);

+          Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

+                    ((Win32HMThreadLockBase<tagWND,1,0> *)&local_e8);

+        }

+        if (param_3 == (HWND__ *)0x12) {

+          *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) =

+               *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) & 0xffffff7f;

+          xxxDrawMenuBarUnderlines(param_1,0);

+        }

+        *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) =

+             *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) & 0xffffffe3;

+        goto LAB_0;

+      }

+      if (param_2 == 0xae) {

+        pHVar15 = _GetDCEx((HWND)param_1,(HRGN)0x0,0x10001);

+        pHVar14 = pHVar15;

+        xxxDrawCaptionBar(param_1,pHVar15,(ulonglong)param_3 & 0xffffffff);

+        _ReleaseDC((HWND)pHVar15,pHVar14);

+        goto LAB_0;

+      }

+      if (param_2 == 0xaf) {

+        xxxDrawWindowFrame(param_1,param_3,(ulonglong)param_4 & 0xffffffff);

+        goto LAB_0;

+      }

+      if (param_2 == 0x100) {

+        if (param_3 == (HWND__ *)0x1b) {

+          iVar6 = CoreWindowProp::IsComponent(param_1);

+          if (((iVar6 == 0) ||

+              (ptVar16 = CoreWindowProp::GetHost(param_1), ptVar16 == (tagWND *)0x0)) ||

+             (param_1 = (tagWND *)_GetTopLevelWindow(ptVar16), param_1 == (tagWND *)0x0))

+          goto LAB_0;

+          uVar23 = 0x100;

+          goto LAB_28;

+        }

+        if (param_3 != (HWND__ *)0x79) goto LAB_0;

+        ptVar11 = PtiCurrent();

+        *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) =

+             *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) | 0x10;

+LAB_29:

+        SVar5 = _GetKeyState(0x10);

+        if (-1 < SVar5) goto LAB_0;

+        uVar34 = 0xffffffffffffffff;

+        goto LAB_16;

+      }

+      if (param_2 == 0x101) goto LAB_27;

+      if (param_2 != 0x104) goto LAB_0;

+      ptVar11 = PtiCurrent();

+      if ((uVar32 >> 0xd & 1) == 0) {

+        if (param_3 != (HWND__ *)0x79) goto LAB_0;

+        *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) =

+             *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) | 0x10;

+        goto LAB_29;

+      }

+      if ((uVar32 >> 0xe & 1) == 0) {

+        if (param_3 == (HWND__ *)0x12) {

+          uVar23 = *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214);

+          if ((uVar23 & 8) == 0) {

+            *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) = uVar23 | 8;

+            xxxDrawMenuBarUnderlines(param_1,1);

+            goto LAB_30;

+          }

+        }

+        *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) =

+             *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) & 0xfffffff3;

+      }

+LAB_30:

+      *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) =

+           *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) & 0xffffffef;

+      ptVar11 = PtiCurrent();

+      if ((*(longlong *)(*(longlong *)(ptVar11 + 0x1d8) + 0x90) != 0) && ((uint)param_3 == 0x73)) {

+        xxxCloseApplication(ptVar11);

+      }

+      goto LAB_0;

+    }

+    if (param_2 != 0x106) {

+      if (param_2 != 0x109) {

+        if (param_2 == 0x112) {

+          xxxSysCommand(param_1,(ulonglong)param_3 & 0xffffffff,param_4);

+          goto LAB_0;

+        }

+        if (param_2 == 0x119) {

+          if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) != 0x40) goto LAB_0;

+          lVar9 = *(longlong *)(param_1 + 0x68);

+          uVar28 = *(undefined8 *)(*(longlong *)(lVar9 + 0x10) + 0x1d0);

+          ptVar11 = PtiCurrent();

+          iVar6 = CheckForMessageAccessCrossIL(*(undefined8 *)(ptVar11 + 0x1d0),uVar28,lVar9,0x119);

+          if (iVar6 == 0) goto LAB_0;

+          Win32HMThreadLockAlways<tagWND>::

+          Win32HMThreadLockAlways<tagWND><tagWND::SharedUserObjPointerFieldspwndParent>

+                    (local_b0,(SharedUserObjPointerFieldspwndParent<tagWND> *)(param_1 + 0x68));

+          pHVar29 = (HICON__ *)

+                    xxxSendTransformableMessageTimeout

+                              (*(undefined8 *)(param_1 + 0x68),0x119,param_3,param_4);

+          pWVar25 = (Win32HMThreadLockBase<tagWND,0,0> *)local_b0;

+        }

+        else {

+          if ((param_2 != 0x11a) ||

+             ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) != 0x40)) goto LAB_0;

+          Win32HMThreadLockAlways<tagWND>::

+          Win32HMThreadLockAlways<tagWND><tagWND::SharedUserObjPointerFieldspwndParent>

+                    (local_68,(SharedUserObjPointerFieldspwndParent<tagWND> *)(param_1 + 0x68));

+          pHVar29 = (HICON__ *)

+                    xxxSendTransformableMessageTimeout

+                              (*(undefined8 *)(param_1 + 0x68),0x11a,param_3,param_4);

+          pWVar25 = (Win32HMThreadLockBase<tagWND,0,0> *)local_68;

+        }

+        goto LAB_11;

+      }

+      if (param_3 == (HWND__ *)0xffff) goto LAB_0;

+      uVar23 = 0x102;

+LAB_28:

+      _PostTransformableMessageExtended

+                (param_1,uVar23,(__uint64)param_3,(__int64)param_4,(tagINPUT_MESSAGE_SOURCE *)0x0,1)

+      ;

+      goto LAB_0;

+    }

+    ptVar11 = PtiCurrent();

+    *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) =

+         *(uint *)(*(longlong *)(ptVar11 + 0x1d8) + 0x214) & 0xfffffff3;

+    if ((param_3 == (HWND__ *)0xd) &&

+       ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0x20) != 0)) {

+      param_4 = (tagDRAWITEMSTRUCT *)0x0;

+      uVar23 = 0x112;

+      param_3 = (HWND__ *)0xf120;

+      goto LAB_28;

+    }

+    if (((uVar32 >> 0xd & 1) == 0) || (param_3 == (HWND__ *)0x0)) {

+      if (param_3 != (HWND__ *)0x1b) {

+        xxxMessageBeep(0);

+      }

+      goto LAB_0;

+    }

+    if ((param_3 == (HWND__ *)0x9) || (param_3 == (HWND__ *)0x1b)) goto LAB_0;

+    if (param_3 == (HWND__ *)&DAT_31) {

+      if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x1f) & 0xc0) == 0x40) {

+        Win32HMThreadLockAlways<tagWND>::

+        Win32HMThreadLockAlways<tagWND><tagWND::SharedUserObjPointerFieldspwndParent>

+                  (local_b0,ptVar11,(SharedUserObjPointerFieldspwndParent<tagWND> *)(param_1 + 0x68)

+                  );

+        goto LAB_21;

+      }

+      p_Var33 = *(__int64 **)(*(longlong *)(ptVar11 + 0x1d8) + 0x90);

+      if ((p_Var33 != (__int64 *)0x0) &&

+         (iVar6 = IsImmersiveApplicationBandId(*(undefined4 *)(p_Var33[5] + 0xec)), iVar6 != 0)) {

+        PostIAMShellHookMessage(0x21,*p_Var33);

+        goto LAB_0;

+      }

+      ptVar16 = *(tagWND **)(*(longlong *)(ptVar11 + 0x1d8) + 0x90);

+      if ((ptVar16 != (tagWND *)0x0) && ((*(uint *)(ptVar16 + 0x17c) & 0x40000000) != 0)) {

+        ptVar16 = GetCompositionInputWindowUIOwner(ptVar16);

+        iVar6 = CoreWindowProp::IsComponent(*(tagWND **)(*(longlong *)(ptVar11 + 0x1d8) + 0x90));

+        if (iVar6 != 0) {

+          ptVar16 = CoreWindowProp::GetTopLevelHostForComponent

+                              (*(tagWND **)(*(longlong *)(ptVar11 + 0x1d8) + 0x90));

+        }

+        if ((ptVar16 != (tagWND *)0x0) &&

+           (ptVar16 = (tagWND *)_GetTopLevelWindow(ptVar16), ptVar16 != (tagWND *)0x0)) {

+          Win32HMThreadLockAlways<tagHOOK>::Win32HMThreadLockAlways<tagHOOK>

+                    ((Win32HMThreadLockAlways<tagHOOK> *)&local_e8,ptVar11,(tagHOOK *)ptVar16);

+          xxxForceForegroundWindowNoRestoreFocus(ptVar16,0);

+          ptVar17 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                              ((Win32HMThreadLockBase<tagXSTATE,0,1> *)&local_e8);

+          if (ptVar17 != (tagXSTATE *)0x0) {

+            _PostTransformableMessageExtended

+                      (ptVar16,0x112,0xf100,0x20,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

+          }

+          Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

+                    ((Win32HMOptionalThreadLockAlways<tagWND> *)&local_e8);

+        }

+        goto LAB_0;

+      }

+    }

+    uVar34 = (ulonglong)param_3 & 0xffffffff;

+    uVar27 = 0x112;

+    uVar28 = 0xf100;

+  }

+  xxxSendTransformableMessageTimeout(param_1,uVar27,uVar28,uVar34);

+LAB_0:

+  SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>((SmartObjStackRef<tagMENU> *)local_d8);

+  return (HICON__ *)0x0;

 }
```

## `IsDebuggerAttached`  (modified)

```diff
--- IsDebuggerAttached
+++ IsDebuggerAttached
@@ -1,21 +1,25 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* bool __cdecl IsDebuggerAttached(struct tagPROCESSINFO const * __ptr64) */

 

 bool __cdecl IsDebuggerAttached(tagPROCESSINFO *param_1)

 

 {

-  char *pcVar1;

-  byte in_AL;

-  undefined7 in_register_00000001;

-  longlong unaff_RBX;

+  char cVar1;

+  longlong lVar2;

+  tagPROCESSINFO *ptVar3;

+  bool bVar4;

   

-  pcVar1 = (char *)(unaff_RBX + -0x7c + (longlong)param_1 * 4);

-  *pcVar1 = *pcVar1 + in_AL;

-  *(byte *)(CONCAT71(in_register_00000001,in_AL) & 0xffffffffffffff98) =

-       *(char *)(CONCAT71(in_register_00000001,in_AL) & 0xffffffffffffff98) + (in_AL & 0x98);

-  pcVar1 = (char *)((CONCAT71(in_register_00000001,in_AL) & 0xffffffffffffff98) - 0x75);

-  *pcVar1 = *pcVar1 + (char)param_1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  bVar4 = false;

+  if ((*(longlong *)param_1 != 0) && (lVar2 = PsGetProcessDebugPort(), lVar2 != 0)) {

+    ptVar3 = param_1 + 0x134;

+    if (param_1 == (tagPROCESSINFO *)0x0) {

+      ptVar3 = (tagPROCESSINFO *)&DAT_0;

+    }

+    if ((*(int *)ptVar3 != 0) && (cVar1 = ExQueryFastCacheDevLicense(), cVar1 == '\0')) {

+      return false;

+    }

+    bVar4 = true;

+  }

+  return bVar4;

 }
```

## `IsGpqForegroundAccessibleOnInputThread`  (modified)

```diff
--- IsGpqForegroundAccessibleOnInputThread
+++ IsGpqForegroundAccessibleOnInputThread
@@ -1,253 +1,20 @@
+

+/* bool __cdecl IsGpqForegroundAccessibleOnInputThread(bool,struct tagUIPI_INFO_INT const & __ptr64)

+    */

 

 bool __cdecl IsGpqForegroundAccessibleOnInputThread(bool param_1,tagUIPI_INFO_INT *param_2)

 

 {

   longlong lVar1;

-  int iVar2;

-  BltBitsResult BVar3;

-  int iVar4;

-  longlong lVar5;

-  undefined8 in_RAX;

-  HWND pHVar6;

-  tagTHREADINFO *ptVar7;

-  code *pcVar8;

-  longlong lVar9;

-  tagWND *ptVar10;

-  _HEAD *p_Var11;

-  SwpActivateOptions SVar12;

-  longlong lVar13;

-  longlong unaff_RBX;

-  tagCVR *ptVar14;

-  undefined8 *puVar15;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  int iVar16;

-  undefined8 *puVar17;

-  tagSMWP *unaff_RDI;

-  SwpActivateOptions SVar18;

-  int unaff_R12D;

-  HWND unaff_R13;

-  tagTHREADINFO *unaff_R14;

-  int unaff_R15D;

-  uint uVar19;

+  bool bVar2;

   

-code_r0x000140099478:

-  SetWindowGroupBand(in_RAX,unaff_R12D,0);

-LAB_0:

-  *(undefined4 *)(unaff_RBX + 0x98 + *(longlong *)(unaff_RDI + 0x28)) = 0;

-LAB_1:

-  lVar9 = unaff_RBX;

-  unaff_ESI = unaff_ESI + 1;

-  unaff_RBX = lVar9 + 0xa8;

-  if (unaff_ESI < *(int *)(unaff_RDI + 0x1c)) {

-    if ((*(longlong *)(unaff_RBX + *(longlong *)(unaff_RDI + 0x28)) == 0) ||

-       (*(int *)(lVar9 + 0x140 + *(longlong *)(unaff_RDI + 0x28)) == 0)) goto LAB_1;

-    lVar5 = _HMObjectFromHandle();

-    unaff_R12D = *(int *)(lVar9 + 0x140 + *(longlong *)(unaff_RDI + 0x28));

-    if (*(int *)(*(longlong *)(lVar5 + 0x28) + 0xec) == unaff_R12D) goto LAB_0;

-    in_RAX = _HMObjectFromHandle(*(undefined8 *)(unaff_RBX + *(longlong *)(unaff_RDI + 0x28)));

-    goto code_r0x000140099478;

-  }

-  iVar4 = *(int *)(unaff_RBP + 0x67);

-  if (unaff_R15D != 0) {

-    AsyncWindowPos(unaff_RDI);

-  }

-  WindowActions::xxxInterceptSetWindowPos(unaff_RDI);

-  pHVar6 = _GetDesktopWindow();

-  if (unaff_R13 == pHVar6) {

-    unaff_RDI = ZOrderByOwner(unaff_RDI);

-    if (unaff_RDI == (tagSMWP *)0x0) {

-      Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

-                ((Win32HMOptionalThreadLockAlways<tagWND> *)(unaff_RBP + -0x49));

-      if (*(longlong *)(unaff_RBP + -0x59) != -1) {

-        ptVar7 = PtiCurrent();

-        *(undefined8 *)(ptVar7 + 0x180) = *(undefined8 *)(unaff_RBP + -0x69);

-      }

-      return false;

-    }

-    if (unaff_R15D != 0) {

-      ptVar14 = *(tagCVR **)(unaff_RDI + 0x28);

-      iVar16 = *(int *)(unaff_RDI + 0x1c);

-      while (iVar16 = iVar16 + -1, -1 < iVar16) {

-        if ((*(longlong *)ptVar14 != 0) &&

-           (iVar2 = ValidateWindowPos(ptVar14,(tagWND *)0x0), iVar2 == 0)) {

-          *(undefined8 *)ptVar14 = 0;

-        }

-        ptVar14 = ptVar14 + 0xa8;

-      }

-      AsyncWindowPos(unaff_RDI);

-    }

-  }

-  if ((*(uint *)(unaff_RDI + 0x18) & 2) == 0) {

-    if (*(longlong *)(unaff_RBP + -0x59) != -1) {

-      ptVar7 = PtiCurrent();

-                    /* WARNING: Subroutine does not return */

-      KeBugCheckEx(0x164,0x12,unaff_RBP + -0x69,unaff_RDI,ptVar7);

-    }

-    ptVar7 = PtiCurrent();

-    *(undefined8 *)(unaff_RBP + -0x69) = *(undefined8 *)(ptVar7 + 0x180);

-    *(longlong *)(ptVar7 + 0x180) = unaff_RBP + -0x69;

-    pcVar8 = DestroySMWP;

-  }

-  else {

-    HMLockObject(unaff_RDI);

-    if (*(longlong *)(unaff_RBP + -0x59) != -1) {

-      ptVar7 = PtiCurrent();

-                    /* WARNING: Subroutine does not return */

-      KeBugCheckEx(0x164,0x12,unaff_RBP + -0x69,unaff_RDI,ptVar7);

-    }

-    ptVar7 = PtiCurrent();

-    iVar4 = 1;

-    *(undefined4 *)(unaff_RBP + 0x67) = 1;

-    *(undefined8 *)(unaff_RBP + -0x69) = *(undefined8 *)(ptVar7 + 0x180);

-    *(longlong *)(ptVar7 + 0x180) = unaff_RBP + -0x69;

-    pcVar8 = UnrefAndDestroySMWP;

-  }

-  *(int *)(unaff_R14 + 0x538) = *(int *)(unaff_R14 + 0x538) + 1;

-  *(code **)(unaff_RBP + -0x59) = pcVar8;

-  *(tagSMWP **)(unaff_RBP + -0x61) = unaff_RDI;

-  *(uint *)(unaff_RDI + 0x18) = *(uint *)(unaff_RDI + 0x18) | 4;

-  CDwmSwpNotifyBatch::CDwmSwpNotifyBatch((CDwmSwpNotifyBatch *)(unaff_RBP + -9),unaff_RDI);

-  puVar15 = (undefined8 *)0x0;

-  iVar16 = 0;

-  *(undefined8 *)(unaff_RBP + -0x51) = 0;

-  puVar17 = puVar15;

-  if (0 < *(int *)(unaff_RDI + 0x1c)) {

-    do {

-      puVar15 = (undefined8 *)(*(longlong *)(unaff_RDI + 0x28) + (longlong)puVar17);

-      lVar9 = HMValidateHandleNoSecure(*puVar15,1);

-      if ((lVar9 != 0) && ((*(uint *)(puVar15 + 4) & 0x10) == 0)) {

-        *(undefined8 **)(unaff_RBP + -0x51) = puVar15;

-        goto LAB_2;

-      }

-      iVar16 = iVar16 + 1;

-      puVar17 = puVar17 + 0x15;

-    } while (iVar16 < *(int *)(unaff_RDI + 0x1c));

-    puVar15 = *(undefined8 **)(unaff_RBP + -0x51);

-  }

-LAB_2:

-  iVar16 = xxxCalcValidRects(unaff_RDI);

-  if (iVar16 != 0) {

-    ptVar10 = (tagWND *)0x0;

-    if (puVar15 != (undefined8 *)0x0) {

-      ptVar10 = (tagWND *)HMValidateHandleNoSecure(*puVar15,1);

-    }

-    Win32HM_LockIntoThread<1>

-              (unaff_R14,(_HEAD *)ptVar10,(_Win32HMThreadLockItem *)(unaff_RBP + -0x31));

-    iVar4 = *(int *)(unaff_R14 + 0x3b4);

-    *(int *)(unaff_RBP + 0x7f) = iVar4;

-    lVar9 = W32GetUserSessionState();

-    *(undefined8 *)(unaff_RBP + -0x39) = *(undefined8 *)(lVar9 + 0x4a60);

-    BVar3 = zzzBltValidBits(unaff_RDI);

-    uVar19 = -(uint)((BVar3 & 1) != 0) & *(uint *)(unaff_RBP + 0x77);

-    *(uint *)(unaff_RBP + 0x77) = uVar19;

-    if ((BVar3 & 2) != 0) {

-      GenerateMouseMove(0);

-    }

-    if ((*(uint *)(unaff_RDI + 0x18) & 1) != 0) {

-      lVar9 = (longlong)*(int *)(unaff_RDI + 0x1c);

-      if (lVar9 != 0) {

-        lVar5 = lVar9 * 0xa8;

-        do {

-          lVar1 = lVar5 + -0xa8;

-          lVar9 = lVar9 + -1;

-          lVar13 = *(longlong *)(lVar1 + *(longlong *)(unaff_RDI + 0x28));

-          if (((lVar13 != 0) &&

-              ((*(uint *)(lVar5 + -0x88 + *(longlong *)(unaff_RDI + 0x28)) & 0x70000000) != 0)) &&

-             (p_Var11 = (_HEAD *)HMValidateHandleNoSecure(lVar13,1), p_Var11 != (_HEAD *)0x0)) {

-            Win32HM_LockIntoThread<0>

-                      (unaff_R14,p_Var11,(_Win32HMThreadLockItem *)(unaff_RBP + -0x19));

-            lVar13 = *(longlong *)(unaff_RDI + 0x28);

-            if ((*(uint *)(lVar5 + -0x88 + lVar13) & 0x10000000) != 0) {

-              if ((*(uint *)(lVar5 + -0xc + lVar13) & 8) == 0) {

-                PostShellHookMessagesEx(1);

-                xxxCallHook(1,*(__uint64 *)(lVar1 + *(longlong *)(unaff_RDI + 0x28)),0,10);

-              }

-              else {

-                PostIAMShellHookMessage(0x15,*(__int64 *)(lVar1 + lVar13));

-              }

-            }

-            if ((*(uint *)(lVar5 + -0x88 + *(longlong *)(unaff_RDI + 0x28)) & 0x20000000) != 0) {

-              PostShellHookMessagesEx(2,*(undefined8 *)(lVar1 + *(longlong *)(unaff_RDI + 0x28)));

-              xxxCallHook(2,*(__uint64 *)(lVar1 + *(longlong *)(unaff_RDI + 0x28)),0,10);

-            }

-            lVar13 = *(longlong *)(unaff_RDI + 0x28);

-            if ((*(uint *)(lVar5 + -0x88 + lVar13) & 0x40000000) != 0) {

-              uVar19 = *(uint *)(lVar5 + -0xc + lVar13);

-              if ((uVar19 & 8) == 0) {

-                if ((uVar19 & 0x10) == 0) {

-                  xxxSetTrayWindow(*(tagDESKTOP **)(p_Var11 + 0x18),(tagWND *)p_Var11);

-                }

-                lVar13 = *(longlong *)(unaff_RDI + 0x28);

-                uVar19 = 0x13;

-              }

-              else {

-                uVar19 = 0x17;

-              }

-              PostIAMShellHookMessage(uVar19,*(__int64 *)(lVar1 + lVar13));

-            }

-            Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

-                      ((Win32HMThreadLockBase<tagWND,0,0> *)(unaff_RBP + -0x19));

-          }

-          lVar5 = lVar1;

-        } while (lVar9 != 0);

-        uVar19 = *(uint *)(unaff_RBP + 0x77);

-        iVar4 = *(int *)(unaff_RBP + 0x7f);

-      }

-      puVar15 = *(undefined8 **)(unaff_RBP + -0x51);

-    }

-    if (((unaff_R14 == *(tagTHREADINFO **)(unaff_RBP + -0x39)) && (iVar4 != 0)) &&

-       ((*(int *)(unaff_R14 + 0x3b4) == 0 &&

-        (iVar4 = IsImmersiveAppRestricted(*(undefined8 *)(unaff_R14 + 0x1d0)), iVar4 == 0)))) {

-      tagTHREADINFO::SetForegroundActivate(unaff_R14,0x10);

-    }

-    iVar4 = 0;

-    if (ptVar10 != (tagWND *)0x0) {

-      SVar18 = *(byte *)((longlong)puVar15 + 0x23) & 1;

-      SVar12 = SVar18 | 2;

-      if ((*(uint *)((longlong)puVar15 + 0x9c) & 0x400) == 0) {

-        SVar12 = SVar18;

-      }

-      iVar4 = xxxSwpActivate(ptVar10,SVar12);

-    }

-    if (uVar19 != 0) {

-      xxxDoSyncPaint();

-    }

-    Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

-              ((Win32HMThreadLockBase<tagWND,1,0> *)(unaff_RBP + -0x31));

-    if (iVar4 != 0) {

-      if (*(longlong *)(*(longlong *)(unaff_R14 + 0x1d8) + 0x90) != 0) {

-        SetOrClrWF(0,*(longlong *)(*(longlong *)(unaff_R14 + 0x1d8) + 0x90),0x101,1);

-      }

-      if (*(longlong *)(*(longlong *)(unaff_R14 + 0x1d8) + 0x98) != 0) {

-        SetOrClrWF(0,*(longlong *)(*(longlong *)(unaff_R14 + 0x1d8) + 0x98),0x101,1);

-      }

-    }

-    xxxSendChangedMsgs(unaff_RDI);

-    iVar4 = *(int *)(unaff_RBP + 0x67);

-  }

-  CDwmNotifyBatch::~CDwmNotifyBatch((CDwmNotifyBatch *)(unaff_RBP + -9));

-  ptVar7 = unaff_R14 + 0x538;

-  *(int *)ptVar7 = *(int *)ptVar7 + -1;

-  if (*(int *)ptVar7 == 0) {

-    lVar9 = W32GetUserSessionState();

-    GreLockVisRgn(*(undefined8 *)(*(longlong *)(lVar9 + 0xdf10) + 0x30));

-    GreClientRgnUpdatedStable();

-    GreUnlockVisRgn(*(undefined8 *)(*(longlong *)(lVar9 + 0xdf10) + 0x30));

-  }

-  Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

-            ((Win32HMOptionalThreadLockAlways<tagWND> *)(unaff_RBP + -0x49));

-  if (*(longlong *)(unaff_RBP + -0x59) != -1) {

-    ptVar7 = PtiCurrent();

-    *(undefined8 *)(ptVar7 + 0x180) = *(undefined8 *)(unaff_RBP + -0x69);

-    *(undefined8 *)(unaff_RBP + -0x59) = 0xffffffffffffffff;

-  }

-  if (iVar4 == 0) {

-    DestroySMWP(unaff_RDI);

-  }

-  else {

-    UnrefAndDestroySMWP(unaff_RDI);

+  if (((param_1) && (lVar1 = W32GetUserSessionState(), *(longlong *)(lVar1 + 0x4a50) != 0)) &&

+     (*(int *)(param_2 + 0xc) == 0)) {

+    lVar1 = W32GetUserSessionState();

+    bVar2 = UIPrivilegeIsolation::CheckAccess

+                      ((tagUIPI_INFO *)param_2,*(tagUIPI_INFO **)(lVar1 + 0x4a50),0);

+    return bVar2;

   }

   return true;

 }
```

## `xxxWrapRealDefWindowProc`  (modified)

```diff
--- xxxWrapRealDefWindowProc
+++ xxxWrapRealDefWindowProc
@@ -1,177 +1,34 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* __int64 __cdecl xxxWrapRealDefWindowProc(struct tagWND * __ptr64,unsigned int,unsigned

+   __int64,__int64,unsigned __int64) */

 

 __int64 __cdecl

 xxxWrapRealDefWindowProc

           (tagWND *param_1,uint param_2,__uint64 param_3,__int64 param_4,__uint64 param_5)

 

 {

   int iVar1;

-  int iVar2;

-  undefined8 uVar3;

-  undefined8 uVar4;

-  bool bVar5;

-  int iVar6;

-  int iVar7;

-  int iVar8;

-  int iVar9;

-  char *in_RAX;

-  uint uVar10;

-  longlong unaff_RBP;

-  ERECTL *this;

-  uint uVar11;

-  uint uVar12;

-  int unaff_R12D;

-  longlong *unaff_R13;

-  ulonglong unaff_R14;

-  _RECTL *unaff_R15;

+  longlong *plVar2;

+  __int64 _Var3;

+  longlong lVar4;

+  longlong *plVar5;

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  if (((uint)param_3 >> 0xe & 1) == 0) {

-    this = (ERECTL *)(in_RAX + 0x448);

-    uVar11 = 0x80;

-  }

-  else {

-    this = (ERECTL *)(in_RAX + 0x438);

-    uVar11 = 0x40;

-  }

-  uVar10 = param_2 & uVar11;

-  uVar12 = (uint)param_3 & 0xc000;

-  iVar6 = ERECTL::bWrapped(this);

-  if (uVar10 == 0) {

-    uVar10 = (-(uint)(iVar6 != 0) & 0xfffffffe) + 0xb;

-  }

-  else {

-    uVar10 = (-(uint)(iVar6 != 0) & 0xfffffffe) + 7;

-  }

-  uVar10 = uVar10 | uVar12;

-  if ((unaff_R14 & 1) != 0) {

-    *(undefined4 *)(this + 4) = 0x7fffffff;

-    *(undefined4 *)this = 0x7fffffff;

-    *(undefined4 *)(this + 0xc) = 0x80000000;

-    *(undefined4 *)(this + 8) = 0x80000000;

-  }

-  if ((unaff_R14 & 2) != 0) {

-    if (uVar12 == 0) {

-      DC::QuickInitXform((DC *)*unaff_R13,(int)unaff_RBP - 0x38);

-      if ((*(byte *)(*(longlong *)(unaff_RBP + -0x38) + 0x20) & 1) == 0) {

-        uVar3 = *(undefined8 *)unaff_R15;

-        uVar4 = *(undefined8 *)(unaff_R15 + 8);

-        *(undefined4 *)(unaff_RBP + -0x20) = *(undefined4 *)unaff_R15;

-        *(undefined4 *)(unaff_RBP + -0x1c) = *(undefined4 *)(unaff_R15 + 0xc);

-        *(undefined4 *)(unaff_RBP + -0x18) = *(undefined4 *)(unaff_R15 + 8);

-        *(undefined4 *)(unaff_RBP + -0x14) = *(undefined4 *)(unaff_R15 + 4);

-        *(undefined8 *)(unaff_RBP + -0x30) = uVar3;

-        *(undefined8 *)(unaff_RBP + -0x28) = uVar4;

-        bVar5 = EXFORMOBJ::bXform((EXFORMOBJ *)(unaff_RBP + -0x38),(_POINTL *)(unaff_RBP + -0x30),4)

-        ;

-        if (!bVar5) goto LAB_0;

-        iVar6 = *(int *)(unaff_RBP + -0x28);

-        iVar1 = *(int *)(unaff_RBP + -0x30);

-        iVar2 = *(int *)(unaff_RBP + -0x20);

-        iVar7 = iVar6;

-        if (iVar1 < iVar6) {

-          iVar7 = iVar1;

-        }

-        iVar8 = iVar2;

-        if ((iVar7 < iVar2) && (iVar8 = iVar6, iVar1 < iVar6)) {

-          iVar8 = iVar1;

-        }

-        iVar7 = *(int *)(unaff_RBP + -0x18);

-        iVar9 = iVar7;

-        if (iVar8 < iVar7) {

-          iVar8 = iVar6;

-          if (iVar1 < iVar6) {

-            iVar8 = iVar1;

-          }

-          iVar9 = iVar2;

-          if ((iVar8 < iVar2) && (iVar9 = iVar6, iVar1 < iVar6)) {

-            iVar9 = iVar1;

-          }

-        }

-        *(int *)unaff_R15 = iVar9;

-        iVar8 = iVar6;

-        if (iVar6 < iVar1) {

-          iVar8 = iVar1;

-        }

-        iVar9 = iVar2;

-        if ((iVar2 < iVar8) && (iVar9 = iVar6, iVar6 < iVar1)) {

-          iVar9 = iVar1;

-        }

-        if (iVar7 < iVar9) {

-          iVar8 = iVar6;

-          if (iVar6 < iVar1) {

-            iVar8 = iVar1;

-          }

-          iVar7 = iVar2;

-          if ((iVar2 < iVar8) && (iVar7 = iVar6, iVar6 < iVar1)) {

-            iVar7 = iVar1;

-          }

-        }

-        iVar6 = *(int *)(unaff_RBP + -0x2c);

-        iVar1 = *(int *)(unaff_RBP + -0x1c);

-        *(int *)(unaff_R15 + 8) = iVar7;

-        iVar2 = *(int *)(unaff_RBP + -0x24);

-        iVar7 = iVar2;

-        if (iVar6 < iVar2) {

-          iVar7 = iVar6;

-        }

-        iVar8 = iVar1;

-        if ((iVar7 < iVar1) && (iVar8 = iVar2, iVar6 < iVar2)) {

-          iVar8 = iVar6;

-        }

-        iVar7 = *(int *)(unaff_RBP + -0x14);

-        iVar9 = iVar7;

-        if (iVar8 < iVar7) {

-          iVar8 = iVar2;

-          if (iVar6 < iVar2) {

-            iVar8 = iVar6;

-          }

-          iVar9 = iVar1;

-          if ((iVar8 < iVar1) && (iVar9 = iVar2, iVar6 < iVar2)) {

-            iVar9 = iVar6;

-          }

-        }

-        *(int *)(unaff_R15 + 4) = iVar9;

-        iVar8 = iVar2;

-        if (iVar2 < iVar6) {

-          iVar8 = iVar6;

-        }

-        iVar9 = iVar1;

-        if ((iVar1 < iVar8) && (iVar9 = iVar2, iVar2 < iVar6)) {

-          iVar9 = iVar6;

-        }

-        if (iVar7 < iVar9) {

-          iVar8 = iVar2;

-          if (iVar2 < iVar6) {

-            iVar8 = iVar6;

-          }

-          iVar7 = iVar1;

-          if ((iVar1 < iVar8) && (iVar7 = iVar2, iVar2 < iVar6)) {

-            iVar7 = iVar6;

-          }

-        }

-        *(int *)(unaff_R15 + 0xc) = iVar7;

-      }

-      else if ((((byte)*(undefined4 *)(*(longlong *)(unaff_RBP + -0x38) + 0x20) & 0x43) != 0x43) &&

-              (iVar6 = bCvtPts1(), iVar6 == 0)) {

-LAB_0:

-        unaff_R12D = 1;

-      }

+  if (param_1 != (tagWND *)0xffffffffffffffff) {

+    plVar2 = (longlong *)PsGetCurrentProcessWin32Process();

+    plVar5 = (longlong *)0x0;

+    if (plVar2 != (longlong *)0x0) {

+      plVar5 = (longlong *)((ulonglong)plVar2 & -(ulonglong)(*plVar2 != 0));

     }

-    ERECTL::operator|=(this,unaff_R15);

-    if (unaff_R12D != 0) {

-      uVar10 = 0;

-      goto LAB_1;

+    iVar1 = CheckForMessageAccessCrossIL

+                      (plVar5,*(undefined8 *)(*(longlong *)(param_1 + 0x10) + 0x1d0),param_1,param_2

+                       ,param_3,param_4);

+    if ((iVar1 != 0) ||

+       (lVar4 = W32GetUserGdiSessionState(), *plVar5 == *(longlong *)(lVar4 + 0x28))) {

+      _Var3 = xxxRealDefWindowProc(param_1,param_2,param_3,param_4);

+      return _Var3;

     }

   }

-  if ((unaff_R14 & 4) != 0) {

-    *(uint *)(*unaff_R13 + 0x24) = *(uint *)(*unaff_R13 + 0x24) | uVar11;

-  }

-  if ((unaff_R14 & 8) != 0) {

-    *(uint *)(*unaff_R13 + 0x24) = *(uint *)(*unaff_R13 + 0x24) & ~uVar11;

-  }

-LAB_1:

-  return (ulonglong)uVar10;

+  UserSetLastError(5);

+  return 0;

 }
```

## `ValidateGestureCaller`  (modified)

```diff
--- ValidateGestureCaller
+++ ValidateGestureCaller
@@ -1,36 +1,30 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-

-undefined8 ValidateGestureCaller(undefined8 param_1)

+undefined8 ValidateGestureCaller(longlong param_1,longlong param_2)

 

 {

-  int iVar1;

-  longlong unaff_RDI;

-  longlong in_R11;

-  undefined8 in_XMM0_Qb;

-  int in_stack_00000030;

-  undefined8 in_stack_00000038;

-  undefined8 in_stack_00000040;

-  undefined8 in_stack_00000048;

-  undefined8 in_stack_00000078;

+  bool bVar1;

+  longlong lVar2;

   

-  *(undefined8 *)(in_R11 + -0x28) = param_1;

-  *(undefined8 *)(in_R11 + -0x20) = in_XMM0_Qb;

-  LeaveEnterUserCritIfAcquired::LeaveEnterUserCritIfAcquired

-            ((LeaveEnterUserCritIfAcquired *)&stack0x00000038);

-  EtwTraceBeginCallback(0x3f);

-  iVar1 = KeUserModeCallback(0x3f,&stack0x00000060,0x48,&stack0x00000040,&stack0x00000030);

-  EtwTraceEndCallback(0x3f);

-  LeaveEnterUserCritIfAcquired::~LeaveEnterUserCritIfAcquired

-            ((LeaveEnterUserCritIfAcquired *)&stack0x00000038);

-  *(undefined8 *)(unaff_RDI + 0x18) = in_stack_00000078;

-  if ((iVar1 < 0) || (in_stack_00000030 != 0x18)) {

-    in_stack_00000038 = 0;

+  lVar2 = W32GetUserSessionState();

+  if ((*(longlong *)(param_1 + 0x1f0) == *(longlong *)(lVar2 + 0x4b58)) &&

+     (*(longlong *)(param_1 + 0x1f0) == *(longlong *)(param_2 + 0x18))) {

+    lVar2 = *(longlong *)(*(longlong *)(param_2 + 0x10) + 0x1d0);

+    bVar1 = UIPrivilegeIsolation::CheckAccess

+                      ((tagUIPI_INFO *)

+                       (-(ulonglong)(*(longlong *)(param_1 + 0x1d0) != 0) &

+                       *(longlong *)(param_1 + 0x1d0) + 0x130U),

+                       (tagUIPI_INFO *)(-(ulonglong)(lVar2 != 0) & lVar2 + 0x130U),0);

+    if (bVar1) {

+      return 1;

+    }

+    UserSetLastError(5);

+    EtwTraceUIPIMsgError

+              (*(undefined8 *)(param_1 + 0x1d0),

+               *(undefined8 *)(*(longlong *)(param_2 + 0x10) + 0x1d0),0x119,0,0);

   }

   else {

-    in_stack_00000038 = 0;

-    RtlCopyFromUser(&stack0x00000038,in_stack_00000040,8);

+    UserSetLastError(5);

   }

-  return in_stack_00000038;

+  return 0;

 }
```

## `xxxSetNCFonts`  (modified)

```diff
--- xxxSetNCFonts
+++ xxxSetNCFonts
@@ -1,74 +1,345 @@
 

-int xxxSetNCFonts(longlong param_1,longlong param_2,int param_3)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+

+undefined8 xxxSetNCFonts(undefined8 param_1,longlong param_2)

 

 {

-  uint uVar1;

-  longlong lVar2;

-  int iVar3;

-  int iVar4;

-  int iVar5;

-  uint uVar6;

-  uint unaff_EBX;

-  uint uVar7;

-  uint uVar8;

-  char unaff_R13B;

+  int iVar1;

+  undefined4 uVar2;

+  longlong lVar3;

+  longlong lVar4;

+  longlong lVar5;

+  longlong lVar6;

+  longlong lVar7;

+  undefined8 uVar8;

+  undefined8 uVar9;

+  undefined8 *puVar10;

+  ulonglong uVar11;

+  uint uVar12;

+  undefined4 uVar13;

+  undefined4 uVar14;

+  undefined4 uVar15;

+  undefined4 uVar16;

+  undefined4 uVar17;

+  undefined4 uVar18;

+  undefined4 uVar19;

+  undefined4 uVar20;

+  undefined1 auStack_2a8 [32];

+  undefined8 local_288;

+  undefined8 local_280;

+  undefined8 uStack_278;

+  undefined8 local_270;

+  undefined8 uStack_268;

+  longlong local_260;

+  undefined8 uStack_258;

+  undefined8 local_250;

+  undefined8 uStack_248;

+  undefined8 local_240;

+  undefined8 uStack_238;

+  undefined8 local_230;

+  undefined8 uStack_228;

+  undefined8 local_220;

+  undefined8 uStack_218;

+  undefined8 local_210;

+  undefined8 uStack_208;

+  undefined8 local_200;

+  undefined4 local_1f8;

+  undefined8 local_1c8;

+  undefined8 uStack_1c0;

+  undefined8 local_1b8;

+  undefined8 uStack_1b0;

+  undefined8 local_1a8;

+  undefined8 uStack_1a0;

+  undefined8 local_198;

+  undefined8 uStack_190;

+  undefined4 local_188;

+  undefined4 uStack_184;

+  undefined4 uStack_180;

+  undefined4 uStack_17c;

+  undefined8 local_178;

+  undefined4 local_170;

+  undefined2 local_16c;

+  undefined8 local_168;

+  undefined8 uStack_160;

+  undefined8 local_158;

+  undefined8 uStack_150;

+  undefined8 local_148;

+  undefined8 uStack_140;

+  undefined8 local_138;

+  undefined8 uStack_130;

+  undefined4 local_128;

+  undefined4 uStack_124;

+  undefined4 uStack_120;

+  undefined4 uStack_11c;

+  undefined8 local_118;

+  undefined4 local_110;

+  undefined2 local_10c;

+  undefined8 local_108;

+  undefined8 uStack_100;

+  int local_f8;

+  undefined4 uStack_f4;

+  undefined8 uStack_f0;

+  undefined8 local_e8;

+  undefined8 uStack_e0;

+  undefined8 local_d8;

+  undefined8 uStack_d0;

+  undefined4 local_c8;

+  undefined4 uStack_c4;

+  undefined4 uStack_c0;

+  undefined4 uStack_bc;

+  undefined8 local_b8;

+  undefined4 local_b0;

+  undefined8 local_a8;

+  undefined8 uStack_a0;

+  int local_98;

+  undefined4 uStack_94;

+  undefined8 uStack_90;

+  undefined8 local_88;

+  undefined8 uStack_80;

+  undefined8 local_78;

+  undefined8 uStack_70;

+  undefined4 local_68;

+  undefined4 uStack_64;

+  undefined4 uStack_60;

+  undefined4 uStack_5c;

+  undefined8 local_58;

+  undefined4 local_50;

+  ulonglong local_48;

   

-  if ((int)param_1 == 0) {

-    uVar7 = *(uint *)(*(longlong *)(param_1 + 0x28) + 0x120);

-    uVar6 = uVar7 & 0xf;

-    if (uVar6 == 3) {

-      unaff_EBX = uVar7 >> 8 & 0x1ff;

+  local_48 = __security_cookie ^ (ulonglong)auStack_2a8;

+  local_200 = 0;

+  local_1f8 = 0;

+  local_230 = 0;

+  uStack_228 = 0;

+  local_220 = 0;

+  uStack_218 = 0;

+  local_210 = 0;

+  uStack_208 = 0;

+  local_288 = param_1;

+  memset(&local_108,0,0x5c);

+  lVar3 = W32GetUserSessionState();

+  uVar8 = *(undefined8 *)(*(longlong *)(lVar3 + 0xdf10) + 0x48);

+  lVar3 = W32GetUserSessionState();

+  lVar3 = *(longlong *)(lVar3 + 0x4e30);

+  local_260 = lVar3;

+  lVar4 = W32GetUserSessionState();

+  lVar4 = *(longlong *)(lVar4 + 0x4e30);

+  lVar5 = GetSessionDpiMetrics();

+  lVar6 = Get96DpiMetrics();

+  local_280 = -(ulonglong)(param_2 != 0) & param_2 + 0x18U;

+  iVar1 = UserSetFont(param_1,local_280,0x8b,lVar3 + 0x13f0);

+  if ((iVar1 != 0) &&

+     (iVar1 = UserSetAltScaleFont(*(undefined8 *)(lVar3 + 0x13f0),lVar4 + 0x1458), iVar1 != 0)) {

+    local_270 = GreSelectFont(uVar8,*(undefined8 *)(lVar3 + 0x13f0));

+    uVar2 = GetCharDimensions(uVar8,0,lVar3 + 0x13fc);

+    *(undefined4 *)(lVar3 + 0x13f8) = uVar2;

+    GreSelectFont(uVar8,*(undefined8 *)(lVar4 + 0x1458));

+    uVar2 = GetCharDimensions(uVar8,0,lVar4 + 0x1464);

+    *(undefined4 *)(lVar4 + 0x1460) = uVar2;

+    uVar11 = param_2 + 0x7c;

+    if (param_2 == 0) {

+      uVar11 = local_280;

     }

-    else if ((*(uint *)(*(longlong *)(param_1 + 0x28) + 0xe8) & 0x400) == 0) {

-      if (((uVar6 == 0) &&

-          (lVar2 = *(longlong *)(*(longlong *)(param_2 + 0x10) + 0x1f0), lVar2 != 0)) &&

-         ((byte)((byte)param_3 & (byte)*(undefined4 *)(**(longlong **)(lVar2 + 8) + 0x40)) != 0)) {

-        unaff_EBX = 0x60;

+    iVar1 = UserSetFont(param_1,uVar11,0x8e,lVar5 + 0x28);

+    if ((iVar1 != 0) &&

+       (iVar1 = UserSetAltScaleFont(*(undefined8 *)(lVar5 + 0x28),lVar6 + 0x28), iVar1 != 0)) {

+      GreSelectFont(uVar8,*(undefined8 *)(lVar5 + 0x28));

+      uVar2 = GetCharDimensions(uVar8,0,lVar5 + 0x34);

+      *(undefined4 *)(lVar5 + 0x30) = uVar2;

+      GreSelectFont(uVar8,*(undefined8 *)(lVar6 + 0x28));

+      uVar2 = GetCharDimensions(uVar8,0,lVar6 + 0x34);

+      *(undefined4 *)(lVar6 + 0x30) = uVar2;

+      local_280 = param_2 + 0xe0;

+      if (param_2 == 0) {

+        local_280 = uVar11;

       }

-      else {

-        unaff_EBX = (uint)*(ushort *)(*(longlong *)(*(longlong *)(param_2 + 0x10) + 0x1d0) + 0x110);

+      puVar10 = (undefined8 *)(lVar5 + 8);

+      iVar1 = UserSetFont(param_1,local_280,0x91,puVar10);

+      if ((iVar1 != 0) && (iVar1 = UserSetAltScaleFont(*puVar10,lVar6 + 8), iVar1 != 0)) {

+        lVar3 = W32GetUserSessionState();

+        if (*(longlong *)(lVar3 + 0x10270) != 0) {

+          lVar7 = GetDpiMetricsForCurrentThread();

+          GreSelectFont(*(undefined8 *)(lVar3 + 0x10270),*(undefined8 *)(lVar7 + 8));

+        }

+        GreSelectFont(uVar8,*puVar10);

+        uVar2 = GetCharDimensions(uVar8,&local_230,lVar5 + 0x14);

+        *(undefined4 *)(lVar5 + 0x10) = uVar2;

+        *(undefined4 *)(lVar5 + 0x18) = (undefined4)local_210;

+        *(int *)(lVar5 + 0x1c) = (int)local_220;

+        uVar12 = (int)local_220 + 1 + *(int *)(lVar5 + 0x14) & 0xfffe;

+        *(int *)(lVar5 + 0x24) = (int)local_220 + 2 + *(int *)(lVar5 + 0x14);

+        *(undefined4 *)(lVar5 + 0x20) = local_230._4_4_;

+        SetDpiDepSysMet(0x1b,uVar12 - 1);

+        SetDpiDepSysMet(0x1c,uVar12 - 1);

+        GreSelectFont(uVar8,*(undefined8 *)(lVar6 + 8));

+        uVar2 = GetCharDimensions(uVar8,&local_230,lVar6 + 0x14);

+        *(undefined4 *)(lVar6 + 0x10) = uVar2;

+        *(undefined4 *)(lVar6 + 0x18) = (undefined4)local_210;

+        *(int *)(lVar6 + 0x1c) = (int)local_220;

+        iVar1 = ((int)local_220 + 1 + *(int *)(lVar6 + 0x14) & 0xfffeU) - 1;

+        *(int *)(lVar6 + 0x24) = (int)local_220 + 2 + *(int *)(lVar6 + 0x14);

+        *(undefined4 *)(lVar6 + 0x20) = local_230._4_4_;

+        lVar3 = W32GetUserSessionState();

+        *(int *)(*(longlong *)(lVar3 + 0x4e30) + 0x9d0) = iVar1;

+        lVar3 = W32GetUserSessionState();

+        *(int *)(*(longlong *)(lVar3 + 0x4e30) + 0x9d4) = iVar1;

+        GreSelectFont(uVar8,local_270);

+        *(int *)(lVar5 + 0x20) = *(int *)(lVar5 + 0x20) + 1;

+        *(int *)(lVar6 + 0x20) = *(int *)(lVar6 + 0x20) + 1;

+        if ((*(longlong *)(lVar5 + 0x38) != 0) &&

+           (*(longlong *)(lVar5 + 0x38) != *(longlong *)(local_260 + 0x1400))) {

+          GreMarkDeletableFont();

+          GreDeleteObject(*(undefined8 *)(lVar5 + 0x38));

+          *(undefined8 *)(lVar5 + 0x38) = 0;

+        }

+        iVar1 = GreExtGetObjectW(*puVar10,0x5c,&local_108);

+        if (iVar1 != 0) {

+          local_1c8 = local_108;

+          uStack_1c0 = uStack_100;

+          if (local_f8 < 0x2bd) {

+            local_f8 = 700;

+          }

+          local_1a8 = local_e8;

+          uStack_1a0 = uStack_e0;

+          local_1b8 = CONCAT44(uStack_f4,local_f8);

+          uStack_1b0 = uStack_f0;

+          local_198 = local_d8;

+          uStack_190 = uStack_d0;

+          local_178 = local_b8;

+          local_188 = local_c8;

+          uStack_184 = uStack_c4;

+          uStack_180 = uStack_c0;

+          uStack_17c = uStack_bc;

+          local_170 = local_b0;

+          local_16c = 0x101;

+          uVar8 = GreCreateFontIndirectW(&local_1c8);

+          *(undefined8 *)(lVar5 + 0x38) = uVar8;

+          if ((*(longlong *)(lVar6 + 0x38) != 0) &&

+             (*(longlong *)(lVar6 + 0x38) != *(longlong *)(lVar4 + 0x1468))) {

+            GreMarkDeletableFont();

+            GreDeleteObject(*(undefined8 *)(lVar6 + 0x38));

+            *(undefined8 *)(lVar6 + 0x38) = 0;

+          }

+          memset(&local_a8,0,0x5c);

+          iVar1 = GreExtGetObjectW(*(undefined8 *)(lVar6 + 8),0x5c,&local_a8);

+          if (iVar1 != 0) {

+            local_168 = local_a8;

+            uStack_160 = uStack_a0;

+            if (local_98 < 0x2bd) {

+              local_98 = 700;

+            }

+            local_158 = CONCAT44(uStack_94,local_98);

+            uStack_150 = uStack_90;

+            local_138 = local_78;

+            uStack_130 = uStack_70;

+            local_148 = local_88;

+            uStack_140 = uStack_80;

+            local_118 = local_58;

+            local_128 = local_68;

+            uStack_124 = uStack_64;

+            uStack_120 = uStack_60;

+            uStack_11c = uStack_5c;

+            local_110 = local_50;

+            local_10c = 0x101;

+            uVar9 = GreCreateFontIndirectW(&local_168);

+            uVar8 = local_288;

+            *(undefined8 *)(lVar6 + 0x38) = uVar9;

+            uVar11 = param_2 + 0x13c;

+            if (param_2 == 0) {

+              uVar11 = local_280;

+            }

+            iVar1 = UserSetFont(local_288,uVar11,0x9c,lVar5 + 0x40);

+            if ((iVar1 != 0) &&

+               (iVar1 = UserSetAltScaleFont(*(undefined8 *)(lVar5 + 0x40),lVar6 + 0x40), iVar1 != 0)

+               ) {

+              if (param_2 == 0) {

+                puVar10 = (undefined8 *)

+                          GetLogFontFromUserProfile((_UNICODE_STRING *)&local_230,(uint)uVar8);

+                local_240 = *puVar10;

+                uStack_238 = puVar10[1];

+                uVar2 = *(undefined4 *)(puVar10 + 0xb);

+                local_250 = puVar10[2];

+                uStack_248 = puVar10[3];

+                local_260 = puVar10[4];

+                uStack_258 = puVar10[5];

+                local_270 = puVar10[6];

+                uStack_268 = puVar10[7];

+                local_280 = puVar10[8];

+                uStack_278 = puVar10[9];

+                local_288 = puVar10[10];

+                lVar3 = W32GetUserSessionState();

+                lVar3 = *(longlong *)(lVar3 + 0x4e30);

+                *(undefined8 *)(lVar3 + 0x138c) = local_240;

+                *(undefined8 *)(lVar3 + 0x1394) = uStack_238;

+                *(undefined8 *)(lVar3 + 0x139c) = local_250;

+                *(undefined8 *)(lVar3 + 0x13a4) = uStack_248;

+                *(longlong *)(lVar3 + 0x13ac) = local_260;

+                *(undefined8 *)(lVar3 + 0x13b4) = uStack_258;

+                uVar13 = (undefined4)local_280;

+                uVar14 = local_280._4_4_;

+                uVar15 = (undefined4)uStack_278;

+                uVar16 = uStack_278._4_4_;

+                uVar17 = (undefined4)local_270;

+                uVar18 = local_270._4_4_;

+                uVar19 = (undefined4)uStack_268;

+                uVar20 = uStack_268._4_4_;

+              }

+              else {

+                local_260 = *(undefined8 *)(param_2 + 0x198);

+                uStack_258 = *(undefined8 *)(param_2 + 0x1a0);

+                uVar2 = *(undefined4 *)(param_2 + 0x1f0);

+                local_270 = *(undefined8 *)(param_2 + 0x1a8);

+                uStack_268 = *(undefined8 *)(param_2 + 0x1b0);

+                local_280 = *(undefined8 *)(param_2 + 0x1b8);

+                uStack_278 = *(undefined8 *)(param_2 + 0x1c0);

+                local_250 = *(undefined8 *)(param_2 + 0x1c8);

+                uStack_248 = *(undefined8 *)(param_2 + 0x1d0);

+                local_240 = *(undefined8 *)(param_2 + 0x1d8);

+                uStack_238 = *(undefined8 *)(param_2 + 0x1e0);

+                local_288 = *(undefined8 *)(param_2 + 0x1e8);

+                lVar3 = W32GetUserSessionState();

+                lVar3 = *(longlong *)(lVar3 + 0x4e30);

+                *(longlong *)(lVar3 + 0x138c) = local_260;

+                *(undefined8 *)(lVar3 + 0x1394) = uStack_258;

+                *(undefined8 *)(lVar3 + 0x139c) = local_270;

+                *(undefined8 *)(lVar3 + 0x13a4) = uStack_268;

+                *(ulonglong *)(lVar3 + 0x13ac) = local_280;

+                *(undefined8 *)(lVar3 + 0x13b4) = uStack_278;

+                uVar13 = (undefined4)local_240;

+                uVar14 = local_240._4_4_;

+                uVar15 = (undefined4)uStack_238;

+                uVar16 = uStack_238._4_4_;

+                uVar17 = (undefined4)local_250;

+                uVar18 = local_250._4_4_;

+                uVar19 = (undefined4)uStack_248;

+                uVar20 = uStack_248._4_4_;

+              }

+              *(undefined4 *)(lVar3 + 0x13bc) = uVar17;

+              *(undefined4 *)(lVar3 + 0x13c0) = uVar18;

+              *(undefined4 *)(lVar3 + 0x13c4) = uVar19;

+              *(undefined4 *)(lVar3 + 0x13c8) = uVar20;

+              *(undefined4 *)(lVar3 + 0x13cc) = uVar13;

+              *(undefined4 *)(lVar3 + 0x13d0) = uVar14;

+              *(undefined4 *)(lVar3 + 0x13d4) = uVar15;

+              *(undefined4 *)(lVar3 + 0x13d8) = uVar16;

+              *(undefined8 *)(lVar3 + 0x13dc) = local_288;

+              *(undefined4 *)(lVar3 + 0x13e4) = uVar2;

+              iVar1 = Feature_DpiMetricsInUserMode__private_IsEnabledDeviceUsageNoInline();

+              if (iVar1 == 0) {

+                InvalidateKMDpiMetricsCacheDPIMETRICS();

+                UpdateDpiMetricsCacheDPISERVERINFO();

+              }

+              else {

+                InvalidateSecondaryDpiServerInfos();

+                InvalidateSecondaryDpiMetrics();

+              }

+              return 1;

+            }

+          }

+        }

       }

     }

-    else {

-      unaff_EBX = GetWindowDpiLastNotify(param_2);

-    }

   }

-  if (*(uint *)(*(longlong *)(param_2 + 0x10) + 0x2a0) < 0x9901) {

-    uVar7 = *(uint *)(*(longlong *)(param_2 + 0x10) + 0x2b0);

-  }

-  else {

-    uVar7 = 0;

-  }

-  uVar6 = *(uint *)(*(longlong *)(param_2 + 0x28) + 0x18);

-  uVar1 = *(uint *)(*(longlong *)(param_2 + 0x28) + 0x1c);

-  if ((uVar6 >> 8 & 1) == 0) {

-    iVar3 = 0;

-    if ((uVar6 >> 0x11 & 1) != 0) {

-      iVar3 = param_3;

-    }

-  }

-  else {

-    iVar3 = 2;

-  }

-  uVar8 = uVar1 & 0xc00000;

-  iVar5 = iVar3 + 1;

-  if ((byte)((byte)param_3 & (byte)uVar6) == 0 && uVar8 == 0) {

-    iVar5 = iVar3;

-  }

-  if (((uVar7 >> 0x1c & 1) == 0) && ((uVar7 >> 0x1d & 1) == 0)) {

-    iVar3 = func_0x000140096c4c(0x5c,unaff_EBX);

-  }

-  else {

-    iVar3 = 0;

-  }

-  if (((uVar1 >> 0x12 & 1) != 0) ||

-     (((0 < iVar3 && (uVar8 == 0xc00000)) && ((uVar7 & 0x30000000) == 0)))) {

-    iVar4 = GetResizeBorderWidthForDpiWithAppCompat2(unaff_EBX,uVar7);

-    iVar5 = iVar4 + iVar5 + iVar3;

-  }

-  if ((unaff_R13B != '\0') && ((uVar6 >> 9 & 1) != 0)) {

-    iVar5 = iVar5 + 2;

-  }

-  return iVar5;

+  return 0;

 }
```

## `HDEV_DeleteRfontsAndUnloadDeviceFonts`  (modified)

```diff
--- HDEV_DeleteRfontsAndUnloadDeviceFonts
+++ HDEV_DeleteRfontsAndUnloadDeviceFonts
@@ -1,10 +1,58 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void HDEV_DeleteRfontsAndUnloadDeviceFonts(void)

+int HDEV_DeleteRfontsAndUnloadDeviceFonts(HDEV__ *param_1,longlong param_2)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  _LIST_ENTRY *p_Var1;

+  int iVar2;

+  int iVar3;

+  _LIST_ENTRY *p_Var4;

+  longlong lVar5;

+  PFF *pPVar6;

+  _LIST_ENTRY *local_res8;

+  HDEV__ *local_res10;

+  undefined8 local_38 [2];

+  undefined8 local_28;

+  undefined8 uStack_20;

+  undefined8 local_18;

+  undefined8 uStack_10;

+  

+                    /* 0x2529f0  503  HDEV_DeleteRfontsAndUnloadDeviceFonts */

+  iVar3 = *(int *)(param_2 + 8);

+  *(undefined4 *)(param_2 + 8) = 0;

+  local_28 = 0;

+  uStack_20 = 0;

+  local_18 = 0;

+  uStack_10 = 0;

+  local_res10 = param_1;

+  PushThreadGuardedObject(&local_28,param_2,vUnreferencePdevWorker_exref);

+  iVar2 = Feature_Servicing_FixEudcRfontRace__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 == 0) {

+    while( true ) {

+      p_Var4 = PDEVOBJ::prfntInactive((PDEVOBJ *)&local_res10);

+      p_Var1 = *(_LIST_ENTRY **)p_Var4;

+      if (p_Var1 == p_Var4) break;

+      local_res8 = p_Var1 + -0x2a0;

+      local_38[0] = *(undefined8 *)(p_Var1 + -0x220);

+      RFONTOBJ::vDeleteRFONT((RFONTOBJ *)&local_res8,param_1,(PFFOBJ *)local_38,iVar3);

+      local_res8 = (_LIST_ENTRY *)0x0;

+      RFONTOBJ::~RFONTOBJ((RFONTOBJ *)&local_res8);

+    }

+  }

+  else {

+    DeleteInactiveRFONTsCollectAndDelete(&local_res10,iVar3);

+  }

+  PopThreadGuardedObject(&local_28);

+  if (*(int *)(param_1 + 0xddc) == 0) {

+    iVar3 = 1;

+  }

+  else {

+    lVar5 = W32GetSessionState();

+    GreAcquireSemaphore<17>((GLOBALS *)(*(longlong *)(lVar5 + 0x60) + 0x1308));

+    DEVICE_PFTOBJ::DEVICE_PFTOBJ((DEVICE_PFTOBJ *)local_38);

+    local_res8 = (_LIST_ENTRY *)0x0;

+    pPVar6 = DEVICE_PFTOBJ::pPFFGet((DEVICE_PFTOBJ *)local_38,param_1,(PFF ***)&local_res8);

+    iVar3 = PFTOBJ::bUnloadWorkhorse((PFTOBJ *)local_38,pPVar6,(PFF **)local_res8,0);

+  }

+  return iVar3;

 }
```

## `xxxGetDummyDib`  (modified)

```diff
--- xxxGetDummyDib
+++ xxxGetDummyDib
@@ -1,9 +1,75 @@
+

+/* void * __ptr64 __cdecl xxxGetDummyDib(struct tagWINDOWSTATION * __ptr64,struct tagGETCLIPBDATA *

+   __ptr64) */

 

 void * __cdecl xxxGetDummyDib(tagWINDOWSTATION *param_1,tagGETCLIPBDATA *param_2)

 

 {

-  uint in_EAX;

+  int iVar1;

+  ulong uVar2;

+  longlong lVar3;

+  HPALETTE__ *pHVar4;

+  tagCLIP *ptVar5;

+  void *pvVar6;

+  HBITMAP__ *pHVar7;

+  tagBITMAPINFOHEADER *ptVar8;

+  ulong local_res18 [2];

   

-  return (void *)(ulonglong)(in_EAX & 1);

+  pHVar4 = (HPALETTE__ *)0x0;

+  lVar3 = W32GetUserSessionState();

+  if (((*(uint *)(*(longlong *)(lVar3 + 0x4e30) + 0x1b5c) & 1) == 0) ||

+     (pHVar4 = (HPALETTE__ *)xxxGetClipboardData(param_1,9,param_2), pHVar4 != (HPALETTE__ *)0x0)) {

+    ptVar5 = FindClipFormat(param_1,0x11,1);

+    if ((ptVar5 != (tagCLIP *)0x0) &&

+       ((*(longlong *)(ptVar5 + 8) != 2 &&

+        (pvVar6 = (void *)xxxGetClipboardData(param_1,0x11,param_2), pvVar6 != (void *)0x0)))) {

+      *(undefined4 *)param_2 = 0x11;

+      *(HPALETTE__ **)(param_2 + 8) = pHVar4;

+      return pvVar6;

+    }

+    ptVar5 = FindClipFormat(param_1,2,1);

+    if (((ptVar5 != (tagCLIP *)0x0) && (*(longlong *)(ptVar5 + 8) != 2)) &&

+       (pHVar7 = (HBITMAP__ *)xxxGetClipboardData(param_1,2), pHVar7 != (HBITMAP__ *)0x0)) {

+      uVar2 = 0;

+      local_res18[0] = 0;

+      iVar1 = Feature_1321969976__private_IsEnabledDeviceUsageNoInline();

+      if (iVar1 == 0) {

+        ptVar8 = xxxBMPtoDIB(pHVar7,pHVar4,(ulong *)0x0);

+      }

+      else {

+        ptVar8 = xxxBMPtoDIB(pHVar7,pHVar4,local_res18);

+        uVar2 = local_res18[0];

+      }

+      if (ptVar8 == (tagBITMAPINFOHEADER *)0x0) {

+        return (void *)0x0;

+      }

+      iVar1 = Feature_1321969976__private_IsEnabledDeviceUsageNoInline();

+      if (iVar1 == 0) {

+        uVar2 = SizeOfDib(ptVar8);

+      }

+      iVar1 = Feature_2204870969__private_IsEnabledDeviceUsageNoInline();

+      if ((iVar1 == 0) || (uVar2 != 0)) {

+        pvVar6 = (void *)_ConvertMemHandle(ptVar8,uVar2);

+        Win32FreePool(ptVar8);

+        if (pvVar6 == (void *)0x0) {

+          return (void *)0x0;

+        }

+        ptVar5 = FindClipFormat(param_1,8,1);

+        if (ptVar5 != (tagCLIP *)0x0) {

+          UT_FreeCBFormat(ptVar5);

+          *(void **)(ptVar5 + 8) = pvVar6;

+          *(undefined4 *)param_2 = 8;

+          return pvVar6;

+        }

+        lVar3 = HMValidateHandleNoRip(pvVar6,6);

+        if (lVar3 != 0) {

+          HMUnlockDestroyObject(lVar3);

+        }

+        return (void *)0x0;

+      }

+      Win32FreePool(ptVar8);

+    }

+  }

+  return (void *)0x0;

 }
```

## `PostEventMessageEx`  (modified)

```diff
--- PostEventMessageEx
+++ PostEventMessageEx
@@ -1,98 +1,165 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl PostEventMessageEx(struct tagTHREADINFO * __ptr64,struct tagQ * __ptr64,unsigned

+   long,struct tagWND * __ptr64,unsigned int,unsigned __int64,__int64,struct tagINPUT_MESSAGE_SOURCE

+   * __ptr64) */

 

 int __cdecl

 PostEventMessageEx(tagTHREADINFO *param_1,tagQ *param_2,ulong param_3,tagWND *param_4,uint param_5,

                   __uint64 param_6,__int64 param_7,tagINPUT_MESSAGE_SOURCE *param_8)

 

 {

-  int iVar1;

-  longlong unaff_RBX;

-  int unaff_ESI;

-  longlong unaff_R12;

-  int unaff_R14D;

-  longlong unaff_R15;

-  undefined1 in_ZF;

-  int in_stack_00000048;

-  undefined4 in_stack_00000060;

-  undefined4 in_stack_00000064;

-  undefined4 in_stack_00000068;

-  int in_stack_00000078;

-  uint in_stack_00000084;

-  code *in_stack_000000a0;

-  code *in_stack_000000b8;

-  code *in_stack_000000d8;

-  int in_stack_000000e0;

-  longlong in_stack_000000e8;

-  longlong in_stack_00000110;

-  code *in_stack_00000118;

-  code *in_stack_00000120;

-  longlong in_stack_00000140;

-  longlong in_stack_000001d8;

+  bool bVar1;

+  uint uVar2;

+  int iVar3;

+  longlong lVar4;

+  tagQMSG *ptVar5;

+  ulong uVar6;

+  undefined1 auStackY_108 [32];

+  tagDomLock *local_98;

+  char local_90;

+  tagDomLock *local_88;

+  char local_80;

+  tagObjLock *local_68;

+  tagObjLock *local_60;

+  char local_50;

+  ulonglong local_48;

   

-  while( true ) {

-    if ((bool)in_ZF) {

-      (*in_stack_00000118)(&stack0x00000130);

+  local_48 = __security_cookie ^ (ulonglong)auStackY_108;

+  if (param_1 == (tagTHREADINFO *)0x0) {

+    lVar4 = W32GetUserSessionState();

+    DomainShared<DLT_THREADINFO,DLT_QUEUE>::DomainExclusive<>::ObjectLock<tagObjLock,tagObjLock>::

+    ObjectLock<tagObjLock,tagObjLock>

+              ((ObjectLock<tagObjLock,tagObjLock> *)&local_98,(tagObjLock *)(lVar4 + 0xa678),

+               (tagObjLock *)(param_2 + 0x10));

+LAB_0:

+    ptVar5 = AllocQEntryEx((tagMLIST *)(param_2 + 0x28),(tagQMSG *)0x0,1);

+    if (ptVar5 != (tagQMSG *)0x0) {

+      if (param_4 == (tagWND *)0x0) {

+        if (*(longlong *)(param_2 + 0x90) == 0) {

+          lVar4 = *(longlong *)(param_2 + 0x78);

+        }

+        else {

+          lVar4 = *(longlong *)(*(longlong *)(param_2 + 0x90) + 0x10);

+        }

+        uVar6 = *(ulong *)(*(longlong *)(lVar4 + 0x1d0) + 0x10c);

+      }

+      else {

+        uVar6 = *(ulong *)(*(longlong *)(param_4 + 0x28) + 0x120);

+      }

+      StoreQMessage(ptVar5,param_4,param_5,param_6,param_7,0,0,param_3,0,0,param_8,uVar6,(void *)0x0

+                    ,(tagUIPI_INFO *)0x0);

+      *(tagTHREADINFO **)(ptVar5 + 0x68) = param_1;

+      if (param_3 == 0x14) {

+        lVar4 = W32GetUserSessionState();

+        CTouchProcessor::ReferenceMsgDataExternal

+                  (*(CTouchProcessor **)(lVar4 + 0xcb8),param_7,3,ptVar5);

+      }

+      if (param_1 == (tagTHREADINFO *)0x0) {

+        SetWakeBit(*(undefined8 *)(param_2 + 0x70),0x2040);

+        param_1 = *(tagTHREADINFO **)(param_2 + 0x78);

+      }

+      SetWakeBit(param_1,0x2040);

+      if (local_50 != '\0') {

+        if (local_60 != (tagObjLock *)0x0) {

+          tagObjLock::UnLockExclusive(local_60);

+        }

+        if (local_68 != (tagObjLock *)0x0) {

+          tagObjLock::UnLockExclusive(local_68);

+        }

+        if (local_88 != (tagDomLock *)0x0) {

+          if (local_80 == '\0') {

+            tagDomLock::UnLockShared(local_88);

+          }

+          else {

+            tagDomLock::UnLockExclusive(local_88);

+          }

+        }

+        if (local_98 != (tagDomLock *)0x0) {

+          if (local_90 == '\0') {

+            tagDomLock::UnLockShared(local_98);

+          }

+          else {

+            tagDomLock::UnLockExclusive(local_98);

+          }

+        }

+      }

+      return 1;

+    }

+    if (local_50 == '\0') {

+      return 0;

+    }

+    if (local_60 != (tagObjLock *)0x0) {

+      tagObjLock::UnLockExclusive(local_60);

+    }

+    if (local_68 != (tagObjLock *)0x0) {

+      tagObjLock::UnLockExclusive(local_68);

+    }

+    if (local_88 == (tagDomLock *)0x0) goto LAB_1;

+    if (local_80 != '\0') {

+      tagDomLock::UnLockExclusive(local_88);

+      goto LAB_1;

+    }

+  }

+  else {

+    DomainShared<DLT_THREADINFO,DLT_QUEUE>::DomainExclusive<>::ObjectLock<tagObjLock,tagObjLock>::

+    ObjectLock<tagObjLock,tagObjLock>

+              ((ObjectLock<tagObjLock,tagObjLock> *)&local_98,(tagObjLock *)(param_1 + 0x1b0),

+               (tagObjLock *)(param_2 + 0x10));

+    LOCK();

+    uVar2 = *(uint *)(param_1 + 0x210);

+    if (uVar2 == 0) {

+      *(uint *)(param_1 + 0x210) = 0;

+      uVar2 = 0;

+    }

+    UNLOCK();

+    if ((uVar2 & 1) == 0) {

+      vAdjustDelegatePriority(param_1);

+      bVar1 = tagPROCESSINFO::SyncAndTestFreeze(*(tagPROCESSINFO **)(param_1 + 0x1d0));

+      if ((!bVar1) ||

+         (iVar3 = ProcessSuspendedEventMessage(param_1,param_3,param_4,param_5), iVar3 != 0))

+      goto LAB_0;

+      if (local_50 == '\0') {

+        return 0;

+      }

+      if (local_60 != (tagObjLock *)0x0) {

+        tagObjLock::UnLockExclusive(local_60);

+      }

+      if (local_68 != (tagObjLock *)0x0) {

+        tagObjLock::UnLockExclusive(local_68);

+      }

+      if (local_88 == (tagDomLock *)0x0) goto LAB_1;

+      if (local_80 != '\0') {

+        tagDomLock::UnLockExclusive(local_88);

+        goto LAB_1;

+      }

     }

     else {

-      (*in_stack_000000b8)(&stack0x00000130,&stack0x000000e8,&stack0x00000270,0);

-      if (*(int *)(unaff_RBX + 0x68) < 1) {

-        if (unaff_ESI == 0) {

-          unaff_ESI = *(int *)(unaff_RBX + 0xac) + -1;

-          in_stack_000000e8 =

-               (longlong)(unaff_ESI * *(int *)(unaff_RBX + 0x78)) + *(longlong *)(unaff_RBX + 0x50);

-        }

-        else {

-          unaff_ESI = unaff_ESI + -1;

-          in_stack_000000e8 = in_stack_000000e8 + *(int *)(unaff_RBX + 0x88);

-        }

+      if (local_50 == '\0') {

+        return 0;

       }

-      else {

-        unaff_ESI = unaff_ESI + 1;

-        in_stack_000000e8 = in_stack_000000e8 + *(int *)(unaff_RBX + 0x88);

-        if (*(int *)(unaff_RBX + 0xac) <= unaff_ESI) {

-          unaff_ESI = 0;

-          in_stack_000000e8 = *(longlong *)(unaff_RBX + 0x50);

-        }

+      if (local_60 != (tagObjLock *)0x0) {

+        tagObjLock::UnLockExclusive(local_60);

+      }

+      if (local_68 != (tagObjLock *)0x0) {

+        tagObjLock::UnLockExclusive(local_68);

+      }

+      if (local_88 == (tagDomLock *)0x0) goto LAB_1;

+      if (local_80 != '\0') {

+        tagDomLock::UnLockExclusive(local_88);

+        goto LAB_1;

       }

     }

-    unaff_R12 = unaff_R12 + *(int *)(unaff_RBX + 0x80);

-    if (in_stack_00000048 == 0) break;

-    in_stack_00000140 = unaff_R12;

-    if (*(int *)(unaff_RBX + 0xd4) != 0) {

-      (*in_stack_00000120)(&stack0x000001d0);

-      in_stack_000001d8 = in_stack_000001d8 + *(int *)(unaff_RBX + 0x7c);

+  }

+  tagDomLock::UnLockShared(local_88);

+LAB_1:

+  if (local_98 != (tagDomLock *)0x0) {

+    if (local_90 != '\0') {

+      tagDomLock::UnLockExclusive(local_98);

+      return 0;

     }

-    if (unaff_R15 != 0) {

-      (*in_stack_000000d8)

-                (&stack0x00000370 + in_stack_00000084,in_stack_00000068,unaff_R15,in_stack_00000064,

-                 in_stack_00000060);

-      if (*(int *)(unaff_RBX + 0x68) == 1) {

-        iVar1 = unaff_R14D + 1;

-        unaff_R15 = unaff_R15 + *(int *)(unaff_RBX + 0x84);

-        if (in_stack_00000078 <= iVar1) {

-          unaff_R15 = *(longlong *)(unaff_RBX + 0x58);

-        }

-        unaff_R14D = 0;

-        if (iVar1 < in_stack_000000e0) {

-          unaff_R14D = iVar1;

-        }

-      }

-      else if (unaff_R14D == 0) {

-        unaff_R14D = in_stack_00000078 + -1;

-        unaff_R15 = (longlong)(*(int *)(in_stack_00000110 + 0x74) * unaff_R14D) +

-                    *(longlong *)(unaff_RBX + 0x58);

-      }

-      else {

-        unaff_R14D = unaff_R14D + -1;

-        unaff_R15 = unaff_R15 - *(int *)(in_stack_00000110 + 0x74);

-      }

-    }

-    (*in_stack_000000a0)(&stack0x00000470,&stack0x00000370,&stack0x00000270);

-    in_ZF = *(int *)(unaff_RBX + 0xe0) == 0;

-    in_stack_00000048 = in_stack_00000048 + -1;

+    tagDomLock::UnLockShared(local_98);

   }

   return 0;

 }
```

## `bCopySurface`  (modified)

```diff
--- bCopySurface
+++ bCopySurface
@@ -1,117 +1,68 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl bCopySurface(class SURFMEM * __ptr64,struct _SURFOBJ * __ptr64) */

 

 int __cdecl bCopySurface(SURFMEM *param_1,_SURFOBJ *param_2)

 

 {

-  int *piVar1;

-  PFF *pPVar2;

-  _UNIVERSAL_FONT_ID *p_Var3;

-  longlong *plVar4;

-  uint uVar5;

-  int iVar6;

-  int iVar7;

-  longlong lVar8;

-  PFF *pPVar9;

-  _EUDCLOAD *unaff_RBX;

-  longlong unaff_RBP;

-  ulong uVar10;

-  ulong in_R9D;

-  PUBLIC_PFTOBJ *unaff_R12;

-  tagDESIGNVECTOR *unaff_R13;

-  ulong unaff_R14D;

-  ulong *in_stack_00000020;

+  int iVar1;

+  uint uVar2;

+  _SURFOBJ *p_Var3;

+  SESSION_GLOBALS *pSVar4;

+  undefined1 auStackY_b8 [32];

+  int local_58;

+  undefined4 local_54;

+  undefined4 local_50;

+  undefined4 local_4c;

+  undefined8 local_48;

+  uint local_40;

+  undefined4 local_3c;

+  undefined8 local_38;

+  undefined4 local_30;

+  undefined4 local_2c;

+  ulonglong local_28;

   

-  uVar5 = PDEVOBJ::QueryFontFile

-                    ((PDEVOBJ *)param_1,(__uint64)param_2,in_R9D + 2,in_R9D,in_stack_00000020);

-  if ((uVar5 == 0) || (uVar5 == 0xffffffff)) goto LAB_0;

-  lVar8 = W32GetSessionState();

-  LOCK();

-  piVar1 = (int *)(*(longlong *)(lVar8 + 0x60) + 0x5ddc);

-  *piVar1 = *piVar1 + 1;

-  UNLOCK();

-  swprintf_s((wchar_t *)(unaff_RBP + 0x18),0x1e,L"REMOTE-%u");

-  lVar8 = -1;

-  do {

-    lVar8 = lVar8 + 1;

-  } while (*(short *)(unaff_RBP + 0x18 + lVar8 * 2) != (short)unaff_RBX);

-  iVar7 = (int)unaff_RBX;

-  uVar10 = (int)lVar8 + 1;

-  PFFMEMOBJ::PFFMEMOBJ

-            ((PFFMEMOBJ *)(unaff_RBP + -0x50),uVar5,(ushort *)(unaff_RBP + 0x18),uVar10,unaff_R14D,

-             unaff_R13,*(ulong *)(unaff_RBP + -0x80),*(__uint64 *)(unaff_RBP + -0x68),

-             *(HDEV__ **)(unaff_RBP + -0x70),(DHPDEV__ *)unaff_RBX,*(PFT **)unaff_R12,0x20,0x20,

-             (FNTCHECKSUM *)(unaff_RBP + -0x38),*(FONTFILEVIEW ***)(unaff_RBP + -0x20),

-             *(_UNIVERSAL_FONT_ID **)(unaff_RBP + -0x78),iVar7);

-  pPVar2 = *(PFF **)(unaff_RBP + -0x50);

-  if (pPVar2 != (PFF *)0x0) {

-    p_Var3 = *(_UNIVERSAL_FONT_ID **)(unaff_RBP + -0x78);

-    *(_EUDCLOAD **)(unaff_RBP + -0x28) = unaff_RBX;

-    **(int **)(unaff_RBP + -0x58) = iVar7;

-    iVar6 = PFFMEMOBJ::bLoadFontFileTable

-                      ((PFFMEMOBJ *)(unaff_RBP + -0x50),(ushort *)(unaff_RBP + 0x18),uVar5,p_Var3,

-                       unaff_RBX);

-    if (iVar6 != 0) {

-      lVar8 = W32GetSessionState();

-      SEMOBJ<17>::SEMOBJ<17>

-                ((SEMOBJ<17> *)(unaff_RBP + -0x58),(GLOBALS *)(*(longlong *)(lVar8 + 0x60) + 0x1308)

-                );

-      iVar6 = Feature_127922488__private_IsEnabledDeviceUsageNoInline();

-      if (iVar6 == 0) {

-        iVar6 = PFFOBJ::bAddHash((PFFOBJ *)(unaff_RBP + -0x50),0);

-        if (iVar6 == 0) goto LAB_1;

-        *(_EUDCLOAD **)(unaff_RBP + -0x78) = unaff_RBX;

-        pPVar9 = PUBLIC_PFTOBJ::pPFFGet

-                           (unaff_R12,(ushort *)(unaff_RBP + 0x18),uVar10,unaff_R14D,unaff_R13,

-                            *(ulong *)(unaff_RBP + -0x80),(PFF ***)(unaff_RBP + -0x78),iVar7);

-        if (pPVar9 == (PFF *)0x0) {

-          iVar7 = XDCOBJ::bAddRemoteFont(*(XDCOBJ **)(unaff_RBP + -0x30),pPVar2);

-          if (iVar7 != 0) goto LAB_2;

-        }

-      }

-      else {

-        iVar6 = PFFOBJ::bAddHash((PFFOBJ *)(unaff_RBP + -0x50),0);

-        if (iVar6 != 0) {

-          *(_EUDCLOAD **)(unaff_RBP + -0x78) = unaff_RBX;

-          pPVar9 = PUBLIC_PFTOBJ::pPFFGet

-                             (unaff_R12,(ushort *)(unaff_RBP + 0x18),uVar10,unaff_R14D,unaff_R13,

-                              *(ulong *)(unaff_RBP + -0x80),(PFF ***)(unaff_RBP + -0x78),iVar7);

-          if (pPVar9 == (PFF *)0x0) {

-            iVar7 = XDCOBJ::bAddRemoteFont(*(XDCOBJ **)(unaff_RBP + -0x30),pPVar2);

-            if (iVar7 != 0) {

-LAB_2:

-              lVar8 = *(longlong *)unaff_R12;

-              if ((*(uint *)(pPVar2 + 0x34) & 0x200) == 0) {

-                piVar1 = (int *)(lVar8 + 0x20);

-                *piVar1 = *piVar1 + 1;

-              }

-              piVar1 = (int *)(lVar8 + 0x1c);

-              *piVar1 = *piVar1 + 1;

-              plVar4 = *(longlong **)(unaff_RBP + -0x78);

-              if (*plVar4 != 0) {

-                *(PFF **)(*plVar4 + 0x10) = pPVar2;

-              }

-              *(longlong *)(pPVar2 + 8) = *plVar4;

-              *(_EUDCLOAD **)(pPVar2 + 0x10) = unaff_RBX;

-              *plVar4 = (longlong)pPVar2;

-              PFFMEMOBJ::vKeepIt((PFFMEMOBJ *)(unaff_RBP + -0x50));

-              unaff_RBX = (_EUDCLOAD *)0x1;

-              goto LAB_3;

-            }

-          }

-        }

-LAB_1:

-        PFFOBJ::vRemoveHash((PFFOBJ *)(unaff_RBP + -0x50));

-      }

-LAB_3:

-      SEMOBJ<17>::vUnlock((SEMOBJ<17> *)(unaff_RBP + -0x58));

-    }

+  local_28 = __security_cookie ^ (ulonglong)auStackY_b8;

+  local_54 = *(undefined4 *)(param_2 + 0x20);

+  local_50 = *(undefined4 *)(param_2 + 0x24);

+  p_Var3 = param_2 + 0x68;

+  local_4c = 0;

+  if (param_2 == (_SURFOBJ *)0x0) {

+    p_Var3 = (_SURFOBJ *)&DAT_0;

   }

-  PFFMEMOBJ::~PFFMEMOBJ((PFFMEMOBJ *)(unaff_RBP + -0x50));

-LAB_0:

-  AutoResource<&void___cdecl_Win32FreePool(void*___ptr64)>::

-  ~AutoResource<&void___cdecl_Win32FreePool(void*___ptr64)>

-            ((AutoResource<&void___cdecl_Win32FreePool(void*___ptr64)> *)(unaff_RBP + -0x28));

-  return (int)unaff_RBX;

+  local_3c = 0;

+  if (*(undefined8 **)p_Var3 == (undefined8 *)0x0) {

+    local_48 = 0;

+  }

+  else {

+    local_48 = **(undefined8 **)p_Var3;

+  }

+  p_Var3 = param_2 + 0x58;

+  if (param_2 == (_SURFOBJ *)0x0) {

+    p_Var3 = (_SURFOBJ *)&DAT_1;

+  }

+  local_58 = *(int *)(param_2 + 0x48);

+  local_40 = *(uint *)p_Var3 & 0x40000;

+  if (local_58 == 7) {

+    local_58 = 2;

+  }

+  else if (local_58 == 8) {

+    local_58 = 3;

+  }

+  iVar1 = SURFMEM::bCreateDIB(param_1,(_DEVBITMAPINFO *)&local_58,(void *)0x0,(void *)0x0,0,

+                              (void *)0x0,0,0,1,0,0);

+  if (iVar1 == 0) {

+    uVar2 = 0;

+  }

+  else {

+    local_30 = *(undefined4 *)(param_2 + 0x20);

+    local_2c = *(undefined4 *)(param_2 + 0x24);

+    local_38 = 0;

+    pSVar4 = Gre::Base::Globals();

+    iVar1 = EngCopyBits(-(ulonglong)(*(longlong *)param_1 != 0) & *(longlong *)param_1 + 0x18U,

+                        param_2,0,pSVar4 + 0x11c8);

+    uVar2 = (uint)(iVar1 != 0);

+  }

+  return uVar2;

 }
```

## `CreateScreenBitmap`  (modified)

```diff
--- CreateScreenBitmap
+++ xxxDIBtoBMP
@@ -1,26 +1,66 @@
 

-/* struct HBITMAP__ * __ptr64 __cdecl CreateScreenBitmap(int,int,unsigned int) */

+/* struct HBITMAP__ * __ptr64 __cdecl xxxDIBtoBMP(struct tagBITMAPINFOHEADER * __ptr64,struct

+   HPALETTE__ * __ptr64,unsigned long) */

 

-HBITMAP__ * __cdecl CreateScreenBitmap(int param_1,int param_2,uint param_3)

+HBITMAP__ * __cdecl xxxDIBtoBMP(tagBITMAPINFOHEADER *param_1,HPALETTE__ *param_2,ulong param_3)

 

 {

-  HBITMAP__ *pHVar1;

-  longlong lVar2;

-  undefined4 in_register_0000000c;

-  undefined4 in_register_00000014;

+  int iVar1;

+  ulong uVar2;

+  uint uVar3;

+  longlong lVar4;

+  HDC hdc;

+  HBITMAP__ *pHVar5;

+  undefined8 uVar6;

+  HPALETTE hPal;

+  uint uVar7;

+  ushort uVar8;

   

-  if (param_3 == 1) {

-    pHVar1 = (HBITMAP__ *)

-             GreCreateBitmap(CONCAT44(in_register_0000000c,param_1),

-                             CONCAT44(in_register_00000014,param_2),1,1,0);

+  iVar1 = Feature_3145181496__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar1 == 0) ||

+     ((3 < param_3 &&

+      (((uVar7 = *(uint *)param_1, uVar7 == 0xc || (0x27 < uVar7)) && (uVar7 <= param_3)))))) {

+    uVar7 = *(uint *)param_1;

+    uVar2 = GreGetBitmapSizeInternal((tagBITMAPINFO *)param_1,0,uVar7);

+    if ((((uVar2 != 0) && (uVar3 = GreGetBitmapBitsSize(param_1), uVar3 != 0)) &&

+        (uVar3 <= uVar3 + uVar2)) && (uVar3 + uVar2 <= param_3)) {

+      if (uVar7 == 0x28) {

+        uVar7 = *(uint *)(param_1 + 4);

+        uVar3 = *(uint *)(param_1 + 8);

+        uVar8 = *(ushort *)(param_1 + 0xe);

+      }

+      else {

+        if (uVar7 != 0xc) {

+          return (HBITMAP__ *)0x0;

+        }

+        uVar7 = (uint)*(ushort *)(param_1 + 4);

+        uVar3 = (uint)*(ushort *)(param_1 + 6);

+        uVar8 = *(ushort *)(param_1 + 10);

+      }

+      lVar4 = W32GetUserSessionState();

+      hdc = (HDC)GreCreateCompatibleDC(*(undefined8 *)(*(longlong *)(lVar4 + 0xdf10) + 0x40));

+      if (hdc != (HDC)0x0) {

+        pHVar5 = CreateScreenBitmap(uVar7,uVar3,(uint)uVar8);

+        if (pHVar5 != (HBITMAP__ *)0x0) {

+          hPal = (HPALETTE)0x0;

+          uVar6 = GreSelectBitmap(hdc,pHVar5);

+          if (param_2 != (HPALETTE__ *)0x0) {

+            hPal = _SelectPalette(hdc,param_2,0);

+            xxxRealizePalette(hdc);

+          }

+          GreSetDIBits(hdc,pHVar5);

+          if (hPal != (HPALETTE)0x0) {

+            _SelectPalette(hdc,hPal,0);

+            xxxRealizePalette(hdc);

+          }

+          GreSelectBitmap(hdc,uVar6);

+        }

+        GreDeleteDC(hdc);

+        return pHVar5;

+      }

+      return (HBITMAP__ *)0x0;

+    }

   }

-  else {

-    lVar2 = W32GetUserSessionState();

-    pHVar1 = (HBITMAP__ *)

-             GreCreateCompatibleBitmapEx

-                       (*(undefined8 *)(*(longlong *)(lVar2 + 0xdf10) + 0x40),param_1,param_2,0,0,0)

-    ;

-  }

-  return pHVar1;

+  return (HBITMAP__ *)0x0;

 }
```

## `xxxScanSysQueue`  (modified)

```diff
--- xxxScanSysQueue
+++ xxxScanSysQueue
@@ -1,2331 +1,2633 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* WARNING: Variable defined which should be unmapped: param_6 */

-/* WARNING: Variable defined which should be unmapped: param_7 */

-/* WARNING: Variable defined which should be unmapped: param_5 */

-/* WARNING: Removing unreachable block (ram,0x00014027522b) */

-/* WARNING: Removing unreachable block (ram,0x000140275244) */

-/* WARNING: Removing unreachable block (ram,0x00014027524c) */

-/* WARNING: Removing unreachable block (ram,0x0001402761f2) */

 /* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

+/* enum _SCANSYSQUEUERESULT __cdecl xxxScanSysQueue(struct tagTHREADINFO * __ptr64,struct tagMSG *

+   __ptr64,struct tagWND * __ptr64,unsigned int,unsigned int,unsigned long,unsigned long,struct

+   tagQMSG * __ptr64 * __ptr64) */

 

 _SCANSYSQUEUERESULT __cdecl

 xxxScanSysQueue(tagTHREADINFO *param_1,tagMSG *param_2,tagWND *param_3,uint param_4,uint param_5,

                ulong param_6,ulong param_7,tagQMSG **param_8)

 

 {

-  tagWND *ptVar1;

-  uint *puVar2;

-  tagMENUSTATE *ptVar3;

-  ulonglong *puVar4;

-  undefined7 uVar5;

+  uint *puVar1;

+  undefined8 uVar2;

+  _W32THREAD *p_Var3;

+  tagMENUSTATE *ptVar4;

+  ulonglong *puVar5;

   undefined8 uVar6;

   undefined8 uVar7;

   undefined8 uVar8;

   undefined8 uVar9;

   undefined8 uVar10;

   undefined8 uVar11;

   undefined8 uVar12;

   undefined8 uVar13;

   undefined8 uVar14;

   undefined8 uVar15;

   undefined8 uVar16;

-  undefined8 uVar17;

-  POINT PVar18;

-  char cVar19;

-  int iVar20;

-  int iVar21;

-  long lVar22;

-  uint uVar23;

+  POINT pt;

+  tagPOINT pt_00;

+  _W32THREAD *p_Var17;

+  _W32THREAD *p_Var18;

+  tagMSG *ptVar19;

+  bool bVar20;

+  char cVar21;

+  int iVar22;

+  long lVar23;

   ulong uVar24;

   BOOL BVar25;

-  tagINPUTMESSAGE_RETRIEVE_RETVAL tVar26;

-  tagPOINT tVar27;

-  longlong lVar28;

-  undefined8 *puVar29;

-  ulonglong uVar30;

+  int iVar26;

+  uint uVar27;

+  tagINPUTMESSAGE_RETRIEVE_RETVAL tVar28;

+  _SCANSYSQUEUERESULT _Var29;

+  void *pvVar30;

   tagQMSG *ptVar31;

   HWND__ *pHVar32;

   tagWND *ptVar33;

-  tagPOINT tVar34;

-  tagTHREADINFO *ptVar35;

+  tagTHREADINFO *ptVar34;

+  tagQMSG *ptVar35;

   __uint64 _Var36;

-  tagPOINT tVar37;

-  longlong lVar38;

-  SsqResult SVar39;

-  ushort uVar40;

-  byte bVar41;

-  byte bVar42;

-  tagPOINT unaff_RSI;

-  tagPOINT unaff_RDI;

-  undefined **ppuVar45;

-  tagDESKTOP *ptVar46;

-  WindowHitTestOption WVar47;

-  byte unaff_R12B;

-  uint uVar48;

-  uint unaff_R13D;

-  tagPOINT unaff_R14;

-  byte bVar49;

-  uint uVar50;

-  tagPOINT unaff_R15;

-  bool bVar51;

-  undefined4 extraout_XMM0_Da;

-  undefined4 uVar52;

-  undefined4 extraout_XMM0_Da_00;

-  undefined4 extraout_XMM0_Da_01;

-  undefined4 extraout_XMM0_Da_02;

-  uint uVar53;

-  uint uVar54;

-  uint uVar55;

+  tagQMSG *ptVar37;

+  undefined1 *puVar38;

+  longlong lVar39;

+  _HEAD *p_Var40;

+  longlong lVar41;

+  SsqResult SVar42;

+  ushort uVar44;

+  undefined8 *puVar43;

+  byte bVar45;

+  byte bVar46;

+  uint uVar47;

+  byte bVar48;

+  uint uVar49;

+  ulonglong uVar50;

+  undefined **ppuVar51;

+  tagPOINT *ptVar52;

+  tagDESKTOP *ptVar53;

+  tagQMSG *ptVar54;

+  WindowHitTestOption WVar55;

   uint uVar56;

   uint uVar57;

-  uint uVar58;

-  uint uVar59;

+  _W32THREAD *p_Var58;

+  bool bVar59;

+  undefined4 extraout_XMM0_Da;

   uint uVar60;

   uint uVar61;

   uint uVar62;

   uint uVar63;

   uint uVar64;

   uint uVar65;

   uint uVar66;

   uint uVar67;

   uint uVar68;

-  tagPOINT in_stack_00000020;

-  LONG LVar69;

-  uint in_stack_00000070;

-  uint in_stack_00000080;

-  uint in_stack_00000084;

-  uint in_stack_00000088;

-  byte in_stack_0000008c;

-  undefined2 uStack0000000000000090;

-  undefined2 uStack0000000000000094;

-  LONG LStack0000000000000098;

-  LONG LStack000000000000009c;

-  tagPOINT in_stack_000000a0;

-  uint in_stack_000000a8;

-  uint in_stack_000000ac;

-  uint in_stack_000000b0;

-  uint in_stack_000000b4;

-  tagPOINT in_stack_000000b8;

-  undefined1 in_stack_000000c0;

-  undefined1 in_stack_000000c1;

-  uint in_stack_000000c4;

-  uint in_stack_000000c8;

-  uint in_stack_000000cc;

-  uint in_stack_000000d0;

-  tagPOINT in_stack_000000d8;

-  tagPOINT in_stack_000000e0;

-  tagPOINT in_stack_000000e8;

-  _W32THREAD *in_stack_000000f0;

-  undefined8 in_stack_000000f8;

-  uint in_stack_00000100;

-  uint in_stack_00000104;

-  tagPOINT in_stack_00000108;

-  undefined8 uVar70;

-  undefined8 uStack0000000000000118;

-  tagPOINT in_stack_00000120;

-  tagPOINT in_stack_00000138;

-  uint in_stack_00000140;

-  longlong in_stack_00000148;

-  longlong in_stack_00000168;

-  uint in_stack_00000170;

-  tagPOINT *in_stack_00000190;

-  longlong in_stack_00000198;

-  int in_stack_000001e0;

-  int in_stack_000001e4;

-  int in_stack_000001e8;

-  int in_stack_000001ec;

-  undefined4 in_stack_000001f4;

-  tagPOINT in_stack_000001f8;

-  tagPOINT in_stack_00000200;

-  undefined4 *in_stack_00000208;

-  WindowHitTestOption in_stack_00000210;

-  byte in_stack_00000214;

-  undefined2 in_stack_00000215;

-  undefined1 in_stack_00000217;

-  undefined8 uVar71;

-  undefined8 uVar72;

-  uint in_stack_00000478;

-  uint in_stack_0000047c;

-  uint in_stack_00000480;

-  uint in_stack_00000484;

-  uint in_stack_00000488;

-  uint in_stack_0000048c;

-  uint in_stack_00000490;

-  uint in_stack_00000494;

-  uint in_stack_00000498;

-  uint in_stack_0000049c;

-  uint in_stack_000004a0;

-  uint in_stack_000004a4;

-  uint in_stack_000004a8;

-  uint in_stack_000004ac;

-  uint in_stack_000004b0;

-  uint in_stack_000004b4;

-  undefined8 in_stack_000004b8;

-  undefined8 in_stack_000004c0;

-  undefined8 in_stack_000004c8;

-  undefined8 in_stack_000004d0;

-  longlong in_stack_000004e8;

-  HWND__ *in_stack_000004f0;

-  uint in_stack_000004f8;

+  uint uVar69;

+  uint uVar70;

+  uint uVar71;

+  uint uVar72;

   uint uVar73;

-  tagPOINT in_stack_00000500;

-  tagPOINT in_stack_00000508;

-  uint in_stack_00000510;

-  LONG in_stack_00000514;

-  LONG in_stack_00000518;

-  undefined8 in_stack_00000528;

-  tagPOINT in_stack_00000530;

-  ulonglong in_stack_00000540;

-  tagPOINT in_stack_00000548;

-  undefined8 in_stack_00000558;

-  int in_stack_00000560;

-  int in_stack_00000588;

   uint uVar74;

-  longlong in_stack_00000678;

-  HWND__ *in_stack_00000680;

-  uint in_stack_00000688;

-  tagPOINT in_stack_00000690;

-  tagPOINT in_stack_00000698;

-  undefined8 in_stack_000006a0;

-  LONG in_stack_000006a8;

-  undefined8 in_stack_000006b8;

-  tagPOINT in_stack_000006c0;

-  ulonglong in_stack_000006d0;

-  tagPOINT in_stack_000006d8;

-  undefined8 in_stack_000006e8;

-  int in_stack_000006f0;

-  int in_stack_00000718;

-  longlong in_stack_00000728;

-  HWND__ *in_stack_00000730;

-  uint in_stack_00000738;

-  tagPOINT in_stack_00000740;

-  tagPOINT in_stack_00000748;

-  undefined8 in_stack_00000750;

-  LONG in_stack_00000758;

-  undefined8 in_stack_00000768;

-  tagPOINT in_stack_00000770;

-  ulonglong in_stack_00000780;

-  tagPOINT in_stack_00000788;

-  undefined8 in_stack_00000798;

-  int in_stack_000007a0;

-  int in_stack_000007c8;

-  undefined4 in_stack_000007e8;

-  uint in_stack_00000a40;

-  int in_stack_00000a50;

-  short sVar43;

-  uint uVar44;

+  undefined1 auStackY_a18 [32];

+  uint local_9a8;

+  _HEAD *local_9a0;

+  uint local_998;

+  int local_994;

+  uint local_990;

+  undefined1 local_98c;

+  tagPOINT local_988;

+  tagPOINT *local_980;

+  undefined1 *local_978;

+  uint local_970;

+  uint local_96c;

+  int local_968;

+  uint local_964;

+  _W32THREAD *local_960;

+  undefined1 local_958;

+  undefined1 local_957;

+  CManageInScanSysQueueBit local_956 [2];

+  uint local_954;

+  int local_950;

+  ulong local_94c;

+  ulong local_948;

+  tagQMSG *local_940;

+  tagQMSG *local_938;

+  tagQMSG **local_930;

+  _W32THREAD *local_928;

+  tagWND *local_920;

+  int local_918;

+  uint local_914;

+  _W32THREAD *local_910;

+  ulonglong local_908;

+  undefined8 uStack_900;

+  _W32THREAD *local_8f8;

+  uint local_8f0;

+  tagTHREADINFO *local_8e8;

+  _W32THREAD *local_8e0;

+  uint local_8d8;

+  undefined4 local_8d4;

+  tagTHREADINFO *local_8d0;

+  Win32HMOptionalThreadLock<tagWND> local_8c8 [16];

+  tagMSG *local_8b8;

+  tagTHREADINFO *local_8b0;

+  uint local_8a8;

+  tagMSG *local_888;

+  longlong local_880;

+  tagTHREADINFO *local_878;

+  tagWND *local_870;

+  MenuStateOwnerLockxxxUnlock local_868 [8];

+  undefined8 local_860;

+  longlong *local_858;

+  Win32RawLockedW32Thread *local_850;

+  undefined8 *local_848;

+  Win32HMOptionalThreadLock<tagWND> *local_840;

+  RECT local_838;

+  uint local_828 [2];

+  undefined1 *local_820;

+  tagPOINT *local_818;

+  uint *local_810;

+  WindowHitTestOption local_808;

+  undefined1 local_804;

+  undefined2 local_803;

+  undefined1 local_801;

+  undefined8 *local_800;

+  char local_7f8;

+  undefined4 local_7f7;

+  undefined2 local_7f3;

+  undefined1 local_7f1;

+  undefined8 local_7f0;

+  undefined8 local_7e8;

+  tagPOINT *local_7e0;

+  ulonglong local_7d8;

+  undefined8 uStack_7d0;

+  Win32HMOptionalThreadLockAlways<tagMENU> local_7b8 [16];

+  Win32HMOptionalThreadLock<tagWND> local_7a8 [16];

+  Win32RawOptionalLockedItem<tagQMSG,0> local_798 [24];

+  Win32RawLockedW32Thread local_780 [24];

+  Win32RawLockedW32Thread local_768 [24];

+  Win32RawOptionalLockedItem<tagQMSG,0> local_750 [24];

+  undefined8 local_738;

+  undefined8 uStack_730;

+  Win32RawLockedW32Thread local_728 [24];

+  Win32RawLockedW32Thread local_710 [24];

+  Win32RawLockedW32Thread local_6f8 [24];

+  Win32RawLockedW32Thread local_6e0 [24];

+  uint local_6c8;

+  uint uStack_6c4;

+  uint uStack_6c0;

+  uint uStack_6bc;

+  uint local_6b8;

+  uint uStack_6b4;

+  uint uStack_6b0;

+  uint uStack_6ac;

+  uint local_6a8;

+  uint uStack_6a4;

+  uint uStack_6a0;

+  uint uStack_69c;

+  uint local_698;

+  uint uStack_694;

+  uint uStack_690;

+  uint uStack_68c;

+  ulonglong local_688;

+  undefined8 uStack_680;

+  undefined8 local_678;

+  undefined8 uStack_670;

+  Win32HMThreadLockBase<tagMENU,0,0> local_650 [16];

+  Win32HMOptionalThreadLock<tagWND> local_640 [16];

+  Win32HMThreadLockBase<tagWND,1,0> local_630 [16];

+  Win32HMThreadLockAlways<tagHOOK> local_620 [24];

+  undefined8 local_608;

+  undefined8 local_600;

+  undefined8 local_5f8;

+  undefined8 uStack_5f0;

+  undefined8 local_5e8;

+  undefined8 uStack_5e0;

+  undefined8 local_5d8;

+  undefined8 local_5d0;

+  ulonglong local_5c8;

+  undefined8 local_5c0;

+  undefined8 uStack_5b8;

+  undefined8 local_5b0;

+  uint local_5a0;

+  uint uStack_59c;

+  uint uStack_598;

+  uint uStack_594;

+  uint local_590;

+  uint uStack_58c;

+  uint uStack_588;

+  uint uStack_584;

+  uint local_580;

+  uint uStack_57c;

+  uint uStack_578;

+  uint uStack_574;

+  uint local_570;

+  uint uStack_56c;

+  uint uStack_568;

+  uint uStack_564;

+  ulonglong local_560;

+  undefined8 uStack_558;

+  undefined8 local_550;

+  undefined8 uStack_548;

+  undefined8 local_538;

+  longlong lStack_530;

+  HWND__ *local_528;

+  ulonglong uStack_520;

+  undefined1 *local_518;

+  tagPOINT *ptStack_510;

+  uint local_508;

+  LONG LStack_504;

+  LONG LStack_500;

+  undefined4 uStack_4fc;

+  undefined8 local_4f8;

+  undefined8 uStack_4f0;

+  tagPOINT local_4e8;

+  undefined8 uStack_4e0;

+  undefined8 local_4d8;

+  tagTHREADINFO *ptStack_4d0;

+  undefined8 local_4c8;

+  undefined8 uStack_4c0;

+  undefined8 local_4b8;

+  undefined8 uStack_4b0;

+  undefined8 local_4a8;

+  undefined8 uStack_4a0;

+  undefined8 local_498;

+  undefined8 uStack_490;

+  tagPOINT local_488;

+  undefined8 uStack_480;

+  ulonglong local_478;

+  undefined8 uStack_470;

+  undefined8 local_468;

+  undefined8 local_458;

+  longlong lStack_450;

+  HWND__ *local_448;

+  ulonglong uStack_440;

+  undefined1 *local_438;

+  tagPOINT *ptStack_430;

+  undefined8 local_428;

+  undefined8 uStack_420;

+  undefined8 local_418;

+  undefined8 uStack_410;

+  tagPOINT local_408;

+  undefined8 uStack_400;

+  ulonglong local_3f8;

+  tagTHREADINFO *ptStack_3f0;

+  undefined8 local_3e8;

+  undefined8 uStack_3e0;

+  undefined8 local_3d8;

+  undefined8 uStack_3d0;

+  undefined4 local_3c8;

+  undefined4 uStack_3c4;

+  undefined4 uStack_3c0;

+  undefined4 uStack_3bc;

+  undefined4 local_3b8;

+  undefined4 uStack_3b4;

+  undefined4 uStack_3b0;

+  undefined4 uStack_3ac;

+  undefined8 local_3a8;

+  longlong lStack_3a0;

+  HWND__ *local_398;

+  int iStack_390;

+  undefined4 uStack_38c;

+  undefined1 *local_388;

+  tagPOINT *ptStack_380;

+  undefined8 local_378;

+  undefined8 uStack_370;

+  undefined8 local_368;

+  undefined8 uStack_360;

+  tagPOINT local_358;

+  undefined8 uStack_350;

+  ulonglong local_348;

+  tagTHREADINFO *ptStack_340;

+  undefined8 local_338;

+  undefined8 uStack_330;

+  undefined8 uStack_328;

+  undefined8 uStack_320;

+  undefined4 uStack_318;

+  undefined4 uStack_314;

+  undefined4 uStack_310;

+  undefined4 uStack_30c;

+  undefined4 uStack_308;

+  undefined4 uStack_304;

+  undefined4 uStack_300;

+  undefined4 uStack_2fc;

+  undefined8 local_2f8;

+  longlong lStack_2f0;

+  HWND__ *local_2e8;

+  ulonglong uStack_2e0;

+  undefined1 *local_2d8;

+  tagPOINT *ptStack_2d0;

+  undefined8 local_2c8;

+  undefined8 uStack_2c0;

+  undefined8 local_2b8;

+  undefined8 uStack_2b0;

+  tagPOINT local_2a8;

+  undefined8 uStack_2a0;

+  ulonglong local_298;

+  tagTHREADINFO *ptStack_290;

+  undefined8 local_288;

+  undefined8 uStack_280;

+  undefined8 local_278;

+  undefined8 uStack_270;

+  undefined8 local_268;

+  undefined8 uStack_260;

+  undefined8 local_258;

+  undefined8 uStack_250;

+  tagQMSG local_248 [24];

+  undefined4 local_230;

+  undefined8 local_198;

+  undefined8 uStack_190;

+  undefined8 local_188;

+  undefined8 uStack_180;

+  undefined8 local_178;

+  undefined8 uStack_170;

+  undefined8 local_168;

+  undefined8 uStack_160;

+  undefined8 local_158;

+  undefined8 uStack_150;

+  undefined8 local_148;

+  undefined8 uStack_140;

+  undefined8 local_138;

+  undefined8 uStack_130;

+  undefined8 local_128;

+  undefined8 uStack_120;

+  undefined8 local_118;

+  undefined8 uStack_110;

+  undefined4 local_108;

+  undefined4 uStack_104;

+  undefined4 uStack_100;

+  undefined4 uStack_fc;

+  undefined4 local_f8;

+  undefined4 uStack_f4;

+  undefined4 uStack_f0;

+  undefined4 uStack_ec;

+  ulonglong local_e8;

   

-  lVar28 = W32GetUserSessionState();

-code_r0x000140274762:

-  sVar43 = (short)unaff_RSI.x;

-  bVar42 = (byte)unaff_RSI.x;

-  uVar44 = unaff_RSI.x;

-  uVar5 = unaff_RSI._1_7_;

-  if ((*(int *)(lVar28 + 0x396c) != 0) &&

-     (lVar28 = W32GetUserSessionState(), (*(byte *)(lVar28 + 0x3968) & unaff_R12B) != 0))

-  goto LAB_0;

-  bVar49 = *(byte *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x17c);

-  uVar23 = in_stack_000000a0.x | unaff_R13D;

-  if ((bVar49 & 0x10) == 0) {

-    uVar23 = in_stack_000000a0.x;

+  local_e8 = __security_cookie ^ (ulonglong)auStackY_a18;

+  local_930 = param_8;

+  local_964 = param_4;

+  local_920 = param_3;

+  local_8f0 = param_4;

+  local_8e8 = param_1;

+  local_8d0 = param_1;

+  local_8b8 = param_2;

+  local_8b0 = param_1;

+  local_888 = param_2;

+  local_878 = param_1;

+  local_870 = param_3;

+  memset(&local_538,0,0xb0);

+  memset(&local_458,0,0xb0);

+  ptVar37 = (tagQMSG *)0x0;

+  local_978 = (undefined1 *)0x0;

+  local_980 = (tagPOINT *)0x0;

+  local_988.x = 0;

+  local_988.y = 0;

+  local_970 = 0;

+  local_96c = 0;

+  local_488.x = 0;

+  local_488.y = 0;

+  uStack_480 = 0;

+  local_478 = 0;

+  uStack_470 = 0;

+  local_468 = 0;

+  local_8d8 = 0;

+  uVar47 = param_6 & 1;

+  local_914 = 0;

+  local_998 = uVar47;

+  pvVar30 = memset(&local_6c8,0,0x60);

+  local_968 = 0;

+  bVar48 = 0;

+  local_990 = (uint)pvVar30 & 0xffffff00;

+  local_98c = 0;

+  local_940 = (tagQMSG *)0x0;

+  *param_8 = (tagQMSG *)0x0;

+  if ((param_7 == 0x2000) && (*(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x68) != 0)) {

+    EtwTraceInputQueueLockedPeekRecursion();

+LAB_0:

+    _Var29 = 0;

   }

-  uVar50 = uVar23 | 0x200;

-  if ((bVar49 & 4) == 0) {

-    uVar50 = uVar23;

-  }

-  uVar23 = uVar50 | 0x100;

-  if (((byte)unaff_R15.x & bVar49) == 0) {

-    uVar23 = uVar50;

-  }

-  puVar29 = (undefined8 *)HotKeyToWindow(uVar23);

-  if (puVar29 == (undefined8 *)0x0) goto LAB_0;

-  if (*(longlong *)((longlong)unaff_R14 + 0x1f0) != *(longlong *)(puVar29[2] + 0x1f0))

-  goto LAB_0;

-  in_stack_00000020.x = uVar44;

-  _PostTransformableMessage

-            (*(undefined8 *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x90),0x112,0xf150,

-             *puVar29,in_stack_00000020);

-LAB_1:

-  xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,unaff_R15.x);

-LAB_2:

-  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

-     (tVar34 = unaff_R15, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

-    tVar34 = unaff_RSI;

-  }

-  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-     (bVar49 = (byte)unaff_R15.x, *(short *)(WPP_GLOBAL_Control + 0x48) == sVar43)) {

-    bVar49 = bVar42;

-  }

-  if (((char)tVar34.x != '\0') || (bVar49 != 0)) {

-    lVar28 = W32GetUserSessionState();

-    in_stack_00000020.x._0_1_ = 5;

-    WPP_RECORDER_AND_TRACE_SF_qq

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(ulonglong)tVar34 & 0xff,bVar49,

-               *(undefined8 *)(lVar28 + 0x10f98),in_stack_00000020);

-  }

-  *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) = unaff_RSI;

-LAB_3:

-  unaff_R15.x = 1;

-  unaff_R15.y = 0;

-  ppuVar45._4_4_ = 0;

-  ppuVar45._0_4_ = in_stack_00000088;

-code_r0x000140273e4e:

-  in_stack_00000170 = **(uint **)((longlong)unaff_R14 + 0x208) >> 9 & unaff_R15.x;

-  uVar23 = uVar44;

-  bVar49 = bVar42;

-  uVar50 = uVar44;

-  if ((*(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) != unaff_RSI) &&

-     (uVar23 = in_stack_00000088, bVar49 = in_stack_0000008c, uVar50 = in_stack_000000b0,

-     (char)ppuVar45 == '\0')) {

-    uVar23 = (uint)ppuVar45 & 0xff;

-    if ((in_stack_000000b0 - 1 & 0xfffffffd) == 0) {

-      uVar23 = unaff_R15.x;

+  else {

+    uVar49 = 0;

+    local_918 = 0;

+    local_950 = 0;

+    local_994 = 0;

+    if (*(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x58) == 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

+         (bVar45 = 1, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+        bVar45 = bVar48;

+      }

+      bVar59 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((bVar45 != 0) || (bVar59)) {

+        W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_qqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar45,bVar59);

+      }

+      *(tagTHREADINFO **)(*(longlong *)(param_1 + 0x1d8) + 0x58) = param_1;

+      **(uint **)(param_1 + 0x1e8) = **(uint **)(param_1 + 0x1e8) | 1;

+      uVar47 = local_998;

     }

-    bVar49 = (byte)uVar23;

-  }

-  in_stack_000000b0 = uVar50;

-  in_stack_0000008c = bVar49;

-  in_stack_00000088 = uVar23;

-  ppuVar45 = (undefined **)&stack0x000004e0;

-  in_stack_000000c4 = uVar44;

-  in_stack_000000cc = uVar44;

-  in_stack_000000d0 = uVar44;

-  unaff_RDI = (tagPOINT)

-              xxxGetNextSysMsg((tagTHREADINFO *)unaff_R14,

-                               *(tagQMSG **)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68),

-                               (tagQMSG *)ppuVar45);

-  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

-     (tVar34 = unaff_R15, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

-    tVar34 = unaff_RSI;

-  }

-  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-     (*(short *)(WPP_GLOBAL_Control + 0x48) == sVar43)) {

-    unaff_R15 = (tagPOINT)((ulonglong)unaff_RSI & 0xff);

-  }

-  if (((char)tVar34.x != '\0') || ((char)unaff_R15.x != '\0')) {

-    lVar28 = W32GetUserSessionState();

-    in_stack_00000020.x._0_1_ = 5;

-    ppuVar45._0_1_ = (char)unaff_R15.x;

-    WPP_RECORDER_AND_TRACE_SF_qqq

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(ulonglong)tVar34 & 0xff,ppuVar45,

-               *(undefined8 *)(lVar28 + 0x10f98),in_stack_00000020);

-  }

-  *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) = unaff_RDI;

-  iVar21 = (int)in_stack_00000540;

-  uVar23 = (uint)(in_stack_00000540 >> 0x20);

-  if (unaff_RDI != (tagPOINT)0x0) {

-    if ((in_stack_00000540 & 0x2000000000) != 0) {

-      iVar20 = func_0x00014027883c();

-      if (iVar20 != 0) {

-        unaff_R15.x = 1;

-        unaff_R15.y = 0;

-        ppuVar45._4_4_ = 0;

-        ppuVar45._0_4_ = in_stack_00000088;

-        if ((in_stack_00000540 & 0x10000000000) != 0) goto code_r0x000140273e4e;

+    if ((param_7 & 0x1c07) != 0) {

+      if (uVar47 == 0) {

+        puVar1 = (uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214);

+        *puVar1 = *puVar1 | 0x400;

       }

-      *(tagPOINT *)in_stack_000000e8 = unaff_RDI;

-      *(uint *)((longlong)unaff_RDI + 100) = *(uint *)((longlong)unaff_RDI + 100) | 0x100;

-      in_stack_00000080 = uVar44;

-      if ((uVar23 >> 0x1b & 1) != 0) {

-        *(uint *)((longlong)*(tagPOINT *)in_stack_000000e8 + 100) =

-             *(uint *)((longlong)*(tagPOINT *)in_stack_000000e8 + 100) | 0x8000000;

+      else {

+        puVar1 = (uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214);

+        *puVar1 = *puVar1 & 0xfffffbff;

       }

     }

-    if ((uVar23 >> 0xd & 1) != 0) {

-      unaff_R15.x = 1;

-      unaff_R15.y = 0;

-      if (in_stack_00000548 == unaff_R14) {

-        in_stack_000000b0 = 1;

-      }

-      ppuVar45._0_1_ = 1;

-      in_stack_00000088 = (uint)ppuVar45;

-      in_stack_0000008c = 1;

-      goto code_r0x000140273e4e;

-    }

-    ppuVar45._4_4_ = 0;

-    ppuVar45._0_4_ = in_stack_00000088;

-    if ((uVar23 >> 0x10 & 1) == 0) {

-      if ((iVar21 == 4) && ((char)in_stack_00000088 != '\0')) {

-        DeferSysPeekMsg();

-        goto LAB_3;

-      }

-      if ((uVar23 >> 0xe & 1) == 0) {

-        iVar20 = ShouldDeferMessage(in_stack_000000b0,&stack0x000004e0);

-        if (iVar20 == 0) goto LAB_4;

-        DeferSysPeekMsg(extraout_XMM0_Da,3);

-        in_stack_000000b0 = 3;

-        goto LAB_3;

-      }

-      unaff_R15.x = 1;

-      unaff_R15.y = 0;

-      if (in_stack_00000548 == unaff_R14) {

-        in_stack_000000b0 = 2;

-      }

-      goto code_r0x000140273e4e;

-    }

-    unaff_R15.x = 1;

-    unaff_R15.y = 0;

-    if (in_stack_00000548 != unaff_R14) goto code_r0x000140273e4e;

-    in_stack_000000b0 = 3;

-    goto LAB_3;

-  }

-LAB_4:

-  if (*(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) == unaff_RSI) {

-    tVar34 = in_stack_000000b8;

-    if (in_stack_00000a50 == 0x2000) {

-      ClearWakeBit((tagTHREADINFO *)unaff_R14,0x2000,0);

-      tVar34 = in_stack_000000b8;

-    }

-LAB_5:

-    *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x60) = unaff_RSI;

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

-       (bVar49 = 1, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      bVar49 = bVar42;

-    }

-    bVar51 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((bVar49 != 0) || (bVar51)) {

-      lVar28 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_qqq

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar49,bVar51,

-                 *(undefined8 *)(lVar28 + 0x10f98),4);

-    }

-    *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x58) = unaff_RSI;

-    **(uint **)((longlong)unaff_R14 + 0x1e8) = **(uint **)((longlong)unaff_R14 + 0x1e8) & 0xfffffffe

-    ;

-    if (in_stack_00000138 == (tagPOINT)0x0) {

-      if (((tVar34 == (tagPOINT)0x0) && (in_stack_00000108 == (tagPOINT)0x0)) &&

-         ((in_stack_00000120 == (tagPOINT)0x0 && (in_stack_000000f0 == (_W32THREAD *)0x0)))) {

-        ClearWakeBit((tagTHREADINFO *)unaff_R14,0x7c07,1);

-        goto LAB_6;

-      }

-    }

-    else {

-      SetWakeBit(in_stack_00000138,0x4001);

-      ClearWakeBit((tagTHREADINFO *)unaff_R14,0x4001,0);

-    }

-    if (tVar34 != (tagPOINT)0x0) {

-      SetWakeBit(tVar34,0x4006);

-      ClearWakeBit((tagTHREADINFO *)unaff_R14,0x4006,0);

-    }

-    if (in_stack_00000120 != (tagPOINT)0x0) {

-      SetWakeBit(in_stack_00000120,0x4400);

-      ClearWakeBit((tagTHREADINFO *)unaff_R14,0x4400,0);

-    }

-    if (in_stack_000000f0 != (_W32THREAD *)0x0) {

-      SetWakeBit(in_stack_000000f0,0x5000);

-      ClearWakeBit((tagTHREADINFO *)unaff_R14,0x5000,0);

-    }

-    if (in_stack_00000108 != (tagPOINT)0x0) {

-      SetWakeBit(in_stack_00000108,0x2040);

-      ClearWakeBit((tagTHREADINFO *)unaff_R14,0x2000,0);

-    }

-    if (in_stack_00000198 != 0) {

-      LogInputQueueWakeTransfer();

-    }

-LAB_6:

-    CManageInScanSysQueueBit::~CManageInScanSysQueueBit

-              ((CManageInScanSysQueueBit *)&stack0x000000c2);

-    Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

-              ((Win32HMOptionalThreadLock<tagHOOK> *)&stack0x00000150);

-    Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

-              ((Win32HMOptionalThreadLock<tagHOOK> *)&stack0x00000270);

-    Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x000002f0);

-    Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x00000308);

-    Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x00000320);

-    Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x00000338);

-    Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x000002b0);

-    Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x00000298);

-    return 0;

-  }

-  Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

-            ((Win32HMThreadLockBase<tagMONITOR,1,1> *)&stack0x00000150);

-  unaff_R15.x = 1;

-  unaff_R15.y = 0;

-  tVar27 = (tagPOINT)HMValidateHandleNoSecure(in_stack_000004f0,1);

-  Win32HM_LockIntoThread<1>

-            ((tagTHREADINFO *)unaff_R14,(_HEAD *)tVar27,(_Win32HMThreadLockItem *)&stack0x00000150);

-  LVar69 = in_stack_00000020.y;

-  if (iVar21 != 0) {

-    if ((iVar21 == 4) &&

-       (ppuVar45._4_4_ = 0, ppuVar45._0_4_ = in_stack_00000088,

-       *(longlong *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) !=

-       *(longlong *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x28))) goto code_r0x000140273e4e;

-    if ((iVar21 == 9) && (lVar28 = in_stack_000004e8, in_stack_000004f8 == 0x60)) {

-      while ((lVar28 != 0 && (iVar21 = IsHiddenByInputService(), iVar21 != 0))) {

-        lVar28 = *(longlong *)(lVar28 + 8);

-      }

-      ppuVar45._4_4_ = 0;

-      ppuVar45._0_4_ = in_stack_00000088;

-      if (lVar28 != 0) goto code_r0x000140273e4e;

-    }

-    if ((in_stack_00000548 == (tagPOINT)0x0) || (in_stack_00000548 == unaff_R14)) {

-      EtwTraceRetrieveQueueEventMessage

-                (*(undefined8 *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68));

-      uVar52 = DelQEntry(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x28,

-                         *(undefined8 *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68),1);

-      if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0 ||

-          (bVar49 = 1, (byte)WPP_GLOBAL_Control[0x29] < 5)))) {

-        bVar49 = bVar42;

+    if (*(tagTHREADINFO **)(*(longlong *)(param_1 + 0x1d8) + 0x58) == param_1) {

+      local_960 = (_W32THREAD *)0x0;

+      local_8e0 = (_W32THREAD *)0x0;

+      local_910 = (_W32THREAD *)0x0;

+      local_8f8 = (_W32THREAD *)0x0;

+      local_928 = (_W32THREAD *)0x0;

+      Win32RawLockedW32Thread::Win32RawLockedW32Thread(local_780,(_W32THREAD *)0x0);

+      Win32RawLockedW32Thread::Win32RawLockedW32Thread(local_768,(_W32THREAD *)0x0);

+      Win32RawLockedW32Thread::Win32RawLockedW32Thread(local_6e0,(_W32THREAD *)0x0);

+      Win32RawLockedW32Thread::Win32RawLockedW32Thread(local_6f8,(_W32THREAD *)0x0);

+      Win32RawLockedW32Thread::Win32RawLockedW32Thread(local_710,(_W32THREAD *)0x0);

+      local_880 = 0;

+      Win32RawLockedW32Thread::Win32RawLockedW32Thread(local_728,(_W32THREAD *)0x0);

+      local_860 = 0;

+      Win32HMOptionalThreadLock<tagWND>::Win32HMOptionalThreadLock<tagWND>

+                (local_7a8,param_1,(tagWND *)0x0);

+      local_858 = &local_880;

+      local_850 = local_728;

+      local_848 = &local_860;

+      local_840 = local_7a8;

+      Win32HMOptionalThreadLock<tagWND>::Win32HMOptionalThreadLock<tagWND>

+                (local_8c8,param_1,(tagWND *)0x0);

+      CManageInScanSysQueueBit::CManageInScanSysQueueBit(local_956);

+LAB_1:

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

+         (ptVar31 = (tagQMSG *)0x1, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+        ptVar31 = ptVar37;

       }

       if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-         (*(short *)(WPP_GLOBAL_Control + 0x48) == sVar43)) {

-        unaff_R15 = (tagPOINT)((ulonglong)unaff_RSI & 0xff);

+         (bVar45 = 1, *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+        bVar45 = bVar48;

       }

-      if ((bVar49 != 0) || ((char)unaff_R15.x != '\0')) {

-        lVar28 = W32GetUserSessionState();

-        in_stack_00000020.x._0_1_ = 5;

-        uVar52 = WPP_RECORDER_AND_TRACE_SF_qq

-                           (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar49,unaff_R15,

-                            *(undefined8 *)(lVar28 + 0x10f98),in_stack_00000020);

+      if (((char)ptVar31 != '\0') || (bVar45 != 0)) {

+        W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_qq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),ptVar31,bVar45);

       }

-      *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) = unaff_RSI;

-      xxxProcessEventMessage(uVar52,&stack0x000004e0);

-      unaff_R15.x = 1;

-      unaff_R15.y = 0;

-      goto LAB_2;

-    }

-    if (*(longlong *)((longlong)in_stack_00000548 + 0x1d8) !=

-        *(longlong *)((longlong)unaff_R14 + 0x1d8)) {

-      CleanEventMessage(*(tagQMSG **)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68));

-      DelQEntry(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x28,

-                *(undefined8 *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68),1);

-      goto LAB_2;

-    }

-    Win32RawLockedW32Thread::Exchange

-              ((Win32RawLockedW32Thread *)&stack0x00000338,(_W32THREAD *)in_stack_00000548);

-    <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&stack0x000001c0,in_stack_00000548);

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

-       (bVar49 = 1, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

-      bVar49 = bVar42;

-    }

-    if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-       (*(short *)(WPP_GLOBAL_Control + 0x48) == sVar43)) {

-      unaff_R15 = (tagPOINT)((ulonglong)unaff_RSI & 0xff);

-    }

-    if ((bVar49 != 0) || ((char)unaff_R15.x != '\0')) {

-      lVar28 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_qq

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar49,unaff_R15,

-                 *(undefined8 *)(lVar28 + 0x10f98),5);

-    }

-    *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) = unaff_RSI;

-    tVar34 = in_stack_000000b8;

-    in_stack_00000108 = in_stack_00000548;

-    goto LAB_5;

-  }

-  ppuVar45._4_4_ = 0;

-  ppuVar45._0_4_ = in_stack_00000088;

-  if (in_stack_00000a50 == 0x2000) goto code_r0x000140273e4e;

-  uVar50 = in_stack_000000b4;

-  uVar23 = uVar44;

-  tVar34 = in_stack_000000b8;

-  in_stack_00000070 = in_stack_000004f8;

-  in_stack_000000a0 = unaff_RSI;

-  uVar73 = in_stack_000004f8;

-  if (0x24a < in_stack_000004f8) {

-    if (in_stack_000004f8 < 0x2ee) {

-      if (in_stack_000004f8 != 0x2ed) {

-        if (((in_stack_000004f8 == 0x251) || (in_stack_000004f8 == 0x252)) ||

-           (in_stack_000004f8 == 0x253)) goto LAB_7;

-        iVar21 = in_stack_000004f8 - 0x2e8;

-LAB_8:

-        if (((iVar21 != 0) && (iVar21 != 1)) && ((iVar21 != 2 && ((iVar21 != 3 && (iVar21 != 4))))))

-        goto LAB_9;

+      *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x68) = 0;

+LAB_2:

+      ppuVar51 = (undefined **)(ulonglong)local_990;

+code_r0x000140273e4e:

+      cVar21 = '\x01';

+      local_8a8 = **(uint **)(param_1 + 0x208) >> 9 & 1;

+      if (*(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x68) == 0) {

+        local_968 = 0;

+        local_990 = 0;

+        local_98c = 0;

       }

-    }

-    else if (((in_stack_000004f8 != 0x2ee) && (in_stack_000004f8 != 0x2ef)) &&

-            (in_stack_000004f8 != 0x2f0)) {

-      iVar21 = in_stack_000004f8 - 0x2f1;

-      goto LAB_8;

-    }

-    if ((in_stack_000000b4 != 0) || (in_stack_00000a40 != 0xffffffff)) {

-      if (in_stack_00000a40 < in_stack_000000b4) {

-        if ((in_stack_000004f8 < in_stack_00000a40) || (in_stack_000000b4 < in_stack_000004f8)) {

-          uVar23 = 1;

+      else if ((char)ppuVar51 == '\0') {

+        local_990 = (uint)ppuVar51 & 0xff;

+        if ((local_968 - 1U & 0xfffffffd) == 0) {

+          local_990 = 1;

         }

-        else {

-LAB_10:

-          uVar23 = uVar44;

-        }

+        local_98c = (undefined1)local_990;

       }

-      else if ((in_stack_000004f8 < in_stack_000000b4) ||

-              (uVar23 = 1, in_stack_00000a40 < in_stack_000004f8)) goto LAB_10;

-      if (uVar23 == 0) goto LAB_5;

-    }

-    iVar21 = IsInsideMenuLoop();

-    uVar53 = in_stack_00000084;

-    in_stack_000000a0 = unaff_RSI;

-    if (iVar21 == 0) {

-      if (in_stack_00000080 != uVar44) {

-        xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,1);

+      local_954 = 0;

+      local_978 = (undefined1 *)0x0;

+      local_94c = 0;

+      local_948 = 0;

+      ppuVar51 = (undefined **)&local_538;

+      ptVar31 = xxxGetNextSysMsg(param_1,*(tagQMSG **)(*(longlong *)(param_1 + 0x1d8) + 0x68),

+                                 (tagQMSG *)ppuVar51);

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

+         (ptVar35 = (tagQMSG *)0x1, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+        ptVar35 = ptVar37;

       }

-      if (tVar27 == unaff_RSI) {

-        tVar27 = *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x88);

+      if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+         (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+        cVar21 = '\0';

       }

-      _LStack0000000000000098 = in_stack_00000508;

-      tVar26 = xxxRetrieveInteractiveControlInputMessage

-                         (in_stack_00000500.x & 0xffff,in_stack_00000500._2_4_ & 0xffff);

-      in_stack_000000a0 = in_stack_00000500;

-      if (tVar26 == 1) goto LAB_11;

-      tVar34 = in_stack_000000b8;

-      uVar53 = in_stack_00000084;

-      if (tVar26 == 2) goto LAB_5;

-    }

-    goto LAB_12;

-  }

-  if (in_stack_000004f8 == 0x24a) {

-LAB_7:

-    unaff_R15.x = 1;

-    unaff_R15.y = 0;

-    iVar21 = (int)((ulonglong)in_stack_00000558 >> 0x20);

-    if (((iVar21 - 2U & 0xffffffcf) != 0) ||

-       (uVar53 = uVar73, tVar34 = in_stack_00000508, tVar37 = in_stack_00000500, iVar21 == 0x32)) {

-      EtwTraceBeginPointerMessageRetrieve(unaff_RDI,(ulonglong)in_stack_00000500 & 0xffff,uVar73);

-      in_stack_00000020.y = LVar69;

-      in_stack_00000020.x = 1;

-      tVar26 = xxxRetrievePointerInputMessage

-                         (*(undefined4 *)((longlong)unaff_RDI + 0xa0),in_stack_000000f8,uVar50,

-                          in_stack_00000a40,in_stack_00000020);

-      InputTraceLogging::Pointer::RetrieveMessage((tagQMSG *)&stack0x00000880,false,tVar26);

-      EtwTraceEndPointerMessageRetrieve(&stack0x00000880,(ulonglong)in_stack_00000500 & 0xffff);

-      if (tVar27 != (tagPOINT)0x0) {

-        Win32HM_ExchangeThreadLock<1>((_HEAD *)tVar27,(_Win32HMThreadLockItem *)&stack0x00000150);

+      local_938 = ptVar31;

+      if (((char)ptVar35 != '\0') || (cVar21 != '\0')) {

+        W32GetUserSessionState();

+        ptVar31 = local_938;

+        ppuVar51 = (undefined **)CONCAT71((int7)((ulonglong)ppuVar51 >> 8),cVar21);

+        WPP_RECORDER_AND_TRACE_SF_qqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),ptVar35);

       }

-      uVar53 = in_stack_00000070;

-      tVar34 = _LStack0000000000000098;

-      tVar37 = in_stack_000000a0;

-      if (tVar26 != 1) {

-        if (tVar26 == 2) {

-          tVar34 = in_stack_000000b8;

-          if (in_stack_000000a8 != uVar44) {

-            in_stack_000000f0 = *(_W32THREAD **)((longlong)tVar27 + 0x10);

-            Win32RawLockedW32Thread::Exchange

-                      ((Win32RawLockedW32Thread *)&stack0x00000308,in_stack_000000f0);

-            <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()

-                      (&stack0x000001c0,in_stack_000000f0);

-            tVar34 = in_stack_000000b8;

-          }

-          goto LAB_5;

-        }

-        in_stack_000004f8 = uVar73;

-        if (tVar26 == 3) {

-          xxxDefPointerProc();

-          *(tagPOINT *)in_stack_000000e8 = unaff_RSI;

-          uVar53 = in_stack_00000084;

-        }

-        else {

-          *(tagPOINT *)in_stack_000000e8 = unaff_RSI;

-          uVar53 = in_stack_00000084;

-          if (tVar26 == 4) goto LAB_3;

-        }

-LAB_12:

-        xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,unaff_R15.x);

-        uVar23 = in_stack_000000c8;

-        if ((in_stack_000000c8 != uVar44) &&

-           (uVar23 = uVar44,

-           ((*(uint *)(**(longlong **)((longlong)unaff_R14 + 0x1f8) + 0x10) |

-            *(uint *)((longlong)unaff_R14 + 0x2d0)) & 0x40) != 0)) {

-          xxxCallHook(6,(ulonglong)in_stack_00000070,(__int64)&stack0x00000590,5);

-        }

-        in_stack_000000c8 = uVar23;

-        uVar23 = in_stack_00000084;

-        if ((uVar53 != 0) &&

-           (uVar23 = uVar44,

-           ((*(uint *)(**(longlong **)((longlong)unaff_R14 + 0x1f8) + 0x10) |

-            *(uint *)((longlong)unaff_R14 + 0x2d0)) & 0x40) != 0)) {

-          xxxCallHook(7,(__uint64)in_stack_000000a0,(__int64)_LStack0000000000000098,5);

-        }

-        in_stack_00000084 = uVar23;

-        ppuVar45._4_4_ = 0;

-        ppuVar45._0_4_ = in_stack_00000088;

-        if (in_stack_00000080 != uVar44) goto LAB_2;

-        goto code_r0x000140273e4e;

-      }

-    }

-    in_stack_000000a0 = tVar37;

-    _LStack0000000000000098 = tVar34;

-    in_stack_00000070 = uVar53;

-    if (in_stack_00000080 != uVar44) {

-      tVar34 = unaff_R14;

-      iVar21 = IsMiPActive();

-      if ((iVar21 == 0) || (uVar23 == 0)) {

-        xxxSkipSysMsgEx((tagTHREADINFO *)tVar34,(tagQMSG *)&stack0x000004e0,1);

-      }

-      else {

-        tVar34 = unaff_RSI;

-        if (tVar27 != unaff_RSI) {

-          tVar34 = *(tagPOINT *)tVar27;

-        }

-        *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x600) + 0x30) = tVar34;

-        uVar50 = *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x600) + 0x24);

-        if (((uVar50 >> 0x16 & 1) != 0) && ((*(uint *)((longlong)tVar27 + 0x17c) & 0x40000000) == 0)

-           ) {

-          *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x600) + 0x24) = uVar50 & 0xffbfffff;

-        }

-        _Var36 = GetMiPWindowFlags((tagWND *)tVar27);

-        SetMiPWindowFlags((tagWND *)tVar27,_Var36 & 0xfffffffffffffffe);

-        if ((uVar73 - 0x242 & 0xfffffffb) == 0) {

-          uVar50 = uVar44;

-          if (uVar73 == 0x242) {

-            uVar50 = 8;

-          }

-          **(uint **)((longlong)unaff_R14 + 0x600) =

-               **(uint **)((longlong)unaff_R14 + 0x600) & 0xfffffff7 | uVar50;

-        }

-        else if ((uVar73 - 0x243 & 0xfffffffb) == 0) {

-          **(uint **)((longlong)unaff_R14 + 0x600) =

-               **(uint **)((longlong)unaff_R14 + 0x600) & 0xfffffff7;

-        }

-      }

-    }

-    iVar21 = IsPointerMessageTouchpad

-                       ((tagTHREADINFO *)unaff_R14,(__uint64)in_stack_00000508,(ushort)uVar23);

-    if (iVar21 != 0) {

-      if ((in_stack_00000080 == uVar44) &&

-         (bVar51 = ShouldReceiveTouchpadMessages((tagTHREADINFO *)unaff_R14,in_stack_000004f0),

-         !bVar51)) {

-        xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,1);

-      }

-      if ((int)CONCAT71(uVar5,in_stack_00000070 == 0x253) != 0) {

-        LStack0000000000000098 = -1;

-        LStack000000000000009c = -1;

-      }

-    }

-    goto LAB_11;

-  }

-  uVar53 = in_stack_00000084;

-  if (in_stack_000004f8 < 0x11c) {

-    if (in_stack_000004f8 == 0x11b) {

-LAB_13:

-      in_stack_000000a0 = unaff_RSI;

-      if ((((tVar27 == (tagPOINT)0x0) ||

-           (lVar28 = *(longlong *)((longlong)tVar27 + 0x28), in_stack_000000a0 = unaff_RSI,

-           *(char *)(lVar28 + 0x14) < (char)bVar42)) ||

-          (in_stack_000000a0 = unaff_RSI, *(char *)(lVar28 + 0x13) < (char)bVar42)) ||

-         ((in_stack_000000a0 = unaff_RSI, (*(byte *)(lVar28 + 0x1f) & 8) != 0 ||

-          (in_stack_000000a0 = unaff_RSI, (*(byte *)(lVar28 + 0x1f) & 0x10) == 0))))

-      goto LAB_12;

-LAB_14:

-      _LStack0000000000000098 = in_stack_00000508;

-      in_stack_000000a0 = in_stack_00000500;

-      if (tVar27 != (tagPOINT)0x0) {

-        in_stack_00000020 = in_stack_000000e8;

-        iVar21 = CheckCrossThreadInput

-                           ((tagWND *)tVar27,(tagQMSG *)unaff_RDI,(int *)&stack0x000000a8,

-                            (int *)&stack0x00000080,(tagQMSG **)in_stack_000000e8);

-        tVar34 = in_stack_000000b8;

-        if (iVar21 != 0) goto LAB_5;

-        uVar53 = in_stack_00000084;

-        if (in_stack_000000a8 != uVar44) goto LAB_12;

-        if ((in_stack_000000b4 != 0) || (in_stack_00000a40 != 0xffffffff)) {

-          if (in_stack_00000a40 < in_stack_000000b4) {

-            if ((in_stack_000004f8 < in_stack_00000a40) || (in_stack_000000b4 < in_stack_000004f8))

-            {

-              uVar23 = 1;

-            }

-            else {

-LAB_15:

-              uVar23 = uVar44;

-            }

-          }

-          else if ((in_stack_000004f8 < in_stack_000000b4) ||

-                  (uVar23 = 1, in_stack_00000a40 < in_stack_000004f8)) goto LAB_15;

-          ppuVar45._4_4_ = 0;

-          ppuVar45._0_4_ = in_stack_00000088;

-          if (uVar23 == 0) goto code_r0x000140273e4e;

-        }

-        iVar21 = CheckPwndFilter(tVar27,in_stack_000000f8);

-        ppuVar45._4_4_ = 0;

-        ppuVar45._0_4_ = in_stack_00000088;

-        if (iVar21 != 0) {

-LAB_16:

-          if (in_stack_00000080 != uVar44) {

-            xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,1);

-          }

-          goto LAB_11;

-        }

-        goto code_r0x000140273e4e;

-      }

-      goto LAB_12;

-    }

-    if (in_stack_000004f8 == 0x23) {

-      if ((tVar27 == (tagPOINT)0x0) ||

-         (tVar37 = *(tagPOINT *)((longlong)tVar27 + 0x10), tVar37 == unaff_R14)) {

-        _LStack0000000000000098 = in_stack_00000508;

-        iVar21 = MiPCheckMsgFilter(unaff_RDI,0x23,in_stack_000000b4,in_stack_00000a40);

-        tVar34 = in_stack_000000b8;

-        in_stack_000000a0 = unaff_RSI;

-        if (iVar21 != 0) goto LAB_16;

-      }

-      else {

-        _LStack0000000000000098 = in_stack_00000508;

-        in_stack_000000a0 = unaff_RSI;

-        if (*(longlong *)((longlong)tVar37 + 0x1d8) != *(longlong *)((longlong)unaff_R14 + 0x1d8))

-        goto LAB_12;

-        if (in_stack_000000b8 == (tagPOINT)0x0) {

-          Win32RawLockedW32Thread::Exchange

-                    ((Win32RawLockedW32Thread *)&stack0x000002b0,(_W32THREAD *)tVar37);

-          <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&stack0x000001c0,tVar37);

-          tVar34 = tVar37;

-        }

-      }

-      goto LAB_5;

-    }

-    if (in_stack_000004f8 == 0xfe) goto LAB_14;

-    if (in_stack_000004f8 == 0xff) {

-      _LStack0000000000000098 = in_stack_00000508;

-      bVar51 = DeleteHidDataIfAlreadyHandledByGRIB

-                         ((tagTHREADINFO *)unaff_R14,(__int64)in_stack_00000508);

-      uVar53 = in_stack_00000084;

-      in_stack_000000a0 = in_stack_00000500;

-      if (bVar51) goto LAB_12;

-      tVar34 = unaff_RSI;

-      tVar27 = unaff_RSI;

-      if ((_LStack0000000000000098 != (tagPOINT)0x0) &&

-         (tVar34 = (tagPOINT)HMValidateHandleNoSecure(_LStack0000000000000098,CONCAT71(uVar5,0x12)),

-         tVar34 != (tagPOINT)0x0)) {

-        tVar27 = *(tagPOINT *)((longlong)tVar34 + 0x18);

-      }

-      if (tVar27 == unaff_RSI) {

-        tVar27 = *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x88);

-        if ((tVar27 == (tagPOINT)0x0) &&

-           (tVar27 = *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x90),

-           tVar27 == (tagPOINT)0x0)) {

-          InputTraceLogging::RawInput::SSQResult((void *)_LStack0000000000000098,0);

-          uVar53 = in_stack_00000084;

-          goto LAB_12;

-        }

-      }

-      if ((tVar34 != (tagPOINT)0x0) &&

-         (*(longlong *)((longlong)tVar34 + 0x10) != *(longlong *)((longlong)tVar27 + 0x10))) {

-        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x2809);

-      }

-      Win32HM_ExchangeThreadLock<1>((_HEAD *)tVar27,(_Win32HMThreadLockItem *)&stack0x00000150);

-      in_stack_00000020 = in_stack_000000e8;

-      iVar21 = CheckCrossThreadInput

-                         ((tagWND *)tVar27,(tagQMSG *)unaff_RDI,(int *)&stack0x000000a8,

-                          (int *)&stack0x00000080,(tagQMSG **)in_stack_000000e8);

-      if (iVar21 != 0) {

-        SVar39 = 0;

-LAB_17:

-        InputTraceLogging::RawInput::SSQResult((void *)_LStack0000000000000098,SVar39);

-        tVar34 = in_stack_000000b8;

-        goto LAB_5;

-      }

-      if (in_stack_000000a8 != uVar44) {

-        uVar53 = in_stack_00000084;

-        if (*(longlong *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d8) !=

-            *(longlong *)((longlong)unaff_R14 + 0x1d8)) goto LAB_12;

-        iVar21 = IsInsideMenuLoop();

-        if (iVar21 == 0) {

-          tVar34 = unaff_RSI;

-          if (*(longlong *)((longlong)unaff_R14 + 0x2c8) != 0) {

-            tVar34 = *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x2c8) + 0x10);

+      *(tagQMSG **)(*(longlong *)(param_1 + 0x1d8) + 0x68) = ptVar31;

+      if (ptVar31 != (tagQMSG *)0x0) {

+        if ((local_4d8 & 0x2000000000) != 0) {

+          iVar22 = Feature_1263511866__private_IsEnabledDeviceUsageNoInline();

+          if ((iVar22 != 0) &&

+             (ppuVar51 = (undefined **)(ulonglong)local_990, (local_4d8 & 0x10000000000) != 0))

+          goto code_r0x000140273e4e;

+          *local_930 = ptVar31;

+          *(uint *)(ptVar31 + 100) = *(uint *)(ptVar31 + 100) | 0x100;

+          local_998 = 0;

+          if ((local_4d8._4_4_ >> 0x1b & 1) != 0) {

+            *(uint *)(*local_930 + 100) = *(uint *)(*local_930 + 100) | 0x8000000;

           }

         }

-        else {

-          tVar34 = *(tagPOINT *)(**(longlong **)((longlong)unaff_R14 + 0x288) + 8);

+        if ((local_4d8._4_4_ >> 0xd & 1) != 0) {

+          if (ptStack_4d0 == param_1) {

+            local_968 = 1;

+          }

+          ppuVar51 = (undefined **)CONCAT71((int7)((ulonglong)ppuVar51 >> 8),1);

+          local_990 = (uint)ppuVar51;

+          local_98c = 1;

+          goto code_r0x000140273e4e;

         }

-        if (tVar34 != (tagPOINT)0x0) {

-          InputTraceLogging::RawInput::IgnoreModalLoop

-                    ((void *)_LStack0000000000000098,*(HWND__ **)tVar34);

+        ppuVar51 = (undefined **)(ulonglong)local_990;

+        if ((local_4d8._4_4_ >> 0x10 & 1) == 0) {

+          if (((int)local_4d8 == 4) && ((char)local_990 != '\0')) {

+            DeferSysPeekMsg(param_1,3);

+            goto LAB_2;

+          }

+          if ((local_4d8._4_4_ >> 0xe & 1) == 0) {

+            iVar22 = ShouldDeferMessage(local_968,&local_538);

+            if (iVar22 == 0) goto LAB_3;

+            DeferSysPeekMsg(param_1,3);

+            local_968 = 3;

+            goto LAB_2;

+          }

+          if (ptStack_4d0 == param_1) {

+            local_968 = 2;

+          }

+          goto code_r0x000140273e4e;

         }

-        if (in_stack_00000120 == unaff_RSI) {

-          in_stack_00000120 = *(tagPOINT *)((longlong)tVar27 + 0x10);

-          Win32RawLockedW32Thread::Exchange

-                    ((Win32RawLockedW32Thread *)&stack0x00000320,(_W32THREAD *)in_stack_00000120);

-          <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&stack0x000001c0,in_stack_00000120);

-        }

+        if (ptStack_4d0 != param_1) goto code_r0x000140273e4e;

+        local_968 = 3;

+        goto LAB_2;

       }

-      if ((in_stack_000000b4 == 0) && (in_stack_00000a40 == 0xffffffff)) {

-LAB_18:

-        iVar21 = CheckPwndFilter(tVar27,in_stack_000000f8);

-        if (iVar21 != 0) {

-          if (in_stack_000000a8 == uVar44) {

-            if (in_stack_00000080 != uVar44) {

-              xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,1);

-            }

-            InputTraceLogging::RawInput::SSQResult((void *)_LStack0000000000000098,4);

-            goto LAB_11;

-          }

-          SVar39 = 3;

-          goto LAB_17;

+LAB_3:

+      if (*(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x68) == 0) {

+        p_Var58 = local_960;

+        if (param_7 == 0x2000) {

+          ClearWakeBit(param_1,0x2000,0);

+          p_Var58 = local_960;

         }

       }

       else {

-        if (in_stack_00000a40 < in_stack_000000b4) {

-          if ((in_stack_00000a40 < 0x100) && (0xfe < in_stack_000000b4)) {

-LAB_19:

-            uVar23 = uVar44;

+        Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

+                  ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_8c8);

+        bVar59 = true;

+        local_9a0 = (_HEAD *)HMValidateHandleNoSecure(local_528,1);

+        Win32HM_LockIntoThread<1>(param_1,local_9a0,(_Win32HMThreadLockItem *)local_8c8);

+        uVar50 = uStack_520;

+        local_9a8 = (uint)uStack_520;

+        if ((int)local_4d8 == 0) {

+          ppuVar51 = (undefined **)(ulonglong)local_990;

+          if (param_7 == 0x2000) goto code_r0x000140273e4e;

+          uVar27 = local_964;

+          uVar47 = uVar49;

+          p_Var58 = local_960;

+          if (0x24a < (uint)uStack_520) {

+            if ((uint)uStack_520 < 0x2ee) {

+              if ((uint)uStack_520 != 0x2ed) {

+                if ((((uint)uStack_520 == 0x251) || ((uint)uStack_520 == 0x252)) ||

+                   ((uint)uStack_520 == 0x253)) goto LAB_4;

+                iVar22 = (uint)uStack_520 - 0x2e8;

+LAB_5:

+                if (((iVar22 != 0) && (iVar22 != 1)) &&

+                   ((iVar22 != 2 && ((iVar22 != 3 && (iVar22 != 4)))))) goto LAB_6;

+              }

+            }

+            else if ((((uint)uStack_520 != 0x2ee) && ((uint)uStack_520 != 0x2ef)) &&

+                    ((uint)uStack_520 != 0x2f0)) {

+              iVar22 = (uint)uStack_520 - 0x2f1;

+              goto LAB_5;

+            }

+            if ((local_964 != 0) || (param_5 != 0xffffffff)) {

+              if (param_5 < local_964) {

+                if (((uint)uStack_520 < param_5) || (local_964 < (uint)uStack_520)) {

+                  uVar47 = 1;

+                }

+                else {

+LAB_7:

+                  uVar47 = uVar49;

+                }

+              }

+              else if (((uint)uStack_520 < local_964) || (uVar47 = 1, param_5 < (uint)uStack_520))

+              goto LAB_7;

+              if (uVar47 == 0) goto LAB_8;

+            }

+            iVar26 = IsInsideMenuLoop(param_1);

+            iVar22 = local_994;

+            if (iVar26 == 0) {

+              if (local_998 != 0) {

+                xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+              }

+              if (local_9a0 == (_HEAD *)0x0) {

+                local_9a0 = *(_HEAD **)(*(longlong *)(param_1 + 0x1d8) + 0x88);

+              }

+              local_978 = local_518;

+              local_980 = ptStack_510;

+              tVar28 = xxxRetrieveInteractiveControlInputMessage

+                                 ((uint)local_518 & 0xffff,

+                                  (uint)((ulonglong)local_518 >> 0x10) & 0xffff);

+              if (tVar28 == 1) goto LAB_9;

+              p_Var58 = local_960;

+              iVar22 = local_994;

+              if (tVar28 == 2) goto LAB_8;

+            }

+            goto LAB_10;

+          }

+          if ((uint)uStack_520 == 0x24a) {

+LAB_4:

+            if (((uStack_4c0._4_4_ - 2U & 0xffffffcf) == 0) && (uStack_4c0._4_4_ != 0x32)) {

+              local_978 = local_518;

+              local_980 = ptStack_510;

+              local_9a8 = (uint)uStack_520;

+LAB_11:

+              if (local_998 != 0) {

+                ptVar34 = param_1;

+                iVar22 = IsMiPActive(param_1,0);

+                if ((iVar22 == 0) || (uVar47 == 0)) {

+                  xxxSkipSysMsgEx(ptVar34,(tagQMSG *)&local_538,1);

+                }

+                else {

+                  ptVar35 = ptVar37;

+                  if (local_9a0 != (_HEAD *)0x0) {

+                    ptVar35 = *(tagQMSG **)local_9a0;

+                  }

+                  *(tagQMSG **)(*(longlong *)(param_1 + 0x600) + 0x30) = ptVar35;

+                  uVar27 = *(uint *)(*(longlong *)(param_1 + 0x600) + 0x24);

+                  if (((uVar27 >> 0x16 & 1) != 0) &&

+                     ((*(uint *)(local_9a0 + 0x17c) & 0x40000000) == 0)) {

+                    *(uint *)(*(longlong *)(param_1 + 0x600) + 0x24) = uVar27 & 0xffbfffff;

+                  }

+                  _Var36 = GetMiPWindowFlags((tagWND *)local_9a0);

+                  SetMiPWindowFlags((tagWND *)local_9a0,_Var36 & 0xfffffffffffffffe);

+                  if (((uint)uStack_520 - 0x242 & 0xfffffffb) == 0) {

+                    if ((uint)uStack_520 == 0x242) {

+                      uVar49 = 8;

+                    }

+                    **(uint **)(param_1 + 0x600) =

+                         **(uint **)(param_1 + 0x600) & 0xfffffff7 | uVar49;

+                  }

+                  else if (((uint)uStack_520 - 0x243 & 0xfffffffb) == 0) {

+                    **(uint **)(param_1 + 0x600) = **(uint **)(param_1 + 0x600) & 0xfffffff7;

+                  }

+                }

+              }

+              iVar22 = IsPointerMessageTouchpad(param_1,(__uint64)ptStack_510,(ushort)uVar47);

+              if (iVar22 != 0) {

+                if ((local_998 == 0) &&

+                   (bVar59 = ShouldReceiveTouchpadMessages(param_1,local_528), !bVar59)) {

+                  xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+                }

+                if (local_9a8 == 0x253) {

+                  local_980 = (tagPOINT *)0xffffffffffffffff;

+                }

+              }

+LAB_9:

+              if (*(longlong *)(param_1 + 0x31c) != CONCAT44(LStack_500,LStack_504)) {

+                LOCK();

+                *(uint *)(param_1 + 0x210) = *(uint *)(param_1 + 0x210) | 0x100000;

+                UNLOCK();

+              }

+              if ((ptVar31 != (tagQMSG *)0x0) &&

+                 (((local_4d8 & 0x2000000000) != 0 || ((local_4d8._4_4_ >> 0x1b & 1) != 0)))) {

+                if (*(int *)(ptVar31 + 0x18) == 0x200) {

+                  ptVar35 = ptVar37;

+                  if (local_9a0 != (_HEAD *)0x0) {

+                    ptVar35 = *(tagQMSG **)local_9a0;

+                  }

+                  *(tagQMSG **)(ptVar31 + 0x10) = ptVar35;

+                  *(uint *)(ptVar31 + 100) = *(uint *)(ptVar31 + 100) | 0x200;

+                }

+                *(tagPOINT **)(ptVar31 + 0x40) = local_980;

+              }

+              *(LONG *)(param_1 + 0x31c) = LStack_504;

+              *(LONG *)(param_1 + 800) = LStack_500;

+              *(undefined4 *)(param_1 + 0x324) =

+                   *(undefined4 *)(*(longlong *)(local_9a0 + 0x28) + 0x120);

+              *(tagPOINT *)(param_1 + 0x328) = local_4e8;

+              *(uint *)(param_1 + 0x260) = local_508;

+              *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x220) = uStack_4f0;

+              if ((local_9a8 == 0x202) || (local_9a8 == 0xa2)) {

+                *(tagPOINT *)(param_1 + 0x330) = local_4e8;

+              }

+              *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x60) = 1;

+              *(undefined8 *)(param_1 + 0x268) = 1;

+              tagTHREADINFO::UpdateLastInputData(param_1,(tagQMSG *)&local_538);

+              ptVar19 = local_888;

+              uVar24 = local_94c;

+              **(uint **)(param_1 + 0x1e8) = **(uint **)(param_1 + 0x1e8) & 0xfffffff7;

+              **(ulonglong **)(param_1 + 0x208) = **(ulonglong **)(param_1 + 0x208) & 0x7fffffff;

+              if (local_998 != 0) {

+                puVar5 = *(ulonglong **)(param_1 + 0x208);

+                if ((local_4d8 & 0x100000000) == 0) {

+                  *puVar5 = *puVar5 & 0xffffffffffffefff;

+                }

+                else {

+                  *puVar5 = *puVar5 | 0x1000;

+                }

+              }

+              TransferWakeBit(param_1,local_9a8);

+              ClearWakeBit(param_1,0x7c07,1);

+              if ((((local_998 != 0) && (local_954 != 0)) &&

+                  (*(uint **)(param_1 + 0x600) != (uint *)0x0)) &&

+                 ((uVar47 = **(uint **)(param_1 + 0x600), (uVar47 & 1) != 0 && ((uVar47 & 4) != 0)))

+                 ) {

+                SetMiPWakeBit(param_1);

+              }

+              if (local_9a0 != (_HEAD *)0x0) {

+                ptVar37 = *(tagQMSG **)local_9a0;

+              }

+              *(tagQMSG **)ptVar19 = ptVar37;

+              *(uint *)(ptVar19 + 8) = local_9a8;

+              puVar38 = local_978;

+              if ((uVar24 & 2) != 0) {

+                puVar38 = (undefined1 *)0xe5;

+              }

+              *(undefined1 **)(ptVar19 + 0x10) = puVar38;

+              *(tagPOINT **)(ptVar19 + 0x18) = local_980;

+              *(uint *)(ptVar19 + 0x20) = local_508;

+              *(ulonglong *)(ptVar19 + 0x24) = CONCAT44(LStack_500,LStack_504);

+              InputTraceLogging::Delivery::ScanSysQueue

+                        ((tagQMSG *)&local_538,ptVar19,param_1,local_998 != 0);

+              if (local_998 != 0) {

+                EtwTraceInputProcessDelay(param_1);

+                *(int *)(*(longlong *)(param_1 + 0x1d8) + 0x228) =

+                     (int)((ulonglong)_DAT_12 * _DAT_fffff78000000320 >> 0x18);

+              }

+              EtwTraceRetrieveInputMessage(ptVar19,local_998);

+              CManageInScanSysQueueBit::~CManageInScanSysQueueBit(local_956);

+              Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

+                        ((Win32HMOptionalThreadLock<tagHOOK> *)local_8c8);

+              Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

+                        ((Win32HMOptionalThreadLock<tagHOOK> *)local_7a8);

+              Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_728);

+              Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_710);

+              Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_6f8);

+              Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_6e0);

+              Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_768);

+              Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_780);

+              return 1;

+            }

+            EtwTraceBeginPointerMessageRetrieve

+                      (ptVar31,(ulonglong)local_518 & 0xffff,(uint)uStack_520);

+            local_198 = *(undefined8 *)ptVar31;

+            uStack_190 = *(undefined8 *)(ptVar31 + 8);

+            local_188 = *(undefined8 *)(ptVar31 + 0x10);

+            uStack_180 = *(undefined8 *)(ptVar31 + 0x18);

+            local_178 = *(undefined8 *)(ptVar31 + 0x20);

+            uStack_170 = *(undefined8 *)(ptVar31 + 0x28);

+            local_168 = *(undefined8 *)(ptVar31 + 0x30);

+            uStack_160 = *(undefined8 *)(ptVar31 + 0x38);

+            local_158 = *(undefined8 *)(ptVar31 + 0x40);

+            uStack_150 = *(undefined8 *)(ptVar31 + 0x48);

+            local_148 = *(undefined8 *)(ptVar31 + 0x50);

+            uStack_140 = *(undefined8 *)(ptVar31 + 0x58);

+            local_138 = *(undefined8 *)(ptVar31 + 0x60);

+            uStack_130 = *(undefined8 *)(ptVar31 + 0x68);

+            local_128 = *(undefined8 *)(ptVar31 + 0x70);

+            uStack_120 = *(undefined8 *)(ptVar31 + 0x78);

+            local_118 = *(undefined8 *)(ptVar31 + 0x80);

+            uStack_110 = *(undefined8 *)(ptVar31 + 0x88);

+            local_108 = *(undefined4 *)(ptVar31 + 0x90);

+            uStack_104 = *(undefined4 *)(ptVar31 + 0x94);

+            uStack_100 = *(undefined4 *)(ptVar31 + 0x98);

+            uStack_fc = *(undefined4 *)(ptVar31 + 0x9c);

+            local_f8 = *(undefined4 *)(ptVar31 + 0xa0);

+            uStack_f4 = *(undefined4 *)(ptVar31 + 0xa4);

+            uStack_f0 = *(undefined4 *)(ptVar31 + 0xa8);

+            uStack_ec = *(undefined4 *)(ptVar31 + 0xac);

+            tVar28 = xxxRetrievePointerInputMessage(param_1,local_920,uVar27);

+            InputTraceLogging::Pointer::RetrieveMessage((tagQMSG *)&local_198,false,tVar28);

+            EtwTraceEndPointerMessageRetrieve(&local_198,(ulonglong)local_518 & 0xffff);

+            if (local_9a0 != (_HEAD *)0x0) {

+              Win32HM_ExchangeThreadLock<1>(local_9a0,(_Win32HMThreadLockItem *)local_8c8);

+            }

+            if (tVar28 == 1) goto LAB_11;

+            if (tVar28 == 2) {

+              p_Var58 = local_960;

+              if (local_970 != 0) {

+                p_Var58 = *(_W32THREAD **)(local_9a0 + 0x10);

+                local_928 = p_Var58;

+                Win32RawLockedW32Thread::Exchange(local_710,p_Var58);

+                <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&local_858,p_Var58);

+                p_Var58 = local_960;

+              }

+              goto LAB_8;

+            }

+            if (tVar28 == 3) {

+              xxxDefPointerProc();

+              *local_930 = (tagQMSG *)0x0;

+              iVar22 = local_994;

+            }

+            else {

+              *local_930 = (tagQMSG *)0x0;

+              iVar22 = local_994;

+              if (tVar28 == 4) goto LAB_2;

+            }

           }

           else {

-            uVar23 = 1;

-          }

-        }

-        else if ((0xff < in_stack_000000b4) || (uVar23 = 1, in_stack_00000a40 < 0xff))

-        goto LAB_19;

-        if (uVar23 != 0) goto LAB_18;

-      }

-      InputTraceLogging::RawInput::SSQResult((void *)_LStack0000000000000098,2);

-      goto LAB_3;

-    }

-    in_stack_000000e0 = unaff_RDI;

-    if (in_stack_000004f8 == 0x100) {

+            iVar22 = local_994;

+            if (0x11b < (uint)uStack_520) {

+              if (((uint)uStack_520 == 0x20a) || ((uint)uStack_520 == 0x20e)) {

+                LOCK();

+                uVar47 = *(uint *)(param_1 + 0x210);

+                if (uVar47 == 0) {

+                  *(uint *)(param_1 + 0x210) = 0;

+                  uVar47 = 0;

+                }

+                UNLOCK();

+                if (((uVar47 >> 10 & 1) != 0) &&

+                   (lVar23 = CheckProcessForeground(param_1), p_Var58 = local_960, lVar23 < 0))

+                goto LAB_8;

+                iVar26 = IsInsideMenuLoop(param_1);

+                iVar22 = local_994;

+                if (iVar26 != 0) goto LAB_10;

+                if ((local_4d8 & 0x10000000000000) == 0) {

+                  if ((local_9a0 == (_HEAD *)0x0) ||

+                     (bVar59 = IsCompositionInputWindowForHitTest((tagWND *)local_9a0), bVar45 = 1,

+                     !bVar59)) {

+                    bVar45 = bVar48;

+                  }

+                  if (bVar45 == 0) {

+                    local_9a0 = (_HEAD *)GetThreadDesktopWindow(0);

+                  }

+                  else {

+                    iVar26 = CoreWindowProp::IsCompositeAppOrSelfDisabled((tagWND *)local_9a0);

+                    iVar22 = local_994;

+                    if (iVar26 != 0) goto LAB_10;

+                  }

+                  Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>

+                            (local_630,(tagWND *)local_9a0);

+                  pHVar32 = xxxDCEWindowHitTest((tagWND *)local_9a0,0x200,(__uint64)local_518,

+                                                (__int64)ptStack_510,local_4e8,(int *)&local_96c,

+                                                (uint)bVar45 * 4 + 9);

+                  local_9a0 = (_HEAD *)HMValidateHandleNoSecure(pHVar32,1);

+                  ptVar33 = (tagWND *)HMValidateHandleNoSecure(pHVar32,1);

+                  InputTraceLogging::Mouse::SecondaryHitTest

+                            ((tagQMSG *)&local_538,&local_4e8,ptVar33);

+                  Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>(local_630);

+                }

+                else {

+                  local_9a0 = *(_HEAD **)(*(longlong *)(param_1 + 0x1d8) + 0x88);

+                }

+                iVar22 = local_994;

+                if (local_9a0 == (_HEAD *)0x0) goto LAB_10;

+                Win32HM_ExchangeThreadLock<1>(local_9a0,(_Win32HMThreadLockItem *)local_8c8);

+                local_970 = (uint)(*(tagTHREADINFO **)(local_9a0 + 0x10) != local_8d0);

+                if (*(tagTHREADINFO **)(local_9a0 + 0x10) != local_8b0) {

+                  p_Var58 = *(_W32THREAD **)(local_9a0 + 0x10);

+                  iVar22 = local_994;

+                  if (*(longlong *)(p_Var58 + 0x1d8) != *(longlong *)(param_1 + 0x1d8))

+                  goto LAB_10;

+                  if (local_8e0 == (_W32THREAD *)0x0) {

+                    local_8e0 = p_Var58;

+                    Win32RawLockedW32Thread::Exchange(local_780,p_Var58);

+                    <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()

+                              (&local_858,p_Var58,local_9a0);

+                  }

+                }

+                uVar27 = local_964;

+                iVar22 = MiPCheckMsgFilter(ptVar31,local_9a8,local_964);

+                ppuVar51 = (undefined **)(ulonglong)local_990;

+                if (iVar22 != 0) {

+                  iVar22 = CheckPwndFilter(local_9a0,local_920);

+                  ppuVar51 = (undefined **)(ulonglong)local_990;

+                  if (iVar22 != 0) {

+                    p_Var58 = local_960;

+                    if (local_970 != 0) goto LAB_8;

+                    if ((ptVar31 == (tagQMSG *)0x0) || (iVar22 = IsMiPActive(param_1), iVar22 == 0))

+                    goto LAB_13;

+                    if ((*(uint *)(ptVar31 + 100) & 0x400) == 0) {

+                      if (local_998 == 0) goto LAB_14;

+                      iVar22 = IsMiPMouseMessage(*(undefined4 *)(ptVar31 + 0x18));

+                      if (iVar22 == 0) {

+LAB_13:

+                        if (local_998 != 0) {

+                          xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+                        }

+                        goto LAB_14;

+                      }

+                      iVar22 = IsGenuineMouseInput(ptVar31 + 0x7c);

+                      if ((((iVar22 == 0) || (*(uint **)(param_1 + 0x600) == (uint *)0x0)) ||

+                          (uVar47 = **(uint **)(param_1 + 0x600), (uVar47 & 2) != 0)) ||

+                         ((uVar47 & 4) != 0)) {

+                        puVar1 = *(uint **)(param_1 + 0x600);

+                        if (puVar1 != (uint *)0x0) {

+                          *puVar1 = *puVar1 & 0xfffffffd;

+                        }

+                        goto LAB_13;

+                      }

+                      goto LAB_15;

+                    }

+                    memset(&local_2f8,0,0xb0);

+                    uVar47 = local_998;

+                    bVar59 = ShouldGenerateMipMessage(param_1,ptVar31,(tagWND *)local_9a0,local_998)

+                    ;

+                    if ((!bVar59) ||

+                       (iVar22 = GeneratePointerMessageFromMouse

+                                           ((tagQMSG *)&local_2f8,local_9a8,ptVar31,

+                                            (tagWND *)local_9a0,uVar47), iVar22 == 0)) {

+                      if (local_998 != 0) {

+                        *(uint *)(ptVar31 + 100) = *(uint *)(ptVar31 + 100) & 0xfffffbff;

+                        goto LAB_13;

+                      }

+LAB_14:

+                      uVar47 = GetMouseKeyFlags(*(undefined8 *)(param_1 + 0x1d8));

+                      local_978 = (undefined1 *)((ulonglong)uVar47 | (ulonglong)local_518);

+                      local_980 = ptStack_510;

+                      local_988.y = (int)(short)((ulonglong)ptStack_510 >> 0x10);

+                      local_988.x = (int)(short)ptStack_510;

+                      PhysicalToLogicalDPIPointWithHitTest

+                                (&local_988,&local_988,(_SUBPIXELS *)0x0,(tagWND *)local_9a0);

+                      local_980 = (tagPOINT *)

+                                  (longlong)

+                                  CONCAT22((undefined2)local_988.y,(undefined2)local_988.x);

+                      LStack_504 = local_988.x;

+                      LStack_500 = local_988.y;

+                      local_488 = local_988;

+                      if (local_9a0 == (_HEAD *)0x0) {

+                        uStack_480 = 0;

+                      }

+                      else {

+                        uStack_480 = *(undefined8 *)local_9a0;

+                      }

+                      local_478 = local_478 & 0xffffffff00000000;

+                      uStack_470 = uStack_4f0;

+                      local_468 = CONCAT44(local_468._4_4_,local_518._0_4_);

+                      if (local_998 != 0) {

+                        local_950 = 1;

+                        iVar26 = xxxCallCtfHook(7,0,local_9a8);

+                        iVar22 = local_994;

+                        if (iVar26 != 0) goto LAB_10;

+                      }

+                      if (((*(uint *)(**(longlong **)(param_1 + 0x1f8) + 0x10) |

+                           *(uint *)(param_1 + 0x2d0)) >> 8 & 1) != 0) {

+                        local_950 = 1;

+                        iVar26 = xxxCallMouseHook(local_9a8,&local_488,local_998);

+                        iVar22 = local_994;

+                        if (iVar26 != 0) goto LAB_10;

+                      }

+                      iVar22 = PsGetWin32KFilterSet();

+                      if (iVar22 == 5) {

+                        ptVar34 = PtiCurrent();

+                        local_958 = *(longlong *)(*(longlong *)(ptVar34 + 0x208) + 0xf8) != 0;

+                        if (((bool)local_958) &&

+                           (lVar39 = xxxClientCallLocalMouseHooks(local_9a8,&local_488,local_998),

+                           iVar22 = local_994, lVar39 != 0)) goto LAB_10;

+                      }

+                      if ((local_950 == 0) ||

+                         ((local_998 == 0 ||

+                          (((*(uint *)(**(longlong **)(param_1 + 0x1f8) + 0x10) |

+                            *(uint *)(param_1 + 0x2d0)) & 0x40) == 0)))) goto LAB_9;

+                      puVar38 = (undefined1 *)(uVar50 & 0xffffffff);

+                      ptVar52 = &local_488;

+                      iVar22 = 6;

+                      goto LAB_16;

+                    }

+                    local_538 = local_2f8;

+                    lStack_530 = lStack_2f0;

+                    local_528 = local_2e8;

+                    uStack_520 = uStack_2e0;

+                    local_518 = local_2d8;

+                    ptStack_510 = ptStack_2d0;

+                    local_508 = (uint)local_2c8;

+                    LStack_504 = (LONG)((ulonglong)local_2c8 >> 0x20);

+                    LStack_500 = (LONG)uStack_2c0;

+                    uStack_4fc = (undefined4)((ulonglong)uStack_2c0 >> 0x20);

+                    local_4f8 = local_2b8;

+                    uStack_4f0 = uStack_2b0;

+                    local_4e8 = local_2a8;

+                    uStack_4e0 = uStack_2a0;

+                    local_4d8 = local_298;

+                    ptStack_4d0 = ptStack_290;

+                    local_4c8 = local_288;

+                    uStack_4c0 = uStack_280;

+                    local_4b8 = local_278;

+                    uStack_4b0 = uStack_270;

+                    local_4a8 = local_268;

+                    uStack_4a0 = uStack_260;

+                    local_498 = local_258;

+                    uStack_490 = uStack_250;

+                    uVar47 = 1;

+                    local_954 = 1;

+                    if (local_998 != 0) {

+                      *(uint *)(ptVar31 + 100) = *(uint *)(ptVar31 + 100) & 0xfffffbff;

+                    }

+LAB_17:

+                    goto LAB_4;

+                  }

+                }

+                goto code_r0x000140273e4e;

+              }

+              if ((uint)uStack_520 == 0x238) goto LAB_18;

+              if ((uint)uStack_520 == 0x240) goto LAB_19;

+              if (((((uint)uStack_520 == 0x245) || ((uint)uStack_520 == 0x246)) ||

+                  ((uint)uStack_520 == 0x247)) || ((uint)uStack_520 == 0x249)) goto LAB_4;

+LAB_6:

+              local_988.y = (int)(short)((ulonglong)ptStack_510 >> 0x10);

+              local_988.x = (int)(short)ptStack_510;

+              local_96c = 1;

+              if (((((local_4d8 & 0x2000000000) == 0) && ((local_4d8 & 0x800000000000000) == 0)) ||

+                  (local_9a0 == (_HEAD *)0x0)) ||

+                 ((((ushort)((uint)*(undefined4 *)

+                                    (*(longlong *)(*(longlong *)(local_9a0 + 0x10) + 0x1d0) + 0x10c)

+                            >> 8) ^

+                   (ushort)((uint)*(undefined4 *)(*(longlong *)(local_9a0 + 0x28) + 0x120) >> 8)) &

+                  0x1ff) != 0)) {

+                uVar47 = (uint)uStack_520;

+                if (local_9a0 == (_HEAD *)0x0) {

 LAB_20:

-      unaff_R12B = 2;

-      in_stack_00000100 = 1;

-      LOCK();

-      uVar23 = *(uint *)((longlong)unaff_R14 + 0x210);

-      if (uVar23 == 0) {

-        *(uint *)((longlong)unaff_R14 + 0x210) = uVar44;

-        uVar23 = 0;

-      }

-      UNLOCK();

-      unaff_R13D = 0x400;

-      if (((uVar23 & 0x400) != 0) &&

-         (lVar22 = CheckProcessForeground((tagTHREADINFO *)unaff_R14), tVar34 = in_stack_000000b8,

-         lVar22 < 0)) goto LAB_5;

-      in_stack_000000a0 = (tagPOINT)((ulonglong)in_stack_00000500 & 0xff);

-      if ((in_stack_00000080 == uVar44) || ((in_stack_00000540 & 0x800000000000) == 0)) {

-        if (in_stack_000000a0 != (tagPOINT)0x12) {

-          puVar2 = (uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x214);

-          *puVar2 = *puVar2 & 0xfffffff3;

-        }

-        bVar49 = *(byte *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x17c);

-        if (in_stack_000000a0 == (tagPOINT)0x2c) {

-          if ((bVar49 & 0x10) == 0) {

+                  uVar27 = uVar49;

+                }

+                else {

+                  bVar59 = IsCompositionInputWindowForHitTest((tagWND *)local_9a0);

+                  uVar27 = 1;

+                  uVar47 = (uint)uStack_520;

+                  if (!bVar59) goto LAB_20;

+                }

+                ptVar33 = *(tagWND **)(*(longlong *)(param_1 + 0x1d8) + 0x80);

+                local_914 = uVar27;

+                if (ptVar33 == (tagWND *)0x0) {

+                  Win32HMOptionalThreadLockAlways<tagMENU>::Win32HMOptionalThreadLockAlways<tagMENU>

+                            (local_7b8);

+                  if (uVar27 == 0) {

+                    lVar39 = W32GetUserSessionState();

+                    local_9a0 = *(_HEAD **)

+                                 (*(longlong *)

+                                   (*(longlong *)(*(longlong *)(lVar39 + 0x4970) + 0x1f0) + 8) +

+                                 0x18);

+                    Win32HM_LockIntoThread<1>(param_1,local_9a0,(_Win32HMThreadLockItem *)local_7b8)

+                    ;

+                    uVar47 = (uint)uStack_520;

+                  }

+                  WVar55 = uVar27 * 4 + 9;

+                  iVar22 = IsThreadDesktopComposed(param_1);

+                  if (iVar22 == 0) {

+                    pHVar32 = xxxWindowHitTest((tagWND *)local_9a0,local_988,(int *)&local_96c,

+                                               WVar55);

+                  }

+                  else {

+                    local_828[1] = 0;

+                    local_820 = local_518;

+                    local_818 = ptStack_510;

+                    local_810 = &local_96c;

+                    local_804 = 0;

+                    local_803 = 0;

+                    local_801 = 0;

+                    local_800 = &uStack_4e0;

+                    local_7f8 = '\0';

+                    local_7f7 = 0;

+                    local_7f3 = 0;

+                    local_7f1 = 0;

+                    local_7f0 = 0;

+                    local_828[0] = uVar47;

+                    local_808 = WVar55;

+                    pHVar32 = xxxDCEWindowHitTestIndirect

+                                        ((tagWND *)local_9a0,local_4e8,false,

+                                         (tagDCE_WINDOW_HIT_TEST_ARGS *)local_828);

+                    if ((pHVar32 != (HWND__ *)0x0) && (local_7f8 != '\0')) {

+                      ptStack_510 = local_818;

+                      LStack_504 = (LONG)(short)local_818;

+                      LStack_500 = (LONG)(short)((ulonglong)local_818 >> 0x10);

+                      local_988.y = LStack_500;

+                      local_988.x = LStack_504;

+                    }

+                  }

+                  ptVar33 = (tagWND *)HMValidateHandleNoSecure(pHVar32,1);

+                  InputTraceLogging::Mouse::SecondaryHitTest

+                            ((tagQMSG *)&local_538,&local_988,ptVar33);

+                  if (uVar27 == 0) {

+                    Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

+                              ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_7b8);

+                  }

+                  local_9a0 = (_HEAD *)HMValidateHandleNoSecure(pHVar32,1);

+                  if ((local_9a0 == (_HEAD *)0x0) &&

+                     (local_9a0 = *(_HEAD **)

+                                   (*(longlong *)(*(longlong *)(param_1 + 0x1f0) + 8) + 0x18),

+                     local_9a0 == (_HEAD *)0x0)) {

+                    lVar39 = W32GetUserSessionState();

+                    local_9a0 = *(_HEAD **)

+                                 (*(longlong *)

+                                   (*(longlong *)(*(longlong *)(lVar39 + 0x4970) + 0x1f0) + 8) +

+                                 0x18);

+                  }

+                  iVar22 = IsMiPActive(param_1,0);

+                  uVar47 = uVar49;

+                  if (((iVar22 != 0) && (*(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x238) != 0)

+                      ) && (ptVar33 = (tagWND *)ValidateHwnd(), ptVar33 != (tagWND *)0x0)) {

+                    if ((*(longlong *)(*(longlong *)(ptVar33 + 0x10) + 0x1d8) ==

+                         *(longlong *)(param_1 + 0x1d8)) ||

+                       (*(longlong *)(*(longlong *)(ptVar33 + 0x10) + 0x1d0) ==

+                        *(longlong *)(param_1 + 0x1d0))) {

+                      local_96c = 1;

+                      *(undefined4 *)(*(longlong *)(param_1 + 0x1d8) + 0xac) = 0;

+                      uVar47 = 1;

+                      local_9a0 = (_HEAD *)ptVar33;

+                    }

+                  }

+                  if (uVar47 == 0) {

+                    *(uint *)(*(longlong *)(local_8d0 + 0x1d8) + 0xac) = (uint)(local_96c != 1);

+                  }

+                  Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

+                            ((Win32HMOptionalThreadLock<tagHOOK> *)local_7b8);

+                }

+                else {

+                  InputTraceLogging::Mouse::RedirectForCapture

+                            ((tagQMSG *)&local_538,*(HWND__ **)ptVar33);

+                  local_9a0 = (_HEAD *)ptVar33;

+                }

+                if (local_9a0 == (_HEAD *)*(tagWND **)(*(longlong *)(param_1 + 0x1d8) + 0x80)) {

+                  uVar44 = (ushort)((uint)*(undefined4 *)(*(longlong *)(local_9a0 + 0x28) + 0x120)

+                                   >> 8);

+                  p_Var40 = local_9a0;

+                  lVar39 = PtiMouseFromQ(*(undefined8 *)(*(longlong *)(local_9a0 + 0x10) + 0x1d8));

+                  if (((((ushort)((uint)*(undefined4 *)(*(longlong *)(lVar39 + 0x1d0) + 0x10c) >> 8)

+                        ^ uVar44) & 0x1ff) != 0) ||

+                     (iVar22 = IsOleDragDropCaptureWindow((tagWND *)p_Var40), iVar22 != 0)) {

+                    local_988 = local_4e8;

+                    PhysicalToLogicalInPlacePointWithParent(local_9a0,&local_988,&uStack_4e0);

+                    if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0 ||

+                        (bVar45 = 1, (byte)WPP_GLOBAL_Control[0x29] < 5)))) {

+                      bVar45 = bVar48;

+                    }

+                    if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+                       (bVar46 = 1, *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+                      bVar46 = bVar48;

+                    }

+                    if ((bVar45 != 0) || (bVar46 != 0)) {

+                      lVar39 = W32GetUserSessionState();

+                      WPP_RECORDER_AND_TRACE_SF_dddd

+                                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar45,bVar46,

+                                 *(undefined8 *)(lVar39 + 0x10f98));

+                    }

+                    local_980 = (tagPOINT *)

+                                (longlong)CONCAT22((undefined2)local_988.y,(undefined2)local_988.x);

+                    LStack_504 = local_988.x;

+                    LStack_500 = local_988.y;

+                    ptVar31 = local_938;

+                  }

+                }

+              }

+              Win32HM_ExchangeThreadLock<1>(local_9a0,(_Win32HMThreadLockItem *)local_8c8);

+              iVar22 = CheckCrossThreadInput

+                                 ((tagWND *)local_9a0,ptVar31,(int *)&local_970,(int *)&local_998,

+                                  local_930);

+              p_Var58 = local_960;

+              if (iVar22 != 0) goto LAB_8;

+              if (local_970 == 0) {

+                if (((local_4d8 & 0x80000000000) != 0) &&

+                   (bVar59 = UIPrivilegeIsolation::CheckAccess

+                                       ((tagUIPI_INFO *)&local_4c8,

+                                        (tagUIPI_INFO *)

+                                        (*(longlong *)(*(longlong *)(local_9a0 + 0x10) + 0x1d0) +

+                                        0x130),0), !bVar59)) {

+                  EtwTraceUIPIMsgError

+                            (0,*(undefined8 *)(*(longlong *)(local_9a0 + 0x10) + 0x1d0),local_9a8);

+                  goto LAB_21;

+                }

+              }

+              else {

+                p_Var58 = *(_W32THREAD **)(local_9a0 + 0x10);

+                if (*(longlong *)(p_Var58 + 0x1d8) != *(longlong *)(param_1 + 0x1d8)) {

 LAB_21:

-            if ((*(uint *)((longlong)unaff_R14 + 0x39c) & 0x20) != 0) goto LAB_22;

-          }

-          else if ((*(uint *)((longlong)unaff_R14 + 0x39c) & 0x10) != 0) {

-            if ((bVar49 & 0x10) != 0) goto LAB_22;

-            goto LAB_21;

-          }

-          xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,1);

-          if (((bVar49 & 0x10) == 0) && ((in_stack_00000508.x & 0xff0000U) != 0x10000)) {

-            ptVar33 = *(tagWND **)

-                       (*(longlong *)(*(longlong *)((longlong)unaff_R14 + 0x1f0) + 8) + 0x18);

+                  lVar39 = W32GetUserSessionState();

+                  zzzSetCursor(*(tagCURSOR **)(lVar39 + 0x5608));

+                  iVar22 = local_994;

+                  goto LAB_10;

+                }

+                if (local_960 == (_W32THREAD *)0x0) {

+                  local_960 = p_Var58;

+                  Win32RawLockedW32Thread::Exchange(local_768,p_Var58);

+                  <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()

+                            (&local_858,p_Var58,local_9a0);

+                }

+              }

+              pt_00 = local_988;

+              iVar22 = *(int *)(*(longlong *)(*(longlong *)(local_9a0 + 0x10) + 0x1d8) + 0xac);

+              if ((iVar22 == 0) || (iVar22 == 2)) {

+                lVar39 = *(longlong *)(local_9a0 + 0x28);

+                if ((*(byte *)(lVar39 + 0x1a) & 0x40) == 0) {

+                  local_988.x = local_988.x - *(int *)(lVar39 + 0x68);

+                }

+                else {

+                  local_988.x = *(int *)(lVar39 + 0x70) - local_988.x;

+                }

+                iVar22 = *(int *)(*(longlong *)(local_9a0 + 0x28) + 0x6c);

+LAB_22:

+                local_988.y = local_988.y - iVar22;

+              }

+              else if (iVar22 == 3) {

+                lVar39 = *(longlong *)(local_9a0 + 0x28);

+                if ((*(byte *)(lVar39 + 0x1a) & 0x40) == 0) {

+                  local_988.x = local_988.x - *(int *)(lVar39 + 0x58);

+                }

+                else {

+                  local_988.x = *(int *)(lVar39 + 0x60) - local_988.x;

+                }

+                iVar22 = *(int *)(*(longlong *)(local_9a0 + 0x28) + 0x5c);

+                goto LAB_22;

+              }

+              if ((local_970 == 0) &&

+                 (lVar39 = W32GetUserSessionState(),

+                 *(longlong *)(param_1 + 0x1d8) == *(longlong *)(lVar39 + 0x4b78))) {

+                bVar59 = *(_HEAD **)(*(longlong *)(param_1 + 0x1f0) + 0xc0) != local_9a0;

+                iVar22 = Feature_UserModeNonClientScrollBars2__private_IsEnabledDeviceUsageNoInline

+                                   ();

+                if ((iVar22 == 0) ||

+                   (bVar20 = Scrollbar::NonClient::UserModeSupportsUserModeScrollBars(), !bVar20)) {

+                  iVar22 = FindNCHitEx(local_9a0,local_96c,local_988);

+                }

+                else {

+                  iVar22 = xxxFindNCHitEx(local_9a0,local_96c,local_988);

+                }

+                if (((local_9a8 != 0x200) || (bVar59)) ||

+                   (*(int *)(*(longlong *)(param_1 + 0x1f0) + 200) != iVar22)) {

+                  xxxTrackMouseMove(local_9a0,iVar22,local_9a8);

+                }

+                ptVar31 = local_938;

+                if (((!bVar59) &&

+                    (ptVar53 = *(tagDESKTOP **)(param_1 + 0x1f0),

+                    (*(uint *)(ptVar53 + 0x30) & 0x40) != 0)) &&

+                   ((local_9a8 != 0x200 ||

+                    (BVar25 = PtInRect((RECT *)(ptVar53 + 0xcc),pt_00), ptVar31 = local_938,

+                    BVar25 == 0)))) {

+                  ResetMouseHover(ptVar53,pt_00);

+                  ptVar31 = local_938;

+                }

+              }

+              iVar22 = CheckPwndFilter(local_9a0,local_920);

+              ppuVar51 = (undefined **)(ulonglong)local_990;

+              if (iVar22 == 0) goto code_r0x000140273e4e;

+              uVar47 = 0;

+              local_908 = local_908 & 0xffffffff00000000;

+              if (local_9a8 == 0x201) {

+                cVar21 = IsMessageInputSourceTouch(&local_538);

+                if (cVar21 == '\0') {

+                  puVar1 = (uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214);

+                  *puVar1 = *puVar1 & 0xff7fffff;

+                }

+                else {

+                  puVar1 = (uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214);

+                  *puVar1 = *puVar1 | 0x800000;

+                }

+                cVar21 = IsMessageInputSourcePen(&local_538);

+                if (cVar21 == '\0') {

+                  puVar1 = (uint *)(*(longlong *)(local_8d0 + 0x1d8) + 0x214);

+                  *puVar1 = *puVar1 & 0xfeffffff;

+                }

+                else {

+                  puVar1 = (uint *)(*(longlong *)(local_8d0 + 0x1d8) + 0x214);

+                  *puVar1 = *puVar1 | 0x1000000;

+                }

 LAB_23:

-            bVar51 = ptVar33 == (tagWND *)0x0;

-          }

-          else {

-            ptVar1 = *(tagWND **)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x90);

-            bVar51 = ptVar1 == (tagWND *)0x0;

-            ptVar33 = (tagWND *)0x0;

-            if (!bVar51) {

-              ptVar33 = CoreWindowProp::GetCompositeAppFrameWindowOrSelf(ptVar1);

-              goto LAB_23;

+                if ((((*(byte *)(*(longlong *)(*(longlong *)(local_9a0 + 0x88) + 8) + 8) & 8) != 0)

+                    || (*(int *)(*(longlong *)(param_1 + 0x1d8) + 0xac) == 1)) ||

+                   (iVar22 = IsMenuStarted(param_1), uVar27 = uVar47, iVar22 != 0)) {

+                  uVar47 = 1;

+                  local_908 = CONCAT44(local_908._4_4_,1);

+                  uVar27 = 1;

+                  if ((local_508 <= *(uint *)(*(longlong *)(param_1 + 0x1d8) + 0xb8)) &&

+                     (lVar39 = W32GetUserSessionState(), uVar27 = uVar47,

+                     *(int *)(lVar39 + 0x3f88) == 0)) {

+                    ptVar35 = ptVar37;

+                    if (local_9a0 != (_HEAD *)0x0) {

+                      ptVar35 = *(tagQMSG **)local_9a0;

+                    }

+                    lVar39 = *(longlong *)(param_1 + 0x1d8);

+                    if (((ptVar35 == *(tagQMSG **)(lVar39 + 0xc0)) &&

+                        (local_9a8 == *(uint *)(lVar39 + 0xb0))) &&

+                       ((local_9a8 != 0x20b ||

+                        ((short)((ulonglong)local_518 >> 0x10) == *(short *)(lVar39 + 0xb4))))) {

+                      lVar39 = W32GetUserSessionState();

+                      local_838.left =

+                           *(int *)(*(longlong *)(param_1 + 0x1d8) + 200) -

+                           *(int *)(*(longlong *)(lVar39 + 0x4e30) + 0x7f8) / 2;

+                      lVar39 = W32GetUserSessionState();

+                      local_838.top =

+                           *(int *)(*(longlong *)(param_1 + 0x1d8) + 0xcc) -

+                           *(int *)(*(longlong *)(lVar39 + 0x4e30) + 0x7fc) / 2;

+                      lVar39 = W32GetUserSessionState();

+                      local_838.right =

+                           *(int *)(*(longlong *)(lVar39 + 0x4e30) + 0x7f8) / 2 +

+                           *(int *)(*(longlong *)(param_1 + 0x1d8) + 200);

+                      lVar39 = W32GetUserSessionState();

+                      local_838.bottom =

+                           *(int *)(*(longlong *)(lVar39 + 0x4e30) + 0x7fc) / 2 +

+                           *(int *)(*(longlong *)(param_1 + 0x1d8) + 0xcc);

+                      pt.y = LStack_500;

+                      pt.x = LStack_504;

+                      BVar25 = PtInRect(&local_838,pt);

+                      if (BVar25 != 0) {

+                        local_9a8 = local_9a8 + 2;

+                        uVar27 = 2;

+                        local_908 = CONCAT44(local_908._4_4_,2);

+                      }

+                    }

+                  }

+                }

+LAB_24:

+                uVar47 = *(uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214);

+                if ((uVar47 & 8) != 0) {

+                  *(uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214) = uVar47 | 4;

+                }

+                uVar57 = uVar27;

+                if ((((local_9a8 - 0x202 < 0xb) && ((0x449U >> (local_9a8 - 0x202 & 0x1f) & 1) != 0)

+                     ) && (*(int *)(*(longlong *)(param_1 + 0x1d8) + 0xb8) != 0)) &&

+                   ((uStack_4c0._4_4_ - 4U & 0xfffffffb) == 0)) {

+                  if (uStack_4c0._4_4_ == 4) {

+                    iVar22 = GetTouchTimeFromCPLValue(300,0xb4,5,1);

+                  }

+                  else {

+                    iVar22 = GetPenDoubleClickTime();

+                  }

+                  *(int *)(*(longlong *)(param_1 + 0x1d8) + 0xb8) = iVar22 + (int)uStack_490;

+                }

+              }

+              else {

+                uVar27 = 0;

+                if (local_9a8 == 0x202) goto LAB_24;

+                if (local_9a8 == 0x204) goto LAB_23;

+                uVar27 = uVar47;

+                if (local_9a8 == 0x205) goto LAB_24;

+                if (local_9a8 == 0x207) goto LAB_23;

+                if (local_9a8 == 0x208) goto LAB_24;

+                if (local_9a8 == 0x20b) goto LAB_23;

+                uVar57 = uVar49;

+                if (local_9a8 == 0x20c) goto LAB_24;

+              }

+              if (*(int *)(*(longlong *)(*(longlong *)(local_9a0 + 0x10) + 0x1d8) + 0xac) == 1) {

+                local_9a8 = local_9a8 - 0x160;

+                local_978 = (undefined1 *)(ulonglong)local_96c;

+              }

+              iVar22 = MiPCheckMsgFilter(ptVar31,local_9a8,local_964);

+              ppuVar51 = (undefined **)(ulonglong)local_990;

+              if (iVar22 == 0) goto code_r0x000140273e4e;

+              p_Var58 = local_960;

+              if (local_970 == 0) {

+                if (local_9a8 - 0x200 < 0xf) {

+                  LOCK();

+                  uVar47 = *(uint *)(param_1 + 0x210);

+                  if (uVar47 == 0) {

+                    *(uint *)(param_1 + 0x210) = 0;

+                    uVar47 = 0;

+                  }

+                  UNLOCK();

+                  if ((uVar47 >> 0xf & 1) != 0) goto code_r0x000140273e4e;

+                }

+                LOCK();

+                uVar47 = *(uint *)(param_1 + 0x210);

+                if (uVar47 == 0) {

+                  *(uint *)(param_1 + 0x210) = 0;

+                  uVar47 = 0;

+                }

+                UNLOCK();

+                if ((uVar47 >> 0x14 & 1) != 0) {

+                  LOCK();

+                  *(uint *)(param_1 + 0x210) = *(uint *)(param_1 + 0x210) & 0xffefffff;

+                  UNLOCK();

+                  xxxWindowEvent(0x800b);

+                }

+                local_488.y = LStack_500;

+                local_488.x = LStack_504;

+                if (local_9a0 == (_HEAD *)0x0) {

+                  uStack_480 = 0;

+                }

+                else {

+                  uStack_480 = *(undefined8 *)local_9a0;

+                }

+                local_478 = CONCAT44(local_478._4_4_,local_96c);

+                uStack_470 = uStack_4f0;

+                local_468 = CONCAT44(local_468._4_4_,local_518._0_4_);

+                if (((local_998 != 0) && (local_9a8 != 0x200)) && (local_9a8 != 0xa0)) {

+                  local_950 = 1;

+                  iVar26 = xxxCallCtfHook(7);

+                  iVar22 = local_994;

+                  if (iVar26 != 0) goto LAB_10;

+                }

+                if (((*(uint *)(**(longlong **)(param_1 + 0x1f8) + 0x10) |

+                     *(uint *)(param_1 + 0x2d0)) >> 8 & 1) != 0) {

+                  local_950 = 1;

+                  iVar26 = xxxCallMouseHook(local_9a8);

+                  iVar22 = local_994;

+                  if (iVar26 != 0) goto LAB_10;

+                }

+                iVar22 = PsGetWin32KFilterSet();

+                if (iVar22 == 5) {

+                  ptVar34 = PtiCurrent();

+                  local_957 = *(longlong *)(*(longlong *)(ptVar34 + 0x208) + 0xf8) != 0;

+                  if (((bool)local_957) &&

+                     (lVar39 = xxxClientCallLocalMouseHooks(local_9a8), iVar22 = local_994,

+                     lVar39 != 0)) goto LAB_10;

+                }

+                if (((*(uint *)(param_1 + 0x550) >> 0xd & 1) == 0) &&

+                   ((local_96c + 2 & 0xfffffffd) == 0)) {

+                  ptVar35 = ptVar37;

+                  if (local_914 != 0) {

+                    p_Var40 = local_9a0;

+                    iVar22 = IsIndependentInputWindow((tagWND *)local_9a0);

+                    if (iVar22 != 0) {

+                      GetCompositionInputWindowUIOwner((tagWND *)p_Var40);

+                    }

+                    ptVar33 = (tagWND *)_GetTopLevelWindow();

+                    ptVar35 = (tagQMSG *)0x0;

+                    if (ptVar33 != (tagWND *)0x0) {

+                      ptVar35 = (tagQMSG *)CoreWindowProp::GetCompositeAppFrameWindowOrSelf(ptVar33)

+                      ;

+                      Win32HMOptionalThreadLock<tagWND>::Win32HMOptionalThreadLock<tagWND>

+                                (local_640,param_1,(tagWND *)ptVar35);

+                      ptVar54 = ptVar37;

+                      if (ptVar35 != (tagQMSG *)0x0) {

+                        ptVar54 = *(tagQMSG **)ptVar35;

+                      }

+                      xxxSendTransformableMessageTimeout(ptVar35,0x20,ptVar54);

+                      Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

+                                ((Win32HMThreadLockBase<tagWND,1,0> *)local_640);

+                    }

+                  }

+                  if (ptVar35 == (tagQMSG *)0x0) {

+                    ptVar35 = ptVar37;

+                    if (local_9a0 != (_HEAD *)0x0) {

+                      ptVar35 = *(tagQMSG **)local_9a0;

+                    }

+                    xxxSendTransformableMessageTimeout(local_9a0,0x20,ptVar35);

+                  }

+                  iVar22 = local_994;

+                  if (((*(tagQMSG **)(*(longlong *)(param_1 + 0x1d8) + 0x68) == ptVar31) &&

+                      (ptVar31 != (tagQMSG *)0x0)) &&

+                     (((iVar26 = IsMiPActive(param_1), iVar22 = local_994, iVar26 != 0 &&

+                       (((*(uint *)(ptVar31 + 100) & 0x400) != 0 &&

+                        (iVar26 = IsGenuineMouseInput(ptVar31 + 0x7c), iVar22 = local_994,

+                        iVar26 != 0)))) &&

+                      (iVar26 = IsMiPMouseMessage(*(undefined4 *)(ptVar31 + 0x18)),

+                      iVar22 = local_994, iVar26 != 0)))) {

+                    memset(local_248,0,0xb0);

+                    GeneratePointerMessageFromMouse

+                              (local_248,local_9a8,ptVar31,(tagWND *)local_9a0,local_998);

+                    SetMiPPromotion(*(undefined8 *)(local_9a0 + 0x10),local_230);

+                    iVar22 = local_994;

+                  }

+                  goto LAB_10;

+                }

+                p_Var58 = local_960;

+                if (*(tagQMSG **)(*(longlong *)(param_1 + 0x1d8) + 0x68) == ptVar31) {

+                  memset(&local_5a0,0,0x60);

+                  uVar74 = uStack_564;

+                  uVar73 = uStack_568;

+                  uVar72 = uStack_56c;

+                  uVar71 = local_570;

+                  uVar70 = uStack_574;

+                  uVar69 = uStack_578;

+                  uVar68 = uStack_57c;

+                  uVar67 = local_580;

+                  uVar66 = uStack_584;

+                  uVar65 = uStack_588;

+                  uVar64 = uStack_58c;

+                  uVar63 = local_590;

+                  uVar62 = uStack_594;

+                  uVar61 = uStack_598;

+                  uVar60 = uStack_59c;

+                  uVar27 = local_5a0;

+                  local_6c8 = local_5a0;

+                  uStack_6c4 = uStack_59c;

+                  uStack_6c0 = uStack_598;

+                  uStack_6bc = uStack_594;

+                  local_6b8 = local_590;

+                  uStack_6b4 = uStack_58c;

+                  uStack_6b0 = uStack_588;

+                  uStack_6ac = uStack_584;

+                  local_6a8 = local_580;

+                  uStack_6a4 = uStack_57c;

+                  uStack_6a0 = uStack_578;

+                  uStack_69c = uStack_574;

+                  local_698 = local_570;

+                  uStack_694 = uStack_56c;

+                  uStack_690 = uStack_568;

+                  uStack_68c = uStack_564;

+                  local_908 = local_560;

+                  uStack_900 = uStack_558;

+                  local_688 = local_560;

+                  uStack_680 = uStack_558;

+                  local_738 = local_550;

+                  uStack_730 = uStack_548;

+                  local_678 = local_550;

+                  uStack_670 = uStack_548;

+                  local_458 = local_538;

+                  lStack_450 = lStack_530;

+                  local_448 = local_528;

+                  uStack_440 = uStack_520;

+                  local_438 = local_518;

+                  ptStack_430 = ptStack_510;

+                  local_428 = CONCAT44(LStack_504,local_508);

+                  uStack_420 = CONCAT44(uStack_4fc,LStack_500);

+                  local_418 = local_4f8;

+                  uStack_410 = uStack_4f0;

+                  local_408 = local_4e8;

+                  uStack_400 = uStack_4e0;

+                  local_3f8 = local_4d8;

+                  ptStack_3f0 = ptStack_4d0;

+                  local_3e8 = local_4c8;

+                  uStack_3e0 = uStack_4c0;

+                  local_3d8 = local_4b8;

+                  uStack_3d0 = uStack_4b0;

+                  local_3c8 = (undefined4)local_4a8;

+                  uStack_3c4 = local_4a8._4_4_;

+                  uStack_3c0 = (undefined4)uStack_4a0;

+                  uStack_3bc = uStack_4a0._4_4_;

+                  local_3b8 = (undefined4)local_498;

+                  uStack_3b4 = local_498._4_4_;

+                  uStack_3b0 = (int)uStack_490;

+                  uStack_3ac = uStack_490._4_4_;

+                  uVar56 = uVar49;

+                  if ((ptVar31 == (tagQMSG *)0x0) || (iVar22 = IsMiPActive(param_1), iVar22 == 0)) {

+LAB_25:

+                    uVar47 = local_954;

+                    if (local_998 != 0) {

+                      lVar39 = W32GetUserSessionState();

+                      if (((int)uStack_440 == 0x200) || ((int)uStack_440 == 0xa0)) {

+                        ptVar35 = ptVar37;

+                        if (local_9a0 != (_HEAD *)0x0) {

+                          ptVar35 = *(tagQMSG **)local_9a0;

+                        }

+                        if ((ptVar35 != *(tagQMSG **)(lVar39 + 0x3fd0)) &&

+                           (iVar22 = IsGenuineMouseInput(ptVar31 + 0x7c), iVar22 != 0)) {

+                          ptVar33 = (tagWND *)

+                                    HMValidateHandleNoSecure(*(undefined8 *)(lVar39 + 0x3fd0),1);

+                          if ((ptVar33 != (tagWND *)0x0) &&

+                             ((iVar22 = IsMiPActive(*(undefined8 *)(ptVar33 + 0x10),0), iVar22 != 0

+                              && (_Var36 = GetMiPWindowFlags(ptVar33), (_Var36 & 1) == 0)))) {

+                            ptVar34 = *(tagTHREADINFO **)(ptVar33 + 0x10);

+                            if (ptVar34 == param_1) {

+                              lVar41 = *(longlong *)(param_1 + 0x600);

+                              uVar2 = *(undefined8 *)(lVar41 + 0x18);

+                              uVar6 = *(undefined8 *)(lVar41 + 0x20);

+                              uVar7 = *(undefined8 *)(lVar41 + 0x28);

+                              uVar8 = *(undefined8 *)(lVar41 + 0x30);

+                              uVar9 = *(undefined8 *)(lVar41 + 0x38);

+                              uVar10 = *(undefined8 *)(lVar41 + 0x40);

+                              uVar11 = *(undefined8 *)(lVar41 + 0x48);

+                              uVar12 = *(undefined8 *)(lVar41 + 0x50);

+                              uVar13 = *(undefined8 *)(lVar41 + 0x58);

+                              uVar14 = *(undefined8 *)(lVar41 + 0x60);

+                              uVar15 = *(undefined8 *)(lVar41 + 0x68);

+                              uVar16 = *(undefined8 *)(lVar41 + 0x70);

+                              if (uVar56 != 0) {

+                                *(uint *)(lVar41 + 0x18) = uVar27;

+                                *(uint *)(lVar41 + 0x1c) = uVar60;

+                                *(uint *)(lVar41 + 0x20) = uVar61;

+                                *(uint *)(lVar41 + 0x24) = uVar62;

+                                *(uint *)(lVar41 + 0x28) = uVar63;

+                                *(uint *)(lVar41 + 0x2c) = uVar64;

+                                *(uint *)(lVar41 + 0x30) = uVar65;

+                                *(uint *)(lVar41 + 0x34) = uVar66;

+                                *(uint *)(lVar41 + 0x38) = uVar67;

+                                *(uint *)(lVar41 + 0x3c) = uVar68;

+                                *(uint *)(lVar41 + 0x40) = uVar69;

+                                *(uint *)(lVar41 + 0x44) = uVar70;

+                                *(uint *)(lVar41 + 0x48) = uVar71;

+                                *(uint *)(lVar41 + 0x4c) = uVar72;

+                                *(uint *)(lVar41 + 0x50) = uVar73;

+                                *(uint *)(lVar41 + 0x54) = uVar74;

+                                *(ulonglong *)(lVar41 + 0x58) = local_908;

+                                *(undefined8 *)(lVar41 + 0x60) = uStack_900;

+                                *(undefined8 *)(lVar41 + 0x68) = local_738;

+                                *(undefined8 *)(lVar41 + 0x70) = uStack_730;

+                                lVar41 = *(longlong *)(param_1 + 0x600);

+                              }

+                              local_5d8 = *(undefined8 *)ptVar33;

+                              local_5d0 = 0x24a;

+                              uVar50 = (ulonglong)((*(uint *)(lVar41 + 0x24) & 0xffffe1f7) << 0x10)

+                                       | 1;

+                              local_5c0 = 0;

+                              uStack_5b8 = 0;

+                              local_5b0 = 0;

+                              local_5c8 = uVar50;

+                              Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+                                        (local_650,(tagMENU *)ptVar33);

+                              FindTimer(ptVar33,0xfff3,2);

+                              iVar22 = IsMiPEnabledForWindow(ptVar33);

+                              if (iVar22 != 0) {

+                                xxxSendTransformableMessageTimeout(extraout_XMM0_Da,0x24a,uVar50,0);

+                              }

+                              if (uVar56 != 0) {

+                                lVar41 = *(longlong *)(param_1 + 0x600);

+                                *(undefined8 *)(lVar41 + 0x18) = uVar2;

+                                *(undefined8 *)(lVar41 + 0x20) = uVar6;

+                                *(undefined8 *)(lVar41 + 0x28) = uVar7;

+                                *(undefined8 *)(lVar41 + 0x30) = uVar8;

+                                *(undefined8 *)(lVar41 + 0x38) = uVar9;

+                                *(undefined8 *)(lVar41 + 0x40) = uVar10;

+                                *(undefined8 *)(lVar41 + 0x48) = uVar11;

+                                *(undefined8 *)(lVar41 + 0x50) = uVar12;

+                                *(undefined8 *)(lVar41 + 0x58) = uVar13;

+                                *(undefined8 *)(lVar41 + 0x60) = uVar14;

+                                *(undefined8 *)(lVar41 + 0x68) = uVar15;

+                                *(undefined8 *)(lVar41 + 0x70) = uVar16;

+                              }

+                              Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+                                        ((Win32HMThreadLockBase<tagWND,0,0> *)local_650);

+                              ptVar31 = local_938;

+                            }

+                            else {

+                              PostEventMessageEx(ptVar34,*(tagQ **)(ptVar34 + 0x1d8),0x15,ptVar33,0,

+                                                 0,0,(tagINPUT_MESSAGE_SOURCE *)0x0);

+                            }

+                          }

+                          if (local_954 == 0) {

+                            *(undefined8 *)(lVar39 + 0x3fd0) = 0;

+                          }

+                          else {

+                            ptVar35 = ptVar37;

+                            if (local_9a0 != (_HEAD *)0x0) {

+                              ptVar35 = *(tagQMSG **)local_9a0;

+                            }

+                            *(tagQMSG **)(lVar39 + 0x3fd0) = ptVar35;

+                          }

+                        }

+                      }

+                      if (local_954 == 0) {

+                        if (uVar57 == 1) {

+                          *(uint *)(*(longlong *)(param_1 + 0x1d8) + 0xb0) = (uint)uStack_520;

+                          *(short *)(*(longlong *)(param_1 + 0x1d8) + 0xb4) =

+                               (short)((ulonglong)local_518 >> 0x10);

+                          lVar39 = W32GetUserSessionState();

+                          *(uint *)(*(longlong *)(param_1 + 0x1d8) + 0xb8) =

+                               local_508 + *(int *)(lVar39 + 0x3978);

+                          ptVar35 = ptVar37;

+                          if (local_9a0 != (_HEAD *)0x0) {

+                            ptVar35 = *(tagQMSG **)local_9a0;

+                          }

+                          *(tagQMSG **)(*(longlong *)(param_1 + 0x1d8) + 0xc0) = ptVar35;

+                          *(ulonglong *)(*(longlong *)(param_1 + 0x1d8) + 200) =

+                               CONCAT44(LStack_500,LStack_504);

+                        }

+                        else if (uVar57 == 2) {

+                          *(undefined4 *)(*(longlong *)(param_1 + 0x1d8) + 0xb8) = 0;

+                        }

+                      }

+                      uVar47 = local_954;

+                      ptVar35 = (tagQMSG *)&local_458;

+                      if (local_954 == 0) {

+                        ptVar35 = (tagQMSG *)&local_538;

+                      }

+                      iVar26 = xxxMouseActivate(param_1,(tagWND *)local_9a0,ptVar35,local_96c);

+                      iVar22 = local_994;

+                      if (iVar26 == 1) goto LAB_10;

+                    }

+                  }

+                  else {

+                    uStack_440 = CONCAT44(uStack_440._4_4_,local_9a8);

+                    local_438 = local_978;

+                    if ((*(uint *)(ptVar31 + 100) & 0x400) == 0) {

+                      uVar47 = local_954;

+                      if (local_998 != 0) {

+                        iVar22 = IsMiPMouseMessage(*(undefined4 *)(ptVar31 + 0x18));

+                        if (iVar22 != 0) {

+                          iVar22 = IsGenuineMouseInput(ptVar31 + 0x7c);

+                          if ((((iVar22 != 0) && (*(uint **)(param_1 + 0x600) != (uint *)0x0)) &&

+                              (uVar47 = **(uint **)(param_1 + 0x600), (uVar47 & 2) == 0)) &&

+                             ((uVar47 & 4) == 0)) goto LAB_15;

+                          puVar1 = *(uint **)(param_1 + 0x600);

+                          if (puVar1 != (uint *)0x0) {

+                            *puVar1 = *puVar1 & 0xfffffffd;

+                          }

+                        }

+                        goto LAB_25;

+                      }

+                    }

+                    else {

+                      memset(&local_3a8,0,0xb0);

+                      bVar59 = ShouldGenerateMipMessage

+                                         (param_1,ptVar31,(tagWND *)local_9a0,local_998);

+                      uVar56 = 0;

+                      if (bVar59) {

+                        puVar1 = *(uint **)(param_1 + 0x600);

+                        uVar56 = 0;

+                        if ((puVar1 != (uint *)0x0) && (uVar56 = 0, (*puVar1 & 1) != 0)) {

+                          uVar27 = puVar1[6];

+                          uVar60 = puVar1[7];

+                          uVar61 = puVar1[8];

+                          uVar62 = puVar1[9];

+                          uVar63 = puVar1[10];

+                          uVar64 = puVar1[0xb];

+                          uVar65 = puVar1[0xc];

+                          uVar66 = puVar1[0xd];

+                          uVar67 = puVar1[0xe];

+                          uVar68 = puVar1[0xf];

+                          uVar69 = puVar1[0x10];

+                          uVar70 = puVar1[0x11];

+                          uVar71 = puVar1[0x12];

+                          uVar72 = puVar1[0x13];

+                          uVar73 = puVar1[0x14];

+                          uVar74 = puVar1[0x15];

+                          local_908 = *(ulonglong *)(puVar1 + 0x16);

+                          uStack_900 = *(undefined8 *)(puVar1 + 0x18);

+                          local_738 = *(undefined8 *)(puVar1 + 0x1a);

+                          uStack_730 = *(undefined8 *)(puVar1 + 0x1c);

+                          uVar56 = 1;

+                          local_6c8 = uVar27;

+                          uStack_6c4 = uVar60;

+                          uStack_6c0 = uVar61;

+                          uStack_6bc = uVar62;

+                          local_6b8 = uVar63;

+                          uStack_6b4 = uVar64;

+                          uStack_6b0 = uVar65;

+                          uStack_6ac = uVar66;

+                          local_6a8 = uVar67;

+                          uStack_6a4 = uVar68;

+                          uStack_6a0 = uVar69;

+                          uStack_69c = uVar70;

+                          local_698 = uVar71;

+                          uStack_694 = uVar72;

+                          uStack_690 = uVar73;

+                          uStack_68c = uVar74;

+                          local_688 = local_908;

+                          uStack_680 = uStack_900;

+                          local_678 = local_738;

+                          uStack_670 = uStack_730;

+                        }

+                        iVar22 = GeneratePointerMessageFromMouse

+                                           ((tagQMSG *)&local_3a8,local_9a8,ptVar31,

+                                            (tagWND *)local_9a0,local_998);

+                        if (iVar22 != 0) {

+                          local_538 = local_3a8;

+                          lStack_530 = lStack_3a0;

+                          uStack_520 = CONCAT44(uStack_38c,iStack_390);

+                          local_528 = local_398;

+                          local_518 = local_388;

+                          ptStack_510 = ptStack_380;

+                          local_508 = (uint)local_378;

+                          LStack_504 = (LONG)((ulonglong)local_378 >> 0x20);

+                          LStack_500 = (LONG)uStack_370;

+                          uStack_4fc = (undefined4)((ulonglong)uStack_370 >> 0x20);

+                          local_4f8 = local_368;

+                          uStack_4f0 = uStack_360;

+                          local_4e8 = local_358;

+                          uStack_4e0 = uStack_350;

+                          local_4d8 = local_348;

+                          ptStack_4d0 = ptStack_340;

+                          local_4c8 = local_338;

+                          uStack_4c0 = uStack_330;

+                          local_4b8 = uStack_328;

+                          uStack_4b0 = uStack_320;

+                          local_4a8 = CONCAT44(uStack_314,uStack_318);

+                          uStack_4a0 = CONCAT44(uStack_30c,uStack_310);

+                          local_498 = CONCAT44(uStack_304,uStack_308);

+                          uStack_490 = CONCAT44(uStack_2fc,uStack_300);

+                          local_954 = 1;

+                          iVar22 = iStack_390;

+                          if ((iStack_390 == 0x246) &&

+                             (p_Var40 = local_9a0, iVar26 = IsMiPEnabledForWindow(), iVar26 != 0)) {

+                            ptVar35 = ptVar37;

+                            if (p_Var40 != (_HEAD *)0x0) {

+                              ptVar35 = *(tagQMSG **)local_9a0;

+                            }

+                            *(tagQMSG **)(*(longlong *)(param_1 + 0x1d8) + 0x238) = ptVar35;

+                          }

+                          else if ((iVar22 - 0x243U & 0xfffffffb) == 0) {

+                            *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x238) = 0;

+                          }

+                        }

+                      }

+                      uVar47 = local_954;

+                      if (local_998 != 0) {

+                        *(uint *)(ptVar31 + 100) = *(uint *)(ptVar31 + 100) & 0xfffffbff;

+                        goto LAB_25;

+                      }

+                    }

+                  }

+                  if ((((local_998 != 0) &&

+                       (xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1), local_998 != 0)) &&

+                      (local_950 != 0)) &&

+                     (((*(uint *)(**(longlong **)(param_1 + 0x1f8) + 0x10) |

+                       *(uint *)(param_1 + 0x2d0)) & 0x40) != 0)) {

+                    xxxCallHook(6,(ulonglong)local_9a8,(__int64)&local_488,5);

+                  }

+                  local_950 = 0;

+                  local_980 = (tagPOINT *)

+                              (longlong)CONCAT22((undefined2)local_988.y,(undefined2)local_988.x);

+                  if (0x1ff < local_9a8) {

+                    uVar27 = GetMouseKeyFlags(*(undefined8 *)(param_1 + 0x1d8));

+                    local_978 = (undefined1 *)(ulonglong)uVar27;

+                  }

+                  if (((local_9a8 - 0xab < 3) || (local_9a8 - 0x20b < 3)) && (uVar47 == 0)) {

+                    local_978 = (undefined1 *)((ulonglong)local_978 | (ulonglong)local_518);

+                  }

+                  ptVar4 = *(tagMENUSTATE **)(param_1 + 0x288);

+                  if (((local_96c == 5) && (local_998 != 0)) &&

+                     ((ptVar4 != (tagMENUSTATE *)0x0 &&

+                      ((((*(uint *)(ptVar4 + 8) & 0x100) != 0 && (*(uint **)ptVar4 != (uint *)0x0))

+                       && ((**(uint **)ptVar4 & 1) != 0)))))) {

+                    MenuStateOwnerLockxxxUnlock::MenuStateOwnerLockxxxUnlock(local_868,ptVar4);

+                    iVar22 = xxxCallHandleMenuMessages(ptVar4,local_9a0,local_9a8);

+                    if (iVar22 != 0) {

+                      MenuStateOwnerLockxxxUnlock::~MenuStateOwnerLockxxxUnlock(local_868);

+                      goto LAB_1;

+                    }

+                    MenuStateOwnerLockxxxUnlock::~MenuStateOwnerLockxxxUnlock(local_868);

+                  }

+                  uVar27 = local_964;

+                  if (uVar47 == 0) goto LAB_9;

+                  goto LAB_17;

+                }

+              }

+              goto LAB_8;

+            }

+            if ((uint)uStack_520 != 0x11b) {

+              if ((uint)uStack_520 == 0x23) {

+                local_978 = (undefined1 *)0x0;

+                local_980 = ptStack_510;

+                if ((local_9a0 == (_HEAD *)0x0) ||

+                   (p_Var3 = *(_W32THREAD **)(local_9a0 + 0x10), p_Var3 == (_W32THREAD *)param_1)) {

+                  iVar22 = MiPCheckMsgFilter(ptVar31,0x23,local_964,param_5);

+                  p_Var58 = local_960;

+                  if (iVar22 != 0) goto LAB_26;

+                }

+                else {

+                  if (*(longlong *)(p_Var3 + 0x1d8) != *(longlong *)(param_1 + 0x1d8))

+                  goto LAB_10;

+                  if (local_960 == (_W32THREAD *)0x0) {

+                    Win32RawLockedW32Thread::Exchange(local_768,p_Var3);

+                    <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&local_858,p_Var3);

+                    p_Var58 = p_Var3;

+                  }

+                }

+                goto LAB_8;

+              }

+              if ((uint)uStack_520 == 0xfe) goto LAB_18;

+              if ((uint)uStack_520 == 0xff) {

+                local_978 = local_518;

+                local_980 = ptStack_510;

+                bVar59 = DeleteHidDataIfAlreadyHandledByGRIB(param_1,(__int64)ptStack_510);

+                iVar22 = local_994;

+                if (bVar59) goto LAB_10;

+                local_9a0 = (_HEAD *)0x0;

+                ptVar35 = ptVar37;

+                if ((local_980 != (tagPOINT *)0x0) &&

+                   (ptVar35 = (tagQMSG *)HMValidateHandleNoSecure(local_980,0x12),

+                   ptVar35 != (tagQMSG *)0x0)) {

+                  local_9a0 = *(_HEAD **)(ptVar35 + 0x18);

+                }

+                if (local_9a0 == (_HEAD *)0x0) {

+                  local_9a0 = *(_HEAD **)(*(longlong *)(param_1 + 0x1d8) + 0x88);

+                  if ((local_9a0 == (_HEAD *)0x0) &&

+                     (local_9a0 = *(_HEAD **)(*(longlong *)(param_1 + 0x1d8) + 0x90),

+                     local_9a0 == (_HEAD *)0x0)) {

+                    InputTraceLogging::RawInput::SSQResult(local_980,0);

+                    iVar22 = local_994;

+                    goto LAB_10;

+                  }

+                }

+                if ((ptVar35 != (tagQMSG *)0x0) &&

+                   (*(longlong *)(ptVar35 + 0x10) != *(longlong *)(local_9a0 + 0x10))) {

+                  local_8d4 = 0x20000;

+                  MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x2809);

+                }

+                Win32HM_ExchangeThreadLock<1>(local_9a0,(_Win32HMThreadLockItem *)local_8c8);

+                iVar22 = CheckCrossThreadInput

+                                   ((tagWND *)local_9a0,ptVar31,(int *)&local_970,(int *)&local_998,

+                                    local_930);

+                if (iVar22 != 0) {

+                  SVar42 = 0;

+LAB_27:

+                  InputTraceLogging::RawInput::SSQResult(local_980,SVar42);

+                  p_Var58 = local_960;

+                  goto LAB_8;

+                }

+                if (local_970 != 0) {

+                  iVar22 = local_994;

+                  if (*(longlong *)(*(longlong *)(local_9a0 + 0x10) + 0x1d8) !=

+                      *(longlong *)(param_1 + 0x1d8)) goto LAB_10;

+                  iVar22 = IsInsideMenuLoop(param_1);

+                  if (iVar22 == 0) {

+                    if (*(longlong *)(param_1 + 0x2c8) == 0) {

+                      puVar43 = (undefined8 *)0x0;

+                    }

+                    else {

+                      puVar43 = *(undefined8 **)(*(longlong *)(param_1 + 0x2c8) + 0x10);

+                    }

+                  }

+                  else {

+                    puVar43 = *(undefined8 **)(**(longlong **)(param_1 + 0x288) + 8);

+                  }

+                  if (puVar43 != (undefined8 *)0x0) {

+                    InputTraceLogging::RawInput::IgnoreModalLoop(local_980,(HWND__ *)*puVar43);

+                  }

+                  if (local_8f8 == (_W32THREAD *)0x0) {

+                    p_Var58 = *(_W32THREAD **)(local_9a0 + 0x10);

+                    local_8f8 = p_Var58;

+                    Win32RawLockedW32Thread::Exchange(local_6f8,p_Var58);

+                    <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&local_858,p_Var58);

+                  }

+                }

+                if ((local_964 == 0) && (param_5 == 0xffffffff)) {

+LAB_28:

+                  iVar22 = CheckPwndFilter(local_9a0,local_920);

+                  if (iVar22 != 0) {

+                    if (local_970 == 0) {

+                      if (local_998 != 0) {

+                        xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+                      }

+                      InputTraceLogging::RawInput::SSQResult(local_980,4);

+                      goto LAB_9;

+                    }

+                    SVar42 = 3;

+                    goto LAB_27;

+                  }

+                }

+                else {

+                  if (param_5 < local_964) {

+                    if ((param_5 < 0x100) && (0xfe < local_964)) {

+LAB_29:

+                      uVar47 = uVar49;

+                    }

+                    else {

+                      uVar47 = 1;

+                    }

+                  }

+                  else if ((0xff < local_964) || (uVar47 = 1, param_5 < 0xff)) goto LAB_29;

+                  if (uVar47 != 0) goto LAB_28;

+                }

+                InputTraceLogging::RawInput::SSQResult(local_980,2);

+                goto LAB_2;

+              }

+              if ((uint)uStack_520 == 0x100) {

+LAB_30:

+                local_918 = 1;

+                LOCK();

+                uVar47 = *(uint *)(param_1 + 0x210);

+                if (uVar47 == 0) {

+                  *(uint *)(param_1 + 0x210) = 0;

+                  uVar47 = 0;

+                }

+                UNLOCK();

+                if (((uVar47 & 0x400) != 0) &&

+                   (lVar23 = CheckProcessForeground(param_1), p_Var58 = local_960, lVar23 < 0))

+                goto LAB_8;

+                local_978 = (undefined1 *)((ulonglong)local_518 & 0xff);

+                if ((local_998 == 0) || ((local_4d8 & 0x800000000000) == 0)) {

+                  if (local_978 != (undefined1 *)0x12) {

+                    *(uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214) =

+                         *(uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214) & 0xfffffff3;

+                  }

+                  bVar45 = *(byte *)(*(longlong *)(param_1 + 0x1d8) + 0x17c);

+                  if (local_978 == (undefined1 *)0x2c) {

+                    if ((bVar45 & 0x10) == 0) {

+LAB_31:

+                      if ((*(uint *)(param_1 + 0x39c) & 0x20) != 0) goto LAB_32;

+                    }

+                    else if ((*(uint *)(param_1 + 0x39c) & 0x10) != 0) {

+                      if ((bVar45 & 0x10) != 0) goto LAB_32;

+                      goto LAB_31;

+                    }

+                    xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+                    if (((bVar45 & 0x10) == 0) && (((uint)ptStack_510 & 0xff0000) != 0x10000)) {

+                      ptVar33 = *(tagWND **)

+                                 (*(longlong *)(*(longlong *)(param_1 + 0x1f0) + 8) + 0x18);

+LAB_33:

+                      bVar59 = ptVar33 == (tagWND *)0x0;

+                    }

+                    else {

+                      bVar59 = *(tagWND **)(*(longlong *)(param_1 + 0x1d8) + 0x90) == (tagWND *)0x0;

+                      ptVar33 = (tagWND *)0x0;

+                      if (!bVar59) {

+                        ptVar33 = CoreWindowProp::GetCompositeAppFrameWindowOrSelf

+                                            (*(tagWND **)(*(longlong *)(param_1 + 0x1d8) + 0x90));

+                        goto LAB_33;

+                      }

+                    }

+                    if (!bVar59) {

+                      bVar59 = (int)local_4b8 != 1;

+                      Win32HMThreadLockAlways<tagHOOK>::Win32HMThreadLockAlways<tagHOOK>

+                                (local_620,param_1,(tagHOOK *)ptVar33);

+                      xxxSnapWindow(ptVar33,bVar59);

+                      Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+                                ((Win32HMThreadLockBase<tagWND,0,0> *)local_620);

+                    }

+                    goto LAB_1;

+                  }

+LAB_32:

+                  lVar39 = W32GetUserSessionState();

+                  if ((*(int *)(lVar39 + 0x3fb0) != 0) &&

+                     ((lVar39 = W32GetUserSessionState(), *(int *)(lVar39 + 0x396c) == 0 ||

+                      (lVar39 = W32GetUserSessionState(), (*(byte *)(lVar39 + 0x3968) & 2) == 0))))

+                  {

+                    bVar45 = *(byte *)(*(longlong *)(param_1 + 0x1d8) + 0x17c);

+                    uVar47 = (uint)local_978 | 0x400;

+                    if ((bVar45 & 0x10) == 0) {

+                      uVar47 = (uint)local_978;

+                    }

+                    uVar27 = uVar47 | 0x200;

+                    if ((bVar45 & 4) == 0) {

+                      uVar27 = uVar47;

+                    }

+                    uVar47 = uVar27 | 0x100;

+                    if ((bVar45 & 1) == 0) {

+                      uVar47 = uVar27;

+                    }

+                    lVar39 = HotKeyToWindow(uVar47);

+                    if ((lVar39 != 0) &&

+                       (*(longlong *)(param_1 + 0x1f0) ==

+                        *(longlong *)(*(longlong *)(lVar39 + 0x10) + 0x1f0))) {

+                      _PostTransformableMessage

+                                (*(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x90),0x112,0xf150

+                                );

+                      goto LAB_15;

+                    }

+                  }

+                }

+                if (local_978 == (undefined1 *)0xe7) {

+                  *(short *)(param_1 + 0x39a) = (short)((ulonglong)local_518 >> 0x10);

+                  local_518 = (undefined1 *)0xe7;

+                }

+LAB_34:

+                local_978 = (undefined1 *)((ulonglong)local_518 & 0xff);

+                if (local_978 == (undefined1 *)0xe7) {

+                  local_518 = (undefined1 *)0xe7;

+                }

+                if ((((((local_998 == 0) || ((local_4d8 & 0x800000000000) == 0)) &&

+                      (lVar39 = W32GetUserSessionState(), *(int *)(lVar39 + 0x37c0) != 0)) &&

+                     ((uVar47 = GetAppImeCompatFlags(0), (uVar47 >> 0x17 & 1) == 0 &&

+                      ((char)((ulonglong)ptStack_510 >> 0x10) == ')')))) && (local_998 != 0)) &&

+                   (((lVar39 = *(longlong *)(param_1 + 0x1d8),

+                     (*(byte *)(lVar39 + 0x17c) & 0x15) == 0 &&

+                     ((*(byte *)(lVar39 + 0x18e) & 0x40) == 0)) &&

+                    (((*(byte *)(lVar39 + 399) & 1) == 0 &&

+                     (((local_9a0 = *(_HEAD **)(lVar39 + 0x88), local_9a0 == (_HEAD *)0x0 &&

+                       (local_9a0 = *(_HEAD **)(lVar39 + 0x90), local_9a0 == (_HEAD *)0x0)) ||

+                      (*(tagTHREADINFO **)((longlong)local_9a0 + 0x10) == param_1)))))))) {

+                  xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+                  if ((local_918 == 0) && (local_9a0 != (_HEAD *)0x0)) {

+                    local_608 = *(undefined8 *)local_9a0;

+                    local_600 = 0x50;

+                    local_5f8 = 0;

+                    uStack_5f0 = 0;

+                    local_5e8 = 0;

+                    uStack_5e0 = 0;

+                    xxxCallCtfHook(3,0,1);

+                  }

+                  goto LAB_1;

+                }

+                if (local_978 == (undefined1 *)0x79) {

+                  local_9a8 = local_9a8 | 4;

+                }

+                if (((*(byte *)(*(longlong *)(param_1 + 0x1d8) + 0x17c) & 4) != 0) &&

+                   (local_978 == (undefined1 *)0x1b)) {

+                  local_9a8 = local_9a8 | 4;

+                }

+                LOCK();

+                uVar47 = *(uint *)(param_1 + 0x210);

+                if (uVar47 == 0) {

+                  *(uint *)(param_1 + 0x210) = 0;

+                  uVar47 = 0;

+                }

+                UNLOCK();

+                if ((uVar47 & 8) == 0) {

+                  ptStack_510 = (tagPOINT *)((ulonglong)ptStack_510 & 0xfffffffffdffffff);

+                }

+              }

+              else {

+                if ((uint)uStack_520 == 0x101) goto LAB_34;

+                if ((uint)uStack_520 != 0x102) {

+                  if ((uint)uStack_520 == 0x104) goto LAB_30;

+                  if ((uint)uStack_520 != 0x105) {

+                    if ((uint)uStack_520 != 0x119) goto LAB_6;

+                    goto LAB_19;

+                  }

+                  goto LAB_34;

+                }

+              }

+              local_978 = (undefined1 *)((ulonglong)local_518 & 0xff);

+              lVar39 = *(longlong *)(param_1 + 0x1d8);

+              local_9a0 = *(_HEAD **)(lVar39 + 0x88);

+              if (*(longlong *)(lVar39 + 0x88) == 0) {

+                local_9a0 = *(_HEAD **)(lVar39 + 0x90);

+                iVar22 = local_994;

+                if (local_9a0 == (_HEAD *)0x0) goto LAB_10;

+                if (local_9a8 - 0x100 < 4) {

+                  local_9a8 = local_9a8 + 4;

+                }

+              }

+              Win32HM_ExchangeThreadLock<1>(local_9a0,(_Win32HMThreadLockItem *)local_8c8);

+              local_970 = (uint)(*(tagTHREADINFO **)(local_9a0 + 0x10) != local_8d0);

+              if (*(tagTHREADINFO **)(local_9a0 + 0x10) != local_8b0) {

+                iVar22 = local_994;

+                if (*(longlong *)(*(longlong *)(local_9a0 + 0x10) + 0x1d8) !=

+                    *(longlong *)(param_1 + 0x1d8)) goto LAB_10;

+                ptVar34 = local_8d0;

+                iVar22 = IsInsideMenuLoop(param_1);

+                if (iVar22 == 0) {

+                  if (*(longlong *)(param_1 + 0x2c8) == 0) {

+                    p_Var40 = (_HEAD *)0x0;

+                  }

+                  else {

+                    p_Var40 = *(_HEAD **)(*(longlong *)(param_1 + 0x2c8) + 0x10);

+                  }

+                }

+                else {

+                  p_Var40 = *(_HEAD **)(**(longlong **)(param_1 + 0x288) + 8);

+                }

+                if (p_Var40 != (_HEAD *)0x0) {

+                  local_970 = (uint)(*(tagTHREADINFO **)(p_Var40 + 0x10) != ptVar34);

+                  Win32HM_ExchangeThreadLock<1>(p_Var40,(_Win32HMThreadLockItem *)local_8c8);

+                  local_9a0 = p_Var40;

+                }

+                if (local_8e0 == (_W32THREAD *)0x0) {

+                  p_Var58 = *(_W32THREAD **)(local_9a0 + 0x10);

+                  local_8e0 = p_Var58;

+                  Win32RawLockedW32Thread::Exchange(local_780,p_Var58);

+                  <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()

+                            (&local_858,p_Var58,local_9a0);

+                }

+              }

+              if ((local_964 != 0) || (param_5 != 0xffffffff)) {

+                if (param_5 < local_964) {

+                  if ((local_9a8 < param_5) || (local_964 < local_9a8)) {

+                    uVar47 = 1;

+                  }

+                  else {

+LAB_35:

+                    uVar47 = uVar49;

+                  }

+                }

+                else if ((local_9a8 < local_964) || (uVar47 = 1, param_5 < local_9a8))

+                goto LAB_35;

+                ppuVar51 = (undefined **)(ulonglong)local_990;

+                if (uVar47 == 0) goto code_r0x000140273e4e;

+              }

+              iVar22 = CheckPwndFilter(local_9a0,local_920);

+              ppuVar51 = (undefined **)(ulonglong)local_990;

+              if (iVar22 != 0) {

+                p_Var58 = local_960;

+                if (local_970 != 0) goto LAB_8;

+                if (local_998 != 0) {

+                  if ((local_4d8 & 0x800000000000) == 0) {

+                    if ((local_998 != 0) && (iVar22 = IsInsideMenuLoop(), iVar22 == 0)) {

+                      if ((local_978 == (undefined1 *)0x5d) && (local_9a8 == 0x101)) {

+                        ppuVar51 = (undefined **)ptVar37;

+                        if (local_9a0 != (_HEAD *)0x0) {

+                          ppuVar51 = (undefined **)*(tagQMSG **)local_9a0;

+                        }

+                        _PostTransformableMessage(local_9a0,0x7b);

+                      }

+                      if ((local_978 == &DAT_36) && (local_9a8 == 0x100)) {

+                        ppuVar51 = (undefined **)0x0;

+                        _PostTransformableMessageExtended

+                                  ((tagWND *)local_9a0,0x4d,0,0,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

+                      }

+                    }

+                    goto LAB_37;

+                  }

+                  goto LAB_38;

+                }

+LAB_37:

+                if (local_978 == &DAT_39) {

+                  uVar50 = (ulonglong)ptStack_510 & 0x1000000;

+                  if (((local_918 != 0) ||

+                      (((-(((ulonglong)ptStack_510 & 0x1000000) != 0) & 0xfdU) + 4 &

+                       *(byte *)(*(longlong *)(param_1 + 0x1d8) + 0x1a0)) == 0)) ||

+                     (iVar22 = IsDesktopApp(*(undefined8 *)(param_1 + 0x1d0)), iVar22 == 0))

+                  goto LAB_40;

+                  LOCK();

+                  uVar47 = *(uint *)(param_1 + 0x210);

+                  if (uVar47 == 0) {

+                    *(uint *)(param_1 + 0x210) = 0;

+                    uVar47 = 0;

+                  }

+                  UNLOCK();

+                  if ((uVar47 & 8) != 0) goto LAB_40;

+                  local_518 = (undefined1 *)((ulonglong)(uVar50 != 0) + 0xa0);

+LAB_15:

+                  xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+                  goto LAB_1;

+                }

+LAB_40:

+                local_8d8 = (uint)*(byte *)((ulonglong)((byte)local_978 >> 2) + 0x178 +

+                                           *(longlong *)(param_1 + 0x1d8)) &

+                            1 << ((byte)local_978 & 3) * '\x02';

+                if (local_8d8 == 0) {

+LAB_38:

+                  if (local_998 != 0) {

+                    if ((((local_4d8 & 0x800000000000) == 0) && (ptVar31 != (tagQMSG *)0x0)) &&

+                       ((*(uint *)(param_1 + 0x550) >> 0x1c & 1) != 0)) {

+                      ppuVar51 = (undefined **)0x0;

+                      local_940 = xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,0);

+                    }

+                    else {

+                      ppuVar51 = (undefined **)0x1;

+                      xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+                    }

+                  }

+                }

+                else if (local_998 != 0) {

+                  if (ptVar31 != (tagQMSG *)0x0) {

+                    *(ulonglong *)(ptVar31 + 0x28) = *(ulonglong *)(ptVar31 + 0x28) | 0x40000000;

+                  }

+                  goto LAB_38;

+                }

+                ptVar35 = local_940;

+                local_980 = ptStack_510;

+                local_978 = local_518;

+                if (local_8d8 != 0) {

+                  local_980 = (tagPOINT *)((ulonglong)ptStack_510 | 0x40000000);

+                }

+                if ((local_9a8 == 0x101) || (local_9a8 == 0x105)) {

+                  local_980 = (tagPOINT *)((ulonglong)local_980 | 0x80000000);

+                }

+                lVar39 = *(longlong *)(param_1 + 0x1d8);

+                if ((*(byte *)(lVar39 + 0x17c) & 0x10) != 0) {

+                  local_980 = (tagPOINT *)((ulonglong)local_980 | 0x20000000);

+                }

+                iVar22 = IsMenuStarted(param_1);

+                if (iVar22 != 0) {

+                  local_980 = (tagPOINT *)((ulonglong)local_980 | 0x10000000);

+                }

+                if ((*(uint *)(lVar39 + 0x214) & 0x4000) != 0) {

+                  local_980 = (tagPOINT *)((ulonglong)local_980 | 0x8000000);

+                }

+                if (((local_8a8 == 0) &&

+                    (lVar39 = W32GetUserSessionState(), *(longlong *)(lVar39 + 0x3288) == 0)) ||

+                   ((local_4d8 & 0x800000000000) != 0)) {

+LAB_41:

+                  uVar24 = local_94c;

+                  if (((local_998 != 0) && ((local_4d8 & 0x800000000000) != 0)) &&

+                     (local_948 = local_94c, (local_4d8._4_4_ >> 0x1a & 1) != 0)) {

+                    uVar24 = 2;

+                    local_94c = uVar24;

+                    local_948 = uVar24;

+                  }

+                }

+                else {

+                  uVar24 = local_94c;

+                  if (local_998 != 0) {

+                    iVar22 = IsMenuStarted(param_1);

+                    if (iVar22 == 0) {

+                      LOCK();

+                      uVar47 = *(uint *)(param_1 + 0x210);

+                      if (uVar47 == 0) {

+                        *(uint *)(param_1 + 0x210) = 0;

+                        uVar47 = 0;

+                      }

+                      UNLOCK();

+                      if (((uVar47 >> 0x19 & 1) == 0) && (local_9a0 != (_HEAD *)0x0)) {

+                        puVar38 = local_978;

+                        if (local_978 == (undefined1 *)0xe7) {

+                          puVar38 = (undefined1 *)

+                                    ((ulonglong)*(ushort *)(param_1 + 0x39a) << 0x10 | 0xe7);

+                        }

+                        tagTHREADINFO::UpdateInputSource

+                                  (param_1,(tagINPUT_MESSAGE_SOURCE *)((longlong)&uStack_4c0 + 4));

+                        Win32RawOptionalLockedItem<tagQMSG,0>::Win32RawOptionalLockedItem<tagQMSG,0>

+                                  (local_798);

+                        if (ptVar35 != (tagQMSG *)0x0) {

+                          Win32RawLockedItemBase<tagQMSG,0,1,1,1>::ManualLock<void>

+                                    ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)local_798,ptVar35,

+                                     (_func_void_void_ptr *)ppuVar51);

+                        }

+                        ppuVar51 = (undefined **)(ulonglong)local_9a8;

+                        uVar24 = xxxImmProcessKey(*(tagQ **)(param_1 + 0x1d8),(tagWND *)local_9a0,

+                                                  local_9a8,(__uint64)puVar38,(__int64)local_980);

+                        local_94c = uVar24;

+                        local_948 = uVar24;

+                        if ((uVar24 & 0x11) != 0) {

+                          if (ptVar35 != (tagQMSG *)0x0) {

+                            Win32RawLockedItemBase<tagQMSG,0,1,1,1>::UnlockWorker

+                                      ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)local_798,false,

+                                       true);

+                            local_940 = (tagQMSG *)0x0;

+                          }

+                          Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                          ::

+                          ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                                    ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                                      *)local_798);

+                          iVar22 = local_994;

+                          goto LAB_10;

+                        }

+                        if (ptVar35 != (tagQMSG *)0x0) {

+                          ppuVar51 = (undefined **)0x0;

+                          Win32RawLockedItemBase<tagQMSG,0,1,1,1>::UnlockWorker

+                                    ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)local_798,false,

+                                     false);

+                        }

+                        Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                        ::

+                        ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                                  ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                                    *)local_798);

+                        goto LAB_42;

+                      }

+                    }

+                    goto LAB_41;

+                  }

+                }

+LAB_42:

+                if (local_998 != 0) {

+                  local_994 = 1;

+                  uVar47 = uVar49;

+                  if ((local_4d8 & 0x800000000000) == 0) {

+                    uVar2 = *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x220);

+                    *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x220) = uStack_4f0;

+                    tagTHREADINFO::UpdateInputSource

+                              (param_1,(tagINPUT_MESSAGE_SOURCE *)((longlong)&uStack_4c0 + 4));

+                    local_7e8 = 0;

+                    local_7d8 = 0;

+                    uStack_7d0 = 0;

+                    local_7e0 = local_980;

+                    local_908 = (ulonglong)Feature_WebThreatDefenseToggle__private_featureState;

+                    if ((Feature_WebThreatDefenseToggle__private_featureState & 0x10) == 0) {

+                      local_908 = (ulonglong)

+                                  (Feature_WebThreatDefenseToggle__private_featureState | 1);

+                      wil_details_FeatureReporting_ReportUsageToService

+                                (&Feature_WebThreatDefenseToggle__private_descriptor,local_908,3,1);

+                      ppuVar51 = &Feature_WebThreatDefenseToggle__private_descriptor;

+                      wil_details_FeatureStateCache_TryEnableDeviceUsageFastPath(local_908,3);

+                    }

+                    if ((*(uint *)(*(longlong *)(param_1 + 0x1d0) + 0x114) & 4) != 0) {

+                      if (((int)*(ulonglong *)(param_1 + 0x560) != 1) ||

+                         (uVar47 = 1, (*(ulonglong *)(param_1 + 0x560) >> 0x20 & 5) == 0)) {

+                        uVar47 = uVar49;

+                      }

+                      if (((uVar47 != 0) &&

+                          (lVar39 = W32GetUserSessionState(),

+                          *(longlong *)(param_1 + 0x1f0) != *(longlong *)(lVar39 + 0xf688))) &&

+                         (cVar21 = CheckImEnabled(), cVar21 != '\0')) {

+                        local_7d8 = CONCAT62(local_7d8._2_6_,1);

+                      }

+                    }

+                    Win32RawOptionalLockedItem<tagQMSG,0>::Win32RawOptionalLockedItem<tagQMSG,0>

+                              (local_750);

+                    if (local_940 != (tagQMSG *)0x0) {

+                      Win32RawLockedItemBase<tagQMSG,0,1,1,1>::ManualLock<void>

+                                ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)local_750,local_940,

+                                 (_func_void_void_ptr *)ppuVar51);

+                    }

+                    uVar47 = xxxCallCtfHook(2,uVar24 & 2,local_978);

+                    if ((local_7d8 & 0x10000) != 0) {

+                      if ((*(byte *)(*(longlong *)(param_1 + 0x1d0) + 0x330) & 0x30) == 0x10) {

+                        local_7d8 = local_7d8 | 0x100000;

+                      }

+                      ProcessTranslatedChar(&local_7e8);

+                    }

+                    *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x220) = uVar2;

+                    if (local_940 != (tagQMSG *)0x0) {

+                      if (((uVar47 == 2 || uVar47 == 3) &&

+                          ((*(uint *)(param_1 + 0x550) >> 0x1d & 1) == 0)) &&

+                         (ptVar31 = AllocQEntryEx((tagMLIST *)

+                                                  (*(longlong *)(param_1 + 0x1d8) + 0x28),local_940,

+                                                  2), ptVar31 != (tagQMSG *)0x0)) {

+                        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

+                           (bVar45 = 1, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+                          bVar45 = bVar48;

+                        }

+                        if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+                           (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+                          bVar59 = false;

+                        }

+                        if ((bVar45 != 0) || (ptVar31 = local_940, bVar59)) {

+                          W32GetUserSessionState();

+                          ptVar31 = local_940;

+                          WPP_RECORDER_AND_TRACE_SF_qqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+                        }

+                        Win32RawLockedItemBase<tagQMSG,0,1,1,1>::UnlockWorker

+                                  ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)local_750,false,false)

+                        ;

+                        *(tagQMSG **)(*(longlong *)(param_1 + 0x1d8) + 0x68) = ptVar31;

+                        iVar22 = 1;

+                        if ((uVar47 != 2) && (iVar22 = local_968, uVar47 == 3)) {

+                          iVar22 = 2;

+                        }

+                        local_968 = iVar22;

+                        DeferSysPeekMsg(param_1,iVar22);

+                        local_940 = (tagQMSG *)0x0;

+                        Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                        ::

+                        ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                                  ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                                    *)local_750);

+                        goto LAB_2;

+                      }

+                      local_940 = (tagQMSG *)0x0;

+                    }

+                    Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                    ::

+                    ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                              ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                                *)local_750);

+                    ptVar31 = local_938;

+                  }

+                  if (uVar47 != 0) {

+                    iVar22 = 1;

+                    goto LAB_10;

+                  }

+                }

+                iVar22 = local_994;

+                if (((*(uint *)(**(longlong **)(param_1 + 0x1f8) + 0x10) |

+                     *(uint *)(param_1 + 0x2d0)) & 8) != 0) {

+                  local_994 = 1;

+                  iVar26 = xxxCallHook(~-(uint)(local_998 != 0) & 3,(__uint64)local_978,

+                                       (__int64)local_980,2);

+                  iVar22 = 1;

+                  if (iVar26 != 0) goto LAB_10;

+                }

+                if (((iVar22 == 0) || (local_998 == 0)) ||

+                   (((*(uint *)(**(longlong **)(param_1 + 0x1f8) + 0x10) |

+                     *(uint *)(param_1 + 0x2d0)) & 0x40) == 0)) goto LAB_9;

+                iVar22 = 7;

+                puVar38 = local_978;

+                ptVar52 = local_980;

+LAB_16:

+                xxxCallHook(iVar22,(__uint64)puVar38,(__int64)ptVar52,5);

+                goto LAB_9;

+              }

+              goto code_r0x000140273e4e;

+            }

+LAB_19:

+            if (((local_9a0 == (_HEAD *)0x0) ||

+                (lVar39 = *(longlong *)(local_9a0 + 0x28), *(char *)(lVar39 + 0x14) < '\0')) ||

+               ((*(char *)(lVar39 + 0x13) < '\0' ||

+                (((*(byte *)(lVar39 + 0x1f) & 8) != 0 || ((*(byte *)(lVar39 + 0x1f) & 0x10) == 0))))

+               )) goto LAB_10;

+LAB_18:

+            local_978 = local_518;

+            local_980 = ptStack_510;

+            if (local_9a0 != (_HEAD *)0x0) {

+              iVar22 = CheckCrossThreadInput

+                                 ((tagWND *)local_9a0,ptVar31,(int *)&local_970,(int *)&local_998,

+                                  local_930);

+              p_Var58 = local_960;

+              if (iVar22 != 0) goto LAB_8;

+              iVar22 = local_994;

+              if (local_970 != 0) goto LAB_10;

+              if ((local_964 != 0) || (param_5 != 0xffffffff)) {

+                if (param_5 < local_964) {

+                  if ((local_9a8 < param_5) || (local_964 < local_9a8)) {

+                    uVar47 = 1;

+                  }

+                  else {

+LAB_43:

+                    uVar47 = uVar49;

+                  }

+                }

+                else if ((local_9a8 < local_964) || (uVar47 = 1, param_5 < local_9a8))

+                goto LAB_43;

+                ppuVar51 = (undefined **)(ulonglong)local_990;

+                if (uVar47 == 0) goto code_r0x000140273e4e;

+              }

+              iVar22 = CheckPwndFilter(local_9a0,local_920);

+              ppuVar51 = (undefined **)(ulonglong)local_990;

+              if (iVar22 != 0) {

+LAB_26:

+                if (local_998 != 0) {

+                  xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+                }

+                goto LAB_9;

+              }

+              goto code_r0x000140273e4e;

             }

           }

-          if (!bVar51) {

-            Win32HMThreadLockAlways<tagHOOK>::Win32HMThreadLockAlways<tagHOOK>

-                      ((Win32HMThreadLockAlways<tagHOOK> *)&stack0x000003f8,

-                       (tagTHREADINFO *)unaff_R14,(tagHOOK *)ptVar33);

-            xxxSnapWindow(ptVar33,CONCAT71(uVar5,in_stack_00000560 != 1) & 0xffffffff);

-            Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

-                      ((Win32HMThreadLockBase<tagWND,0,0> *)&stack0x000003f8);

+LAB_10:

+          xxxSkipSysMsgEx(param_1,(tagQMSG *)&local_538,1);

+          if (local_950 != 0) {

+            if (((*(uint *)(**(longlong **)(param_1 + 0x1f8) + 0x10) | *(uint *)(param_1 + 0x2d0)) &

+                0x40) != 0) {

+              xxxCallHook(6,(ulonglong)local_9a8,(__int64)&local_488,5);

+            }

+            local_950 = 0;

           }

-          goto LAB_2;

+          if (iVar22 != 0) {

+            if (((*(uint *)(**(longlong **)(param_1 + 0x1f8) + 0x10) | *(uint *)(param_1 + 0x2d0)) &

+                0x40) != 0) {

+              xxxCallHook(7,(__uint64)local_978,(__int64)local_980,5);

+            }

+            local_994 = 0;

+          }

+          ppuVar51 = (undefined **)(ulonglong)local_990;

+          if (local_998 != 0) goto LAB_1;

+          goto code_r0x000140273e4e;

         }

-LAB_22:

-        lVar28 = W32GetUserSessionState();

-        if (*(int *)(lVar28 + 0x3fb0) != 0) {

-          lVar28 = W32GetUserSessionState();

-          goto code_r0x000140274762;

+        if (((int)local_4d8 == 4) &&

+           (ppuVar51 = (undefined **)(ulonglong)local_990,

+           *(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x68) !=

+           *(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x28))) goto code_r0x000140273e4e;

+        if (((int)local_4d8 == 9) && (lVar39 = lStack_530, (uint)uStack_520 == 0x60)) {

+          while ((lVar39 != 0 && (iVar22 = IsHiddenByInputService(), iVar22 != 0))) {

+            lVar39 = *(longlong *)(lVar39 + 8);

+          }

+          ppuVar51 = (undefined **)(ulonglong)local_990;

+          if (lVar39 != 0) goto code_r0x000140273e4e;

+        }

+        ptVar34 = ptStack_4d0;

+        if ((ptStack_4d0 == (tagTHREADINFO *)0x0) || (ptStack_4d0 == param_1)) {

+          EtwTraceRetrieveQueueEventMessage(*(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x68));

+          DelQEntry(*(longlong *)(param_1 + 0x1d8) + 0x28,

+                    *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x68),1);

+          if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+             (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0 ||

+              (bVar45 = 1, (byte)WPP_GLOBAL_Control[0x29] < 5)))) {

+            bVar45 = bVar48;

+          }

+          if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+             (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+            bVar59 = false;

+          }

+          if ((bVar45 != 0) || (bVar59 != false)) {

+            W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_qq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar45,bVar59);

+          }

+          *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x68) = 0;

+          xxxProcessEventMessage(param_1,&local_538);

+          goto LAB_1;

+        }

+        if (*(longlong *)(ptStack_4d0 + 0x1d8) != *(longlong *)(param_1 + 0x1d8)) {

+          CleanEventMessage(*(tagQMSG **)(*(longlong *)(param_1 + 0x1d8) + 0x68));

+          DelQEntry(*(longlong *)(param_1 + 0x1d8) + 0x28,

+                    *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x68),1);

+          goto LAB_1;

+        }

+        local_910 = (_W32THREAD *)ptStack_4d0;

+        Win32RawLockedW32Thread::Exchange(local_6e0,(_W32THREAD *)ptStack_4d0);

+        <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&local_858,ptVar34);

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

+           (bVar45 = 1, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+          bVar45 = bVar48;

+        }

+        if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+           (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+          bVar59 = false;

+        }

+        if ((bVar45 != 0) || (bVar59 != false)) {

+          lVar39 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_qq

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar45,bVar59,

+                     *(undefined8 *)(lVar39 + 0x10f98));

+        }

+        *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x68) = 0;

+        p_Var58 = local_960;

+      }

+LAB_8:

+      *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x60) = 0;

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

+         (bVar45 = 1, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+        bVar45 = bVar48;

+      }

+      bVar59 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((bVar45 != 0) || (bVar59)) {

+        lVar39 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_qqq

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar45,bVar59,

+                   *(undefined8 *)(lVar39 + 0x10f98));

+      }

+      p_Var18 = local_8f8;

+      p_Var17 = local_910;

+      p_Var3 = local_928;

+      *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x58) = 0;

+      **(uint **)(param_1 + 0x1e8) = **(uint **)(param_1 + 0x1e8) & 0xfffffffe;

+      if (local_8e0 == (_W32THREAD *)0x0) {

+        if (((p_Var58 != (_W32THREAD *)0x0) || (local_910 != (_W32THREAD *)0x0)) ||

+           ((local_8f8 != (_W32THREAD *)0x0 || (local_928 != (_W32THREAD *)0x0))))

+        goto LAB_44;

+        ClearWakeBit(param_1,0x7c07,1);

+      }

+      else {

+        SetWakeBit(local_8e0,0x4001);

+        ClearWakeBit(param_1,0x4001,0);

+LAB_44:

+        if (p_Var58 != (_W32THREAD *)0x0) {

+          SetWakeBit(p_Var58,0x4006);

+          ClearWakeBit(param_1,0x4006,0);

+        }

+        if (p_Var18 != (_W32THREAD *)0x0) {

+          SetWakeBit(p_Var18,0x4400);

+          ClearWakeBit(param_1,0x4400,0);

+        }

+        if (p_Var3 != (_W32THREAD *)0x0) {

+          SetWakeBit(p_Var3,0x5000);

+          ClearWakeBit(param_1,0x5000,0);

+        }

+        if (p_Var17 != (_W32THREAD *)0x0) {

+          SetWakeBit(p_Var17,0x2040);

+          ClearWakeBit(param_1,0x2000,0);

+        }

+        if (local_880 != 0) {

+          LogInputQueueWakeTransfer(param_1,local_880,local_860);

         }

       }

-LAB_0:

-      if (in_stack_000000a0 == (tagPOINT)0xe7) {

-        *(short *)((longlong)unaff_R14 + 0x39a) = in_stack_00000500.x._2_2_;

-        in_stack_00000500.x = 0xe7;

-        in_stack_00000500.y = 0;

-      }

-LAB_24:

-      uVar30 = (ulonglong)in_stack_00000500 & 0xff;

-      if (uVar30 == 0xe7) {

-        in_stack_00000500.x = 0xe7;

-        in_stack_00000500.y = 0;

-      }

-      if (((((((in_stack_00000080 == uVar44) || ((in_stack_00000540 & 0x800000000000) == 0)) &&

-             (lVar28 = W32GetUserSessionState(), *(int *)(lVar28 + 0x37c0) != 0)) &&

-            ((uVar23 = GetAppImeCompatFlags(0), (uVar23 >> 0x17 & 1) == 0 &&

-             (in_stack_00000508.x._2_1_ == ')')))) && (in_stack_00000080 != uVar44)) &&

-          ((lVar28 = *(longlong *)((longlong)unaff_R14 + 0x1d8),

-           (*(byte *)(lVar28 + 0x17c) & 0x15) == 0 && ((*(byte *)(lVar28 + 0x18e) & 0x40) == 0))))

-         && (((*(byte *)(lVar28 + 399) & (byte)unaff_R15.x) == 0 &&

-             (((lVar38 = *(longlong *)(lVar28 + 0x88), lVar38 == 0 &&

-               (lVar38 = *(longlong *)(lVar28 + 0x90), lVar38 == 0)) ||

-              (*(tagPOINT *)(lVar38 + 0x10) == unaff_R14)))))) {

-        xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,unaff_R15.x);

-        if ((in_stack_00000100 == uVar44) && (lVar38 != 0)) {

-          xxxCallCtfHook(3,0,unaff_R15);

-        }

-        goto LAB_2;

-      }

-      if (uVar30 == 0x79) {

-        in_stack_00000070 = in_stack_00000070 | 4;

-      }

-      if (((*(byte *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x17c) & 4) != 0) &&

-         (uVar30 == 0x1b)) {

-        in_stack_00000070 = in_stack_00000070 | 4;

-      }

-      LOCK();

-      uVar23 = *(uint *)((longlong)unaff_R14 + 0x210);

-      if (uVar23 == 0) {

-        *(uint *)((longlong)unaff_R14 + 0x210) = uVar44;

-        uVar23 = 0;

-      }

-      UNLOCK();

-      if ((uVar23 & 8) == 0) {

-        in_stack_00000508 = (tagPOINT)((ulonglong)in_stack_00000508 & 0xfffffffffdffffff);

-      }

+      CManageInScanSysQueueBit::~CManageInScanSysQueueBit(local_956);

+      Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

+                ((Win32HMOptionalThreadLock<tagHOOK> *)local_8c8);

+      Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

+                ((Win32HMOptionalThreadLock<tagHOOK> *)local_7a8);

+      Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_728);

+      Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_710);

+      Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_6f8);

+      Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_6e0);

+      Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_768);

+      Win32RawLockedW32Thread::~Win32RawLockedW32Thread(local_780);

+      goto LAB_0;

     }

-    else {

-      if (in_stack_000004f8 == 0x101) goto LAB_24;

-      if (in_stack_000004f8 != 0x102) {

-        if (in_stack_000004f8 == 0x104) goto LAB_20;

-        if (in_stack_000004f8 != 0x105) {

-          if (in_stack_000004f8 != 0x119) goto LAB_9;

-          goto LAB_13;

-        }

-        goto LAB_24;

-      }

-    }

-    in_stack_000000a0 = (tagPOINT)((ulonglong)in_stack_00000500 & 0xff);

-    lVar28 = *(longlong *)((longlong)unaff_R14 + 0x1d8);

-    tVar27 = *(tagPOINT *)(lVar28 + 0x88);

-    if (*(tagPOINT *)(lVar28 + 0x88) == unaff_RSI) {

-      tVar27 = *(tagPOINT *)(lVar28 + 0x90);

-      uVar53 = in_stack_00000084;

-      if (tVar27 == (tagPOINT)0x0) goto LAB_12;

-      if (in_stack_00000070 - 0x100 < 4) {

-        in_stack_00000070 = in_stack_00000070 + 4;

-      }

-    }

-    Win32HM_ExchangeThreadLock<1>((_HEAD *)tVar27,(_Win32HMThreadLockItem *)&stack0x00000150);

-    in_stack_000000a8 =

-         (uint)CONCAT71(uVar5,*(longlong *)((longlong)tVar27 + 0x10) != in_stack_00000148);

-    if (*(longlong *)((longlong)tVar27 + 0x10) != in_stack_00000168) {

-      uVar53 = in_stack_00000084;

-      if (*(longlong *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d8) !=

-          *(longlong *)((longlong)unaff_R14 + 0x1d8)) goto LAB_12;

-      lVar28 = in_stack_00000148;

-      iVar21 = IsInsideMenuLoop();

-      if (iVar21 == 0) {

-        tVar34 = unaff_RSI;

-        if (*(longlong *)((longlong)unaff_R14 + 0x2c8) != 0) {

-          tVar34 = *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x2c8) + 0x10);

-        }

-      }

-      else {

-        tVar34 = *(tagPOINT *)(**(longlong **)((longlong)unaff_R14 + 0x288) + 8);

-      }

-      if (tVar34 != (tagPOINT)0x0) {

-        in_stack_000000a8 = (uint)CONCAT71(uVar5,*(longlong *)((longlong)tVar34 + 0x10) != lVar28);

-        Win32HM_ExchangeThreadLock<1>((_HEAD *)tVar34,(_Win32HMThreadLockItem *)&stack0x00000150);

-        tVar27 = tVar34;

-      }

-      if (in_stack_00000138 == unaff_RSI) {

-        in_stack_00000138 = *(tagPOINT *)((longlong)tVar27 + 0x10);

-        Win32RawLockedW32Thread::Exchange

-                  ((Win32RawLockedW32Thread *)&stack0x00000298,(_W32THREAD *)in_stack_00000138);

-        <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()

-                  (&stack0x000001c0,in_stack_00000138,tVar27);

-      }

-    }

-    uVar53 = unaff_R15.x;

-    if ((in_stack_000000b4 != 0) || (in_stack_00000a40 != 0xffffffff)) {

-      uVar23 = uVar53;

-      if (in_stack_00000a40 < in_stack_000000b4) {

-        if ((in_stack_00000a40 <= in_stack_00000070) && (in_stack_00000070 <= in_stack_000000b4)) {

-LAB_25:

-          uVar23 = uVar44;

-        }

-      }

-      else if ((in_stack_00000070 < in_stack_000000b4) || (in_stack_00000a40 < in_stack_00000070))

-      goto LAB_25;

-      ppuVar45._4_4_ = 0;

-      ppuVar45._0_4_ = in_stack_00000088;

-      if (uVar23 == 0) goto code_r0x000140273e4e;

-    }

-    iVar21 = CheckPwndFilter(tVar27,in_stack_000000f8);

-    ppuVar45._4_4_ = 0;

-    ppuVar45._0_4_ = in_stack_00000088;

-    if (iVar21 == 0) goto code_r0x000140273e4e;

-    tVar34 = in_stack_000000b8;

-    if (in_stack_000000a8 != uVar44) goto LAB_5;

-    if (in_stack_00000080 == uVar44) {

-LAB_26:

-      if (in_stack_000000a0 == (tagPOINT)0x10) {

-        if (((in_stack_00000100 == uVar44) &&

-            (((-(((ulonglong)in_stack_00000508 & 0x1000000) != 0) & 0xfdU) + 4 &

-             *(byte *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x1a0)) != 0)) &&

-           (iVar21 = IsDesktopApp(*(undefined8 *)((longlong)unaff_R14 + 0x1d0)), iVar21 != 0)) {

-          LOCK();

-          uVar23 = *(uint *)((longlong)unaff_R14 + 0x210);

-          if (uVar23 == 0) {

-            *(uint *)((longlong)unaff_R14 + 0x210) = uVar44;

-            uVar23 = 0;

-          }

-          UNLOCK();

-          if ((uVar23 & 8) == 0) {

-            in_stack_00000500 =

-                 (tagPOINT)((ulonglong)(((ulonglong)in_stack_00000508 & 0x1000000) != 0) + 0xa0);

-            goto LAB_1;

-          }

-        }

-      }

-      in_stack_000000a0.x._0_1_ = (byte)in_stack_00000500.x;

-      in_stack_00000140 =

-           (uint)*(byte *)((ulonglong)((byte)in_stack_000000a0.x >> 2) + 0x178 +

-                          *(longlong *)((longlong)unaff_R14 + 0x1d8)) &

-           uVar53 << ((byte)in_stack_000000a0.x & 3) * '\x02';

-      if (in_stack_00000140 == 0) goto LAB_27;

-      if (in_stack_00000080 != uVar44) {

-        if (unaff_RDI != (tagPOINT)0x0) {

-          *(ulonglong *)((longlong)unaff_RDI + 0x28) =

-               *(ulonglong *)((longlong)unaff_RDI + 0x28) | 0x40000000;

-        }

-        goto LAB_27;

-      }

-    }

-    else {

-      if ((in_stack_00000540 & 0x800000000000) == 0) {

-        if ((in_stack_00000080 != uVar44) && (iVar21 = IsInsideMenuLoop(), iVar21 == 0)) {

-          if ((in_stack_000000a0 == (tagPOINT)0x5d) && (in_stack_00000070 == 0x101)) {

-            ppuVar45 = (undefined **)unaff_RSI;

-            if (tVar27 != unaff_RSI) {

-              ppuVar45 = (undefined **)*(tagPOINT *)tVar27;

-            }

-            in_stack_00000020.x = uVar44;

-            _PostTransformableMessage(tVar27,0x7b);

-          }

-          if ((in_stack_000000a0 == (tagPOINT)0x70) && (in_stack_00000070 == 0x100)) {

-            ppuVar45._0_4_ = 0;

-            ppuVar45._4_4_ = 0;

-            in_stack_00000020 = unaff_RSI;

-            _PostTransformableMessageExtended

-                      ((tagWND *)tVar27,0x4d,0,0,(tagINPUT_MESSAGE_SOURCE *)unaff_RSI,uVar53);

-          }

-        }

-        goto LAB_26;

-      }

-LAB_27:

-      if (in_stack_00000080 != uVar44) {

-        if ((((in_stack_00000540 & 0x800000000000) == 0) && (unaff_RDI != (tagPOINT)0x0)) &&

-           ((*(uint *)((longlong)unaff_R14 + 0x550) >> 0x1c & 1) != 0)) {

-          ppuVar45._0_4_ = 0;

-          ppuVar45._4_4_ = 0;

-          in_stack_000000d8 =

-               (tagPOINT)xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,0);

-        }

-        else {

-          ppuVar45 = (undefined **)((ulonglong)unaff_R15 & 0xffffffff);

-          xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,uVar53);

-        }

-      }

-    }

-    _LStack0000000000000098 = in_stack_00000508;

-    if (in_stack_00000140 != uVar44) {

-      _LStack0000000000000098 = (tagPOINT)((ulonglong)in_stack_00000508 | 0x40000000);

-    }

-    if ((in_stack_00000070 == 0x101) || (in_stack_00000070 == 0x105)) {

-      _LStack0000000000000098 = (tagPOINT)((ulonglong)_LStack0000000000000098 | 0x80000000);

-    }

-    lVar28 = *(longlong *)((longlong)unaff_R14 + 0x1d8);

-    if ((*(byte *)(lVar28 + 0x17c) & 0x10) != 0) {

-      _LStack0000000000000098 = (tagPOINT)((ulonglong)_LStack0000000000000098 | 0x20000000);

-    }

-    iVar21 = IsMenuStarted();

-    if (iVar21 != 0) {

-      _LStack0000000000000098 = (tagPOINT)((ulonglong)_LStack0000000000000098 | 0x10000000);

-    }

-    if ((*(uint *)(lVar28 + 0x214) & 0x4000) != 0) {

-      _LStack0000000000000098 = (tagPOINT)((ulonglong)_LStack0000000000000098 | 0x8000000);

-    }

-    in_stack_000000a0 = in_stack_00000500;

-    if (((in_stack_00000170 == uVar44) &&

-        (lVar28 = W32GetUserSessionState(), *(longlong *)(lVar28 + 0x3288) == 0)) ||

-       ((in_stack_00000540 & 0x800000000000) != 0)) {

-LAB_28:

-      uVar24 = in_stack_000000cc;

-      if (((in_stack_00000080 != uVar44) && ((in_stack_00000540 & 0x800000000000) != 0)) &&

-         (in_stack_000000d0 = in_stack_000000cc, ((uint)(in_stack_00000540 >> 0x3a) & 1) != 0)) {

-        uVar24 = 2;

-        in_stack_000000cc = uVar24;

-        in_stack_000000d0 = uVar24;

-      }

-    }

-    else {

-      uVar24 = in_stack_000000cc;

-      if (in_stack_00000080 != uVar44) {

-        iVar21 = IsMenuStarted();

-        if (iVar21 == 0) {

-          LOCK();

-          uVar23 = *(uint *)((longlong)unaff_R14 + 0x210);

-          if (uVar23 == 0) {

-            *(uint *)((longlong)unaff_R14 + 0x210) = uVar44;

-            uVar23 = 0;

-          }

-          UNLOCK();

-          if (((uVar23 >> 0x19 & 1) == 0) && (tVar27 != unaff_RSI)) {

-            tVar34 = in_stack_00000500;

-            if (in_stack_00000500 == (tagPOINT)0xe7) {

-              tVar34 = (tagPOINT)

-                       ((ulonglong)*(ushort *)((longlong)unaff_R14 + 0x39a) << 0x10 | 0xe7);

-            }

-            tagTHREADINFO::UpdateInputSource

-                      ((tagTHREADINFO *)unaff_R14,(tagINPUT_MESSAGE_SOURCE *)&stack0x0000055c);

-            Win32RawOptionalLockedItem<tagQMSG,0>::Win32RawOptionalLockedItem<tagQMSG,0>

-                      ((Win32RawOptionalLockedItem<tagQMSG,0> *)&stack0x00000280);

-            if (in_stack_000000d8 != (tagPOINT)0x0) {

-              Win32RawLockedItemBase<tagQMSG,0,1,1,1>::ManualLock<void>

-                        ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)&stack0x00000280,

-                         (tagQMSG *)in_stack_000000d8,(_func_void_void_ptr *)ppuVar45);

-            }

-            ppuVar45._4_4_ = 0;

-            ppuVar45._0_4_ = in_stack_00000070;

-            in_stack_00000020 = _LStack0000000000000098;

-            uVar24 = xxxImmProcessKey(*(tagQ **)((longlong)unaff_R14 + 0x1d8),(tagWND *)tVar27,

-                                      in_stack_00000070,(__uint64)tVar34,

-                                      (__int64)_LStack0000000000000098);

-            in_stack_000000cc = uVar24;

-            in_stack_000000d0 = uVar24;

-            if ((uVar24 & 0x11) != 0) {

-              if (in_stack_000000d8 != (tagPOINT)0x0) {

-                Win32RawLockedItemBase<tagQMSG,0,1,1,1>::UnlockWorker

-                          ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)&stack0x00000280,false,

-                           unaff_R15.x._0_1_);

-                in_stack_000000d8 = unaff_RSI;

-              }

-              Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-              ::

-              ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-                        ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-                          *)&stack0x00000280);

-              uVar53 = in_stack_00000084;

-              goto LAB_12;

-            }

-            if (in_stack_000000d8 != (tagPOINT)0x0) {

-              ppuVar45._0_4_ = 0;

-              ppuVar45._4_4_ = 0;

-              Win32RawLockedItemBase<tagQMSG,0,1,1,1>::UnlockWorker

-                        ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)&stack0x00000280,false,false);

-            }

-            Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-            ::

-            ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-                      ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-                        *)&stack0x00000280);

-            goto LAB_29;

-          }

-        }

-        goto LAB_28;

-      }

-    }

-LAB_29:

-    if (in_stack_00000080 != uVar44) {

-      uVar23 = uVar44;

-      in_stack_00000084 = uVar53;

-      if ((in_stack_00000540 & 0x800000000000) == 0) {

-        uVar70 = *(undefined8 *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x220);

-        *(undefined8 *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x220) = in_stack_00000528;

-        tagTHREADINFO::UpdateInputSource

-                  ((tagTHREADINFO *)unaff_R14,(tagINPUT_MESSAGE_SOURCE *)&stack0x0000055c);

-        if ((Feature_WebThreatDefenseToggle__private_featureState & 0x10) == 0) {

-          uVar23 = Feature_WebThreatDefenseToggle__private_featureState | uVar53;

-          wil_details_FeatureReporting_ReportUsageToService

-                    (&Feature_WebThreatDefenseToggle__private_descriptor,uVar23,3,unaff_R15);

-          ppuVar45 = &Feature_WebThreatDefenseToggle__private_descriptor;

-          wil_details_FeatureStateCache_TryEnableDeviceUsageFastPath(uVar23,3);

-        }

-        if ((*(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d0) + 0x114) & 4) != 0) {

-          if (((uint)*(ulonglong *)((longlong)unaff_R14 + 0x560) != uVar53) ||

-             (uVar23 = uVar53, (*(ulonglong *)((longlong)unaff_R14 + 0x560) >> 0x20 & 5) == 0)) {

-            uVar23 = uVar44;

-          }

-          if ((uVar23 != 0) &&

-             (lVar28 = W32GetUserSessionState(),

-             *(longlong *)((longlong)unaff_R14 + 0x1f0) != *(longlong *)(lVar28 + 0xf688))) {

-            CheckImEnabled();

-          }

-        }

-        Win32RawOptionalLockedItem<tagQMSG,0>::Win32RawOptionalLockedItem<tagQMSG,0>

-                  ((Win32RawOptionalLockedItem<tagQMSG,0> *)&stack0x000002c8);

-        if (in_stack_000000d8 != (tagPOINT)0x0) {

-          Win32RawLockedItemBase<tagQMSG,0,1,1,1>::ManualLock<void>

-                    ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)&stack0x000002c8,

-                     (tagQMSG *)in_stack_000000d8,(_func_void_void_ptr *)ppuVar45);

-        }

-        uVar23 = xxxCallCtfHook(2,uVar24 & 2,in_stack_00000500);

-        *(undefined8 *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x220) = uVar70;

-        tVar34 = in_stack_000000d8;

-        if ((((in_stack_000000d8 != (tagPOINT)0x0) && (tVar34 = unaff_RSI, uVar23 - 2 <= uVar53)) &&

-            (tVar34 = unaff_RSI, (*(uint *)((longlong)unaff_R14 + 0x550) >> 0x1d & 1) == 0)) &&

-           (ptVar31 = AllocQEntryEx((tagMLIST *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x28),

-                                    (tagQMSG *)in_stack_000000d8,2), tVar34 = unaff_RSI,

-           ptVar31 != (tagQMSG *)0x0)) {

-          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

-             (tVar34 = unaff_R15, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

-            tVar34 = unaff_RSI;

-          }

-          if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-             (*(short *)(WPP_GLOBAL_Control + 0x48) == sVar43)) {

-            unaff_R15 = (tagPOINT)((ulonglong)unaff_RSI & 0xff);

-          }

-          if (((char)tVar34.x != '\0') || ((char)unaff_R15.x != '\0')) {

-            W32GetUserSessionState();

-            in_stack_00000020.x._0_1_ = 5;

-            WPP_RECORDER_AND_TRACE_SF_qqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

-          }

-          Win32RawLockedItemBase<tagQMSG,0,1,1,1>::UnlockWorker

-                    ((Win32RawLockedItemBase<tagQMSG,0,1,1,1> *)&stack0x000002c8,false,false);

-          *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) = in_stack_000000d8;

-          uVar50 = 1;

-          if ((uVar23 != 2) && (uVar50 = in_stack_000000b0, uVar23 == 3)) {

-            uVar50 = 2;

-          }

-          in_stack_000000b0 = uVar50;

-          DeferSysPeekMsg();

-          Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>::

-          ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-                    ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-                      *)&stack0x000002c8);

-          in_stack_000000d8 = unaff_RSI;

-          goto LAB_3;

-        }

-        in_stack_000000d8 = tVar34;

-        Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>::

-        ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-                    *)&stack0x000002c8);

-        unaff_RDI = in_stack_000000e0;

-      }

-      if (uVar23 != 0) goto LAB_12;

-    }

-    uVar23 = in_stack_00000084;

-    if ((((*(uint *)(**(longlong **)((longlong)unaff_R14 + 0x1f8) + 0x10) |

-          *(uint *)((longlong)unaff_R14 + 0x2d0)) & 8) != 0) &&

-       (in_stack_00000084 = uVar53,

-       iVar21 = xxxCallHook(~-(uint)(in_stack_00000080 != 0) & 3,(__uint64)in_stack_00000500,

-                            (__int64)_LStack0000000000000098,2), uVar23 = uVar53, iVar21 != 0))

-    goto LAB_12;

-    if ((uVar23 == 0) ||

-       ((in_stack_00000080 == uVar44 ||

-        (((*(uint *)(**(longlong **)((longlong)unaff_R14 + 0x1f8) + 0x10) |

-          *(uint *)((longlong)unaff_R14 + 0x2d0)) & 0x40) == 0)))) goto LAB_11;

-    iVar21 = 7;

-    tVar34 = _LStack0000000000000098;

+    EtwTraceInputQueueLocked();

+    _Var29 = 2;

   }

-  else {

-    if ((in_stack_000004f8 != 0x20a) && (in_stack_000004f8 != 0x20e)) {

-      if (in_stack_000004f8 == 0x238) goto LAB_14;

-      if (in_stack_000004f8 == 0x240) goto LAB_13;

-      if ((((in_stack_000004f8 == 0x245) || (in_stack_000004f8 == 0x246)) ||

-          (in_stack_000004f8 == 0x247)) || (in_stack_000004f8 == 0x249)) goto LAB_7;

-LAB_9:

-      _uStack0000000000000094 = (int)in_stack_00000508.x._2_2_;

-      _uStack0000000000000090 = (int)(short)in_stack_00000508.x;

-      in_stack_000000ac = 1;

-      if ((((in_stack_00000540 & 0x2000000000) == 0) &&

-          ((in_stack_00000540 & 0x800000000000000) == 0)) ||

-         ((tVar27 == (tagPOINT)0x0 ||

-          ((((ushort)((uint)*(undefined4 *)

-                             (*(longlong *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d0) + 0x10c)

-                     >> 8) ^

-            (ushort)((uint)*(undefined4 *)(*(longlong *)((longlong)tVar27 + 0x28) + 0x120) >> 8)) &

-           0x1ff) != 0)))) {

-        if (tVar27 == (tagPOINT)0x0) {

-LAB_30:

-          in_stack_00000104 = uVar44;

-        }

-        else {

-          bVar51 = IsCompositionInputWindowForHitTest((tagWND *)tVar27);

-          in_stack_00000104 = 1;

-          if (!bVar51) goto LAB_30;

-        }

-        tVar34 = *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x80);

-        if (tVar34 == (tagPOINT)0x0) {

-          Win32HMOptionalThreadLockAlways<tagMENU>::Win32HMOptionalThreadLockAlways<tagMENU>

-                    ((Win32HMOptionalThreadLockAlways<tagMENU> *)&stack0x00000260);

-          if (in_stack_00000104 == 0) {

-            lVar28 = W32GetUserSessionState();

-            tVar27 = *(tagPOINT *)

-                      (*(longlong *)(*(longlong *)(*(longlong *)(lVar28 + 0x4970) + 0x1f0) + 8) +

-                      0x18);

-            Win32HM_LockIntoThread<1>

-                      ((tagTHREADINFO *)unaff_R14,(_HEAD *)tVar27,

-                       (_Win32HMThreadLockItem *)&stack0x00000260);

-          }

-          WVar47 = in_stack_00000104 * 4 + 9;

-          iVar21 = IsThreadDesktopComposed((tagTHREADINFO *)unaff_R14);

-          if (iVar21 == 0) {

-            pHVar32 = xxxWindowHitTest((tagWND *)tVar27,_uStack0000000000000090,

-                                       (int *)&stack0x000000ac,WVar47);

-          }

-          else {

-            in_stack_000001f4 = 0;

-            in_stack_00000208 = &stack0x000000ac;

-            in_stack_00000215 = 0;

-            in_stack_00000217 = 0;

-            in_stack_000001f8 = in_stack_00000500;

-            in_stack_00000200 = in_stack_00000508;

-            in_stack_00000210 = WVar47;

-            in_stack_00000214 = bVar42;

-            pHVar32 = xxxDCEWindowHitTestIndirect

-                                ((tagWND *)tVar27,in_stack_00000530,false,

-                                 (tagDCE_WINDOW_HIT_TEST_ARGS *)&stack0x000001f0);

-          }

-          ptVar33 = (tagWND *)HMValidateHandleNoSecure(pHVar32,1);

-          InputTraceLogging::Mouse::SecondaryHitTest

-                    ((tagQMSG *)&stack0x000004e0,(tagPOINT *)&stack0x00000090,ptVar33);

-          if (in_stack_00000104 == 0) {

-            Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

-                      ((Win32HMThreadLockBase<tagMONITOR,1,1> *)&stack0x00000260);

-          }

-          tVar34 = (tagPOINT)HMValidateHandleNoSecure(pHVar32,1);

-          uVar52 = extraout_XMM0_Da_00;

-          if ((tVar34 == (tagPOINT)0x0) &&

-             (tVar34 = *(tagPOINT *)

-                        (*(longlong *)(*(longlong *)((longlong)unaff_R14 + 0x1f0) + 8) + 0x18),

-             tVar34 == (tagPOINT)0x0)) {

-            lVar28 = W32GetUserSessionState();

-            tVar34 = *(tagPOINT *)

-                      (*(longlong *)(*(longlong *)(*(longlong *)(lVar28 + 0x4970) + 0x1f0) + 8) +

-                      0x18);

-            uVar52 = extraout_XMM0_Da_01;

-          }

-          iVar21 = IsMiPActive(uVar52,0);

-          if (((iVar21 != 0) &&

-              (*(longlong *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x238) != 0)) &&

-             (tVar27 = (tagPOINT)ValidateHwnd(), tVar27 != (tagPOINT)0x0)) {

-            if ((*(longlong *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d8) ==

-                 *(longlong *)((longlong)unaff_R14 + 0x1d8)) ||

-               (*(longlong *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d0) ==

-                *(longlong *)((longlong)unaff_R14 + 0x1d0))) {

-              in_stack_000000ac = 1;

-              *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xac) = uVar44;

-              uVar23 = 1;

-              tVar34 = tVar27;

-            }

-          }

-          if (uVar23 == 0) {

-            *(int *)(*(longlong *)(in_stack_00000148 + 0x1d8) + 0xac) =

-                 (int)CONCAT71(uVar5,in_stack_000000ac != 1);

-          }

-          Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

-                    ((Win32HMOptionalThreadLock<tagHOOK> *)&stack0x00000260);

-        }

-        else {

-          InputTraceLogging::Mouse::RedirectForCapture

-                    ((tagQMSG *)&stack0x000004e0,*(HWND__ **)tVar34);

-        }

-        tVar27 = tVar34;

-        if (tVar34 == *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x80)) {

-          uVar40 = (ushort)((uint)*(undefined4 *)(*(longlong *)((longlong)tVar34 + 0x28) + 0x120) >>

-                           8);

-          tVar37 = tVar34;

-          lVar28 = PtiMouseFromQ(*(undefined8 *)(*(longlong *)((longlong)tVar34 + 0x10) + 0x1d8));

-          if (((((ushort)((uint)*(undefined4 *)(*(longlong *)(lVar28 + 0x1d0) + 0x10c) >> 8) ^

-                uVar40) & 0x1ff) != 0) ||

-             (iVar21 = IsOleDragDropCaptureWindow((tagWND *)tVar37), iVar21 != 0)) {

-            _uStack0000000000000090 = in_stack_00000530;

-            PhysicalToLogicalInPlacePointWithParent(tVar34,&stack0x00000090,&stack0x00000538);

-            if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-               (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0 ||

-                (bVar49 = 1, (byte)WPP_GLOBAL_Control[0x29] < 5)))) {

-              bVar49 = bVar42;

-            }

-            if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-               (bVar41 = 1, *(short *)(WPP_GLOBAL_Control + 0x48) == sVar43)) {

-              bVar41 = bVar42;

-            }

-            if ((bVar49 != 0) || (bVar41 != 0)) {

-              lVar28 = W32GetUserSessionState();

-              WPP_RECORDER_AND_TRACE_SF_dddd

-                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar49,bVar41,

-                         *(undefined8 *)(lVar28 + 0x10f98),5);

-            }

-            _LStack0000000000000098 =

-                 (tagPOINT)(longlong)CONCAT22(uStack0000000000000094,uStack0000000000000090);

-            in_stack_00000514 = (LONG)uStack0000000000000090;

-            in_stack_00000518 = uStack0000000000000090._4_4_;

-          }

-        }

-      }

-      Win32HM_ExchangeThreadLock<1>((_HEAD *)tVar27,(_Win32HMThreadLockItem *)&stack0x00000150);

-      in_stack_00000020 = in_stack_000000e8;

-      iVar21 = CheckCrossThreadInput

-                         ((tagWND *)tVar27,(tagQMSG *)unaff_RDI,(int *)&stack0x000000a8,

-                          (int *)&stack0x00000080,(tagQMSG **)in_stack_000000e8);

-      tVar34 = in_stack_000000b8;

-      if (iVar21 != 0) goto LAB_5;

-      if (in_stack_000000a8 == uVar44) {

-        if (((in_stack_00000540 & 0x80000000000) != 0) &&

-           (bVar51 = UIPrivilegeIsolation::CheckAccess

-                               ((tagUIPI_INFO *)&stack0x00000550,

-                                (tagUIPI_INFO *)

-                                (*(longlong *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d0) +

-                                0x130),0), !bVar51)) {

-          in_stack_00000020 = in_stack_00000508;

-          EtwTraceUIPIMsgError

-                    (0,*(undefined8 *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d0),

-                     in_stack_000004f8,in_stack_00000500,in_stack_00000508);

-          goto LAB_31;

-        }

-      }

-      else {

-        tVar34 = *(tagPOINT *)((longlong)tVar27 + 0x10);

-        if (*(longlong *)((longlong)tVar34 + 0x1d8) != *(longlong *)((longlong)unaff_R14 + 0x1d8)) {

-LAB_31:

-          lVar28 = W32GetUserSessionState();

-          zzzSetCursor(*(tagCURSOR **)(lVar28 + 0x5608));

-          uVar53 = in_stack_00000084;

-          in_stack_000000a0 = unaff_RSI;

-          goto LAB_12;

-        }

-        if (in_stack_000000b8 == unaff_RSI) {

-          in_stack_000000b8 = tVar34;

-          Win32RawLockedW32Thread::Exchange

-                    ((Win32RawLockedW32Thread *)&stack0x000002b0,(_W32THREAD *)tVar34);

-          <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&stack0x000001c0,tVar34,tVar27);

-        }

-      }

-      PVar18 = _uStack0000000000000090;

-      iVar21 = *(int *)(*(longlong *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d8) + 0xac);

-      if ((iVar21 == 0) || (iVar21 == 2)) {

-        lVar28 = *(longlong *)((longlong)tVar27 + 0x28);

-        if ((*(byte *)(lVar28 + 0x1a) & 0x40) == 0) {

-          _uStack0000000000000090 = _uStack0000000000000090 - *(int *)(lVar28 + 0x68);

-        }

-        else {

-          _uStack0000000000000090 = *(int *)(lVar28 + 0x70) - _uStack0000000000000090;

-        }

-        iVar21 = *(int *)(*(longlong *)((longlong)tVar27 + 0x28) + 0x6c);

-LAB_32:

-        _uStack0000000000000094 = _uStack0000000000000094 - iVar21;

-      }

-      else if (iVar21 == 3) {

-        lVar28 = *(longlong *)((longlong)tVar27 + 0x28);

-        if ((*(byte *)(lVar28 + 0x1a) & 0x40) == 0) {

-          _uStack0000000000000090 = _uStack0000000000000090 - *(int *)(lVar28 + 0x58);

-        }

-        else {

-          _uStack0000000000000090 = *(int *)(lVar28 + 0x60) - _uStack0000000000000090;

-        }

-        iVar21 = *(int *)(*(longlong *)((longlong)tVar27 + 0x28) + 0x5c);

-        goto LAB_32;

-      }

-      if ((in_stack_000000a8 == uVar44) &&

-         (lVar28 = W32GetUserSessionState(),

-         *(longlong *)((longlong)unaff_R14 + 0x1d8) == *(longlong *)(lVar28 + 0x4b78))) {

-        iVar21 = (int)CONCAT71(uVar5,*(tagPOINT *)

-                                      (*(longlong *)((longlong)unaff_R14 + 0x1f0) + 0xc0) != tVar27)

-        ;

-        iVar20 = func_0x0001402789e0();

-        if ((iVar20 == 0) ||

-           (bVar51 = Scrollbar::NonClient::UserModeSupportsUserModeScrollBars(), !bVar51)) {

-          iVar20 = FindNCHitEx(tVar27,in_stack_000000ac,_uStack0000000000000090);

-        }

-        else {

-          iVar20 = xxxFindNCHitEx(tVar27,in_stack_000000ac,_uStack0000000000000090);

-        }

-        if (((in_stack_000004f8 != 0x200) || (iVar21 != 0)) ||

-           (*(int *)(*(longlong *)((longlong)unaff_R14 + 0x1f0) + 200) != iVar20)) {

-          xxxTrackMouseMove(tVar27,iVar20,in_stack_000004f8);

-        }

-        if (((iVar21 == 0) &&

-            (ptVar46 = *(tagDESKTOP **)((longlong)unaff_R14 + 0x1f0),

-            (*(uint *)(ptVar46 + 0x30) & 0x40) != 0)) &&

-           ((in_stack_000004f8 != 0x200 ||

-            (BVar25 = PtInRect((RECT *)(ptVar46 + 0xcc),PVar18), BVar25 == 0)))) {

-          ResetMouseHover(ptVar46,PVar18);

-        }

-      }

-      iVar21 = CheckPwndFilter(tVar27,in_stack_000000f8);

-      ppuVar45._4_4_ = 0;

-      ppuVar45._0_4_ = in_stack_00000088;

-      if (iVar21 == 0) goto code_r0x000140273e4e;

-      uVar50 = uVar44;

-      if (in_stack_000004f8 == 0x201) {

-        cVar19 = IsMessageInputSourceTouch(&stack0x000004e0);

-        if (cVar19 == '\0') {

-          puVar2 = (uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x214);

-          *puVar2 = *puVar2 & 0xff7fffff;

-        }

-        else {

-          puVar2 = (uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x214);

-          *puVar2 = *puVar2 | 0x800000;

-        }

-        cVar19 = IsMessageInputSourcePen(&stack0x000004e0);

-        if (cVar19 == '\0') {

-          puVar2 = (uint *)(*(longlong *)(in_stack_00000148 + 0x1d8) + 0x214);

-          *puVar2 = *puVar2 & 0xfeffffff;

-        }

-        else {

-          puVar2 = (uint *)(*(longlong *)(in_stack_00000148 + 0x1d8) + 0x214);

-          *puVar2 = *puVar2 | 0x1000000;

-        }

-LAB_33:

-        if (((((*(byte *)(*(longlong *)(*(longlong *)((longlong)tVar27 + 0x88) + 8) + 8) & 8) != 0)

-             || (*(int *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xac) == 1)) ||

-            (iVar21 = IsMenuStarted(), iVar21 != 0)) &&

-           ((uVar50 = 1,

-            in_stack_00000510 <= *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xb8) &&

-            (lVar28 = W32GetUserSessionState(), *(int *)(lVar28 + 0x3f88) == 0)))) {

-          tVar34 = unaff_RSI;

-          if (tVar27 != unaff_RSI) {

-            tVar34 = *(tagPOINT *)tVar27;

-          }

-          lVar28 = *(longlong *)((longlong)unaff_R14 + 0x1d8);

-          if (((tVar34 == *(tagPOINT *)(lVar28 + 0xc0)) &&

-              (in_stack_000004f8 == *(uint *)(lVar28 + 0xb0))) &&

-             ((in_stack_000004f8 != 0x20b ||

-              (in_stack_00000500.x._2_2_ == *(short *)(lVar28 + 0xb4))))) {

-            lVar28 = W32GetUserSessionState();

-            in_stack_000001e0 =

-                 *(int *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 200) -

-                 *(int *)(*(longlong *)(lVar28 + 0x4e30) + 0x7f8) / 2;

-            lVar28 = W32GetUserSessionState();

-            in_stack_000001e4 =

-                 *(int *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xcc) -

-                 *(int *)(*(longlong *)(lVar28 + 0x4e30) + 0x7fc) / 2;

-            lVar28 = W32GetUserSessionState();

-            in_stack_000001e8 =

-                 *(int *)(*(longlong *)(lVar28 + 0x4e30) + 0x7f8) / 2 +

-                 *(int *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 200);

-            lVar28 = W32GetUserSessionState();

-            in_stack_000001ec =

-                 *(int *)(*(longlong *)(lVar28 + 0x4e30) + 0x7fc) / 2 +

-                 *(int *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xcc);

-            PVar18.y = in_stack_00000518;

-            PVar18.x = in_stack_00000514;

-            BVar25 = PtInRect((RECT *)&stack0x000001e0,PVar18);

-            if (BVar25 != 0) {

-              in_stack_00000070 = in_stack_000004f8 + 2;

-              uVar50 = 2;

-            }

-          }

-        }

-LAB_34:

-        uVar23 = *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x214);

-        if ((uVar23 & 8) != 0) {

-          *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x214) = uVar23 | 4;

-        }

-        if ((((in_stack_00000070 - 0x202 < 0xb) &&

-             ((0x449U >> (in_stack_00000070 - 0x202 & 0x1f) & 1) != 0)) &&

-            (*(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xb8) != uVar44)) &&

-           (iVar21 = (int)((ulonglong)in_stack_00000558 >> 0x20), (iVar21 - 4U & 0xfffffffb) == 0))

-        {

-          if (iVar21 == 4) {

-            iVar21 = GetTouchTimeFromCPLValue(300,0xb4,5,1);

-          }

-          else {

-            iVar21 = GetPenDoubleClickTime();

-          }

-          *(int *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xb8) = iVar21 + in_stack_00000588;

-        }

-      }

-      else {

-        if (in_stack_000004f8 == 0x202) goto LAB_34;

-        if (in_stack_000004f8 == 0x204) goto LAB_33;

-        if (in_stack_000004f8 == 0x205) goto LAB_34;

-        if (in_stack_000004f8 == 0x207) goto LAB_33;

-        if (in_stack_000004f8 == 0x208) goto LAB_34;

-        if (in_stack_000004f8 == 0x20b) goto LAB_33;

-        if (in_stack_000004f8 == 0x20c) goto LAB_34;

-      }

-      if (*(int *)(*(longlong *)(*(longlong *)((longlong)tVar27 + 0x10) + 0x1d8) + 0xac) == 1) {

-        in_stack_00000070 = in_stack_00000070 - 0x160;

-        in_stack_000000a0.y = 0;

-        in_stack_000000a0.x = in_stack_000000ac;

-      }

-      iVar21 = MiPCheckMsgFilter(unaff_RDI,in_stack_00000070,in_stack_000000b4);

-      ppuVar45._4_4_ = 0;

-      ppuVar45._0_4_ = in_stack_00000088;

-      if (iVar21 == 0) goto code_r0x000140273e4e;

-      tVar34 = in_stack_000000b8;

-      if (in_stack_000000a8 != uVar44) goto LAB_5;

-      if (in_stack_00000070 - 0x200 < 0xf) {

-        LOCK();

-        uVar23 = *(uint *)((longlong)unaff_R14 + 0x210);

-        if (uVar23 == 0) {

-          *(uint *)((longlong)unaff_R14 + 0x210) = uVar44;

-          uVar23 = 0;

-        }

-        UNLOCK();

-        if ((uVar23 >> 0xf & 1) != 0) goto code_r0x000140273e4e;

-      }

-      LOCK();

-      uVar23 = *(uint *)((longlong)unaff_R14 + 0x210);

-      if (uVar23 == 0) {

-        *(uint *)((longlong)unaff_R14 + 0x210) = uVar44;

-        uVar23 = 0;

-      }

-      UNLOCK();

-      if ((uVar23 >> 0x14 & 1) != 0) {

-        LOCK();

-        *(uint *)((longlong)unaff_R14 + 0x210) = *(uint *)((longlong)unaff_R14 + 0x210) & 0xffefffff

-        ;

-        UNLOCK();

-        in_stack_00000020.x = 1;

-        xxxWindowEvent(0x800b);

-      }

-      if (((in_stack_00000080 != uVar44) && (in_stack_00000070 != 0x200)) &&

-         (in_stack_00000070 != 0xa0)) {

-        in_stack_000000c8 = 1;

-        iVar21 = xxxCallCtfHook(7);

-        uVar53 = in_stack_00000084;

-        if (iVar21 != 0) goto LAB_12;

-      }

-      if (((*(uint *)(**(longlong **)((longlong)unaff_R14 + 0x1f8) + 0x10) |

-           *(uint *)((longlong)unaff_R14 + 0x2d0)) >> 8 & 1) != 0) {

-        in_stack_000000c8 = 1;

-        iVar21 = xxxCallMouseHook(in_stack_00000070);

-        uVar53 = in_stack_00000084;

-        if (iVar21 != 0) goto LAB_12;

-      }

-      iVar21 = PsGetWin32KFilterSet();

-      if (iVar21 == 5) {

-        ptVar35 = PtiCurrent();

-        in_stack_000000c1 = *(tagPOINT *)(*(longlong *)(ptVar35 + 0x208) + 0xf8) != unaff_RSI;

-        if (((bool)in_stack_000000c1) &&

-           (lVar28 = xxxClientCallLocalMouseHooks(in_stack_00000070), uVar53 = in_stack_00000084,

-           lVar28 != 0)) goto LAB_12;

-      }

-      if (((*(uint *)((longlong)unaff_R14 + 0x550) >> 0xd & 1) == 0) &&

-         ((in_stack_000000ac + 2 & 0xfffffffd) == 0)) {

-        tVar34 = unaff_RSI;

-        if (in_stack_00000104 != uVar44) {

-          tVar34 = tVar27;

-          iVar21 = IsIndependentInputWindow((tagWND *)tVar27);

-          if (iVar21 != 0) {

-            GetCompositionInputWindowUIOwner((tagWND *)tVar34);

-          }

-          ptVar33 = (tagWND *)_GetTopLevelWindow();

-          LVar69 = in_stack_00000020.y;

-          tVar34.x = 0;

-          tVar34.y = 0;

-          if (ptVar33 != (tagWND *)0x0) {

-            tVar34 = (tagPOINT)CoreWindowProp::GetCompositeAppFrameWindowOrSelf(ptVar33);

-            Win32HMOptionalThreadLock<tagWND>::Win32HMOptionalThreadLock<tagWND>

-                      ((Win32HMOptionalThreadLock<tagWND> *)&stack0x000003d8,

-                       (tagTHREADINFO *)unaff_R14,(tagWND *)tVar34);

-            in_stack_00000020.y = LVar69;

-            in_stack_00000020.x = uVar44;

-            xxxSendTransformableMessageTimeout(tVar34,0x20);

-            Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

-                      ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x000003d8);

-          }

-        }

-        if (tVar34 == (tagPOINT)0x0) {

-          in_stack_00000020.x = uVar44;

-          xxxSendTransformableMessageTimeout(tVar27,0x20);

-        }

-        uVar53 = in_stack_00000084;

-        if ((((*(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) == unaff_RDI) &&

-             (unaff_RDI != (tagPOINT)0x0)) &&

-            (iVar21 = IsMiPActive(), uVar53 = in_stack_00000084, iVar21 != 0)) &&

-           (((*(uint *)((longlong)unaff_RDI + 100) & 0x400) != 0 &&

-            (iVar21 = IsGenuineMouseInput((tagQMSG *)((longlong)unaff_RDI + 0x7c)),

-            uVar53 = in_stack_00000084, iVar21 != 0)))) {

-          iVar21 = IsMiPMouseMessage(*(undefined4 *)((longlong)unaff_RDI + 0x18));

-          LVar69 = in_stack_00000020.y;

-          uVar53 = in_stack_00000084;

-          if (iVar21 != 0) {

-            memset(&stack0x000007d0,0,0xb0);

-            in_stack_00000020.y = LVar69;

-            in_stack_00000020.x = in_stack_00000080;

-            GeneratePointerMessageFromMouse

-                      ((tagQMSG *)&stack0x000007d0,in_stack_00000070,(tagQMSG *)unaff_RDI,

-                       (tagWND *)tVar27,in_stack_00000080);

-            SetMiPPromotion(*(undefined8 *)((longlong)tVar27 + 0x10),in_stack_000007e8);

-            uVar53 = in_stack_00000084;

-          }

-        }

-        goto LAB_12;

-      }

-      tVar34 = in_stack_000000b8;

-      if (*(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x68) != unaff_RDI)

-      goto LAB_5;

-      memset(&stack0x00000478,0,0x60);

-      uVar53 = in_stack_00000478;

-      uVar54 = in_stack_0000047c;

-      uVar55 = in_stack_00000480;

-      uVar56 = in_stack_00000484;

-      uVar57 = in_stack_00000488;

-      uVar58 = in_stack_0000048c;

-      uVar59 = in_stack_00000490;

-      uVar60 = in_stack_00000494;

-      uVar61 = in_stack_00000498;

-      uVar62 = in_stack_0000049c;

-      uVar63 = in_stack_000004a0;

-      uVar64 = in_stack_000004a4;

-      uVar65 = in_stack_000004a8;

-      uVar66 = in_stack_000004ac;

-      uVar67 = in_stack_000004b0;

-      uVar68 = in_stack_000004b4;

-      uVar48 = uVar44;

-      uVar70 = in_stack_000004b8;

-      uStack0000000000000118 = in_stack_000004c0;

-      uVar71 = in_stack_000004c8;

-      uVar72 = in_stack_000004d0;

-      uVar74 = in_stack_000004f8;

-      if (unaff_RDI != (tagPOINT)0x0) {

-        iVar21 = IsMiPActive();

-        LVar69 = in_stack_00000020.y;

-        if (iVar21 == 0) goto LAB_35;

-        uVar74 = in_stack_00000070;

-        if ((*(uint *)((longlong)unaff_RDI + 100) & 0x400) != 0) {

-          memset(&stack0x00000670,0,0xb0);

-          bVar51 = ShouldGenerateMipMessage

-                             ((tagTHREADINFO *)unaff_R14,(tagQMSG *)unaff_RDI,(tagWND *)tVar27,

-                              in_stack_00000080);

-          if (bVar51) {

-            puVar2 = *(uint **)((longlong)unaff_R14 + 0x600);

-            if ((puVar2 != (uint *)0x0) && ((*puVar2 & 1) != 0)) {

-              uVar53 = puVar2[6];

-              uVar54 = puVar2[7];

-              uVar55 = puVar2[8];

-              uVar56 = puVar2[9];

-              uVar57 = puVar2[10];

-              uVar58 = puVar2[0xb];

-              uVar59 = puVar2[0xc];

-              uVar60 = puVar2[0xd];

-              uVar61 = puVar2[0xe];

-              uVar62 = puVar2[0xf];

-              uVar63 = puVar2[0x10];

-              uVar64 = puVar2[0x11];

-              uVar65 = puVar2[0x12];

-              uVar66 = puVar2[0x13];

-              uVar67 = puVar2[0x14];

-              uVar68 = puVar2[0x15];

-              uVar70 = *(undefined8 *)(puVar2 + 0x16);

-              uStack0000000000000118 = *(undefined8 *)(puVar2 + 0x18);

-              uVar71 = *(undefined8 *)(puVar2 + 0x1a);

-              uVar72 = *(undefined8 *)(puVar2 + 0x1c);

-              uVar48 = 1;

-            }

-            in_stack_00000020.x = in_stack_00000080;

-            iVar21 = GeneratePointerMessageFromMouse

-                               ((tagQMSG *)&stack0x00000670,in_stack_00000070,(tagQMSG *)unaff_RDI,

-                                (tagWND *)tVar27,in_stack_00000080);

-            if (iVar21 != 0) {

-              in_stack_00000510 = (uint)in_stack_000006a0;

-              in_stack_00000514 = (LONG)((ulonglong)in_stack_000006a0 >> 0x20);

-              in_stack_000000c4 = 1;

-              uVar23 = in_stack_00000688;

-              in_stack_000004e8 = in_stack_00000678;

-              in_stack_000004f0 = in_stack_00000680;

-              in_stack_00000500 = in_stack_00000690;

-              in_stack_00000508 = in_stack_00000698;

-              in_stack_00000518 = in_stack_000006a8;

-              in_stack_00000528 = in_stack_000006b8;

-              in_stack_00000530 = in_stack_000006c0;

-              in_stack_00000540 = in_stack_000006d0;

-              in_stack_00000548 = in_stack_000006d8;

-              in_stack_00000558 = in_stack_000006e8;

-              in_stack_000004f8 = in_stack_00000688;

-              in_stack_00000560 = in_stack_000006f0;

-              in_stack_00000588 = in_stack_00000718;

-              if ((in_stack_00000688 == 0x246) &&

-                 (tVar34 = tVar27, iVar21 = IsMiPEnabledForWindow(), iVar21 != 0)) {

-                tVar37 = unaff_RSI;

-                if (tVar34 != (tagPOINT)0x0) {

-                  tVar37 = *(tagPOINT *)tVar27;

-                }

-                *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x238) = tVar37;

-              }

-              else if ((uVar23 - 0x243 & 0xfffffffb) == 0) {

-                *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x238) = unaff_RSI;

-              }

-            }

-          }

-          LVar69 = in_stack_00000020.y;

-          uVar23 = in_stack_000000c4;

-          uVar73 = in_stack_000004f8;

-          if (in_stack_00000080 != uVar44) {

-            *(uint *)((longlong)unaff_RDI + 100) = *(uint *)((longlong)unaff_RDI + 100) & 0xfffffbff

-            ;

-            goto LAB_35;

-          }

-          goto LAB_36;

-        }

-        uVar23 = in_stack_000000c4;

-        if (in_stack_00000080 == uVar44) goto LAB_36;

-        iVar21 = IsMiPMouseMessage(*(undefined4 *)((longlong)unaff_RDI + 0x18));

-        if (iVar21 != 0) {

-          iVar21 = IsGenuineMouseInput((tagQMSG *)((longlong)unaff_RDI + 0x7c));

-          if ((((iVar21 == 0) || (*(uint **)((longlong)unaff_R14 + 0x600) == (uint *)0x0)) ||

-              (uVar23 = **(uint **)((longlong)unaff_R14 + 0x600), (uVar23 & 2) != 0)) ||

-             ((uVar23 & 4) != 0)) {

-            puVar2 = *(uint **)((longlong)unaff_R14 + 0x600);

-            if (puVar2 != (uint *)0x0) {

-              *puVar2 = *puVar2 & 0xfffffffd;

-            }

-            goto LAB_35;

-          }

-          goto LAB_1;

-        }

-      }

-LAB_35:

-      LVar69 = in_stack_00000020.y;

-      uVar23 = in_stack_000000c4;

-      uVar73 = in_stack_000004f8;

-      if (in_stack_00000080 != uVar44) {

-        lVar28 = W32GetUserSessionState();

-        if ((uVar74 == 0x200) || (uVar74 == 0xa0)) {

-          tVar34 = unaff_RSI;

-          if (tVar27 != unaff_RSI) {

-            tVar34 = *(tagPOINT *)tVar27;

-          }

-          if ((tVar34 != *(tagPOINT *)(lVar28 + 0x3fd0)) &&

-             (iVar21 = IsGenuineMouseInput((tagQMSG *)((longlong)unaff_RDI + 0x7c)), iVar21 != 0)) {

-            ptVar33 = (tagWND *)HMValidateHandleNoSecure(*(undefined8 *)(lVar28 + 0x3fd0),1);

-            if ((ptVar33 != (tagWND *)0x0) &&

-               ((iVar21 = IsMiPActive(*(undefined8 *)(ptVar33 + 0x10),0), iVar21 != 0 &&

-                (_Var36 = GetMiPWindowFlags(ptVar33), (_Var36 & 1) == 0)))) {

-              tVar34 = *(tagPOINT *)(ptVar33 + 0x10);

-              if (tVar34 == unaff_R14) {

-                lVar38 = *(longlong *)((longlong)unaff_R14 + 0x600);

-                uVar6 = *(undefined8 *)(lVar38 + 0x18);

-                uVar7 = *(undefined8 *)(lVar38 + 0x20);

-                uVar8 = *(undefined8 *)(lVar38 + 0x28);

-                uVar9 = *(undefined8 *)(lVar38 + 0x30);

-                uVar10 = *(undefined8 *)(lVar38 + 0x38);

-                uVar11 = *(undefined8 *)(lVar38 + 0x40);

-                uVar12 = *(undefined8 *)(lVar38 + 0x48);

-                uVar13 = *(undefined8 *)(lVar38 + 0x50);

-                uVar14 = *(undefined8 *)(lVar38 + 0x58);

-                uVar15 = *(undefined8 *)(lVar38 + 0x60);

-                uVar16 = *(undefined8 *)(lVar38 + 0x68);

-                uVar17 = *(undefined8 *)(lVar38 + 0x70);

-                if (uVar48 != 0) {

-                  *(uint *)(lVar38 + 0x18) = uVar53;

-                  *(uint *)(lVar38 + 0x1c) = uVar54;

-                  *(uint *)(lVar38 + 0x20) = uVar55;

-                  *(uint *)(lVar38 + 0x24) = uVar56;

-                  *(uint *)(lVar38 + 0x28) = uVar57;

-                  *(uint *)(lVar38 + 0x2c) = uVar58;

-                  *(uint *)(lVar38 + 0x30) = uVar59;

-                  *(uint *)(lVar38 + 0x34) = uVar60;

-                  *(uint *)(lVar38 + 0x38) = uVar61;

-                  *(uint *)(lVar38 + 0x3c) = uVar62;

-                  *(uint *)(lVar38 + 0x40) = uVar63;

-                  *(uint *)(lVar38 + 0x44) = uVar64;

-                  *(uint *)(lVar38 + 0x48) = uVar65;

-                  *(uint *)(lVar38 + 0x4c) = uVar66;

-                  *(uint *)(lVar38 + 0x50) = uVar67;

-                  *(uint *)(lVar38 + 0x54) = uVar68;

-                  *(undefined8 *)(lVar38 + 0x58) = uVar70;

-                  *(undefined8 *)(lVar38 + 0x60) = uStack0000000000000118;

-                  *(undefined8 *)(lVar38 + 0x68) = uVar71;

-                  *(undefined8 *)(lVar38 + 0x70) = uVar72;

-                  lVar38 = *(longlong *)((longlong)unaff_R14 + 0x600);

-                }

-                uVar23 = *(uint *)(lVar38 + 0x24);

-                Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

-                          ((Win32HMThreadLockBase<tagMENU,0,0> *)&stack0x000003c8,(tagMENU *)ptVar33

-                          );

-                in_stack_00000020 = unaff_RSI;

-                FindTimer(ptVar33,0xfff3,2);

-                iVar21 = IsMiPEnabledForWindow(ptVar33);

-                if (iVar21 != 0) {

-                  in_stack_00000020.x = uVar44;

-                  xxxSendTransformableMessageTimeout

-                            (extraout_XMM0_Da_02,0x24a,(uVar23 & 0xffffe1f7) << 0x10 | 1,0,

-                             in_stack_00000020);

-                }

-                if (uVar48 != 0) {

-                  lVar38 = *(longlong *)((longlong)unaff_R14 + 0x600);

-                  *(undefined8 *)(lVar38 + 0x18) = uVar6;

-                  *(undefined8 *)(lVar38 + 0x20) = uVar7;

-                  *(undefined8 *)(lVar38 + 0x28) = uVar8;

-                  *(undefined8 *)(lVar38 + 0x30) = uVar9;

-                  *(undefined8 *)(lVar38 + 0x38) = uVar10;

-                  *(undefined8 *)(lVar38 + 0x40) = uVar11;

-                  *(undefined8 *)(lVar38 + 0x48) = uVar12;

-                  *(undefined8 *)(lVar38 + 0x50) = uVar13;

-                  *(undefined8 *)(lVar38 + 0x58) = uVar14;

-                  *(undefined8 *)(lVar38 + 0x60) = uVar15;

-                  *(undefined8 *)(lVar38 + 0x68) = uVar16;

-                  *(undefined8 *)(lVar38 + 0x70) = uVar17;

-                }

-                Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

-                          ((Win32HMThreadLockBase<tagWND,0,0> *)&stack0x000003c8);

-              }

-              else {

-                in_stack_00000020.x = uVar44;

-                PostEventMessageEx((tagTHREADINFO *)tVar34,*(tagQ **)((longlong)tVar34 + 0x1d8),0x15

-                                   ,ptVar33,uVar44,(__uint64)unaff_RSI,(__int64)unaff_RSI,

-                                   (tagINPUT_MESSAGE_SOURCE *)unaff_RSI);

-              }

-            }

-            if (in_stack_000000c4 == 0) {

-              *(tagPOINT *)(lVar28 + 0x3fd0) = unaff_RSI;

-            }

-            else {

-              tVar34 = unaff_RSI;

-              if (tVar27 != (tagPOINT)0x0) {

-                tVar34 = *(tagPOINT *)tVar27;

-              }

-              *(tagPOINT *)(lVar28 + 0x3fd0) = tVar34;

-            }

-          }

-        }

-        if (in_stack_000000c4 == 0) {

-          if (uVar50 == 1) {

-            *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xb0) = in_stack_000004f8;

-            *(short *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xb4) =

-                 in_stack_00000500.x._2_2_;

-            lVar28 = W32GetUserSessionState();

-            *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xb8) =

-                 in_stack_00000510 + *(int *)(lVar28 + 0x3978);

-            tVar34 = unaff_RSI;

-            if (tVar27 != (tagPOINT)0x0) {

-              tVar34 = *(tagPOINT *)tVar27;

-            }

-            *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xc0) = tVar34;

-            *(ulonglong *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 200) =

-                 CONCAT44(in_stack_00000518,in_stack_00000514);

-          }

-          else if (uVar50 == 2) {

-            *(uint *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0xb8) = uVar44;

-          }

-        }

-        uVar23 = in_stack_000000c4;

-        ptVar31 = (tagQMSG *)&stack0x000005c0;

-        if (in_stack_000000c4 == 0) {

-          ptVar31 = (tagQMSG *)&stack0x000004e0;

-        }

-        iVar21 = xxxMouseActivate((tagTHREADINFO *)unaff_R14,(tagWND *)tVar27,ptVar31,

-                                  in_stack_000000ac);

-        LVar69 = in_stack_00000020.y;

-        if (iVar21 == 1) {

-          unaff_R15.x = 1;

-          unaff_R15.y = 0;

-          uVar53 = in_stack_00000084;

-          goto LAB_12;

-        }

-      }

-LAB_36:

-      unaff_R15.x = 1;

-      unaff_R15.y = 0;

-      if ((((in_stack_00000080 != uVar44) &&

-           (xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,1),

-           in_stack_00000080 != uVar44)) && (in_stack_000000c8 != uVar44)) &&

-         (((*(uint *)(**(longlong **)((longlong)unaff_R14 + 0x1f8) + 0x10) |

-           *(uint *)((longlong)unaff_R14 + 0x2d0)) & 0x40) != 0)) {

-        xxxCallHook(6,(ulonglong)in_stack_00000070,(__int64)&stack0x00000590,5);

-      }

-      _LStack0000000000000098 =

-           (tagPOINT)(longlong)CONCAT22(uStack0000000000000094,uStack0000000000000090);

-      in_stack_000000c8 = uVar44;

-      if (0x1ff < in_stack_00000070) {

-        in_stack_000000a0.x = GetMouseKeyFlags(*(undefined8 *)((longlong)unaff_R14 + 0x1d8));

-        in_stack_000000a0.y = 0;

-      }

-      if (((in_stack_00000070 - 0xab < 3) || (in_stack_00000070 - 0x20b < 3)) && (uVar23 == 0)) {

-        in_stack_000000a0 = (tagPOINT)((ulonglong)in_stack_000000a0 | (ulonglong)in_stack_00000500);

-      }

-      ptVar3 = *(tagMENUSTATE **)((longlong)unaff_R14 + 0x288);

-      if (((in_stack_000000ac == 5) && (in_stack_00000080 != uVar44)) &&

-         ((ptVar3 != (tagMENUSTATE *)0x0 &&

-          ((((*(uint *)(ptVar3 + 8) & 0x100) != 0 && (*(uint **)ptVar3 != (uint *)0x0)) &&

-           ((**(uint **)ptVar3 & 1) != 0)))))) {

-        MenuStateOwnerLockxxxUnlock::MenuStateOwnerLockxxxUnlock

-                  ((MenuStateOwnerLockxxxUnlock *)&stack0x000001b0,ptVar3);

-        in_stack_00000020 = _LStack0000000000000098;

-        iVar21 = xxxCallHandleMenuMessages

-                           (ptVar3,tVar27,in_stack_00000070,in_stack_000000a0,

-                            _LStack0000000000000098);

-        LVar69 = in_stack_00000020.y;

-        if (iVar21 != 0) {

-          MenuStateOwnerLockxxxUnlock::~MenuStateOwnerLockxxxUnlock

-                    ((MenuStateOwnerLockxxxUnlock *)&stack0x000001b0);

-          in_stack_000004f8 = uVar73;

-          goto LAB_2;

-        }

-        MenuStateOwnerLockxxxUnlock::~MenuStateOwnerLockxxxUnlock

-                  ((MenuStateOwnerLockxxxUnlock *)&stack0x000001b0);

-      }

-      uVar50 = in_stack_000000b4;

-      if (uVar23 == 0) goto LAB_11;

-      goto LAB_7;

-    }

-    LOCK();

-    uVar23 = *(uint *)((longlong)unaff_R14 + 0x210);

-    if (uVar23 == 0) {

-      *(uint *)((longlong)unaff_R14 + 0x210) = uVar44;

-      uVar23 = 0;

-    }

-    UNLOCK();

-    if (((uVar23 >> 10 & 1) != 0) &&

-       (lVar22 = CheckProcessForeground((tagTHREADINFO *)unaff_R14), tVar34 = in_stack_000000b8,

-       lVar22 < 0)) goto LAB_5;

-    iVar21 = IsInsideMenuLoop();

-    uVar53 = in_stack_00000084;

-    if (iVar21 != 0) goto LAB_12;

-    if ((in_stack_00000540 & 0x10000000000000) == 0) {

-      if ((tVar27 == (tagPOINT)0x0) ||

-         (bVar51 = IsCompositionInputWindowForHitTest((tagWND *)tVar27), bVar49 = 1, !bVar51)) {

-        bVar49 = bVar42;

-      }

-      if (bVar49 == 0) {

-        tVar27 = (tagPOINT)GetThreadDesktopWindow(0);

-      }

-      else {

-        iVar21 = CoreWindowProp::IsCompositeAppOrSelfDisabled((tagWND *)tVar27);

-        uVar53 = in_stack_00000084;

-        if (iVar21 != 0) goto LAB_12;

-      }

-      Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>

-                ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x000003e8,(tagWND *)tVar27);

-      in_stack_00000020 = in_stack_00000530;

-      pHVar32 = xxxDCEWindowHitTest((tagWND *)tVar27,0x200,(__uint64)in_stack_00000500,

-                                    (__int64)in_stack_00000508,in_stack_00000530,

-                                    (int *)&stack0x000000ac,(uint)bVar49 * 4 + 9);

-      tVar27 = (tagPOINT)HMValidateHandleNoSecure(pHVar32,1);

-      ptVar33 = (tagWND *)HMValidateHandleNoSecure(pHVar32,1);

-      InputTraceLogging::Mouse::SecondaryHitTest

-                ((tagQMSG *)&stack0x000004e0,(tagPOINT *)&stack0x00000530,ptVar33);

-      Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

-                ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x000003e8);

-    }

-    else {

-      tVar27 = *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x88);

-    }

-    uVar53 = in_stack_00000084;

-    if (tVar27 == (tagPOINT)0x0) goto LAB_12;

-    Win32HM_ExchangeThreadLock<1>((_HEAD *)tVar27,(_Win32HMThreadLockItem *)&stack0x00000150);

-    in_stack_000000a8 =

-         (uint)CONCAT71(uVar5,*(longlong *)((longlong)tVar27 + 0x10) != in_stack_00000148);

-    if (*(longlong *)((longlong)tVar27 + 0x10) != in_stack_00000168) {

-      tVar34 = *(tagPOINT *)((longlong)tVar27 + 0x10);

-      uVar53 = in_stack_00000084;

-      if (*(longlong *)((longlong)tVar34 + 0x1d8) != *(longlong *)((longlong)unaff_R14 + 0x1d8))

-      goto LAB_12;

-      if (in_stack_00000138 == unaff_RSI) {

-        Win32RawLockedW32Thread::Exchange

-                  ((Win32RawLockedW32Thread *)&stack0x00000298,(_W32THREAD *)tVar34);

-        <lambda_9a8c56010d4439f253c20c359e4261ef>::operator()(&stack0x000001c0,tVar34,tVar27);

-        in_stack_00000138 = tVar34;

-      }

-    }

-    uVar50 = in_stack_000000b4;

-    iVar21 = MiPCheckMsgFilter(unaff_RDI,in_stack_000004f8,in_stack_000000b4);

-    ppuVar45._4_4_ = 0;

-    ppuVar45._0_4_ = in_stack_00000088;

-    if (iVar21 == 0) goto code_r0x000140273e4e;

-    iVar21 = CheckPwndFilter(tVar27,in_stack_000000f8);

-    ppuVar45._4_4_ = 0;

-    ppuVar45._0_4_ = in_stack_00000088;

-    if (iVar21 == 0) goto code_r0x000140273e4e;

-    tVar34 = in_stack_000000b8;

-    if (in_stack_000000a8 != uVar44) goto LAB_5;

-    if ((unaff_RDI == (tagPOINT)0x0) || (iVar21 = IsMiPActive(), iVar21 == 0)) {

-LAB_37:

-      if (in_stack_00000080 != uVar44) {

-        xxxSkipSysMsgEx((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0,1);

-      }

-    }

-    else if ((*(uint *)((longlong)unaff_RDI + 100) & 0x400) == 0) {

-      if (in_stack_00000080 != uVar44) {

-        iVar21 = IsMiPMouseMessage(*(undefined4 *)((longlong)unaff_RDI + 0x18));

-        if (iVar21 != 0) {

-          iVar21 = IsGenuineMouseInput((tagQMSG *)((longlong)unaff_RDI + 0x7c));

-          if ((((iVar21 == 0) || (*(uint **)((longlong)unaff_R14 + 0x600) == (uint *)0x0)) ||

-              (uVar23 = **(uint **)((longlong)unaff_R14 + 0x600), (uVar23 & 2) != 0)) ||

-             ((uVar23 & 4) != 0)) {

-            puVar2 = *(uint **)((longlong)unaff_R14 + 0x600);

-            if (puVar2 != (uint *)0x0) {

-              *puVar2 = *puVar2 & 0xfffffffd;

-            }

-            goto LAB_37;

-          }

-          goto LAB_1;

-        }

-        goto LAB_37;

-      }

-    }

-    else {

-      memset(&stack0x00000720,0,0xb0);

-      uVar23 = in_stack_00000080;

-      bVar51 = ShouldGenerateMipMessage

-                         ((tagTHREADINFO *)unaff_R14,(tagQMSG *)unaff_RDI,(tagWND *)tVar27,

-                          in_stack_00000080);

-      if (bVar51) {

-        in_stack_00000020.x = uVar23;

-        iVar21 = GeneratePointerMessageFromMouse

-                           ((tagQMSG *)&stack0x00000720,in_stack_000004f8,(tagQMSG *)unaff_RDI,

-                            (tagWND *)tVar27,uVar23);

-        LVar69 = in_stack_00000020.y;

-        if (iVar21 != 0) {

-          in_stack_00000510 = (uint)in_stack_00000750;

-          in_stack_00000514 = (LONG)((ulonglong)in_stack_00000750 >> 0x20);

-          uVar23 = 1;

-          in_stack_000000c4 = 1;

-          in_stack_000004e8 = in_stack_00000728;

-          in_stack_000004f0 = in_stack_00000730;

-          in_stack_00000500 = in_stack_00000740;

-          in_stack_00000508 = in_stack_00000748;

-          in_stack_00000518 = in_stack_00000758;

-          in_stack_00000528 = in_stack_00000768;

-          in_stack_00000530 = in_stack_00000770;

-          in_stack_00000540 = in_stack_00000780;

-          in_stack_00000548 = in_stack_00000788;

-          in_stack_00000558 = in_stack_00000798;

-          uVar73 = in_stack_00000738;

-          in_stack_00000560 = in_stack_000007a0;

-          in_stack_00000588 = in_stack_000007c8;

-          if (in_stack_00000080 != uVar44) {

-            *(uint *)((longlong)unaff_RDI + 100) = *(uint *)((longlong)unaff_RDI + 100) & 0xfffffbff

-            ;

-          }

-          goto LAB_7;

-        }

-      }

-      if (in_stack_00000080 != uVar44) {

-        *(uint *)((longlong)unaff_RDI + 100) = *(uint *)((longlong)unaff_RDI + 100) & 0xfffffbff;

-        goto LAB_37;

-      }

-    }

-    uVar23 = GetMouseKeyFlags(*(undefined8 *)((longlong)unaff_R14 + 0x1d8));

-    in_stack_000000a0 = (tagPOINT)((ulonglong)uVar23 | (ulonglong)in_stack_00000500);

-    _uStack0000000000000094 = (int)in_stack_00000508.x._2_2_;

-    _uStack0000000000000090 = (int)(short)in_stack_00000508.x;

-    _LStack0000000000000098 = in_stack_00000508;

-    PhysicalToLogicalDPIPointWithHitTest

-              ((tagPOINT *)&stack0x00000090,(tagPOINT *)&stack0x00000090,(_SUBPIXELS *)0x0,

-               (tagWND *)tVar27);

-    _LStack0000000000000098 =

-         (tagPOINT)(longlong)CONCAT22(uStack0000000000000094,uStack0000000000000090);

-    in_stack_00000514 = (LONG)uStack0000000000000090;

-    in_stack_00000518 = uStack0000000000000090._4_4_;

-    if (in_stack_00000080 != uVar44) {

-      in_stack_000000c8 = 1;

-      iVar21 = xxxCallCtfHook(7,0,in_stack_000004f8);

-      uVar53 = in_stack_00000084;

-      if (iVar21 != 0) goto LAB_12;

-    }

-    if (((*(uint *)(**(longlong **)((longlong)unaff_R14 + 0x1f8) + 0x10) |

-         *(uint *)((longlong)unaff_R14 + 0x2d0)) >> 8 & 1) != 0) {

-      in_stack_000000c8 = 1;

-      iVar21 = xxxCallMouseHook(in_stack_000004f8,&stack0x00000590,in_stack_00000080);

-      uVar53 = in_stack_00000084;

-      if (iVar21 != 0) goto LAB_12;

-    }

-    iVar21 = PsGetWin32KFilterSet();

-    if (iVar21 == 5) {

-      ptVar35 = PtiCurrent();

-      in_stack_000000c0 = *(tagPOINT *)(*(longlong *)(ptVar35 + 0x208) + 0xf8) != unaff_RSI;

-      if (((bool)in_stack_000000c0) &&

-         (lVar28 = xxxClientCallLocalMouseHooks

-                             (in_stack_000004f8,&stack0x00000590,in_stack_00000080),

-         uVar53 = in_stack_00000084, lVar28 != 0)) goto LAB_12;

-    }

-    if (((in_stack_000000c8 == uVar44) || (in_stack_00000080 == uVar44)) ||

-       (((*(uint *)(**(longlong **)((longlong)unaff_R14 + 0x1f8) + 0x10) |

-         *(uint *)((longlong)unaff_R14 + 0x2d0)) & 0x40) == 0)) goto LAB_11;

-    in_stack_00000500.y = 0;

-    in_stack_00000500.x = in_stack_000004f8;

-    tVar34 = (tagPOINT)&stack0x00000590;

-    iVar21 = 6;

-  }

-  xxxCallHook(iVar21,(__uint64)in_stack_00000500,(__int64)tVar34,5);

-LAB_11:

-  if (*(longlong *)((longlong)unaff_R14 + 0x31c) != CONCAT44(in_stack_00000518,in_stack_00000514)) {

-    LOCK();

-    *(uint *)((longlong)unaff_R14 + 0x210) = *(uint *)((longlong)unaff_R14 + 0x210) | 0x100000;

-    UNLOCK();

-  }

-  if ((unaff_RDI != (tagPOINT)0x0) &&

-     (((in_stack_00000540 & 0x2000000000) != 0 || (((uint)(in_stack_00000540 >> 0x3b) & 1) != 0))))

-  {

-    if (*(int *)((longlong)unaff_RDI + 0x18) == 0x200) {

-      tVar34 = unaff_RSI;

-      if (tVar27 != unaff_RSI) {

-        tVar34 = *(tagPOINT *)tVar27;

-      }

-      *(tagPOINT *)((longlong)unaff_RDI + 0x10) = tVar34;

-      *(uint *)((longlong)unaff_RDI + 100) = *(uint *)((longlong)unaff_RDI + 100) | 0x200;

-    }

-    *(tagPOINT *)((longlong)unaff_RDI + 0x40) = _LStack0000000000000098;

-  }

-  *(LONG *)((longlong)unaff_R14 + 0x31c) = in_stack_00000514;

-  *(LONG *)((longlong)unaff_R14 + 800) = in_stack_00000518;

-  *(undefined4 *)((longlong)unaff_R14 + 0x324) =

-       *(undefined4 *)(*(longlong *)((longlong)tVar27 + 0x28) + 0x120);

-  *(tagPOINT *)((longlong)unaff_R14 + 0x328) = in_stack_00000530;

-  *(uint *)((longlong)unaff_R14 + 0x260) = in_stack_00000510;

-  *(undefined8 *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x220) = in_stack_00000528;

-  if ((in_stack_00000070 == 0x202) || (in_stack_00000070 == 0xa2)) {

-    *(tagPOINT *)((longlong)unaff_R14 + 0x330) = in_stack_00000530;

-  }

-  *(tagPOINT *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x60) = unaff_R15;

-  *(tagPOINT *)((longlong)unaff_R14 + 0x268) = unaff_R15;

-  tagTHREADINFO::UpdateLastInputData((tagTHREADINFO *)unaff_R14,(tagQMSG *)&stack0x000004e0);

-  uVar23 = in_stack_000000cc;

-  **(uint **)((longlong)unaff_R14 + 0x1e8) = **(uint **)((longlong)unaff_R14 + 0x1e8) & 0xfffffff7;

-  **(ulonglong **)((longlong)unaff_R14 + 0x208) =

-       **(ulonglong **)((longlong)unaff_R14 + 0x208) & 0x7fffffff;

-  if (in_stack_00000080 != uVar44) {

-    puVar4 = *(ulonglong **)((longlong)unaff_R14 + 0x208);

-    if ((byte)((byte)(in_stack_00000540 >> 0x20) & (byte)unaff_R15.x) == 0) {

-      *puVar4 = *puVar4 & 0xffffffffffffefff;

-    }

-    else {

-      *puVar4 = *puVar4 | 0x1000;

-    }

-  }

-  TransferWakeBit();

-  ClearWakeBit((tagTHREADINFO *)unaff_R14,0x7c07,unaff_R15.x);

-  if ((((in_stack_00000080 != 0) && (in_stack_000000c4 != 0)) &&

-      (*(uint **)((longlong)unaff_R14 + 0x600) != (uint *)0x0)) &&

-     ((uVar44 = **(uint **)((longlong)unaff_R14 + 0x600),

-      (byte)((byte)unaff_R15.x & (byte)uVar44) != 0 && ((uVar44 & 4) != 0)))) {

-    SetMiPWakeBit((tagTHREADINFO *)unaff_R14);

-  }

-  if (tVar27 != (tagPOINT)0x0) {

-    unaff_RSI = *(tagPOINT *)tVar27;

-  }

-  *in_stack_00000190 = unaff_RSI;

-  in_stack_00000190[1].x = in_stack_00000070;

-  if ((uVar23 & 2) != 0) {

-    in_stack_000000a0.x = 0xe5;

-    in_stack_000000a0.y = 0;

-  }

-  in_stack_00000190[2] = in_stack_000000a0;

-  in_stack_00000190[3] = _LStack0000000000000098;

-  in_stack_00000190[4].x = in_stack_00000510;

-  *(ulonglong *)&in_stack_00000190[4].y = CONCAT44(in_stack_00000518,in_stack_00000514);

-  InputTraceLogging::Delivery::ScanSysQueue

-            ((tagQMSG *)&stack0x000004e0,(tagMSG *)in_stack_00000190,(tagTHREADINFO *)unaff_R14,

-             in_stack_00000080 != 0);

-  if (in_stack_00000080 != 0) {

-    EtwTraceInputProcessDelay();

-    *(int *)(*(longlong *)((longlong)unaff_R14 + 0x1d8) + 0x228) =

-         (int)((ulonglong)_DAT_38 * _DAT_fffff78000000320 >> 0x18);

-  }

-  EtwTraceRetrieveInputMessage(in_stack_00000190,in_stack_00000080);

-  CManageInScanSysQueueBit::~CManageInScanSysQueueBit((CManageInScanSysQueueBit *)&stack0x000000c2);

-  Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

-            ((Win32HMOptionalThreadLock<tagHOOK> *)&stack0x00000150);

-  Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

-            ((Win32HMOptionalThreadLock<tagHOOK> *)&stack0x00000270);

-  Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x000002f0);

-  Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x00000308);

-  Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x00000320);

-  Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x00000338);

-  Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x000002b0);

-  Win32RawLockedW32Thread::~Win32RawLockedW32Thread((Win32RawLockedW32Thread *)&stack0x00000298);

-  return unaff_R15.x;

+  return _Var29;

 }
```

## `ValidateChangeMessageFilter`  (modified)

```diff
--- ValidateChangeMessageFilter
+++ ValidateChangeMessageFilter
@@ -1,160 +1,32 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* int __cdecl ValidateChangeMessageFilter(struct tagPROCESSINFO * __ptr64,unsigned int) */

 

 int __cdecl ValidateChangeMessageFilter(tagPROCESSINFO *param_1,uint param_2)

 

 {

-  tagFREELIST *ptVar1;

-  undefined7 uVar2;

-  int iVar3;

-  tagTHREADINFO *ptVar4;

-  tagWND *ptVar5;

-  tagDDECONV *ptVar6;

-  longlong lVar7;

-  uint uVar8;

-  uint uVar9;

-  undefined4 in_register_00000014;

-  undefined8 uVar10;

-  int unaff_EBX;

-  ulong uVar11;

-  tagWND *unaff_RBP;

-  ulong *unaff_RSI;

-  tagDDECONV *unaff_RDI;

-  undefined8 unaff_R12;

-  __int64 *unaff_R14;

-  undefined1 *puStack0000000000000028;

+  bool bVar1;

+  int iVar2;

   

-  xxxClientGetDDEHookData(param_1,CONCAT44(in_register_00000014,param_2));

-  puStack0000000000000028 = &stack0x00000040;

-  xxxMessageEvent();

-  ptVar4 = PtiCurrent();

-  if (*(longlong *)(ptVar4 + 0x1d0) == *(longlong *)(*(longlong *)(unaff_RBP + 0x10) + 0x1d0)) {

-    return unaff_EBX;

-  }

-  uVar9 = (uint)unaff_R12;

-  if (*unaff_RSI == 0x3e0) {

-    return uVar9;

-  }

-  ptVar5 = (tagWND *)ValidateHwnd();

-  uVar2 = (undefined7)((ulonglong)unaff_R12 >> 8);

-  if (ptVar5 == (tagWND *)0x0) {

-    uVar11 = (int)CONCAT71(uVar2,*unaff_RSI == 0x3e1) + 1;

+  iVar2 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 == 0) {

+    if (*(uint *)(param_1 + 0x130) < 0x1001) {

+LAB_0:

+      UserSetLastError(5);

+      EtwTraceUIPISystemError(param_1,0,3);

+      return 0;

+    }

   }

   else {

-    unaff_RDI = FindDdeConv(ptVar5,unaff_RBP);

-    if (unaff_RDI == (tagDDECONV *)0x0) {

-      uVar11 = (ulong)CONCAT71(uVar2,*unaff_RSI == 0x3e1);

-    }

-    else {

-      ptVar4 = PtiCurrent();

-      if ((ptVar4 != *(tagTHREADINFO **)(unaff_RDI + 0x10)) &&

-         (ptVar4 = PtiCurrent(), *(short *)(ptVar4 + 0x2a0) != 0x400)) {

-        UserSetLastError(0x580);

-        return uVar9;

-      }

-      ptVar4 = PtiCurrent();

-      Win32HM_LockIntoThread<0>

-                (ptVar4,(_HEAD *)unaff_RDI,(_Win32HMThreadLockItem *)&stack0x00000030);

-      ptVar1 = *(tagFREELIST **)(unaff_RDI + 0x48);

-      *(undefined8 *)(unaff_RDI + 0x48) = unaff_R12;

-      xxxFreeListFree(ptVar1);

-      iVar3 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

-      if (iVar3 == 0) {

-        iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-        if (iVar3 == 0) {

-          lVar7 = _HMPheFromObject(unaff_RDI);

-          uVar8 = (byte)~*(byte *)(lVar7 + 0x19) & 1;

-        }

-        else {

-          ptVar6 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)unaff_RDI,10);

-          uVar8 = (uint)CONCAT71(uVar2,ptVar6 == unaff_RDI);

-        }

-        if (uVar8 != 0) {

-          if (*unaff_RSI != 0x3e1) {

-            uVar8 = *(uint *)(unaff_RDI + 0x50) & 6;

-            goto LAB_0;

-          }

-          goto LAB_1;

-        }

-LAB_2:

-        uVar11 = 1;

-      }

-      else {

-        iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-        if (iVar3 == 0) {

-          lVar7 = _HMPheFromObject(unaff_RDI);

-          uVar8 = (byte)~*(byte *)(lVar7 + 0x19) & 1;

-        }

-        else {

-          ptVar6 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)unaff_RDI,10);

-          uVar8 = (uint)CONCAT71(uVar2,ptVar6 == unaff_RDI);

-        }

-        if (uVar8 == 0) goto LAB_2;

-        if (*unaff_RSI != 0x3e1) {

-          uVar8 = *(uint *)(unaff_RDI + 0x50) & 0xe;

-LAB_0:

-          if (uVar8 != 0) goto LAB_2;

-        }

-LAB_1:

-        if (*(longlong *)(unaff_RDI + 0x38) == 0) {

-          if ((*(uint *)(unaff_RDI + 0x50) & 1) == 0) {

-            uVar11 = xxxUnexpectedClientPost(unaff_RSI,unaff_R14,unaff_RDI);

-          }

-          else {

-            uVar11 = xxxUnexpectedServerPost(unaff_RSI,unaff_R14,unaff_RDI);

-          }

-        }

-        else {

-          uVar11 = (**(code **)(*(longlong *)(unaff_RDI + 0x38) + 0x20))();

-        }

-      }

-      Win32HMThreadLockBase<tagKL,0,0>::~Win32HMThreadLockBase<tagKL,0,0>

-                ((Win32HMThreadLockBase<tagKL,0,0> *)&stack0x00000030);

-    }

+    bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                      ((UIPIAccessor *)

+                       (-(ulonglong)(param_1 != (tagPROCESSINFO *)0x0) &

+                       (ulonglong)(param_1 + 0x130)),0x2000);

+    if (!bVar1) goto LAB_0;

   }

-  if (uVar11 != 1) {

-    return uVar11;

+  if ((short)(param_2 >> 0x10) != 0) {

+    UserSetLastError(0x57);

+    return 0;

   }

-  ptVar4 = PtiCurrent();

-  LOCK();

-  uVar8 = *(uint *)(ptVar4 + 0x210);

-  if (uVar8 == 0) {

-    *(uint *)(ptVar4 + 0x210) = uVar9;

-    uVar8 = 0;

-  }

-  UNLOCK();

-  if ((uVar8 & 1) != 0) {

-    return 1;

-  }

-  uVar10 = 0x8000;

-  uVar9 = *unaff_RSI & 0xffff;

-  if (uVar9 == 0x3e2) {

-    uVar10 = 0x8101;

-  }

-  else if (uVar9 != 0x3e3) {

-    if (uVar9 == 0x3e4) {

-      uVar10 = 0x8001;

-    }

-    else {

-      if (uVar9 != 0x3e5) {

-        if (uVar9 == 0x3e6) goto LAB_3;

-        if (uVar9 != 999) {

-          if (uVar9 != 1000) {

-            return 1;

-          }

-          uVar10 = 0x8800;

-          goto LAB_3;

-        }

-      }

-      uVar10 = 0x8083;

-    }

-  }

-LAB_3:

-  iVar3 = 1;

-  if (unaff_RDI != (tagDDECONV *)0x0) {

-    xxxClientFreeDDEHandle(*unaff_R14,uVar10);

-    iVar3 = 3;

-  }

-  return iVar3;

+  return 1;

 }
```

## `xxxSetForegroundWindow2`  (modified)

```diff
--- xxxSetForegroundWindow2
+++ EditionPostRawMouseInputMessage
@@ -1,479 +1,174 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* int __cdecl xxxSetForegroundWindow2(struct tagWND * __ptr64,struct tagTHREADINFO * __ptr64,enum

-   SetForegroundBehaviors) */

 

-int __cdecl

-xxxSetForegroundWindow2(tagWND *param_1,tagTHREADINFO *param_2,SetForegroundBehaviors param_3)

+undefined8

+EditionPostRawMouseInputMessage

+          (longlong param_1,__uint64 param_2,ulong param_3,int *param_4,tagRAWMOUSE *param_5)

 

 {

-  uint *puVar1;

-  ulong uVar2;

-  tagQMSG *ptVar3;

-  int iVar4;

-  DeactivateOption DVar5;

-  DeactivateOption DVar6;

-  tagTHREADINFO *ptVar7;

-  longlong lVar8;

-  longlong lVar9;

-  tagWND *ptVar10;

-  tagTHREADINFO *ptVar11;

-  tagTHREADINFO *ptVar12;

-  byte bVar13;

-  undefined8 *puVar14;

-  undefined8 *puVar15;

-  char cVar16;

-  char cVar17;

-  DeactivateOption DVar18;

-  byte bVar19;

-  byte bVar20;

-  tagTHREADINFO *ptVar21;

-  _W32THREAD *p_Var22;

-  uint uVar23;

-  bool bVar24;

-  undefined1 auStackY_1a8 [32];

-  _W32THREAD *local_118;

-  tagQMSG *local_110;

-  undefined8 local_108;

-  tagQMSG *local_100;

-  undefined8 local_f8;

-  undefined8 uStack_f0;

-  undefined8 local_e8;

-  undefined8 local_e0;

-  undefined8 uStack_d8;

-  undefined8 local_d0;

-  undefined8 local_c8;

-  undefined8 uStack_c0;

-  undefined8 local_b8;

-  undefined8 local_b0;

-  undefined8 uStack_a8;

-  undefined8 local_a0;

-  undefined8 local_98;

-  undefined8 uStack_90;

-  undefined8 local_88;

-  undefined8 local_80;

-  undefined8 uStack_78;

-  undefined8 local_70;

+  tagPROCESS_HID_TABLE *ptVar1;

+  undefined8 *puVar2;

+  bool bVar3;

+  undefined4 uVar4;

+  undefined4 uVar5;

+  undefined4 uVar6;

+  bool bVar7;

+  char cVar8;

+  int iVar9;

+  longlong lVar10;

+  tagHIDDATA *ptVar11;

+  longlong lVar12;

+  undefined8 uVar13;

+  tagPROCESS_HID_TABLE *ptVar14;

+  void *pvVar15;

+  undefined8 *puVar16;

+  WhyBgInputSkipped WVar17;

+  undefined1 auStackY_f8 [32];

   undefined8 local_68;

   undefined4 local_60;

   undefined8 local_58;

   undefined4 local_50;

   ulonglong local_48;

   

-  bVar13 = (byte)param_3;

-  local_48 = __security_cookie ^ (ulonglong)auStackY_1a8;

-  local_b0 = 0;

-  uStack_a8 = 0;

-  local_c8 = 0;

-  uStack_c0 = 0;

-  local_a0 = 0;

-  local_b8 = 0xffffffffffffffff;

-  local_98 = 0;

-  uStack_90 = 0;

-  local_88 = 0;

-  local_e0 = 0;

-  uStack_d8 = 0;

-  local_d0 = 0xffffffffffffffff;

-  local_70 = 0;

-  local_80 = 0;

-  uStack_78 = 0;

-  local_e8 = 0xffffffffffffffff;

-  local_f8 = 0;

-  uStack_f0 = 0;

-  bVar19 = bVar13;

-  ptVar7 = PtiCurrent();

-  ptVar12 = (tagTHREADINFO *)0x0;

-  DVar6 = 0;

-  DVar18 = 0;

-  local_108 = 0;

-  local_58 = 0;

-  local_50 = 0;

-  local_68 = 0;

-  local_60 = 0;

-  Feature_FixAsyncActivationChildWindowGuard__private_IsEnabledDeviceUsageNoInline();

-  SetSystemInputSource(&local_108);

-  cVar17 = '\0';

-  ptVar21 = ptVar12;

-  if (param_1 != (tagWND *)0x0) {

-    lVar8 = W32GetUserSessionState();

-    if ((*(longlong *)(param_1 + 0x18) != *(longlong *)(lVar8 + 0x4b58)) ||

-       (*(char *)(*(longlong *)(param_1 + 0x28) + 0x13) < '\0')) {

-      if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0 ||

-          (cVar16 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)))) {

-        cVar16 = cVar17;

-      }

-      bVar24 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar16 != '\0') || (bVar24)) {

-        lVar8 = W32GetUserSessionState();

-        bVar19 = bVar24;

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar16,bVar24,

-                   *(undefined8 *)(lVar8 + 0x10f98));

-      }

-      Win32RawLockedItemBase<_W32THREAD,0,1,1,1>::UnlockWorker

-                ((Win32RawLockedItemBase<_W32THREAD,0,1,1,1> *)&local_f8,true,(bool)bVar19);

-      Win32RawLockedItemBase<_W32THREAD,0,1,1,1>::UnlockWorker

-                ((Win32RawLockedItemBase<_W32THREAD,0,1,1,1> *)&local_e0,true,(bool)bVar19);

-      Win32RawLockedItemBase<_W32THREAD,0,1,1,1>::UnlockWorker

-                ((Win32RawLockedItemBase<_W32THREAD,0,1,1,1> *)&local_c8,true,(bool)bVar19);

-      return 0;

-    }

-    iVar4 = IsWindowUnderActiveLockScreen(param_1);

-    if (iVar4 != 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-         (cVar16 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-        cVar16 = cVar17;

-      }

-      bVar24 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar16 != '\0') || (bVar24)) {

-        lVar8 = W32GetUserSessionState();

-        bVar19 = bVar24;

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar16,bVar24,

-                   *(undefined8 *)(lVar8 + 0x10f98));

-      }

-      goto LAB_0;

-    }

-  }

-  if (param_2 != (tagTHREADINFO *)0x0) {

-    Win32RawLockedW32Thread::ManualLock((Win32RawLockedW32Thread *)&local_c8,(_W32THREAD *)param_2);

-  }

-  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-     (cVar16 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar16 = cVar17;

-  }

-  bVar24 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar16 != '\0') || (bVar24)) {

-    PsGetThreadId(*(undefined8 *)ptVar7);

-    if (param_2 != (tagTHREADINFO *)0x0) {

-      PsGetThreadId(*(undefined8 *)param_2);

-    }

-    lVar8 = W32GetUserSessionState();

-    bVar19 = bVar24;

-    WPP_RECORDER_AND_TRACE_SF_qDD

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar16,bVar24,

-               *(undefined8 *)(lVar8 + 0x10f98));

-  }

-  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-     (cVar17 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar17 = '\0';

-  }

-  bVar24 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar17 != '\0') || (bVar24)) {

-    lVar8 = W32GetUserSessionState();

-    bVar19 = bVar24;

-    WPP_RECORDER_AND_TRACE_SF_d

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar17,bVar24,

-               *(undefined8 *)(lVar8 + 0x10f98));

-  }

-  lVar8 = W32GetUserSessionState();

-  *(undefined8 *)(lVar8 + 0x4a20) = 0;

-  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-     (cVar17 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar17 = '\0';

-  }

-  bVar24 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar17 != '\0') || (bVar24)) {

-    lVar8 = W32GetUserSessionState();

-    bVar19 = bVar24;

-    WPP_RECORDER_AND_TRACE_SF_

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar17,bVar24,

-               *(undefined8 *)(lVar8 + 0x10f98));

-  }

-  lVar8 = W32GetUserSessionState();

-  p_Var22 = (_W32THREAD *)ptVar12;

-  if (*(longlong *)(lVar8 + 0x4a60) != 0) {

-    lVar8 = W32GetUserSessionState();

-    puVar1 = (uint *)(*(longlong *)(lVar8 + 0x4a60) + 0x210);

-    LOCK();

-    uVar23 = *puVar1;

-    if (uVar23 == 0) {

-      *puVar1 = 0;

-      uVar23 = 0;

-    }

-    UNLOCK();

-    if ((uVar23 & 1) == 0) {

-      lVar8 = W32GetUserSessionState();

-      p_Var22 = *(_W32THREAD **)(lVar8 + 0x4a60);

-      Win32RawLockedW32Thread::ManualLock((Win32RawLockedW32Thread *)&local_e0,p_Var22);

-    }

-  }

-  if (param_1 == (tagWND *)0x0) {

-    local_118 = (_W32THREAD *)0x0;

-    ResetForegroundQueue(1);

-    ptVar11 = ptVar12;

-    ptVar10 = (tagWND *)ptVar12;

+                    /* 0x226f80  238  EditionPostRawMouseInputMessage */

+  local_48 = __security_cookie ^ (ulonglong)auStackY_f8;

+  iVar9 = RawInputRequestedForMouse();

+  if (iVar9 == 0) {

+LAB_0:

+    uVar13 = 0;

   }

   else {

-    local_118 = *(_W32THREAD **)(param_1 + 0x10);

-    SetNewForegroundQueue(*(tagQ **)(local_118 + 0x1d8),(param_3 & 0x200 | 0x100) >> 8);

-    Win32RawLockedW32Thread::ManualLock((Win32RawLockedW32Thread *)&local_f8,local_118);

-    ptVar11 = *(tagTHREADINFO **)(param_1 + 0x10);

-    ptVar10 = param_1;

-  }

-  xxxSetForegroundThreadWithWindowHint(ptVar11,ptVar10);

-  if ((param_3 & 0x20) == 0) {

-    lVar8 = W32GetUserSessionState();

-    if (*(longlong *)(lVar8 + 0x4a50) != 0) {

-      lVar8 = W32GetUserSessionState();

-      local_58 = CONCAT44(local_58._4_4_,**(undefined4 **)(lVar8 + 0x4a50));

-      lVar8 = W32GetUserSessionState();

-      local_58 = CONCAT44(*(undefined4 *)(*(longlong *)(lVar8 + 0x4a50) + 4),(undefined4)local_58);

+    if (param_1 == 0) {

+      lVar10 = W32GetUserSessionState();

+      if (*(longlong *)(lVar10 + 0x4a60) != 0) {

+        lVar10 = W32GetUserSessionState();

+        cVar8 = IsSpatialDelegationEnabledForThread(*(undefined8 *)(lVar10 + 0x4a60));

+        if (cVar8 != '\0') goto LAB_0;

+      }

+      lVar10 = W32GetUserSessionState();

+      puVar16 = *(undefined8 **)(lVar10 + 0x4a50);

     }

-    lVar8 = W32GetUserSessionState();

-    if (*(longlong *)(lVar8 + 0x4a58) != 0) {

-      lVar8 = W32GetUserSessionState();

-      local_68 = CONCAT44(local_68._4_4_,**(undefined4 **)(lVar8 + 0x4a58));

-      lVar8 = W32GetUserSessionState();

-      local_68 = CONCAT44(*(undefined4 *)(*(longlong *)(lVar8 + 0x4a58) + 4),(undefined4)local_68);

+    else {

+      if (*(int *)(param_1 + 0x5c) == 2) {

+        lVar10 = *(longlong *)(param_1 + 0x50);

+      }

+      else {

+        lVar10 = 0;

+      }

+      puVar16 = *(undefined8 **)(*(longlong *)(lVar10 + 0x10) + 0x1d8);

     }

-    bVar19 = 0;

-    bVar24 = UIPrivilegeIsolation::CheckAccess

-                       ((tagUIPI_INFO *)&local_58,(tagUIPI_INFO *)&local_68,0);

-    if (!bVar24) {

-      ClearKeyboardToggleStates();

-      lVar8 = W32GetUserSessionState();

-      if (*(longlong *)(ptVar7 + 0x1f0) == *(longlong *)(lVar8 + 0x4b58)) {

-        lVar8 = W32GetUserSessionState();

-        puVar14 = (undefined8 *)(*(longlong *)(lVar8 + 0x4b58) + 0xb0);

-        for (puVar15 = (undefined8 *)*puVar14; puVar15 != puVar14; puVar15 = (undefined8 *)*puVar15)

-        {

-          lVar8 = puVar15[-0x26];

-          *(undefined8 *)(lVar8 + 0x158) = 0xffffffffffffffff;

-          *(undefined8 *)(lVar8 + 0x160) = 0xffffffffffffffff;

-          *(undefined8 *)(lVar8 + 0x168) = 0xffffffffffffffff;

-          *(undefined8 *)(lVar8 + 0x170) = 0xffffffffffffffff;

-          *(uint *)(lVar8 + 0x214) = *(uint *)(lVar8 + 0x214) | 1;

+    if (*param_4 == 2) {

+      pvVar15 = *(void **)(param_4 + 2);

+    }

+    else {

+      pvVar15 = (void *)0x0;

+    }

+    bVar3 = true;

+    if (puVar16 != (undefined8 *)0x0) {

+      lVar10 = PtiMouseFromQ(puVar16);

+      ptVar1 = *(tagPROCESS_HID_TABLE **)(*(longlong *)(lVar10 + 0x1d0) + 0x340);

+      if ((ptVar1 != (tagPROCESS_HID_TABLE *)0x0) && ((*(uint *)(ptVar1 + 100) & 1) != 0)) {

+        FlushThrottledRawMouseInput(ptVar1,param_3);

+        PtiMouseFromQ(puVar16);

+        ptVar11 = (tagHIDDATA *)AllocateHidData(pvVar15,0,0x18);

+        bVar3 = false;

+        if (ptVar11 == (tagHIDDATA *)0x0) goto LAB_0;

+        puVar2 = *(undefined8 **)(ptVar11 + 0x18);

+        puVar16 = *(undefined8 **)(puVar2[2] + 0x1d8);

+        InputTraceLogging::Mouse::DeliverRawInput(param_2,(HWND__ *)*puVar2,ptVar11,param_5,false);

+        uVar4 = *(undefined4 *)(param_5 + 4);

+        uVar5 = *(undefined4 *)(param_5 + 8);

+        uVar6 = *(undefined4 *)(param_5 + 0xc);

+        *(undefined4 *)(ptVar11 + 0x50) = *(undefined4 *)param_5;

+        *(undefined4 *)(ptVar11 + 0x54) = uVar4;

+        *(undefined4 *)(ptVar11 + 0x58) = uVar5;

+        *(undefined4 *)(ptVar11 + 0x5c) = uVar6;

+        *(undefined8 *)(ptVar11 + 0x60) = *(undefined8 *)(param_5 + 0x10);

+        iVar9 = PostInputMessage(puVar16,puVar2,0xff,0);

+        if (iVar9 == 0) {

+          FreeHidData(ptVar11);

+          bVar3 = true;

         }

       }

     }

-  }

-  lVar8 = W32GetUserSessionState();

-  if (*(longlong *)(lVar8 + 0x4a50) != 0) {

-    lVar8 = W32GetUserSessionState();

-    lVar8 = *(longlong *)(lVar8 + 0x4a50);

-    lVar9 = W32GetUserSessionState();

-    if ((lVar8 != *(longlong *)(lVar9 + 0x4a58)) &&

-       (lVar8 = W32GetUserSessionState(), *(longlong *)(*(longlong *)(lVar8 + 0x4a50) + 0x88) != 0))

-    {

-      lVar8 = W32GetUserSessionState();

-      if (-1 < (char)*(int *)(lVar8 + 0x10658)) {

-        xxxApplyGlobalInputSettings(*(int *)(lVar8 + 0x10658));

+    lVar10 = W32GetUserSessionState();

+    if (*(int *)(lVar10 + 0x41d4) != 0) {

+      lVar12 = W32GetUserSessionState();

+      lVar10 = 0;

+      ptVar1 = (tagPROCESS_HID_TABLE *)(lVar12 + 0xd8);

+      local_58 = 0;

+      local_50 = 0;

+      if (puVar16 != (undefined8 *)0x0) {

+        lVar10 = PtiMouseFromQ(puVar16);

+        lVar10 = *(longlong *)(lVar10 + 0x1d0);

+        local_58 = *puVar16;

+      }

+      for (ptVar14 = *(tagPROCESS_HID_TABLE **)ptVar1; ptVar14 != ptVar1;

+          ptVar14 = *(tagPROCESS_HID_TABLE **)ptVar14) {

+        if ((*(uint *)(ptVar14 + 100) & 4) == 0) goto LAB_1;

+        lVar12 = *(longlong *)(ptVar14 + 0x40);

+        if (((lVar12 == 0) || (*(char *)(*(longlong *)(lVar12 + 0x28) + 0x14) < '\0')) ||

+           (*(char *)(*(longlong *)(lVar12 + 0x28) + 0x13) < '\0')) {

+          WVar17 = 0;

+LAB_2:

+          InputTraceLogging::RawInput::SkipBackgroundListener(ptVar14,pvVar15,WVar17);

+        }

+        else {

+          uVar13 = *(undefined8 *)(*(longlong *)(lVar12 + 0x10) + 0x1d8);

+          lVar12 = W32GetUserSessionState();

+          if (*(longlong *)(*(longlong *)(ptVar14 + 0x40) + 0x18) != *(longlong *)(lVar12 + 0x4b58))

+          {

+            WVar17 = 1;

+            goto LAB_2;

+          }

+          bVar7 = UIPrivilegeIsolation::CheckAccess

+                            ((tagUIPI_INFO *)

+                             (*(longlong *)

+                               (*(longlong *)(*(longlong *)(ptVar14 + 0x40) + 0x10) + 0x1d0) + 0x130

+                             ),(tagUIPI_INFO *)&local_58,0);

+          if ((!bVar7) &&

+             (-1 < *(int *)(*(longlong *)

+                             (*(longlong *)(*(longlong *)(ptVar14 + 0x40) + 0x10) + 0x1d0) + 0xc)))

+          {

+            local_68 = local_58;

+            local_60 = local_50;

+            EtwTraceUIPIInputError

+                      (*(longlong *)(*(longlong *)(ptVar14 + 0x40) + 0x10),0,uVar13,&local_68);

+            WVar17 = 2;

+            goto LAB_2;

+          }

+          if (*(longlong *)(*(longlong *)(*(longlong *)(ptVar14 + 0x40) + 0x10) + 0x1d0) != lVar10)

+          {

+            if (((*(uint *)(ptVar14 + 100) & 8) == 0) || (bVar3)) {

+              bVar7 = ThrottleRawMouseInputToBackgroundListener

+                                (ptVar14,pvVar15,param_5,param_2,param_3);

+              if (!bVar7) {

+                PostRawMouseInputToBackgroundListener(ptVar14,pvVar15,param_5,param_2,param_3);

+                goto LAB_1;

+              }

+              WVar17 = 4;

+            }

+            else {

+              WVar17 = 3;

+            }

+            goto LAB_2;

+          }

+        }

+LAB_1:

+      }

+      cVar8 = RawMouseThrottlingTimerActive();

+      if (cVar8 != '\0') {

+        for (ptVar14 = *(tagPROCESS_HID_TABLE **)ptVar1; ptVar14 != ptVar1;

+            ptVar14 = *(tagPROCESS_HID_TABLE **)ptVar14) {

+          if (((*(uint *)(ptVar14 + 100) & 1) != 0) && (*(int *)(ptVar14 + 0x70) == 2))

+          goto LAB_3;

+        }

+        ArmRawMouseThrottlingTimer(0,0);

       }

     }

+LAB_3:

+    uVar13 = 1;

   }

-  lVar8 = W32GetUserSessionState();

-  lVar8 = *(longlong *)(lVar8 + 0x4a50);

-  lVar9 = W32GetUserSessionState();

-  if (lVar8 != *(longlong *)(lVar9 + 0x4a58)) {

-    lVar8 = W32GetUserSessionState();

-    if ((*(longlong *)(lVar8 + 0x4a58) != 0) &&

-       (lVar8 = W32GetUserSessionState(), *(longlong *)(*(longlong *)(lVar8 + 0x4a58) + 0x88) != 0))

-    {

-      lVar8 = W32GetUserSessionState();

-      zzzInputFocusLostWindowEvent(*(undefined8 *)(*(longlong *)(lVar8 + 0x4a58) + 0x88),1);

-    }

-    lVar8 = W32GetUserSessionState();

-    if ((*(longlong *)(lVar8 + 0x4a50) != 0) &&

-       (lVar8 = W32GetUserSessionState(), *(longlong *)(*(longlong *)(lVar8 + 0x4a50) + 0x88) != 0))

-    {

-      zzzInputFocusReceivedWindowEvent(1);

-    }

-    if (param_2 != (tagTHREADINFO *)0x0) {

-      xxxCancelTracking();

-      lVar8 = W32GetUserSessionState();

-      CCursorClip::ClearClip(*(CCursorClip **)(lVar8 + 0x8e20));

-      zzzLockWindowUpdate2(0,1);

-    }

-    ptVar7 = ptVar12;

-    if (p_Var22 != (_W32THREAD *)0x0) {

-      LOCK();

-      uVar23 = *(uint *)(p_Var22 + 0x210);

-      if (uVar23 == 0) {

-        *(uint *)(p_Var22 + 0x210) = 0;

-        uVar23 = 0;

-      }

-      UNLOCK();

-      if ((uVar23 & 1) == 0) {

-        ptVar7 = *(tagTHREADINFO **)(p_Var22 + 0x1d8);

-      }

-    }

-    ptVar11 = ptVar12;

-    if (param_2 != (tagTHREADINFO *)0x0) {

-      ptVar11 = *(tagTHREADINFO **)(param_2 + 0x1d8);

-    }

-    local_110 = (tagQMSG *)0x0;

-    if ((ptVar7 != (tagTHREADINFO *)0x0) && (ptVar7 != ptVar11)) {

-      bVar19 = 1;

-      local_100 = AllocQEntryEx((tagMLIST *)(ptVar7 + 0x28),(tagQMSG *)0x0,1);

-      if (local_100 == (tagQMSG *)0x0) goto LAB_0;

-      if ((((param_1 != (tagWND *)0x0) &&

-           (ptVar10 = (tagWND *)_GetTopLevelWindow(param_1), ptVar10 != (tagWND *)0x0)) &&

-          (iVar4 = CoreWindowProp::IsComponent(ptVar10), ptVar21 = (tagTHREADINFO *)0x0, iVar4 != 0)

-          ) && (iVar4 = CoreWindowProp::IsHostThreadOf((tagTHREADINFO *)p_Var22,ptVar10), iVar4 != 0

-               )) {

-        ptVar21 = (tagTHREADINFO *)0x1;

-      }

-      lVar8 = PtiKbdFromQ(ptVar7);

-      uVar2 = *(ulong *)(*(longlong *)(lVar8 + 0x1d0) + 0x10c);

-      lVar8 = W32GetUserSessionState();

-      ptVar11 = ptVar12;

-      if (*(longlong *)(lVar8 + 0x4a60) != 0) {

-        lVar8 = W32GetUserSessionState();

-        ptVar11 = (tagTHREADINFO *)PsGetThreadId(**(undefined8 **)(lVar8 + 0x4a60));

-      }

-      ptVar3 = local_100;

-      StoreQMessage(local_100,(tagWND *)0x0,0,(__uint64)ptVar11,0,0,0,5,(__uint64)ptVar21,0,

-                    (tagINPUT_MESSAGE_SOURCE *)&local_108,uVar2,(void *)0x0,(tagUIPI_INFO *)0x0);

-      if (p_Var22 != (_W32THREAD *)0x0) {

-        *(_W32THREAD **)(ptVar3 + 0x68) = p_Var22;

-        SetWakeBit(p_Var22,0x2040);

-      }

-      if ((*(tagWND **)(ptVar7 + 0x90) != (tagWND *)0x0) &&

-         (bVar24 = IsHungWindow(*(tagWND **)(ptVar7 + 0x90)), bVar24)) {

-        ProcessHungWindow(*(tagWND **)(ptVar7 + 0x90));

-      }

-    }

-    bVar19 = 1;

-    ptVar7 = ptVar12;

-    if (local_118 != (_W32THREAD *)0x0) {

-      LOCK();

-      uVar23 = *(uint *)(local_118 + 0x210);

-      if (uVar23 == 0) {

-        *(int *)(local_118 + 0x210) = 0;

-        uVar23 = 0;

-      }

-      UNLOCK();

-      if ((uVar23 & 1) == 0) {

-        ptVar7 = *(tagTHREADINFO **)(local_118 + 0x1d8);

-      }

-    }

-    ptVar11 = ptVar12;

-    if (param_2 != (tagTHREADINFO *)0x0) {

-      ptVar11 = *(tagTHREADINFO **)(param_2 + 0x1d8);

-    }

-    bVar20 = 1;

-    if (ptVar7 != (tagTHREADINFO *)0x0) {

-      if ((ptVar7 != ptVar11) &&

-         (local_110 = AllocQEntryEx((tagMLIST *)(ptVar7 + 0x28),(tagQMSG *)0x0,1),

-         ptVar21 = (tagTHREADINFO *)0x0, local_110 == (tagQMSG *)0x0)) goto LAB_0;

-      bVar20 = 0xff;

-      iVar4 = `anonymous_namespace'::RemoveEventMessage(ptVar7,5);

-      if (ptVar7 == ptVar11) {

-        if (param_1 == *(tagWND **)(ptVar11 + 0x90)) {

-          ptVar21 = ptVar12;

-          if (param_1 != (tagWND *)0x0) {

-            ptVar21 = *(tagTHREADINFO **)param_1;

-          }

-          bVar20 = (byte)ptVar21;

-          `anonymous_namespace'::xxxSendNCActivateMessage(param_1,1);

-          `anonymous_namespace'::xxxUpdateTray(param_1);

-          if ((param_3 & 4) == 0) {

-            bVar20 = 0;

-            xxxSetWindowPos(param_1,0,0,0);

-          }

-        }

-        else if ((param_3 & 1) == 0) {

-          bVar13 = ~(byte)(param_3 << 4) & 0x80;

-          bVar19 = bVar13 | 2;

-          if ((param_3 & 4) == 0) {

-            bVar19 = bVar13;

-          }

-          if (p_Var22 != (_W32THREAD *)0x0) {

-            ptVar12 = (tagTHREADINFO *)PsGetThreadId(*(undefined8 *)p_Var22);

-          }

-          `anonymous_namespace'::xxxLocalActivateWindow(param_1,(ulonglong)ptVar12 & 0xffffffff);

-          lVar8 = W32GetUserSessionState();

-          if ((*(uint *)(lVar8 + 0x10654) & 1) != 0) {

-            zzzActiveCursorTracking(param_1);

-          }

-          ptVar21 = (tagTHREADINFO *)0x1;

-          goto LAB_0;

-        }

-      }

-      else {

-        ptVar21 = ptVar12;

-        if (((ptVar11 != (tagTHREADINFO *)0x0) || ((param_3 & 2) != 0)) &&

-           (param_1 != (tagWND *)0x0)) {

-          ptVar21 = *(tagTHREADINFO **)param_1;

-        }

-        if (iVar4 != 0) {

-          *(uint *)(ptVar7 + 0x214) = *(uint *)(ptVar7 + 0x214) | 0x8000;

-        }

-        bVar19 = 1;

-        uVar23 = param_3 >> 2 & 1;

-        lVar8 = PtiKbdFromQ(ptVar7);

-        uVar2 = *(ulong *)(*(longlong *)(lVar8 + 0x1d0) + 0x10c);

-        ptVar11 = ptVar12;

-        if ((bVar19 & bVar13) == 0) {

-          DVar5 = DVar18;

-          if (p_Var22 != (_W32THREAD *)0x0) {

-            DVar5 = PsGetThreadId(*(undefined8 *)p_Var22);

-          }

-          ptVar11 = (tagTHREADINFO *)(ulonglong)DVar5;

-        }

-        bVar20 = (byte)uVar23;

-        StoreQMessage(local_110,(tagWND *)0x0,uVar23,(__uint64)ptVar11,(__int64)ptVar21,0,0,6,0,0,

-                      (tagINPUT_MESSAGE_SOURCE *)&local_108,uVar2,(void *)0x0,(tagUIPI_INFO *)0x0);

-        *(_W32THREAD **)(local_110 + 0x68) = local_118;

-        SetWakeBit(local_118,0x2040);

-        if ((*(tagWND **)(ptVar7 + 0x90) != (tagWND *)0x0) &&

-           (bVar24 = IsHungWindow(*(tagWND **)(ptVar7 + 0x90)), bVar24)) {

-          ProcessHungWindow(*(tagWND **)(ptVar7 + 0x90));

-        }

-      }

-      if ((param_3 & 0x40) == 0) {

-        xxxDeliverRestoreFocusMessage(param_1);

-      }

-    }

-    bVar19 = bVar20;

-    ptVar21 = ptVar12;

-    if (p_Var22 != (_W32THREAD *)0x0) {

-      LOCK();

-      uVar23 = *(uint *)(p_Var22 + 0x210);

-      if (uVar23 == 0) {

-        *(uint *)(p_Var22 + 0x210) = 0;

-        uVar23 = 0;

-      }

-      UNLOCK();

-      if ((uVar23 & 1) == 0) {

-        ptVar21 = *(tagTHREADINFO **)(p_Var22 + 0x1d8);

-      }

-    }

-    if (param_2 != (tagTHREADINFO *)0x0) {

-      ptVar12 = *(tagTHREADINFO **)(param_2 + 0x1d8);

-    }

-    if ((ptVar21 != (tagTHREADINFO *)0x0) && (ptVar21 == ptVar12)) {

-      if (param_1 != (tagWND *)0x0) {

-        ptVar10 = (tagWND *)_GetTopLevelWindow(param_1);

-        DVar18 = DVar6;

-        if ((ptVar10 != (tagWND *)0x0) && (iVar4 = CoreWindowProp::IsComponent(ptVar10), iVar4 != 0)

-           ) {

-          iVar4 = CoreWindowProp::IsHostThreadOf((tagTHREADINFO *)p_Var22,ptVar10);

-          DVar18 = 0;

-          if (iVar4 != 0) {

-            DVar18 = 1;

-          }

-        }

-        DVar6 = PsGetThreadId(**(undefined8 **)(param_1 + 0x10));

-      }

-      bVar19 = (byte)DVar18;

-      xxxDeactivate(param_2,DVar6,DVar18);

-    }

-  }

-  ptVar21 = (tagTHREADINFO *)0x1;

-LAB_0:

-  Win32RawLockedItemBase<_W32THREAD,0,1,1,1>::UnlockWorker

-            ((Win32RawLockedItemBase<_W32THREAD,0,1,1,1> *)&local_f8,true,(bool)bVar19);

-  Win32RawLockedItemBase<_W32THREAD,0,1,1,1>::UnlockWorker

-            ((Win32RawLockedItemBase<_W32THREAD,0,1,1,1> *)&local_e0,true,(bool)bVar19);

-  Win32RawLockedItemBase<_W32THREAD,0,1,1,1>::UnlockWorker

-            ((Win32RawLockedItemBase<_W32THREAD,0,1,1,1> *)&local_c8,true,(bool)bVar19);

-  return (int)ptVar21;

+  return uVar13;

 }
```

## `xxxProcessNotifyWinEvent`  (modified)

```diff
--- xxxProcessNotifyWinEvent
+++ xxxProcessNotifyWinEvent
@@ -1,550 +1,279 @@
 

-undefined8

-xxxProcessNotifyWinEvent(byte param_1,undefined8 param_2,undefined8 param_3,longlong param_4)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+

+undefined8 xxxProcessNotifyWinEvent(longlong param_1)

 

 {

-  byte *pbVar1;

-  byte bVar2;

-  ushort uVar3;

-  longlong lVar4;

-  byte bVar5;

-  bool bVar6;

-  int iVar7;

-  int iVar8;

-  undefined8 *puVar9;

-  _HEAD *p_Var10;

-  longlong lVar11;

-  tagWND *ptVar12;

-  byte bVar13;

-  tagWND *ptVar14;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  tagWND *unaff_RSI;

-  char cVar15;

-  tagTHREADINFO *ptVar16;

-  tagTHREADINFO *ptVar17;

-  undefined8 uVar18;

-  tagTHREADINFO *ptVar19;

-  char cVar20;

-  bool bVar21;

-  float10 in_ST0;

-  undefined8 in_stack_00000020;

-  ulonglong uVar22;

+  tagEVENTHOOK *ptVar1;

+  uint *puVar2;

+  tagEVENTHOOK *ptVar3;

+  undefined8 uVar4;

+  tagTHREADINFO *ptVar5;

+  tagDomLock *this;

+  code *pcVar6;

+  char cVar7;

+  bool bVar8;

+  short sVar9;

+  short sVar10;

+  uint uVar11;

+  int iVar12;

+  undefined4 uVar13;

+  undefined8 *puVar14;

+  longlong lVar15;

+  tagUIPI_INFO *ptVar16;

+  longlong *plVar17;

+  longlong lVar18;

+  _func_void_HWINEVENTHOOK___ptr_ulong_HWND___ptr_long_long_ulong_ulong *p_Var19;

+  tagUIPI_INFO *ptVar20;

+  undefined8 uVar21;

+  tagUIPI_INFO *ptVar22;

+  undefined8 unaff_RBX;

+  char *pcVar23;

+  undefined1 *puVar24;

+  tagUIPI_INFO *ptVar25;

+  uint uVar26;

+  undefined8 unaff_R12;

+  undefined8 unaff_R15;

+  tagQ *ptVar27;

+  undefined1 auStack_b8 [8];

+  undefined1 auStack_b0 [128];

+  ulonglong local_30;

   

-  pbVar1 = (byte *)(unaff_RBX + -0x74b71cbb);

-  bVar2 = *pbVar1;

-  *pbVar1 = *pbVar1 + param_1;

-  *(char *)(param_4 + -0x74b7dbbc) =

-       (*(char *)(param_4 + -0x74b7dbbc) - param_1) - CARRY1(bVar2,param_1);

-  *(short *)(param_4 + 0x4c402444) = (short)in_ST0;

-  uVar22 = CONCAT71((int7)((ulonglong)in_stack_00000020 >> 8),5);

-  WPP_RECORDER_AND_TRACE_SF_ddq();

-  ptVar12 = *(tagWND **)(unaff_RSI + 0x68);

-  ptVar19 = (tagTHREADINFO *)0x0;

-  *(undefined8 *)(unaff_RBP + -0x31) = *(undefined8 *)(unaff_RBP + -0x21);

-  uVar18 = 0xfffffffe;

-  *(tagWND **)(unaff_RBP + -0x29) = ptVar12;

-  *(undefined1 *)(unaff_RBP + 0x67) = 0;

-  *(undefined8 *)(unaff_RBP + -0x39) = 0;

-  ptVar16 = ptVar19;

-  ptVar17 = ptVar19;

-  do {

-    iVar8 = (int)ptVar16;

-    if (iVar8 == 0) {

-      bVar21 = IsCompositionInputWindowForHitTest(unaff_RSI);

-      if (bVar21) {

-        lVar11 = *(longlong *)(unaff_RBP + 0x7f);

-        if ((*(uint *)(lVar11 + 0x20) & 4) != 0) {

-          ptVar17 = ptVar19;

-          if (*(longlong *)(unaff_RSI + 0x18) != 0) {

-            ptVar17 = *(tagTHREADINFO **)(*(longlong *)(unaff_RSI + 0x18) + 0x70);

+  puVar24 = auStack_b8;

+  local_30 = __security_cookie ^ (ulonglong)auStack_b8;

+  puVar14 = (undefined8 *)PsGetCurrentThreadWin32Thread();

+  ptVar20 = (tagUIPI_INFO *)0x0;

+  ptVar25 = ptVar20;

+  if (puVar14 != (undefined8 *)0x0) {

+    ptVar25 = (tagUIPI_INFO *)*puVar14;

+  }

+  lVar15 = W32GetUserSessionState();

+  cVar7 = ExIsResourceAcquiredExclusiveLite(*(undefined8 *)(lVar15 + 0xa5f0));

+  if (cVar7 != '\x01') {

+    pcVar6 = (code *)swi(0x2c);

+    (*pcVar6)();

+    puVar24 = auStack_b0;

+  }

+  ptVar3 = *(tagEVENTHOOK **)(param_1 + 0x10);

+  uVar13 = *(undefined4 *)(param_1 + 0x38);

+  *(undefined8 *)(puVar24 + 200) = unaff_RBX;

+  *(undefined8 *)(puVar24 + 0xd0) = unaff_R12;

+  *(undefined8 *)(puVar24 + 0xd8) = unaff_R15;

+  ptVar1 = ptVar3 + 0x10;

+  if (((byte)uVar13 & 0xc) == 4) {

+LAB_0:

+    uVar21 = *(undefined8 *)(ptVar3 + 0x18);

+    ptVar27 = *(tagQ **)(*(longlong *)(ptVar3 + 0x10) + 0x1d8);

+  }

+  else {

+    LOCK();

+    uVar26 = *(uint *)(ptVar25 + 0x210);

+    if (uVar26 == 0) {

+      *(uint *)(ptVar25 + 0x210) = 0;

+      uVar26 = 0;

+    }

+    UNLOCK();

+    if ((uVar26 & 0xd) != 0) goto LAB_0;

+    if ((*(undefined8 **)ptVar1)[0x3a] != *(longlong *)(ptVar25 + 0x1d0)) {

+      uVar21 = **(undefined8 **)ptVar1;

+      *(undefined8 *)(puVar24 + -8) = 0x140031343;

+      cVar7 = IsRestricted(uVar21);

+      if (cVar7 != '\0') goto LAB_0;

+    }

+    uVar21 = **(undefined8 **)(*(longlong *)ptVar1 + 0x1d0);

+    *(undefined8 *)(puVar24 + -8) = 0x140031364;

+    sVar9 = PsGetProcessMachine(uVar21);

+    uVar21 = **(undefined8 **)(ptVar25 + 0x1d0);

+    *(undefined8 *)(puVar24 + -8) = 0x14003137d;

+    sVar10 = PsGetProcessMachine(uVar21);

+    if (sVar10 != sVar9) goto LAB_0;

+    ptVar16 = (tagUIPI_INFO *)(*(longlong *)(ptVar25 + 0x1d0) + 0x130);

+    if (*(longlong *)(ptVar25 + 0x1d0) == 0) {

+      ptVar16 = ptVar20;

+    }

+    ptVar22 = (tagUIPI_INFO *)(*(longlong *)(*(longlong *)ptVar1 + 0x1d0) + 0x130);

+    if (*(longlong *)(*(longlong *)ptVar1 + 0x1d0) == 0) {

+      ptVar22 = ptVar20;

+    }

+    *(undefined8 *)(puVar24 + -8) = 0x1400313c5;

+    bVar8 = UIPrivilegeIsolation::CheckAccess(ptVar22,ptVar16,0);

+    if (bVar8) {

+      if ((*(int *)(ptVar3 + 0x38) == 0) || (*(longlong *)(ptVar3 + 0x30) == 0)) {

+        uVar21 = *(undefined8 *)(*(longlong *)(ptVar3 + 0x10) + 0x1d0);

+        *(undefined8 *)(puVar24 + -8) = 0x14003141a;

+        iVar12 = IsImmersiveBroker(uVar21);

+        if ((iVar12 == 0) &&

+           (((lVar15 = *(longlong *)(*(longlong *)(ptVar3 + 0x10) + 0x1d0),

+             -1 < *(int *)(lVar15 + 0xc) && (lVar15 != *(longlong *)(ptVar25 + 0x1d0))) &&

+            ((*(uint *)(lVar15 + 0x330) >> 8 & 1) == 0)))) {

+          *(undefined8 *)(puVar24 + -8) = 0x140031464;

+          iVar12 = IsImmersiveAppRestricted();

+          if (iVar12 == 0) {

+            *(undefined8 *)(puVar24 + 0x40) = 0;

+            *(undefined4 *)(puVar24 + 0x40) = 6;

+            *(undefined8 *)(puVar24 + 0x20) = 0;

+            *(undefined8 *)(puVar24 + -8) = 0x140031499;

+            iVar12 = ZwQueryInformationProcess(0xffffffffffffffff,0x34,puVar24 + 0x40);

+            if ((-1 < iVar12) && ((puVar24[0x44] & 1) == 0)) goto LAB_1;

           }

-          if ((*(tagTHREADINFO **)(unaff_RSI + 0x68) == ptVar17) ||

-             ((*(byte *)(*(longlong *)(unaff_RSI + 0x28) + 0x1f) & 0x10) != 0)) goto LAB_0;

-        }

-        ptVar16 = (tagTHREADINFO *)0x3;

+          goto LAB_0;

+        }

+      }

 LAB_1:

-        ptVar17 = *(tagTHREADINFO **)(unaff_RBP + -0x39);

-      }

-      else {

-        if ((*(byte *)(*(longlong *)(unaff_RSI + 0x28) + 0x1f) & 0x10) == 0) {

-          ptVar16 = (tagTHREADINFO *)0x3;

-          goto LAB_1;

-        }

-        lVar11 = *(longlong *)(unaff_RBP + 0x7f);

-LAB_0:

-        iVar8 = CoreWindowProp::IsComponent(unaff_RSI);

-        ptVar12 = unaff_RSI;

-        if (iVar8 == 0) {

-          do {

-            ptVar14 = ptVar12;

-            ptVar12 = *(tagWND **)(ptVar14 + 0x68);

-            if (ptVar12 == (tagWND *)0x0) goto LAB_2;

-          } while (((*(longlong *)(ptVar14 + 0x18) == 0) ||

-                   (lVar4 = *(longlong *)(*(longlong *)(ptVar14 + 0x18) + 8), lVar4 == 0)) ||

-                  (ptVar12 != *(tagWND **)(lVar4 + 0x18)));

-          if ((ptVar14 == (tagWND *)0x0) || (-1 < *(char *)(*(longlong *)(ptVar14 + 0x28) + 0xe9)))

-          {

-LAB_2:

-            bVar2 = *(byte *)(*(longlong *)(unaff_RSI + 0x28) + 0xe9);

-            bVar13 = bVar2 >> 4 & 2;

-            bVar5 = bVar13 | 1;

-            if ((bVar2 & 0x40) == 0) {

-              bVar5 = bVar13;

-            }

-            bVar13 = bVar5 | 1;

-            if (-1 < (char)bVar2) {

-              bVar13 = bVar5;

-            }

-            if (bVar13 != 0) {

-              ptVar16 = (tagTHREADINFO *)0x3;

-              goto LAB_1;

-            }

-          }

-        }

-        if ((((*(uint *)(lVar11 + 0x20) & 2) == 0) || (*(longlong *)(unaff_RSI + 0x68) == 0)) ||

-           ((*(longlong *)(unaff_RSI + 0x18) == 0 ||

-            (((lVar4 = *(longlong *)(*(longlong *)(unaff_RSI + 0x18) + 8), lVar4 == 0 ||

-              (*(longlong *)(unaff_RSI + 0x68) != *(longlong *)(lVar4 + 0x18))) ||

-             ((((ushort)((uint)*(undefined4 *)(*(longlong *)(unaff_RSI + 0x28) + 0x120) >> 8) ^

-               (ushort)((uint)*(undefined4 *)(unaff_RBP + 0x17) >> 8)) & 0x1ff) != 0)))))) {

-          ptVar17 = *(tagTHREADINFO **)(unaff_RBP + -0x39);

+      if ((*(uint *)(ptVar3 + 0x28) & 1) == 0) {

+        *(undefined8 *)(puVar24 + 0x48) = *(undefined8 *)(ptVar25 + 0x1c8);

+        *(undefined1 **)(ptVar25 + 0x1c8) = puVar24 + 0x48;

+        *(tagEVENTHOOK **)(puVar24 + 0x50) = ptVar3;

+        *(undefined8 *)(puVar24 + -8) = 0x140031635;

+        HMLockObject(ptVar3);

+        *(tagUIPI_INFO **)(param_1 + 0x40) = ptVar25;

+        if ((*(uint *)(ptVar3 + 0x28) & 8) == 0) {

+          p_Var19 = *(_func_void_HWINEVENTHOOK___ptr_ulong_HWND___ptr_long_long_ulong_ulong **)

+                     (ptVar3 + 0x40);

         }

         else {

-          *(longlong *)(unaff_RBP + -0x31) = unaff_RBX;

-          *(tagWND **)(unaff_RBP + -0x39) = unaff_RSI;

-          ptVar17 = (tagTHREADINFO *)unaff_RSI;

-        }

-        if (bVar21) {

-LAB_3:

-          if ((*(longlong *)(*(longlong *)(unaff_RSI + 0x28) + 0xa8) == 0) ||

-             (iVar8 = GrePtInRegion(*(longlong *)(*(longlong *)(unaff_RSI + 0x28) + 0xa8),

-                                    *(undefined4 *)(unaff_RBP + -0x31),

-                                    *(undefined4 *)(unaff_RBP + -0x2d)), iVar8 != 0)) {

-            if (((*(byte *)(*(longlong *)(unaff_RSI + 0x28) + 0x1a) & 8) == 0) ||

-               (((*(uint *)(*(longlong *)(unaff_RSI + 0x28) + 0xe8) & 2) != 0 ||

-                (bVar6 = DCELayerHitTest(unaff_RSI,*(tagPOINT *)(unaff_RBP + -0x31)), bVar6)))) {

-              iVar8 = CoreWindowProp::IsCompositeAppOrSelfDisabled(unaff_RSI);

-              if ((iVar8 == 0) || ((*(uint *)(lVar11 + 0x20) & 1) == 0)) {

-                if ((!bVar21) &&

-                   (lVar11 = *(longlong *)(unaff_RSI + 0x28), (*(byte *)(lVar11 + 0x1f) & 0x20) == 0

-                   )) {

-                  iVar8 = (int)*(undefined8 *)(unaff_RBP + -0x31);

-                  if ((*(int *)(lVar11 + 0x68) <= iVar8) &&

-                     (((iVar8 < *(int *)(lVar11 + 0x70) &&

-                       (iVar8 = (int)((ulonglong)*(undefined8 *)(unaff_RBP + -0x31) >> 0x20),

-                       *(int *)(lVar11 + 0x6c) <= iVar8)) && (iVar8 < *(int *)(lVar11 + 0x74))))) {

-                    ptVar17 = *(tagTHREADINFO **)(unaff_RBP + -0x39);

-                    ptVar12 = *(tagWND **)(unaff_RBP + -0x29);

-                    if (*(tagWND **)(unaff_RSI + 0x70) == (tagWND *)0x0) {

-                      ptVar16 = (tagTHREADINFO *)0x2;

-                    }

-                    else {

-                      ptVar16 = (tagTHREADINFO *)0x0;

-                      unaff_RSI = *(tagWND **)(unaff_RSI + 0x70);

-                    }

-                    goto LAB_4;

-                  }

-                }

-                ptVar16 = (tagTHREADINFO *)0x1;

-              }

-              else if ((bVar21) ||

-                      ((*(byte *)(*(longlong *)(unaff_RSI + 0x28) + 0x1f) & 0xc0) != 0x40)) {

-                ptVar16 = (tagTHREADINFO *)&DAT_5;

-              }

-              else {

-                ptVar16 = (tagTHREADINFO *)0x3;

-              }

-            }

-            else {

-              ptVar16 = (tagTHREADINFO *)0x3;

-            }

-          }

-          else {

-            ptVar16 = (tagTHREADINFO *)0x3;

-          }

-          goto LAB_1;

-        }

-        if ((*(_D3DMATRIX **)(unaff_RSI + 0xd8) != (_D3DMATRIX *)0x0) &&

-           (unaff_RSI != (tagWND *)ptVar17)) {

-          bVar6 = DCEHitTestWindow((tagRECT *)(*(longlong *)(unaff_RSI + 0x28) + 0x58),

-                                   *(_D3DMATRIX **)(unaff_RSI + 0xd8),

-                                   (tagPOINT *)(unaff_RBP + -0x31),*(_SUBPIXELS **)(lVar11 + 0x28));

-          if (!bVar6) {

-            ptVar16 = (tagTHREADINFO *)0x3;

-            goto LAB_1;

-          }

-          goto LAB_3;

-        }

-        lVar4 = *(longlong *)(unaff_RSI + 0x28);

-        iVar8 = (int)*(undefined8 *)(unaff_RBP + -0x31);

-        if (((*(int *)(lVar4 + 0x58) <= iVar8) && (iVar8 < *(int *)(lVar4 + 0x60))) &&

-           ((iVar8 = (int)((ulonglong)*(undefined8 *)(unaff_RBP + -0x31) >> 0x20),

-            *(int *)(lVar4 + 0x5c) <= iVar8 && (iVar8 < *(int *)(lVar4 + 100)))))

-        goto LAB_3;

-        ptVar16 = (tagTHREADINFO *)0x3;

-      }

-      ptVar12 = *(tagWND **)(unaff_RBP + -0x29);

-    }

-    else {

-      if ((iVar8 == 1) || (iVar8 == 2)) {

-        *(undefined4 *)(unaff_RBP + -0x19) = 0xfffffffe;

-        bVar21 = IsCompositionInputWindowForHitTest(unaff_RSI);

-        if (bVar21) {

-          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 5)) {

-            cVar20 = '\0';

-          }

-          else {

-            cVar20 = '\x01';

-          }

-          if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-             (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

-            cVar15 = '\0';

-          }

-          else {

-            cVar15 = '\x01';

-          }

-          if ((cVar20 != '\0') || (cVar15 != '\0')) {

-            lVar11 = W32GetUserSessionState();

-            uVar18 = *(undefined8 *)(lVar11 + 0x10f98);

-LAB_6:

-            uVar22 = CONCAT71((int7)(uVar22 >> 8),5);

-            WPP_RECORDER_AND_TRACE_SF_

-                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar20,cVar15,uVar18,uVar22);

-          }

-        }

-        else {

-          puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-          ptVar17 = ptVar19;

-          if (puVar9 != (undefined8 *)0x0) {

-            ptVar17 = (tagTHREADINFO *)*puVar9;

-          }

-          if (*(tagTHREADINFO **)(unaff_RSI + 0x10) == ptVar17) {

-            if ((((((*(longlong *)(unaff_RSI + 0x68) == 0) || (*(longlong *)(unaff_RSI + 0x18) == 0)

-                   ) || (lVar11 = *(longlong *)(*(longlong *)(unaff_RSI + 0x18) + 8), lVar11 == 0))

-                 || ((*(longlong *)(unaff_RSI + 0x68) != *(longlong *)(lVar11 + 0x18) ||

-                     (iVar7 = IsWindowDesktopComposed(unaff_RSI), iVar7 == 0)))) ||

-                ((*(byte *)(*(longlong *)(unaff_RSI + 0x28) + 0x1a) & 8) == 0)) || (iVar8 == 2)) {

-LAB_7:

-              puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-              ptVar17 = ptVar19;

-              if (puVar9 != (undefined8 *)0x0) {

-                ptVar17 = (tagTHREADINFO *)*puVar9;

-              }

-              *(undefined8 *)(unaff_RBP + 7) = *(undefined8 *)(ptVar17 + 0x1c8);

-              *(longlong *)(ptVar17 + 0x1c8) = unaff_RBP + 7;

-              *(tagWND **)(unaff_RBP + 0xf) = unaff_RSI;

-              HMLockObject(unaff_RSI);

-              uVar22 = uVar22 & 0xffffffff00000000;

-              uVar18 = xxxSendTransformableMessageTimeout

-                                 (unaff_RSI,0x84,0,

-                                  (longlong)

-                                  CONCAT22(*(undefined2 *)(unaff_RBP + -0x2d),

-                                           *(undefined2 *)(unaff_RBP + -0x31)),uVar22);

-              puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-              ptVar17 = ptVar19;

-              if (puVar9 != (undefined8 *)0x0) {

-                ptVar17 = (tagTHREADINFO *)*puVar9;

-              }

-              p_Var10 = Win32HM_UnlockFromThread<1>

-                                  (ptVar17,(_Win32HMThreadLockItem *)(unaff_RBP + 7));

-              *(undefined8 *)(unaff_RBP + 0xf) = 0;

-              *(undefined8 *)(unaff_RBP + 7) = 0xffffffffffffffff;

-              if ((p_Var10 == (_HEAD *)0x0) ||

-                 (lVar11 = _HMPheFromObject(unaff_RSI), (*(byte *)(lVar11 + 0x19) & 1) != 0)) {

-                if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                   (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0 ||

-                    ((byte)WPP_GLOBAL_Control[0x29] < 3)))) {

-                  cVar20 = '\0';

+          *(undefined8 *)(puVar24 + -8) = 0x140031653;

+          p_Var19 = xxxGetEventProc(ptVar3);

+        }

+        if (p_Var19 != (_func_void_HWINEVENTHOOK___ptr_ulong_HWND___ptr_long_long_ulong_ulong *)0x0)

+        {

+          uVar13 = *(undefined4 *)(ptVar3 + 0x4c);

+          *(undefined8 *)(puVar24 + -8) = 0x140031665;

+          uVar13 = W32SetCurrentThreadDpiAwarenessContext(uVar13);

+          *(undefined8 *)(puVar24 + -8) = 0x140031676;

+          UnlockDomainShared<>::UnlockDomainExclusive<DLT_WINEVENT>::UnlockObjectLock<>::

+          UnlockObjectLock<>((UnlockObjectLock<> *)(puVar24 + 0x58));

+          *(undefined8 *)(puVar24 + -8) = 0x140031684;

+          xxxClientCallWinEventProc(p_Var19,ptVar3,param_1);

+          if (puVar24[0x80] != '\0') {

+            pcVar23 = puVar24 + 0x60;

+            ptVar25 = ptVar20;

+            do {

+              this = *(tagDomLock **)(pcVar23 + -8);

+              if (this != (tagDomLock *)0x0) {

+                if (*pcVar23 == '\0') {

+                  *(undefined8 *)(puVar24 + -8) = 0x1400316b9;

+                  tagDomLock::LockShared(this);

                 }

                 else {

-                  cVar20 = '\x01';

-                }

-                bVar21 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-                if ((cVar20 != '\0') || (bVar21)) {

-                  lVar11 = W32GetUserSessionState();

-                  WPP_RECORDER_AND_TRACE_SF_q

-                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar20,bVar21,

-                             *(undefined8 *)(lVar11 + 0x10f98),3);

-                }

-                if (*(longlong *)(unaff_RBP + 7) == -1) {

-                  return 0;

-                }

-                puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-                if (puVar9 != (undefined8 *)0x0) {

-                  ptVar19 = (tagTHREADINFO *)*puVar9;

-                }

-                Win32HM_UnlockFromThread<1>(ptVar19,(_Win32HMThreadLockItem *)(unaff_RBP + 7));

-                return 0;

-              }

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 5)) {

-                cVar20 = '\0';

-              }

-              else {

-                cVar20 = '\x01';

-              }

-              if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-                 (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

-                cVar15 = '\0';

-              }

-              else {

-                cVar15 = '\x01';

-              }

-              if ((cVar20 != '\0') || (cVar15 != '\0')) {

-                lVar11 = W32GetUserSessionState();

-                WPP_RECORDER_AND_TRACE_SF_ddqd

-                          (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar20,cVar15,

-                           *(undefined8 *)(lVar11 + 0x10f98));

-              }

-              if (*(longlong *)(unaff_RBP + 7) != -1) {

-                puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-                if (puVar9 == (undefined8 *)0x0) {

-                  Win32HM_UnlockFromThread<1>

-                            ((tagTHREADINFO *)0x0,(_Win32HMThreadLockItem *)(unaff_RBP + 7));

-                }

-                else {

-                  Win32HM_UnlockFromThread<1>

-                            ((tagTHREADINFO *)*puVar9,(_Win32HMThreadLockItem *)(unaff_RBP + 7));

+                  *(undefined8 *)(puVar24 + -8) = 0x1400316ab;

+                  tagDomLock::LockExclusive(this);

                 }

               }

-            }

-            else {

-              puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-              ptVar17 = ptVar19;

-              if (puVar9 != (undefined8 *)0x0) {

-                ptVar17 = (tagTHREADINFO *)*puVar9;

-              }

-              *(undefined8 *)(unaff_RBP + -9) = *(undefined8 *)(ptVar17 + 0x1c8);

-              *(longlong *)(ptVar17 + 0x1c8) = unaff_RBP + -9;

-              *(tagWND **)(unaff_RBP + -1) = unaff_RSI;

-              HMLockObject(unaff_RSI);

-              uVar18 = ReferenceDwmApiPort();

-              *(undefined4 *)(unaff_RBP + -0x11) = 1;

-              UserSessionSwitchLeaveCrit();

-              uVar22 = *(ulonglong *)(*(undefined4 **)(unaff_RBP + 0x7f) + 2);

-              DwmSyncHitTestQuery(uVar18,*(undefined8 *)unaff_RSI,

-                                  **(undefined4 **)(unaff_RBP + 0x7f),

-                                  *(undefined8 *)(unaff_RBP + -0x21),uVar22);

-              EnterCrit(1);

-              puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-              ptVar17 = ptVar19;

-              if (puVar9 != (undefined8 *)0x0) {

-                ptVar17 = (tagTHREADINFO *)*puVar9;

-              }

-              p_Var10 = Win32HM_UnlockFromThread<1>

-                                  (ptVar17,(_Win32HMThreadLockItem *)(unaff_RBP + -9));

-              *(undefined8 *)(unaff_RBP + -1) = 0;

-              *(undefined8 *)(unaff_RBP + -9) = 0xffffffffffffffff;

-              if ((p_Var10 == (_HEAD *)0x0) ||

-                 (lVar11 = _HMPheFromObject(unaff_RSI), (*(byte *)(lVar11 + 0x19) & 1) != 0)) {

-                if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                   (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0 ||

-                    ((byte)WPP_GLOBAL_Control[0x29] < 3)))) {

-                  cVar20 = '\0';

-                }

-                else {

-                  cVar20 = '\x01';

-                }

-                bVar21 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-                if ((cVar20 != '\0') || (bVar21)) {

-                  lVar11 = W32GetUserSessionState();

-                  WPP_RECORDER_AND_TRACE_SF_q

-                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar20,bVar21,

-                             *(undefined8 *)(lVar11 + 0x10f98),3);

-                }

-                if (*(longlong *)(unaff_RBP + -9) == -1) {

-                  return 0;

-                }

-                puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-                if (puVar9 != (undefined8 *)0x0) {

-                  ptVar19 = (tagTHREADINFO *)*puVar9;

-                }

-                Win32HM_UnlockFromThread<1>(ptVar19,(_Win32HMThreadLockItem *)(unaff_RBP + -9));

-                return 0;

-              }

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 5)) {

-                cVar20 = '\0';

-              }

-              else {

-                cVar20 = '\x01';

-              }

-              if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-                 (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

-                cVar15 = '\0';

-              }

-              else {

-                cVar15 = '\x01';

-              }

-              iVar8 = *(int *)(unaff_RBP + -0x11);

-              *(ulonglong *)(unaff_RBP + -0x19) = (ulonglong)*(uint *)(unaff_RBP + -0x19);

-              if ((cVar20 != '\0') || (cVar15 != '\0')) {

-                lVar11 = W32GetUserSessionState();

-                WPP_RECORDER_AND_TRACE_SF_ddds

-                          (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar20,cVar15,

-                           *(undefined8 *)(lVar11 + 0x10f98));

-              }

-              if (*(longlong *)(unaff_RBP + -9) != -1) {

-                ptVar17 = PtiCurrent();

-                Win32HM_UnlockFromThread<1>(ptVar17,(_Win32HMThreadLockItem *)(unaff_RBP + -9));

-              }

-              if (iVar8 == 0) goto LAB_7;

-              uVar18 = *(undefined8 *)(unaff_RBP + -0x19);

-            }

-            ptVar17 = *(tagTHREADINFO **)(unaff_RBP + -0x39);

-            ptVar12 = *(tagWND **)(unaff_RBP + -0x29);

-            if ((int)uVar18 == -1) {

-              *(undefined1 *)(unaff_RBP + 0x67) = 1;

-              ptVar16 = (tagTHREADINFO *)0x3;

-              uVar18 = 0xfffffffe;

-            }

-            else {

-              ptVar16 = (tagTHREADINFO *)&DAT_5;

-            }

-            goto LAB_4;

+              uVar26 = (int)ptVar25 + 1;

+              ptVar25 = (tagUIPI_INFO *)(ulonglong)uVar26;

+              pcVar23 = pcVar23 + 0x10;

+            } while (uVar26 == 0);

           }

-          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 5)) {

-            cVar20 = '\0';

-          }

-          else {

-            cVar20 = '\x01';

-          }

-          if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-             (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

-            cVar15 = '\0';

-          }

-          else {

-            cVar15 = '\x01';

-          }

-          if ((cVar20 != '\0') || (cVar15 != '\0')) {

-            lVar11 = W32GetUserSessionState();

-            uVar18 = *(undefined8 *)(lVar11 + 0x10f98);

-            goto LAB_6;

-          }

-        }

-        ptVar16 = (tagTHREADINFO *)&DAT_5;

-        uVar18 = 1;

-        goto LAB_1;

-      }

-      if (iVar8 == 3) {

-        if ((*(longlong *)(unaff_RSI + 0xd8) != 0) || (unaff_RSI == (tagWND *)ptVar17)) {

-          *(undefined8 *)(unaff_RBP + -0x31) = *(undefined8 *)(unaff_RBP + -0x21);

-          RestoreLogicalPoint(*(tagWND **)(unaff_RSI + 0x68),(tagPOINT *)(unaff_RBP + -0x31),

-                              *(tagDCE_WINDOW_HIT_TEST_ARGS **)(unaff_RBP + 0x7f));

-          ptVar12 = *(tagWND **)(unaff_RBP + -0x29);

-        }

-        ptVar14 = *(tagWND **)(unaff_RSI + 0x58);

-        ptVar17 = (tagTHREADINFO *)0x0;

-        *(undefined8 *)(unaff_RBP + -0x39) = 0;

-        if (ptVar14 == (tagWND *)0x0) {

-          ptVar16 = (tagTHREADINFO *)0x2;

-          unaff_RSI = *(tagWND **)(unaff_RSI + 0x68);

-        }

-        else {

-          unaff_RSI = ptVar14;

-          ptVar16 = ptVar19;

-          ptVar17 = ptVar19;

-          if ((*(tagWND **)(ptVar14 + 0x68) == ptVar12) &&

-             (ptVar16 = (tagTHREADINFO *)0x0, *(char *)(unaff_RBP + 0x77) != '\0')) break;

-        }

-      }

-      else if (iVar8 == 4) {

-        if (*(char *)(unaff_RBP + 0x67) == '\0') {

-          lVar11 = *(longlong *)(unaff_RBP + 0x7f);

-        }

-        else {

-          puVar9 = (undefined8 *)PsGetCurrentThreadWin32Thread();

-          if (puVar9 != (undefined8 *)0x0) {

-            ptVar19 = (tagTHREADINFO *)*puVar9;

-          }

-          lVar11 = *(longlong *)(unaff_RBP + 0x7f);

-          if ((*(tagTHREADINFO **)(unaff_RSI + 0x10) != ptVar19) &&

-             ((*(uint *)(lVar11 + 0x20) & 8) != 0)) {

-            if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-               (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0 ||

-                ((byte)WPP_GLOBAL_Control[0x29] < 5)))) {

-              cVar20 = '\0';

-            }

-            else {

-              cVar20 = '\x01';

-            }

-            if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-               (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

-              cVar15 = '\0';

-            }

-            else {

-              cVar15 = '\x01';

-            }

-            if ((cVar20 == '\0') && (cVar15 == '\0')) {

-              return 0;

-            }

-            lVar11 = W32GetUserSessionState();

-            WPP_RECORDER_AND_TRACE_SF_

-                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar20,cVar15,

-                       *(undefined8 *)(lVar11 + 0x10f98),5);

-            return 0;

-          }

-        }

-        if (*(int **)(lVar11 + 0x18) != (int *)0x0) {

-          **(int **)(lVar11 + 0x18) = (int)uVar18;

-          *(undefined1 *)(lVar11 + 0x24) = 1;

-        }

-        iVar8 = *(int *)(unaff_RBP + -0x2d);

-        if ((*(int *)(unaff_RBP + -0x31) != *(int *)(unaff_RBP + -0x21)) ||

-           (iVar8 != *(int *)(unaff_RBP + -0x1d))) {

-          uVar3 = *(ushort *)(unaff_RBP + -0x31);

-          *(undefined1 *)(lVar11 + 0x30) = 1;

-          *(longlong *)(lVar11 + 0x10) = (longlong)(int)(iVar8 << 0x10 | (uint)uVar3);

-        }

-        lVar11 = *(longlong *)(unaff_RSI + 0x28);

-        if ((((int)uVar18 ==

-              ((byte)(~*(byte *)(lVar11 + 0x1a) ^ *(byte *)(lVar11 + 0x19)) >> 6 & 1) + 0x10) &&

-            ((*(byte *)(lVar11 + 0x1e) & 4) == 0)) &&

-           (ptVar12 = (tagWND *)SizeBoxHwnd(unaff_RSI), ptVar12 != (tagWND *)0x0)) {

-          unaff_RSI = ptVar12;

-        }

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

-          cVar20 = '\0';

-        }

-        else {

-          cVar20 = '\x01';

-        }

-        bVar21 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-        if ((cVar20 != '\0') || (bVar21)) {

-          lVar11 = W32GetUserSessionState();

-          WPP_RECORDER_AND_TRACE_SF_qddd

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar20,bVar21,

-                     *(undefined8 *)(lVar11 + 0x10f98),4);

-        }

-        return *(undefined8 *)unaff_RSI;

-      }

-    }

+          *(undefined8 *)(puVar24 + -8) = 0x1400316d2;

+          W32SetCurrentThreadDpiAwarenessContext(uVar13);

+        }

+        *(undefined8 *)(param_1 + 0x40) = 0;

+        uVar21 = *(undefined8 *)(ptVar3 + 0x18);

+        *(undefined8 *)(puVar24 + -8) = 0x1400316e6;

+        puVar14 = (undefined8 *)PsGetCurrentThreadWin32Thread();

+        if (puVar14 != (undefined8 *)0x0) {

+          ptVar20 = (tagUIPI_INFO *)*puVar14;

+        }

+        puVar14 = *(undefined8 **)(ptVar20 + 0x1c8);

+        if (puVar14 != (undefined8 *)(puVar24 + 0x48)) {

+          *(undefined8 *)(puVar24 + 0x20) = 0;

+                    /* WARNING: Subroutine does not return */

+          *(undefined8 *)(puVar24 + -8) = 0x140031727;

+          KeBugCheckEx(0x164,0x3b,ptVar20,puVar24 + 0x48);

+        }

+        *(undefined8 *)(ptVar20 + 0x1c8) = *puVar14;

+        uVar4 = puVar14[1];

+        *(undefined8 *)(puVar24 + -8) = 0x140031742;

+        HMUnlockObject(uVar4);

+      }

+      else {

+        uVar21 = *(undefined8 *)(ptVar3 + 0x18);

+      }

+      *(undefined8 *)(puVar24 + -8) = 0x14003174f;

+      DestroyNotify(param_1);

+      goto LAB_2;

+    }

+    lVar15 = *(longlong *)(ptVar3 + 0x10);

+    uVar21 = *(undefined8 *)(ptVar3 + 0x18);

+    ptVar27 = *(tagQ **)(lVar15 + 0x1d8);

+    *(undefined8 *)(puVar24 + -8) = 0x1400313ee;

+    EtwTraceUIPIEventHookError(param_1,lVar15,ptVar25);

+  }

+  *(undefined8 *)(puVar24 + -8) = 0x1400314c6;

+  plVar17 = (longlong *)W32GetUserSessionState();

+  if (*plVar17 == 0) {

+LAB_3:

+    *(undefined8 *)(puVar24 + 0x20) = 0;

+                    /* WARNING: Subroutine does not return */

+    *(undefined8 *)(puVar24 + -8) = 0x1400315f8;

+    KeBugCheckEx(0x164,0x2a,0);

+  }

+  *(undefined8 *)(puVar24 + -8) = 0x1400314db;

+  lVar15 = PsGetCurrentThreadWin32Thread();

+  if ((*(uint *)(lVar15 + 0x18) & 0xc) == 0) goto LAB_3;

+  *(undefined8 *)(puVar24 + -8) = 0x1400314f3;

+  lVar15 = PsGetCurrentThreadWin32Thread();

+  *(int *)(lVar15 + 0x1c) = *(int *)(lVar15 + 0x1c) + 1;

+  *(uint *)(param_1 + 0x38) = *(uint *)(param_1 + 0x38) | 0xc;

+  if (ptVar27 == (tagQ *)0x0) {

 LAB_4:

-  } while (unaff_RSI != ptVar12);

-  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x4000) == 0)) ||

-     ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar20 = '\0';

+    *(undefined8 *)(puVar24 + -8) = 0x1400315d1;

+    DestroyNotify(param_1);

   }

   else {

-    cVar20 = '\x01';

-  }

-  bVar21 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar20 != '\0') || (bVar21)) {

-    lVar11 = W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_Dd

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar20,bVar21,

-               *(undefined8 *)(lVar11 + 0x10f98),4);

-  }

-  return 0;

+    *(undefined8 *)(puVar24 + -8) = 0x140031513;

+    lVar18 = W32GetUserSessionState();

+    if ((*(longlong *)(ptVar3 + 0x10) == *(longlong *)(lVar18 + 0x4970)) ||

+       ((*(uint *)(ptVar3 + 0x28) & 1) != 0)) goto LAB_4;

+    if ((*(uint *)(ptVar3 + 0x28) & 0x10) != 0) {

+      puVar2 = (uint *)(*(longlong *)(ptVar3 + 0x10) + 0x210);

+      LOCK();

+      uVar26 = *puVar2;

+      if (uVar26 == 0) {

+        *puVar2 = 0;

+        uVar26 = 0;

+      }

+      UNLOCK();

+      LOCK();

+      uVar11 = *(uint *)(ptVar25 + 0x210);

+      if (uVar11 == 0) {

+        *(uint *)(ptVar25 + 0x210) = 0;

+        uVar11 = 0;

+      }

+      UNLOCK();

+      if (((uVar11 ^ uVar26) >> 8 & 1) != 0) goto LAB_4;

+      LOCK();

+      uVar26 = *(uint *)(ptVar25 + 0x210);

+      if (uVar26 == 0) {

+        *(uint *)(ptVar25 + 0x210) = 0;

+        uVar26 = 0;

+      }

+      UNLOCK();

+      if ((uVar26 >> 8 & 1) != 0) {

+        uVar4 = **(undefined8 **)(*(longlong *)(ptVar3 + 0x10) + 0x1d0);

+        *(undefined8 *)(puVar24 + -8) = 0x14003157c;

+        sVar9 = PsWow64GetProcessMachine(uVar4);

+        uVar4 = **(undefined8 **)(ptVar25 + 0x1d0);

+        *(undefined8 *)(puVar24 + -8) = 0x140031595;

+        sVar10 = PsWow64GetProcessMachine(uVar4);

+        if (sVar10 != sVar9) goto LAB_4;

+      }

+    }

+    ptVar5 = *(tagTHREADINFO **)(ptVar3 + 0x10);

+    *(undefined8 *)(puVar24 + 0x38) = 0;

+    *(longlong *)(puVar24 + 0x30) = param_1;

+    *(undefined8 *)(puVar24 + 0x28) = 0;

+    *(undefined4 *)(puVar24 + 0x20) = 0;

+    *(undefined8 *)(puVar24 + -8) = 0x1400315c5;

+    iVar12 = PostEventMessageEx(ptVar5,ptVar27,0xc,(tagWND *)0x0,*(uint *)(puVar24 + 0x20),

+                                *(__uint64 *)(puVar24 + 0x28),*(__int64 *)(puVar24 + 0x30),

+                                *(tagINPUT_MESSAGE_SOURCE **)(puVar24 + 0x38));

+    if (iVar12 == 0) goto LAB_4;

+  }

+  *(int *)(lVar15 + 0x1c) = *(int *)(lVar15 + 0x1c) + -1;

+LAB_2:

+  *(undefined8 *)(puVar24 + -8) = 0x14003177a;

+  return uVar21;

 }
```

## `CheckCursorClipAccess`  (modified)

```diff
--- CheckCursorClipAccess
+++ CheckCursorClipAccess
@@ -1,10 +1,74 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-void CheckCursorClipAccess(void)

+bool CheckCursorClipAccess(int param_1,int param_2)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  int iVar1;

+  uint uVar2;

+  tagTHREADINFO *ptVar3;

+  longlong lVar4;

+  int *piVar5;

+  undefined1 auStack_48 [32];

+  tagRECT local_28;

+  ulonglong local_18;

+  

+                    /* 0x225990  21  CheckCursorClipAccess */

+  local_18 = __security_cookie ^ (ulonglong)auStack_48;

+  ptVar3 = _GetCurrentLogicalCursorThread();

+  if (param_1 == 0) {

+    lVar4 = W32GetUserGdiSessionState();

+    if ((**(longlong **)(ptVar3 + 0x1d0) != *(longlong *)(lVar4 + 0x28)) &&

+       (iVar1 = CheckWinstaAttributeAccess(0x10), iVar1 == 0)) {

+      iVar1 = IsImmersiveAppRestricted(*(undefined8 *)(ptVar3 + 0x1d0));

+      if (iVar1 == 0) {

+        return false;

+      }

+      iVar1 = IsGpqForegroundAccessibleForPti(ptVar3,1);

+      if (iVar1 == 0) {

+        return false;

+      }

+    }

+    lVar4 = W32GetUserSessionState();

+    CCursorClip::GetClip(*(CCursorClip **)(lVar4 + 0x8e20),&local_28);

+    lVar4 = W32GetUserSessionState();

+    if ((*(longlong *)(ptVar3 + 0x1d8) != *(longlong *)(lVar4 + 0x4a50)) && (param_2 == 0)) {

+      iVar1 = ERECTL::bWrapped((ERECTL *)&local_28);

+      return iVar1 == 0;

+    }

+  }

+  else {

+    if (param_1 == 1) {

+      uVar2 = CheckGrantedAccess(*(undefined4 *)(*(longlong *)(ptVar3 + 0x1d0) + 0x2b0),2);

+    }

+    else {

+      if (param_1 != 2) {

+        return true;

+      }

+      iVar1 = IsDesktopApp(*(undefined8 *)(ptVar3 + 0x1d0));

+      if (iVar1 != 0) {

+        return false;

+      }

+      piVar5 = (int *)(*(longlong *)(ptVar3 + 0x1d0) + 0x134);

+      if (*(longlong *)(ptVar3 + 0x1d0) == 0) {

+        piVar5 = (int *)&DAT_0;

+      }

+      if (*piVar5 == 0) {

+        return false;

+      }

+      iVar1 = InForegroundQueue(ptVar3,0);

+      if (iVar1 == 0) {

+        return false;

+      }

+      if (*(longlong *)(*(longlong *)(ptVar3 + 0x1d0) + 0x340) == 0) {

+        return false;

+      }

+      uVar2 = *(uint *)(*(longlong *)(*(longlong *)(ptVar3 + 0x1d0) + 0x340) + 100) & 1;

+    }

+    if (uVar2 == 0) {

+      return false;

+    }

+  }

+  return true;

 }
```

## `IsGpqForegroundAccessibleExplicit`  (modified)

```diff
--- IsGpqForegroundAccessibleExplicit
+++ IsGpqForegroundAccessibleExplicit
@@ -1,130 +1,24 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl IsGpqForegroundAccessibleExplicit(int,struct tagTHREADINFO * __ptr64,struct

+   tagUIPI_INFO,int) */

 

-int __cdecl IsGpqForegroundAccessibleExplicit(ulonglong param_1)

+int __cdecl

+IsGpqForegroundAccessibleExplicit

+          (int param_1,tagTHREADINFO *param_2,tagUIPI_INFO *param_3,int param_4)

 

 {

-  longlong lVar1;

-  int extraout_EAX;

-  uint uVar2;

-  longlong *plVar3;

-  ulonglong uVar4;

-  tagHIDDATA *ptVar5;

-  longlong unaff_RDI;

-  tagTHREADINFO *unaff_R14;

-  undefined8 *unaff_R15;

-  bool in_ZF;

-  int in_stack_00000058;

-  undefined8 in_stack_00000060;

-  undefined8 in_stack_00000080;

-  longlong in_stack_000000a0;

-  longlong in_stack_000000e8;

-  longlong in_stack_000000f0;

-  undefined4 uStack0000000000000110;

-  undefined4 uStack0000000000000114;

-  undefined8 in_stack_00000118;

-  undefined8 in_stack_00000120;

-  undefined8 in_stack_00000128;

-  undefined8 in_stack_00000130;

-  undefined8 in_stack_00000138;

+  bool bVar1;

+  int iVar2;

+  longlong lVar3;

   

-  if (!in_ZF) {

-    func_0x0001084912e7();

-    if ((param_1 & 0x1ff) != 0) {

-      plVar3 = (longlong *)PsGetCurrentProcessWin32Process();

-      uVar4 = 0;

-      if (plVar3 != (longlong *)0x0) {

-        uVar4 = (ulonglong)plVar3 & -(ulonglong)(*plVar3 != 0);

-      }

-      LogicalToPhysicalDPIPoint(&stack0x00000110,&stack0x00000110,*(undefined4 *)(uVar4 + 0x10c),0);

-      PhysicalToLogicalDPIPoint

-                (&stack0x00000110,&stack0x00000110,*(undefined4 *)(unaff_RDI + 0x74),0);

+  if ((((param_1 != 0) && (lVar3 = W32GetUserSessionState(), *(longlong *)(lVar3 + 0x4a50) != 0)) &&

+      (param_4 == 0)) && (iVar2 = IsForegroundShellFrameQueueAccessible(param_2), iVar2 == 0)) {

+    lVar3 = W32GetUserSessionState();

+    bVar1 = UIPrivilegeIsolation::CheckAccess(param_3,*(tagUIPI_INFO **)(lVar3 + 0x4a50),0);

+    if (!bVar1) {

+      return 0;

     }

-    *unaff_R15 = CONCAT44(uStack0000000000000114,uStack0000000000000110);

-    unaff_R15[1] = in_stack_00000118;

-    unaff_R15[2] = in_stack_00000120;

-    unaff_R15[3] = in_stack_00000128;

-    unaff_R15[4] = in_stack_00000130;

-    Win32HMThreadLockAlways<tagMENU>::~Win32HMThreadLockAlways<tagMENU>

-              ((Win32HMThreadLockAlways<tagMENU> *)&stack0x000000a8);

-    lVar1 = in_stack_000000a0;

-    uVar2 = *(uint *)(unaff_RDI + 0x44);

-    if ((uVar2 & 0x101) == 0x100) {

-      in_stack_00000130 = 0;

-      in_stack_00000138 = 0;

-      *(uint *)(unaff_RDI + 0x44) = uVar2 | 1;

-      if ((uVar2 & 4) == 0) {

-        uStack0000000000000110 = 0x21;

-        if ((uVar2 >> 10 & 1) != 0) {

-          uStack0000000000000110 = 0x121;

-        }

-        in_stack_00000118 = *(undefined8 *)(unaff_RDI + 0x20);

-        in_stack_00000120 = *(undefined8 *)(unaff_RDI + 0x28);

-        in_stack_00000128 = in_stack_00000060;

-        Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>

-                  ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x00000100,

-                   *(tagWND **)(unaff_RDI + 0x60));

-        xxxInterSendMsgEx(*(undefined8 *)(unaff_RDI + 0x60),*(undefined4 *)(unaff_RDI + 0x58),0,0);

-        Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

-                  ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x00000100);

-      }

-    }

-    if (lVar1 == 0) {

-      Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

-                ((Win32HMThreadLockBase<tagMONITOR,1,1> *)&stack0x00000090);

-    }

-    *(longlong *)(unaff_R14 + 0x228) = in_stack_000000e8;

-    uVar2 = **(uint **)(in_stack_000000f0 + 0x1e8);

-    if (in_stack_000000e8 == 0) {

-      uVar2 = uVar2 & 0xfffffffd;

-    }

-    else {

-      uVar2 = uVar2 | 2;

-    }

-    **(uint **)(in_stack_000000f0 + 0x1e8) = uVar2;

-    uVar2 = **(uint **)(in_stack_000000f0 + 0x1e8);

-    if (in_stack_00000058 == 0) {

-      uVar2 = uVar2 & 0xfffffff7;

-    }

-    else {

-      uVar2 = uVar2 | 8;

-    }

-    **(uint **)(in_stack_000000f0 + 0x1e8) = uVar2;

-    if (*(int *)(unaff_RDI + 0x58) == 0xff) {

-      ptVar5 = (tagHIDDATA *)HMValidateHandleNoSecure(*(undefined8 *)(unaff_RDI + 0x50),0x12);

-      if (ptVar5 != (tagHIDDATA *)0x0) {

-        if (*(tagTHREADINFO **)(ptVar5 + 0x10) == unaff_R14) {

-          ptVar5 = UnlinkHidData(unaff_R14,ptVar5,(tagHIDDATA ***)0x0);

-          if (ptVar5 != (tagHIDDATA *)0x0) {

-            FreeHidData(ptVar5);

-          }

-        }

-        else {

-          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x115a);

-        }

-      }

-    }

-    EtwTraceEndRetrieveSendMessage(in_stack_00000080);

-    uVar2 = *(uint *)(unaff_RDI + 0x44);

-    *(uint *)(unaff_RDI + 0x44) = uVar2 & 0xffffbfff;

-    if ((uVar2 & 8) == 0) {

-      if ((uVar2 & 1) == 0) {

-        *(undefined8 *)(unaff_RDI + 0x38) = in_stack_00000060;

-        *(uint *)(unaff_RDI + 0x44) = uVar2 & 0xffffbfff | 1;

-        if (lVar1 != 0) {

-          SetWakeBit(lVar1,0x200);

-        }

-      }

-    }

-    else {

-      UnlinkSendListSms(in_stack_00000080);

-    }

-    Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

-              ((Win32HMOptionalThreadLock<tagHOOK> *)&stack0x00000090);

-    return extraout_EAX;

   }

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  return 1;

 }
```

## `vDIBSolidBlt`  (modified)

```diff
--- vDIBSolidBlt
+++ vDIBSolidBlt
@@ -1,374 +1,118 @@
 

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

-/* WARNING: Variable defined which should be unmapped: param_5 */

+/* void __cdecl vDIBSolidBlt(class SURFACE * __ptr64,struct _RECTL * __ptr64,struct _CLIPOBJ *

+   __ptr64,unsigned long,int) */

 

 void __cdecl

 vDIBSolidBlt(SURFACE *param_1,_RECTL *param_2,_CLIPOBJ *param_3,ulong param_4,int param_5)

 

 {

-  int *piVar1;

-  _SURFOBJ *p_Var2;

-  uint *puVar3;

-  ulong uVar4;

-  longlong lVar5;

-  uint uVar6;

-  undefined4 uVar7;

-  undefined4 uVar8;

-  undefined4 uVar9;

-  ulong in_EAX;

-  ulong uVar10;

+  int iVar1;

+  bool bVar2;

+  bool bVar3;

+  int iVar4;

+  int iVar5;

+  int iVar6;

+  ulonglong uVar7;

+  longlong lVar8;

+  int *piVar9;

+  code *pcVar10;

   uint uVar11;

-  longlong lVar12;

-  undefined8 *puVar13;

-  SESSION_GLOBALS *pSVar14;

-  void *pvVar15;

-  longlong lVar16;

-  code *pcVar17;

-  uint *puVar18;

-  ulong uVar19;

-  _SURFOBJ *p_Var20;

-  ushort uVar21;

-  uint uVar22;

-  longlong *unaff_RBP;

-  int unaff_ESI;

-  longlong unaff_RDI;

-  _SURFOBJ *p_Var23;

-  _SURFOBJ *p_Var24;

-  int iVar25;

-  ulonglong uVar26;

-  undefined4 in_R11D;

-  longlong unaff_R13;

-  longlong lVar27;

-  XCLIPOBJ *this;

-  uint uVar28;

-  _SURFOBJ *unaff_R15;

-  bool in_ZF;

-  char in_SF;

-  char in_OF;

-  int in_stack_00000060;

-  char in_stack_00000064;

-  long in_stack_00000068;

-  longlong in_stack_00000070;

+  int iVar12;

+  int iVar13;

+  longlong lVar14;

+  undefined1 auStackY_228 [32];

+  uint local_198;

+  undefined8 local_194;

+  undefined8 uStack_18c;

+  ulonglong local_48;

   

-  if (!in_ZF && in_OF == in_SF) {

-    param_4 = in_EAX;

-  }

-  iVar25 = param_4 - (int)param_1;

-  if (iVar25 < 1) {

-LAB_0:

-    SURFMEM::~SURFMEM((SURFMEM *)(unaff_RBP + -6));

-    PALMEMOBJ::~PALMEMOBJ((PALMEMOBJ *)(unaff_RBP + -8));

-    SURFMEM::~SURFMEM((SURFMEM *)(unaff_RBP + -4));

-    if (unaff_ESI != 0) {

-      pSVar14 = Gre::Base::Globals();

-      GreReleaseSemaphoreCommon<10,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

-                (GreReleaseSemaphoreExclusiveInternal_exref,

-                 (HSEMAPHORE__ *)(*(longlong *)pSVar14 + 0x548));

+  local_48 = __security_cookie ^ (ulonglong)auStackY_228;

+  memset(&local_198,0,0x144);

+  iVar5 = *(int *)(param_1 + 0x60);

+  if ((iVar5 - 1U < 6) || (iVar4 = bUMPDSecurityGateEx(), iVar4 == 0)) {

+    Feature_1831571771__private_IsEnabledDeviceUsageNoInline();

+    if (param_5 == 0) {

+      pcVar10 = vSolidFillRect1;

+      if (iVar5 == 5) {

+        pcVar10 = vSolidFillRect24;

+      }

     }

-    return;

-  }

-  uVar4 = *(ulong *)(unaff_RDI + 0xc);

-  *(int *)(unaff_RBP + 0x2e) = (int)param_1;

-  uVar10 = *(ulong *)(unaff_RDI + 4);

-  *(ulong *)(unaff_RBP + 0x2f) = param_4;

-  uVar19 = uVar10;

-  if ((int)uVar4 <= (int)uVar10) {

-    uVar19 = uVar4;

-    uVar4 = uVar10;

-  }

-  uVar22 = (uint)unaff_R15;

-  uVar10 = uVar22;

-  if (-1 < (int)uVar19) {

-    uVar10 = uVar19;

-  }

-  if (*(int *)((longlong)unaff_RBP + -0x74) < (int)uVar4) {

-    uVar4 = *(ulong *)((longlong)unaff_RBP + -0x74);

-  }

-  if ((int)(uVar4 - uVar10) < 1) goto LAB_0;

-  *(ulong *)((longlong)unaff_RBP + 0x174) = uVar10;

-  uVar11 = *(uint *)(unaff_R13 + 0x70);

-  *(ulong *)((longlong)unaff_RBP + 0x17c) = uVar4;

-  *(ushort *)(unaff_RBP + 0x26) = (ushort)param_3 | 0x10;

-  *(ulong *)(unaff_RBP + 0x14) = uVar4 - uVar10;

-  *(uint *)((longlong)unaff_RBP + 0xa4) = uVar22;

-  *(uint *)((longlong)unaff_RBP + 0xb4) = uVar22;

-  *(int *)((longlong)unaff_RBP + 0x9c) = iVar25;

-  unaff_RBP[0x15] = (longlong)unaff_R15;

-  *(uint *)(unaff_RBP + 0x16) = uVar11 & 0x40000;

-  *(undefined4 *)(unaff_RBP + 0x13) = in_R11D;

-  iVar25 = SURFMEM::bCreateDIB((SURFMEM *)(unaff_RBP + -6),(_DEVBITMAPINFO *)(unaff_RBP + 0x13),

-                               (void *)0x0,(void *)0x0,uVar22,unaff_R15,(__uint64)unaff_R15,uVar22,1

-                               ,uVar22,uVar22);

-  if (iVar25 == 0) goto LAB_1;

-  lVar27 = unaff_RBP[-6];

-  unaff_RBP[1] = lVar27;

-  lVar12 = unaff_RBP[-0xb] + 0x11c8;

-  unaff_RBP[-0xf] = lVar12;

-  unaff_RBP[0x34] = lVar12;

-  unaff_RBP[-0xc] = (longlong)unaff_R15;

-  puVar13 = PDEVOBJ::pDevHTInfo((PDEVOBJ *)&stack0x00000070);

-  lVar16 = lVar12;

-  if (*(ulong *)(unaff_RBP + -10) == uVar22) {

-    lVar12 = HmgShareLockCheck(*puVar13,8);

-    unaff_RBP[-10] = lVar12;

-    iVar25 = EXLATEOBJ::bInitXlateObj((EXLATEOBJ *)&stack0x00000078,0);

-    if (iVar25 == 0) {

-      if (lVar12 != 0) {

-        DEC_SHARE_REF_CNT(lVar12);

+    else {

+      pcVar10 = vSolidXorRect24;

+      if (iVar5 != 5) {

+        pcVar10 = vSolidXorRect1;

       }

-      EXLATEOBJ::vAltUnlock((EXLATEOBJ *)(unaff_RBP + -0xc));

-      EXLATEOBJ::vAltUnlock((EXLATEOBJ *)&stack0x00000078);

-      SURFMEM::~SURFMEM((SURFMEM *)(unaff_RBP + -6));

-      PALMEMOBJ::~PALMEMOBJ((PALMEMOBJ *)(unaff_RBP + -8));

-      SURFMEM::~SURFMEM((SURFMEM *)(unaff_RBP + -4));

-      if (unaff_ESI == 0) {

-        return;

-      }

-      pSVar14 = Gre::Base::Globals();

-      GreReleaseSemaphoreExclusive<10>(pSVar14);

-      return;

     }

-    unaff_RBP[-0xf] = (longlong)unaff_R15;

-    if ((((_SURFOBJ *)*unaff_RBP == unaff_R15) && ((int)unaff_RBP[0x6c] != 0x200)) ||

-       (*(ulong *)(unaff_RBP + -0xe) == uVar22)) {

-      lVar16 = unaff_RBP[0x34];

-LAB_2:

-      if (lVar12 != 0) {

-        DEC_SHARE_REF_CNT(lVar12);

-      }

-      lVar12 = unaff_RBP[-0xf];

-      goto LAB_3;

-    }

-    iVar25 = EXLATEOBJ::bInitXlateObj((EXLATEOBJ *)(unaff_RBP + -0xc),0);

-    if (iVar25 != 0) {

-      lVar16 = unaff_RBP[-0xc];

-      goto LAB_2;

-    }

-    EPALOBJ::~EPALOBJ((EPALOBJ *)(unaff_RBP + -10));

-  }

-  else {

-LAB_3:

-    if (unaff_ESI != 0) {

-      pSVar14 = Gre::Base::Globals();

-      GreReleaseSemaphoreCommon<10,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

-                (GreReleaseSemaphoreExclusiveInternal_exref,

-                 (HSEMAPHORE__ *)(*(longlong *)pSVar14 + 0x548));

-    }

-    p_Var20 = (_SURFOBJ *)unaff_RBP[3];

-    PDEVOBJ::vSync((PDEVOBJ *)&stack0x00000070,p_Var20,(_RECTL *)0x0,0);

-    if ((((_SURFOBJ *)*unaff_RBP != unaff_R15) || ((int)unaff_RBP[0x6c] == 0x200)) &&

-       (*(ulong *)(unaff_RBP + -0xe) != uVar22)) {

-      *(undefined4 *)(unaff_RBP + 0x35) = *(undefined4 *)(lVar27 + 0x38);

-      *(undefined4 *)((longlong)unaff_RBP + 0x1ac) = *(undefined4 *)(lVar27 + 0x3c);

-      *(int *)(lVar27 + 0x5c) = *(int *)(lVar27 + 0x5c) + 1;

-      unaff_RBP[0x34] = (longlong)unaff_R15;

-      if ((*(uint *)(unaff_RBP[-9] + 0x70) & 0x400) == 0) {

-        pcVar17 = EngCopyBits;

+    bVar2 = false;

+    bVar3 = false;

+    if (param_3 != (_CLIPOBJ *)0x0) {

+      bVar3 = false;

+      if (param_3[0x14] == (_CLIPOBJ)0x1) {

+        bVar2 = true;

+        local_198 = 1;

+        local_194 = *(undefined8 *)(param_3 + 4);

+        uStack_18c = *(undefined8 *)(param_3 + 0xc);

       }

       else {

-        pcVar17 = *(code **)(in_stack_00000070 + 0xb10);

-      }

-      uVar26 = -(ulonglong)(lVar27 != 0) & lVar27 + 0x18U;

-      iVar25 = (*pcVar17)(uVar26,p_Var20,0,lVar16,unaff_RBP + 0x34);

-      if ((iVar25 == 0) && (iVar25 = EngBitBlt(uVar26,0,0,0), iVar25 == 0)) {

-        HTSEMOBJ::vAcquire((HTSEMOBJ *)(unaff_RBP + -0x10));

-        goto LAB_4;

+        bVar2 = false;

+        if (param_3[0x14] == (_CLIPOBJ)0x3) {

+          bVar2 = true;

+          XCLIPOBJ::cEnumStart((XCLIPOBJ *)param_3,0,0,4,0x14);

+          bVar3 = bVar2;

+        }

       }

     }

-    if (unaff_ESI != 0) {

-      pSVar14 = Gre::Base::Globals();

-      GreAcquireSemaphore<10>(pSVar14);

+    lVar14 = *(longlong *)(param_1 + 0x50);

+    if (*(longlong *)(param_1 + 0x278) != 0) {

+      pcVar10 = vSolidFillRectWithCallback;

+      lVar14 = *(longlong *)(param_1 + 0x278);

     }

-    pvVar15 = PDEVOBJ::pDevHTInfo((PDEVOBJ *)&stack0x00000070);

-    if ((pvVar15 != (void *)0x0) ||

-       (iVar25 = PDEVOBJ::bEnableHalftone

-                           ((PDEVOBJ *)&stack0x00000070,(tagCOLORADJUSTMENT *)unaff_RBP[-2]),

-       iVar25 != 0)) {

-      pvVar15 = PDEVOBJ::pDevHTInfo((PDEVOBJ *)&stack0x00000070);

-      unaff_RBP[4] = (longlong)pvVar15;

-      unaff_RBP[0x1b] = (longlong)unaff_R15;

-      iVar25 = bSetHTSrcSurfInfo();

-      if (iVar25 == 0) goto LAB_5;

-      p_Var20 = (_SURFOBJ *)(lVar27 + 0x18);

-      if (lVar27 == 0) {

-        p_Var20 = unaff_R15;

-      }

-      iVar25 = bSetHTSurfInfo(p_Var20,(_HTSURFACEINFO *)(unaff_RBP + 0x1c),in_stack_00000068);

-      if (iVar25 == 0) goto LAB_5;

-      lVar16 = 0;

-      if (*unaff_RBP != 0) {

-        iVar25 = bSetHTSurfInfo((_SURFOBJ *)(*unaff_RBP + 0x18),(_HTSURFACEINFO *)(unaff_RBP + 0x21)

-                                ,*(long *)(unaff_RBP[5] + 0x48));

-        if (iVar25 == 0) goto LAB_5;

-        lVar16 = *unaff_RBP;

-      }

-      p_Var20 = unaff_R15;

-      if (lVar16 != 0) {

-        iVar25 = bUMPDSecurityGateEx();

-        if ((iVar25 != 0) && ((longlong *)unaff_RBP[0xb] == (longlong *)0x0)) {

-          if (unaff_RBP[0x1b] != 0) {

-            FreeThreadBufferWithTag();

+    if (bVar2) {

+      iVar5 = 0;

+      if (!bVar3) goto LAB_0;

+      do {

+        iVar5 = XCLIPOBJ::bEnum((XCLIPOBJ *)param_3,0x144,&local_198,(ulong *)0x0);

+LAB_0:

+        for (uVar11 = 0; uVar11 < local_198; uVar11 = uVar11 + 1) {

+          uVar7 = (ulonglong)uVar11;

+          lVar8 = uVar7 * 0x10;

+          piVar9 = (int *)(&local_194 + uVar7 * 2);

+          iVar4 = *(int *)param_2;

+          iVar12 = *piVar9;

+          if (*piVar9 < iVar4) {

+            *piVar9 = iVar4;

+            iVar12 = iVar4;

           }

-          goto LAB_4;

+          iVar4 = *(int *)(param_2 + 8);

+          iVar13 = *(int *)(&uStack_18c + uVar7 * 2);

+          if (iVar4 < *(int *)(&uStack_18c + uVar7 * 2)) {

+            *(int *)(&uStack_18c + uVar7 * 2) = iVar4;

+            iVar13 = iVar4;

+          }

+          iVar4 = *(int *)((longlong)&local_194 + lVar8 + 4);

+          iVar6 = *(int *)(param_2 + 4);

+          if (iVar4 < iVar6) {

+            *(int *)((longlong)&local_194 + lVar8 + 4) = iVar6;

+            iVar4 = iVar6;

+          }

+          iVar6 = *(int *)((longlong)&uStack_18c + lVar8 + 4);

+          iVar1 = *(int *)(param_2 + 0xc);

+          if (iVar1 < iVar6) {

+            *(int *)((longlong)&uStack_18c + lVar8 + 4) = iVar1;

+            iVar6 = iVar1;

+          }

+          if ((iVar4 < iVar6) && (iVar12 < iVar13)) {

+            (*pcVar10)(piVar9,1,lVar14);

+          }

         }

-        p_Var20 = (_SURFOBJ *)(unaff_RBP + 0x21);

-        unaff_RBP[0x31] = *(longlong *)unaff_RBP[0xb];

-      }

-      uVar21 = *(ushort *)(unaff_RBP + 0x26);

-      if ((*(uint *)(in_stack_00000070 + 0x93c) & 0x100) == 0) {

-        uVar21 = uVar21 | 2;

-        *(ushort *)(unaff_RBP + 0x26) = uVar21;

-      }

-      if (in_stack_00000060 == 3) {

-        *(undefined4 *)(unaff_RBP + 8) = 0x10100;

-        unaff_RBP[0x20] = (longlong)(unaff_RBP + 8);

-        unaff_RBP[10] = (longlong)(unaff_RBP + 0x38);

-        *(undefined4 *)((longlong)unaff_RBP + 0x44) = 0xff;

-        *(undefined4 *)(unaff_RBP + 9) = 0x100;

-        uVar11 = *(uint *)(lVar12 + 0xc);

-        uVar28 = 0x100;

-        if ((0x100 < uVar11) || (uVar28 = uVar11, uVar11 != 0)) {

-          p_Var23 = (_SURFOBJ *)(unaff_RBP + 0x38);

-          uVar26 = (ulonglong)uVar28;

-          p_Var24 = unaff_R15;

-          do {

-            p_Var2 = p_Var24 + *(longlong *)(lVar12 + 0x10);

-            p_Var24 = p_Var24 + 4;

-            *p_Var23 = *p_Var2;

-            p_Var23 = p_Var23 + 1;

-            uVar26 = uVar26 - 1;

-          } while (uVar26 != 0);

-        }

-        lVar12 = unaff_RBP[-0xb] + 0x11c8;

-        unaff_RBP[-0xf] = lVar12;

-      }

-      if (in_stack_00000064 == '\0') {

-LAB_6:

-        iVar25 = HT_HalftoneBitmap(pvVar15,unaff_RBP[-2],unaff_RBP + 0x17,p_Var20,unaff_RBP + 0x1c);

-        uVar22 = (uint)CONCAT71((int7)((ulonglong)unaff_R15 >> 8),-1 < iVar25);

-LAB_7:

-        this = (XCLIPOBJ *)unaff_RBP[-0xd];

-      }

-      else {

-        *(ushort *)(unaff_RBP + 0x26) = uVar21 | 1;

-        if (in_stack_00000064 == '\x01') {

-          lVar16 = unaff_RBP[-0xd];

-          uVar7 = *(undefined4 *)(lVar16 + 8);

-          uVar8 = *(undefined4 *)(lVar16 + 0xc);

-          uVar9 = *(undefined4 *)(lVar16 + 0x10);

-          *(undefined4 *)(unaff_RBP + 0x2c) = *(undefined4 *)(lVar16 + 4);

-          *(undefined4 *)((longlong)unaff_RBP + 0x164) = uVar7;

-          *(undefined4 *)(unaff_RBP + 0x2d) = uVar8;

-          *(undefined4 *)((longlong)unaff_RBP + 0x16c) = uVar9;

-          goto LAB_6;

-        }

-        this = (XCLIPOBJ *)unaff_RBP[-0xd];

-        XCLIPOBJ::cEnumStart(this,0,0,4,0x14);

-        puVar18 = (uint *)AllocFreeTmpBuffer(0x144);

-        if (puVar18 != (uint *)0x0) {

-          lVar27 = unaff_RBP[4];

-          unaff_RBP[5] = (longlong)puVar18;

-          uVar22 = 1;

-          do {

-            iVar25 = XCLIPOBJ::bEnum(this,0x144,puVar18,(ulong *)0x0);

-            uVar26 = (ulonglong)unaff_R15 & 0xffffffff;

-            *(int *)(unaff_RBP + -10) = iVar25;

-            if ((uint)unaff_R15 < *puVar18) {

-              lVar16 = unaff_RBP[-2];

-              do {

-                puVar3 = puVar18 + uVar26 * 4 + 1;

-                uVar11 = puVar3[1];

-                uVar28 = puVar3[2];

-                uVar6 = puVar3[3];

-                *(uint *)(unaff_RBP + 0x2c) = *puVar3;

-                *(uint *)((longlong)unaff_RBP + 0x164) = uVar11;

-                *(uint *)(unaff_RBP + 0x2d) = uVar28;

-                *(uint *)((longlong)unaff_RBP + 0x16c) = uVar6;

-                uVar11 = HT_HalftoneBitmap(lVar27,lVar16,unaff_RBP + 0x17,p_Var20,unaff_RBP + 0x1c);

-                uVar28 = (int)uVar26 + 1;

-                uVar26 = (ulonglong)uVar28;

-                uVar22 = uVar22 & ~uVar11 >> 0x1f;

-              } while (uVar28 < *puVar18);

-              iVar25 = (int)unaff_RBP[-10];

-              unaff_R15 = (_SURFOBJ *)0x0;

-              this = (XCLIPOBJ *)unaff_RBP[-0xd];

-            }

-          } while ((iVar25 != 0) && (uVar22 != 0));

-          AutoResource<&void___cdecl_FreeTmpBuffer(void*___ptr64)>::

-          ~AutoResource<&void___cdecl_FreeTmpBuffer(void*___ptr64)>

-                    ((AutoResource<&void___cdecl_FreeTmpBuffer(void*___ptr64)> *)(unaff_RBP + 5));

-          unaff_ESI = (int)unaff_RBP[2];

-          lVar27 = unaff_RBP[1];

-          lVar12 = unaff_RBP[-0xf];

-          goto LAB_7;

-        }

-        lVar12 = unaff_RBP[-0xf];

-      }

-      if (unaff_ESI != 0) {

-        pSVar14 = Gre::Base::Globals();

-        GreReleaseSemaphoreCommon<10,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

-                  (GreReleaseSemaphoreExclusiveInternal_exref,

-                   (HSEMAPHORE__ *)(*(longlong *)pSVar14 + 0x548));

-      }

-      if (((int)unaff_RBP[-0xe] != (int)unaff_R15) && (uVar22 != 0)) {

-        lVar16 = unaff_RBP[-9];

-        unaff_RBP[-0xb] = 0;

-        piVar1 = (int *)(lVar16 + 0x5c);

-        *piVar1 = *piVar1 + 1;

-        lVar5 = unaff_RBP[3];

-        if (*(short *)(lVar5 + 0x4c) == (short)unaff_R15) {

-          p_Var20 = (_SURFOBJ *)(lVar27 + 0x18);

-          if (lVar27 == 0) {

-            p_Var20 = unaff_R15;

-          }

-          EngCopyBits(lVar5,p_Var20,this,lVar12,unaff_RBP + 0x2e);

-        }

-        else {

-          if ((*(uint *)(lVar16 + 0x70) & 0x400) == 0) {

-            pcVar17 = EngCopyBits;

-          }

-          else {

-            pcVar17 = *(code **)(in_stack_00000070 + 0xb10);

-          }

-          p_Var20 = (_SURFOBJ *)(lVar27 + 0x18);

-          if (lVar27 == 0) {

-            p_Var20 = unaff_R15;

-          }

-          (*pcVar17)(lVar5,p_Var20,this,lVar12,unaff_RBP + 0x2e);

-        }

-      }

-      if (unaff_ESI != 0) {

-        pSVar14 = Gre::Base::Globals();

-        GreAcquireSemaphore<10>(pSVar14);

-      }

-LAB_5:

-      if (unaff_RBP[0x1b] != 0) {

-        FreeThreadBufferWithTag();

-      }

-      EXLATEOBJ::vAltUnlock((EXLATEOBJ *)(unaff_RBP + -0xc));

-      EXLATEOBJ::vAltUnlock((EXLATEOBJ *)&stack0x00000078);

-      SURFMEM::~SURFMEM((SURFMEM *)(unaff_RBP + -6));

-      PALMEMOBJ::~PALMEMOBJ((PALMEMOBJ *)(unaff_RBP + -8));

-      SURFMEM::~SURFMEM((SURFMEM *)(unaff_RBP + -4));

-      if (unaff_ESI == 0) {

-        return;

-      }

-      pSVar14 = Gre::Base::Globals();

-      GreReleaseSemaphoreCommon<10,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

-                (GreReleaseSemaphoreExclusiveInternal_exref,

-                 (HSEMAPHORE__ *)(*(longlong *)pSVar14 + 0x548));

-      return;

+      } while (iVar5 != 0);

+    }

+    else {

+      (*pcVar10)(param_2,1,lVar14,*(undefined4 *)(param_1 + 0x58));

     }

   }

-LAB_4:

-  EXLATEOBJ::vAltUnlock((EXLATEOBJ *)(unaff_RBP + -0xc));

-  EXLATEOBJ::vAltUnlock((EXLATEOBJ *)&stack0x00000078);

-LAB_1:

-  SURFMEM::~SURFMEM((SURFMEM *)(unaff_RBP + -6));

-  PALMEMOBJ::~PALMEMOBJ((PALMEMOBJ *)(unaff_RBP + -8));

-  SURFMEM::~SURFMEM((SURFMEM *)(unaff_RBP + -4));

-  HTSEMOBJ::vRelease((HTSEMOBJ *)(unaff_RBP + -0x10));

   return;

 }
```

## `NtUserGetClipboardAccessToken`  (modified)

```diff
--- NtUserGetClipboardAccessToken
+++ NtUserGetClipboardAccessToken
@@ -1,19 +1,66 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-longlong NtUserGetClipboardAccessToken(undefined8 param_1,undefined8 *param_2)

+uint NtUserGetClipboardAccessToken(undefined8 *param_1,undefined4 param_2)

 

 {

-  int unaff_EBX;

-  undefined8 *unaff_RDI;

-  bool in_CF;

-  undefined8 in_stack_00000048;

+  longlong lVar1;

+  bool bVar2;

+  int iVar3;

+  uint uVar4;

+  tagTHREADINFO *ptVar5;

+  undefined1 auStack_88 [32];

+  undefined8 local_68;

+  undefined1 local_60;

+  undefined8 *local_58;

+  undefined8 local_40 [2];

+  EnterLeaveCritShared local_30 [16];

+  undefined4 local_20;

+  undefined4 local_1c;

+  undefined4 local_18;

+  ulonglong local_10;

   

-  if (!in_CF) {

-    unaff_RDI = param_2;

+                    /* 0x237350  1670  NtUserGetClipboardAccessToken */

+  local_10 = __security_cookie ^ (ulonglong)auStack_88;

+  local_40[0] = 0;

+  uVar4 = 0;

+  EnterLeaveCritShared::EnterLeaveCritShared(local_30,1);

+  iVar3 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar3 == 0) {

+    local_20 = 0x2000;

+    local_1c = 0xffffffff;

+    local_18 = 0;

+    ptVar5 = PtiCurrent();

+    bVar2 = UIPrivilegeIsolation::CheckAccess

+                      ((tagUIPI_INFO *)(*(longlong *)(ptVar5 + 0x1d0) + 0x130),

+                       (tagUIPI_INFO *)&local_20,0);

   }

-  *unaff_RDI = in_stack_00000048;

+  else {

+    ptVar5 = PtiCurrent();

+    bVar2 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                      ((UIPIAccessor *)

+                       (-(ulonglong)(*(longlong *)(ptVar5 + 0x1d0) != 0) &

+                       *(longlong *)(ptVar5 + 0x1d0) + 0x130U),0x2000);

+  }

+  if (bVar2 != false) {

+    ptVar5 = PtiCurrent();

+    lVar1 = *(longlong *)(*(longlong *)(*(longlong *)(ptVar5 + 0x1f0) + 0x28) + 0xa0);

+    if (lVar1 != 0) {

+      local_58 = local_40;

+      local_60 = 1;

+      local_68 = *(undefined8 *)SeTokenObjectType_exref;

+      uVar4 = ObOpenObjectByPointer(lVar1,0,0,param_2);

+      uVar4 = ~uVar4 >> 0x1f;

+      if (*(undefined8 **)MmUserProbeAddress_exref <= param_1) {

+        param_1 = *(undefined8 **)MmUserProbeAddress_exref;

+      }

+      *param_1 = local_40[0];

+      goto LAB_0;

+    }

+  }

+  UserSetLastError(5);

+LAB_0:

   UserSessionSwitchLeaveCrit();

-  return (longlong)unaff_EBX;

+  return uVar4;

 }
```

## `xxxAdvise`  (modified)

```diff
--- xxxAdvise
+++ xxxAdvise
@@ -1,19 +1,48 @@
+

+/* unsigned long __cdecl xxxAdvise(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

+   __ptr64) */

 

 ulong __cdecl xxxAdvise(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

   ulong uVar1;

-  longlong lVar2;

-  uint unaff_EBX;

+  int iVar2;

+  tagDDECONV *ptVar3;

+  longlong lVar4;

+  void *pvVar5;

+  bool bVar6;

+  ulong local_res20 [2];

+  tagINTDDEINFO *local_18;

+  void *local_10;

   

-  lVar2 = _HMPheFromObject((tagDDECONV *)(ulonglong)(unaff_EBX >> 0x17));

-  if ((~*(byte *)(lVar2 + 0x19) & 1) == 0) {

-    uVar1 = 0;

+  local_18 = (tagINTDDEINFO *)0x0;

+  local_10 = (void *)0x0;

+  local_res20[0] = 0x81;

+  uVar1 = xxxCopyDdeIn((void *)*param_2,local_res20,&local_10,&local_18);

+  iVar2 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 == 0) {

+    lVar4 = _HMPheFromObject(param_3);

+    bVar6 = (bool)(~*(byte *)(lVar4 + 0x19) & 1);

   }

   else {

-    PopState((tagDDECONV *)(ulonglong)(unaff_EBX >> 0x17));

-    uVar1 = 2;

+    ptVar3 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

+    bVar6 = ptVar3 == param_3;

+  }

+  if (bVar6 == false) {

+    uVar1 = 3;

+    if (local_18 != (tagINTDDEINFO *)0x0) {

+      Win32FreePool();

+    }

+  }

+  else if (uVar1 == 2) {

+    *param_1 = *param_1 | 0x80000000;

+    pvVar5 = AnticipatePost(*(tagDDECONV **)(param_3 + 0x20),xxxAdviseAck,local_10,(void *)0x0,

+                            local_18,local_res20[0]);

+    *param_2 = (__int64)pvVar5;

+    if (pvVar5 == (void *)0x0) {

+      uVar1 = 3;

+    }

   }

   return uVar1;

 }
```

## `NtUserGetSendMessageReceiver`  (modified)

```diff
--- NtUserGetSendMessageReceiver
+++ NtUserGetSendMessageReceiver
@@ -1,10 +1,52 @@
 

-undefined4 NtUserGetSendMessageReceiver(void)

+undefined8 NtUserGetSendMessageReceiver(undefined4 param_1)

 

 {

-  undefined4 unaff_EDI;

+  undefined8 *puVar1;

+  bool bVar2;

+  longlong lVar3;

+  longlong lVar4;

+  undefined8 uVar5;

+  undefined8 uVar6;

+  AtomicExecutionCheck local_18 [8];

+  undefined8 local_10;

   

+                    /* 0x290480  1750  NtUserGetSendMessageReceiver */

+  uVar6 = 0;

+  lVar3 = EnterSharedCrit(0,1);

+  local_18[0] = (AtomicExecutionCheck)0x0;

+  local_10 = 0;

+  AtomicExecutionCheck::Arm(local_18);

+  lVar4 = PtiFromThreadId(param_1);

+  if ((lVar4 == 0) || (*(longlong *)(lVar4 + 0x1f0) != *(longlong *)(lVar3 + 0x1f0))) {

+    uVar5 = 0x57;

+  }

+  else {

+    bVar2 = UIPrivilegeIsolation::CheckAccess

+                      ((tagUIPI_INFO *)

+                       (-(ulonglong)(*(longlong *)(lVar3 + 0x1d0) != 0) &

+                       *(longlong *)(lVar3 + 0x1d0) + 0x130U),

+                       (tagUIPI_INFO *)

+                       (-(ulonglong)(*(longlong *)(lVar4 + 0x1d0) != 0) &

+                       *(longlong *)(lVar4 + 0x1d0) + 0x130U),0);

+    if (bVar2) {

+      if ((*(longlong *)(lVar4 + 0x220) == 0) ||

+         (puVar1 = *(undefined8 **)(*(longlong *)(lVar4 + 0x220) + 0x70),

+         puVar1 == (undefined8 *)0x0)) goto LAB_0;

+      if (*(longlong *)(puVar1[2] + 0x1f0) == *(longlong *)(lVar3 + 0x1f0)) {

+        uVar6 = *puVar1;

+        goto LAB_0;

+      }

+    }

+    else {

+      EtwTraceUIPIMsgError(*(undefined8 *)(lVar3 + 0x1d0),*(undefined8 *)(lVar4 + 0x1d0),0,0,0);

+    }

+    uVar5 = 5;

+  }

+  UserSetLastError(uVar5);

+LAB_0:

+  AtomicExecutionCheck::Disarm(local_18);

   UserSessionSwitchLeaveCrit();

-  return unaff_EDI;

+  return uVar6;

 }
```

## `PostRawKeyboardInputToSinks`  (modified)

```diff
--- PostRawKeyboardInputToSinks
+++ DwmSetPointerShape
@@ -1,119 +1,218 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* void __cdecl PostRawKeyboardInputToSinks(unsigned long,void * __ptr64,struct _KEYBOARD_INPUT_DATA

-   * __ptr64,unsigned int,unsigned short,int) */

-

-void __cdecl

-PostRawKeyboardInputToSinks

-          (ulong param_1,void *param_2,_KEYBOARD_INPUT_DATA *param_3,uint param_4,ushort param_5,

-          int param_6)

+/* unsigned long __cdecl DwmSetPointerShape(struct _SURFOBJ * __ptr64,struct _SURFOBJ *

+   __ptr64,struct _SURFOBJ * __ptr64,struct _XLATEOBJ * __ptr64,long,long,long,long,struct _RECTL *

+   __ptr64,unsigned long) */

+

+ulong __cdecl

+DwmSetPointerShape(_SURFOBJ *param_1,_SURFOBJ *param_2,_SURFOBJ *param_3,_XLATEOBJ *param_4,

+                  long param_5,long param_6,long param_7,long param_8,_RECTL *param_9,ulong param_10

+                  )

 

 {

-  undefined8 *puVar1;

-  undefined4 uVar2;

-  bool bVar3;

-  int iVar4;

-  longlong lVar5;

-  longlong lVar6;

-  longlong lVar7;

-  undefined8 *puVar8;

-  undefined1 auStack_e8 [32];

-  longlong local_c8;

-  ulong local_c0;

-  undefined8 local_b8;

-  ulonglong local_b0;

-  undefined4 local_a8;

-  undefined8 local_a0;

-  void *local_98;

-  undefined8 local_90;

-  undefined4 local_88;

-  undefined4 local_80;

-  undefined8 local_78;

-  undefined8 local_70;

-  ulong local_68;

-  undefined8 local_60;

-  undefined8 local_58;

-  undefined4 local_50;

-  undefined8 local_48;

-  undefined4 local_40;

-  ulonglong local_38;

+  uint uVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  HDEV__ *pHVar4;

+  undefined8 uVar5;

+  code *pcVar6;

+  DWMSPRITE *pDVar7;

+  _SURFOBJ *p_Var8;

+  undefined4 uVar9;

+  int iVar10;

+  SESSION_GLOBALS *pSVar11;

+  void *pvVar12;

+  HSPRITE__ *pHVar13;

+  undefined8 uVar14;

+  longlong lVar15;

+  longlong *plVar16;

+  undefined1 *puVar17;

+  uint uVar18;

+  HSPRITE__ *pHVar19;

+  _XLATEOBJ *p_Var20;

+  ulong uVar21;

+  undefined4 uVar22;

+  DWMSPRITE *local_res8;

+  _SURFOBJ *local_res10;

+  _SURFOBJ *local_res18;

+  _XLATEOBJ *local_res20;

+  undefined1 auStack_d8 [8];

+  undefined1 auStack_d0 [88];

+  HSEMAPHORE__ *local_78;

+  UnexpectedThreadTerminationHandler<DWMSPRITEREF> local_70 [32];

+  undefined8 local_50;

   

-  local_38 = __security_cookie ^ (ulonglong)auStack_e8;

-  local_48 = 0;

-  local_40 = 0;

-  lVar6 = 0;

-  local_68 = param_1;

-  lVar5 = W32GetUserSessionState();

-  if (*(longlong *)(lVar5 + 0x4a50) != 0) {

-    lVar6 = W32GetUserSessionState();

-    lVar6 = PtiKbdFromQ(*(undefined8 *)(lVar6 + 0x4a50));

-    lVar6 = *(longlong *)(lVar6 + 0x1d0);

-    lVar5 = W32GetUserSessionState();

-    local_48 = **(undefined8 **)(lVar5 + 0x4a50);

-    local_40 = *(undefined4 *)(*(undefined8 **)(lVar5 + 0x4a50) + 1);

+  lVar15 = *(longlong *)(param_1 + 0x18);

+  local_res10 = param_2;

+  local_res18 = param_3;

+  local_res20 = param_4;

+  pSVar11 = Gre::Base::Globals();

+  uVar21 = 2;

+  p_Var20 = *(_XLATEOBJ **)(pSVar11 + 0x88);

+  if (*(int *)(p_Var20 + 100) != 0) {

+    puVar17 = auStack_d8;

+    if ((param_2 == (_SURFOBJ *)0x0) && (puVar17 = auStack_d8, param_3 == (_SURFOBJ *)0x0)) {

+      SEMOBJ<7>::SEMOBJ<7>((SEMOBJ<7> *)&local_res20,pSVar11);

+      plVar16 = (longlong *)(lVar15 + 0xdc0);

+      lVar2 = *plVar16;

+      if ((*(longlong **)(lVar2 + 8) == plVar16) &&

+         (plVar3 = *(longlong **)(lVar15 + 0xdc8), (longlong *)*plVar3 == plVar16)) {

+        *plVar3 = lVar2;

+        *(longlong **)(lVar2 + 8) = plVar3;

+        *(longlong **)(lVar15 + 0xdc8) = plVar16;

+        *plVar16 = (longlong)plVar16;

+        plVar16 = (longlong *)(*(longlong *)(pSVar11 + 0x88) + 0x68);

+        if (((longlong *)*plVar16 == plVar16) &&

+           (plVar16 = (longlong *)(*(longlong *)(pSVar11 + 0x88) + 0x78),

+           (longlong *)*plVar16 == plVar16)) {

+          vSpDwmDestroyCursorSprites(*(HDEV__ **)(param_1 + 0x18));

+        }

+        if (local_res20 == (_XLATEOBJ *)0x0) {

+          return 2;

+        }

+        GreReleaseSemaphoreCommon<7,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+                  (GreReleaseSemaphoreExclusiveInternal_exref,(HSEMAPHORE__ *)local_res20);

+        return 2;

+      }

+      pcVar6 = (code *)swi(0x29);

+      (*pcVar6)(3);

+      puVar17 = auStack_d0;

+    }

+    *(undefined8 *)(puVar17 + -8) = 0x1401aca77;

+    UnexpectedThreadTerminationHandler<DWMSPRITEREF>::

+    UnexpectedThreadTerminationHandler<DWMSPRITEREF>(local_70);

+    local_50 = 0;

+    uVar18 = (param_10 >> 8 & 0xf) + 1;

+    if ((char)(param_10 >> 0xc) == '\0') {

+      uVar22 = 0;

+    }

+    else {

+      uVar22 = (undefined4)(1000 / (ulonglong)(param_10 >> 0xc & 0xff));

+    }

+    local_res20 = (_XLATEOBJ *)CONCAT44(local_res20._4_4_,0x1000000);

+    *(undefined8 *)(puVar17 + -8) = 0x1401acabf;

+    SEMOBJ<7>::SEMOBJ<7>((SEMOBJ<7> *)&local_78,pSVar11);

+    uVar1 = *(uint *)(*(longlong *)(pSVar11 + 0x88) + 0xa0);

+    while (uVar1 < uVar18) {

+      if (((param_7 == -1) && (param_8 == -1)) || (uVar9 = 1, (param_10 & 0x40) != 0)) {

+        uVar9 = 0;

+      }

+      pHVar4 = *(HDEV__ **)(param_1 + 0x18);

+      p_Var20 = (_XLATEOBJ *)0x0;

+      *(undefined8 *)(puVar17 + 0x58) = 0;

+      *(undefined4 *)(puVar17 + 0x50) = 0;

+      *(undefined4 *)(puVar17 + 0x48) = 0;

+      *(undefined4 *)(puVar17 + 0x40) = 0;

+      *(undefined4 *)(puVar17 + 0x38) = 0;

+      *(undefined4 *)(puVar17 + 0x30) = uVar9;

+      *(undefined4 *)(puVar17 + 0x28) = 1;

+      *(undefined4 *)(puVar17 + 0x20) = 0x9900;

+      *(undefined8 *)(puVar17 + -8) = 0x1401acb31;

+      pvVar12 = GreCreateSpriteInternal

+                          (pHVar4,(HWND__ *)0x0,(tagRECT *)param_9,(tagMINIWINDOWINFO *)0x0,

+                           *(ulong *)(puVar17 + 0x20),*(int *)(puVar17 + 0x28),

+                           *(int *)(puVar17 + 0x30),*(int *)(puVar17 + 0x38),

+                           *(int *)(puVar17 + 0x40),*(int *)(puVar17 + 0x48),

+                           *(int *)(puVar17 + 0x50),*(ushort **)(puVar17 + 0x58));

+      if (pvVar12 == (void *)0x0) break;

+      if (*(longlong *)(*(longlong *)(pSVar11 + 0x88) + 0x88) == 0) {

+        *(void **)(*(longlong *)(pSVar11 + 0x88) + 0x88) = pvVar12;

+      }

+      *(void **)(*(longlong *)(pSVar11 + 0x88) + 0x90) = pvVar12;

+      *(int *)(*(longlong *)(pSVar11 + 0x88) + 0xa0) =

+           *(int *)(*(longlong *)(pSVar11 + 0x88) + 0xa0) + 1;

+      uVar1 = *(uint *)(*(longlong *)(pSVar11 + 0x88) + 0xa0);

+    }

+    while (lVar15 = *(longlong *)(pSVar11 + 0x88), uVar18 < *(uint *)(lVar15 + 0xa0)) {

+      pHVar19 = *(HSPRITE__ **)(lVar15 + 0x90);

+      *(undefined8 *)(puVar17 + -8) = 0x1401acb97;

+      pHVar13 = hspGetNeighborSprite(pHVar19,true,false);

+      p_Var20 = (_XLATEOBJ *)0x1;

+      *(HSPRITE__ **)(*(longlong *)(pSVar11 + 0x88) + 0x90) = pHVar13;

+      pHVar4 = *(HDEV__ **)(param_1 + 0x18);

+      *(undefined8 *)(puVar17 + -8) = 0x1401acbb9;

+      GreDeleteSpriteInternal(pHVar4,(HWND__ *)0x0,pHVar19,1);

+      *(int *)(*(longlong *)(pSVar11 + 0x88) + 0xa0) =

+           *(int *)(*(longlong *)(pSVar11 + 0x88) + 0xa0) + -1;

+    }

+    *(undefined4 *)(lVar15 + 0xa8) = uVar22;

+    lVar15 = *(longlong *)(pSVar11 + 0x88);

+    uVar21 = 2;

+    if (*(HSPRITE__ **)(lVar15 + 0x88) != (HSPRITE__ *)0x0) {

+      pHVar19 = *(HSPRITE__ **)(lVar15 + 0x90);

+      if (*(HSPRITE__ **)(lVar15 + 0x90) != *(HSPRITE__ **)(lVar15 + 0x88)) {

+        do {

+          *(undefined8 *)(puVar17 + -8) = 0x1401acc1d;

+          pHVar13 = hspGetNeighborSprite(pHVar19,true,false);

+          local_res8 = (DWMSPRITE *)0x0;

+          *(undefined8 *)(puVar17 + -8) = 0x1401acc31;

+          DWMALTSPRITEREF::AltLockSpriteObj((DWMALTSPRITEREF *)&local_res8,pHVar19);

+          pDVar7 = local_res8;

+          if (local_res8 != (DWMSPRITE *)0x0) {

+            local_res8 = local_res8 + 0x58;

+            if (local_res8 != (DWMSPRITE *)0x0) {

+              *(undefined8 *)(puVar17 + -8) = 0x1401acc4e;

+              GreAcquirePushLockExclusive();

+            }

+            *(undefined8 *)(puVar17 + -8) = 0x1401acc5d;

+            vSpDwmUpdateSpriteVisibility(pDVar7,false);

+            *(undefined8 *)(puVar17 + -8) = 0x1401acc68;

+            Gre::PUSHLOCKEX::vUnlock((PUSHLOCKEX *)&local_res8,0);

+          }

+          if (pDVar7 != (DWMSPRITE *)0x0) {

+            *(undefined8 *)(puVar17 + -8) = 0x1401acc7a;

+            DEC_SHARE_REF_CNT(pDVar7);

+          }

+          lVar15 = *(longlong *)(pSVar11 + 0x88);

+          pHVar19 = pHVar13;

+        } while (pHVar13 != *(HSPRITE__ **)(lVar15 + 0x88));

+      }

+      p_Var8 = local_res18;

+      pHVar19 = *(HSPRITE__ **)(lVar15 + 0x90);

+      do {

+        if (pHVar19 == (HSPRITE__ *)0x0) {

+          uVar21 = 2;

+          goto LAB_0;

+        }

+        *(undefined8 *)(puVar17 + -8) = 0x1401accac;

+        pHVar13 = hspGetNeighborSprite(pHVar19,true,false);

+        *(ulonglong *)(puVar17 + 0x28) =

+             -(ulonglong)((param_10 & 0x40) != 0) & (ulonglong)&local_res20;

+        *(_RECTL **)(puVar17 + 0x20) = param_9;

+        *(undefined8 *)(puVar17 + -8) = 0x1401acccf;

+        iVar10 = bSpDwmUpdateCursor(pHVar19,local_res10,p_Var8,p_Var20,*(_RECTL **)(puVar17 + 0x20),

+                                    *(_BLENDFUNCTION **)(puVar17 + 0x28));

+        pHVar19 = pHVar13;

+      } while (iVar10 != 0);

+      uVar21 = 0;

+LAB_0:

+      *(long *)(*(longlong *)(pSVar11 + 0x88) + 0x98) = param_5 - *(int *)param_9;

+      *(long *)(*(longlong *)(pSVar11 + 0x88) + 0x9c) = param_6 - *(int *)(param_9 + 4);

+      *(undefined8 *)(puVar17 + -8) = 0x1401acd16;

+      iVar10 = Feature_CompositionMagnifier_Iter2__private_IsEnabledDeviceUsageNoInline();

+      if (iVar10 != 0) {

+        *(undefined8 *)(puVar17 + -8) = 0x1401acd1f;

+        iVar10 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+        if (iVar10 == 0) {

+          local_res20 = *(_XLATEOBJ **)(*(longlong *)(pSVar11 + 0x88) + 0x98);

+          uVar5 = *(undefined8 *)(*(longlong *)(pSVar11 + 0x88) + 0x88);

+          *(undefined8 *)(puVar17 + -8) = 0x1401acd4a;

+          uVar14 = UserReferenceDwmApiPort();

+          *(undefined8 *)(puVar17 + -8) = 0x1401acd5e;

+          DwmAsyncUpdateCursorHotspot(uVar14,uVar5,local_res20);

+        }

+      }

+    }

+    if (local_78 != (HSEMAPHORE__ *)0x0) {

+      *(undefined8 *)(puVar17 + -8) = 0x1401acd73;

+      GreReleaseSemaphoreCommon<7,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+                (GreReleaseSemaphoreExclusiveInternal_exref,local_78);

+    }

+    *(uint *)(puVar17 + 0x20) = -(uint)((param_10 & 0x60) != 0) & 4;

+    *(undefined8 *)(puVar17 + -8) = 0x1401acd95;

+    DwmMovePointer(param_1,param_7,param_8,(_RECTL *)p_Var20,*(ulong *)(puVar17 + 0x20));

+    *(undefined8 *)(puVar17 + -8) = 0x1401acd9e;

+    DWMSPRITEREF::~DWMSPRITEREF((DWMSPRITEREF *)local_70);

   }

-  lVar5 = W32GetUserSessionState();

-  puVar1 = *(undefined8 **)(lVar5 + 0xd8);

-  lVar5 = W32GetUserSessionState();

-  do {

-    if (puVar1 == (undefined8 *)(lVar5 + 0xd8)) {

-      return;

-    }

-    if (((((*(uint *)((longlong)puVar1 + 100) & 0x40) != 0) && (puVar1[9] != 0)) &&

-        (lVar7 = *(longlong *)(puVar1[9] + 0x28), -1 < *(char *)(lVar7 + 0x14))) &&

-       (-1 < *(char *)(lVar7 + 0x13))) {

-      lVar7 = W32GetUserSessionState();

-      if (*(longlong *)(puVar1[9] + 0x18) == *(longlong *)(lVar7 + 0x4b58)) {

-        if (((lVar6 == 0) ||

-            (bVar3 = UIPrivilegeIsolation::CheckAccess

-                               ((tagUIPI_INFO *)

-                                (*(longlong *)(*(longlong *)(puVar1[9] + 0x10) + 0x1d0) + 0x130),

-                                (tagUIPI_INFO *)&local_48,0), uVar2 = local_40, bVar3)) ||

-           (*(int *)(*(longlong *)(*(longlong *)(puVar1[9] + 0x10) + 0x1d0) + 0xc) < 0)) {

-          if ((*(longlong *)(*(longlong *)(puVar1[9] + 0x10) + 0x1d0) != lVar6) &&

-             ((-1 < (char)*(undefined4 *)((longlong)puVar1 + 100) || (param_6 == 0)))) {

-            local_c8 = puVar1[9];

-            puVar8 = (undefined8 *)AllocateHidData(param_2,1,0x10);

-            if (puVar8 == (undefined8 *)0x0) {

-              return;

-            }

-            local_70 = 0xffffffffffffffff;

-            local_c8 = *puVar8;

-            local_78 = 0;

-            local_80 = 0;

-            local_88 = 0;

-            local_90 = 0;

-            *(undefined2 *)(puVar8 + 10) = *(undefined2 *)(param_3 + 2);

-            *(undefined2 *)((longlong)puVar8 + 0x52) = *(undefined2 *)(param_3 + 4);

-            *(undefined2 *)((longlong)puVar8 + 0x54) = *(undefined2 *)(param_3 + 6);

-            *(uint *)(puVar8 + 0xb) = param_4;

-            *(ushort *)((longlong)puVar8 + 0x56) = param_5;

-            local_a0 = 0;

-            local_a8 = 0;

-            *(undefined4 *)((longlong)puVar8 + 0x5c) = *(undefined4 *)(param_3 + 8);

-            local_b0 = (ulonglong)*(uint *)(param_3 + 8);

-            local_b8 = 0;

-            local_c0 = local_68;

-            local_98 = param_2;

-            iVar4 = PostInputMessage(*(undefined8 *)(*(longlong *)(puVar8[3] + 0x10) + 0x1d8),

-                                     puVar8[3],0xff,1);

-            if (iVar4 == 0) {

-              FreeHidData(puVar8);

-            }

-          }

-        }

-        else {

-          local_60 = local_48;

-          lVar7 = W32GetUserSessionState();

-          local_58 = local_60;

-          local_50 = uVar2;

-          local_c8 = CONCAT44(local_c8._4_4_,5);

-          EtwTraceUIPIInputError

-                    (*(undefined8 *)(puVar1[9] + 0x10),0,*(undefined8 *)(lVar7 + 0x4a50),&local_58);

-        }

-      }

-    }

-    puVar1 = (undefined8 *)*puVar1;

-  } while( true );

+  return uVar21;

 }
```

## `NtUserGetClipboardData`  (modified)

```diff
--- NtUserGetClipboardData
+++ NtUserGetClipboardData
@@ -1,26 +1,271 @@
 

-undefined8

-NtUserGetClipboardData(_tlgProvider_t *param_1,undefined8 param_2,_GUID *param_3,_GUID *param_4)

+/* WARNING: Type propagation algorithm not settling */

+

+longlong NtUserGetClipboardData(int param_1,void *param_2,_GUID *param_3,_GUID *param_4)

 

 {

-  undefined8 unaff_RBX;

-  undefined8 unaff_RDI;

-  bool in_ZF;

-  undefined8 in_stack_00000040;

-  undefined4 in_stack_000000f0;

-  undefined8 in_stack_000000f8;

+  undefined8 *puVar1;

+  char *pcVar2;

+  char *pcVar3;

+  char cVar4;

+  bool bVar5;

+  int iVar6;

+  undefined4 uVar7;

+  uint uVar8;

+  tagTHREADINFO *ptVar9;

+  tagWINDOWSTATION *ptVar10;

+  longlong lVar11;

+  uint *puVar12;

+  int *piVar13;

+  uchar auVar14 [8];

+  _GUID *p_Var15;

+  _GUID *p_Var16;

+  _GUID local_res18;

+  undefined8 in_stack_ffffffffffffff48;

+  undefined4 uVar17;

+  undefined1 local_98 [16];

+  char *local_88 [4];

+  undefined1 local_68 [16];

+  undefined8 uStack_58;

+  Win32RawLockedNtObject<tagWINDOWSTATION> local_48 [32];

   

-  if (!in_ZF) {

-    in_stack_000000f0 = 0x80070005;

-    in_stack_00000040 = unaff_RBX;

-    in_stack_000000f8 = unaff_RDI;

-    _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

-    ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

-              (param_1,&DAT_0,param_3,param_4,(_tlgWrapSz<char> *)&stack0x00000040,

-               (_tlgWrapperByVal<4> *)&stack0x000000f0,

-               (_tlgWrapSz<unsigned_short> *)&stack0x000000f8);

+                    /* 0x2374c0  1671  NtUserGetClipboardData */

+  uVar17 = (undefined4)((ulonglong)in_stack_ffffffffffffff48 >> 0x20);

+  local_68[8] = '\0';

+  local_68[9] = '\0';

+  local_68[10] = '\0';

+  local_68[0xb] = '\0';

+  local_68[0xc] = '\0';

+  local_68[0xd] = '\0';

+  local_68[0xe] = '\0';

+  local_68[0xf] = '\0';

+  uStack_58 = 0;

+  EnterCrit(0,0);

+  UserSetLastError(0);

+  ptVar9 = PtiCurrent();

+  auVar14 = (uchar  [8])(*(longlong *)(ptVar9 + 0x1d0) + 0x3d0);

+  local_98._8_8_ = auVar14;

+  ptVar10 = CheckClipboardAccess();

+  if (ptVar10 == (tagWINDOWSTATION *)0x0) {

+    if (5 < DAT_0) {

+      puVar12 = &DAT_0;

+      cVar4 = _tlgKeywordOn(&DAT_0,0x400000000000);

+      if (cVar4 != '\0') {

+        local_res18.Data1 = 0x80070005;

+        local_98._8_8_ = "AccessDenied";

+        local_98._0_8_ = (char *)0x1;

+        param_4 = (_GUID *)local_98;

+        local_res18.Data4 = auVar14;

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+        ::

+        Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                  ((_tlgProvider_t *)puVar12,&DAT_1,param_3,(_tlgWrapperByVal<8> *)param_4,

+                   (_tlgWrapSz<char> *)(local_98 + 8),(_tlgWrapperByVal<4> *)&local_res18,

+                   (_tlgWrapSz<unsigned_short> *)((longlong)&local_res18 + 8));

+      }

+    }

+    pcVar2 = (char *)local_98._0_8_;

+    if (5 < DAT_2) {

+      puVar12 = &DAT_2;

+      cVar4 = _tlgKeywordOn(&DAT_2,1);

+      pcVar3 = "AccessDenied";

+      pcVar2 = (char *)local_98._0_8_;

+joined_r0x0001402376f4:

+      local_98._0_8_ = pcVar3;

+      if (cVar4 != '\0') {

+        local_res18.Data1 = 0x80070005;

+        local_res18.Data4 = auVar14;

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+        ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                  ((_tlgProvider_t *)puVar12,&DAT_3,param_3,param_4,

+                   (_tlgWrapSz<char> *)local_98,(_tlgWrapperByVal<4> *)&local_res18,

+                   (_tlgWrapSz<unsigned_short> *)((longlong)&local_res18 + 8));

+        pcVar2 = (char *)local_98._0_8_;

+      }

+    }

   }

+  else {

+    bVar5 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(ptVar9 + 0x1d0),2);

+    if (bVar5) {

+      piVar13 = (int *)(*(longlong *)(ptVar9 + 0x1d0) + 0x134);

+      if (*(longlong *)(ptVar9 + 0x1d0) == 0) {

+        piVar13 = (int *)&DAT_4;

+      }

+      if ((*piVar13 == 0) ||

+         ((iVar6 = InForegroundQueue(ptVar9,1), iVar6 != 0 && ((param_1 == 1 || (param_1 == 0xd)))))

+         ) {

+        Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

+                  (local_48,ptVar10);

+        Feature_ReadClipboardEvent__private_IsEnabledPreCheck();

+        uVar7 = 0;

+        local_res18._0_8_ = (uchar  [8])0x0;

+        if (*(longlong *)(ptVar10 + 0x70) != 0) {

+          puVar1 = *(undefined8 **)(*(longlong *)(ptVar10 + 0x70) + 0x10);

+          uVar7 = PsGetThreadProcessId(*puVar1);

+          local_res18._0_8_ = PsGetProcessCreateTimeQuadPart(*(undefined8 *)puVar1[0x3a]);

+        }

+        local_res18.Data4 =

+             (uchar  [8])PsGetProcessCreateTimeQuadPart(**(undefined8 **)(ptVar9 + 0x1d0));

+        p_Var16 = &local_res18;

+        EtwTraceUiAuditReadClipboard

+                  (*(undefined4 *)(*(longlong *)(ptVar9 + 0x1d0) + 0x38),(longlong)&local_res18 + 8,

+                   uVar7,p_Var16,CONCAT44(uVar17,*(undefined4 *)(ptVar10 + 0x90)));

+        local_68._8_4_ = param_1;

+        p_Var15 = (_GUID *)(local_68 + 8);

+        lVar11 = xxxGetClipboardData(ptVar10,param_1);

+        if (lVar11 != 0) {

+          if (*(void **)MmUserProbeAddress_exref <= param_2) {

+            param_2 = *(void **)MmUserProbeAddress_exref;

+          }

+          p_Var15 = (_GUID *)&DAT_5;

+          RtlCopyVolatileMemory(param_2,local_68 + 8,0x10);

+        }

+        Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>::

+        ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                  ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

+                    *)local_48);

+        if (5 < DAT_0) {

+          puVar12 = &DAT_0;

+          cVar4 = _tlgKeywordOn(&DAT_0,0x400000000000);

+          if (cVar4 != '\0') {

+            if (lVar11 == 0) {

+              local_res18._0_8_ = auVar14;

+              uVar8 = UserGetLastError();

+              if (0 < (int)uVar8) {

+                uVar8 = uVar8 & 0xffff | 0x80070000;

+              }

+            }

+            else {

+              uVar8 = 0;

+              local_res18._0_8_ = auVar14;

+            }

+            local_res18.Data4[0] = (char)uVar8;

+            local_res18.Data4[1] = (char)(uVar8 >> 8);

+            local_res18.Data4[2] = (char)(uVar8 >> 0x10);

+            local_res18.Data4[3] = (char)(uVar8 >> 0x18);

+            local_88[0] = "FunctionExit";

+            local_68._0_4_ = 1;

+            local_68._4_2_ = 0;

+            local_68._6_2_ = 0;

+            p_Var16 = (_GUID *)local_68;

+            _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+            ::

+            Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                      ((_tlgProvider_t *)puVar12,&DAT_1,p_Var15,

+                       (_tlgWrapperByVal<8> *)p_Var16,(_tlgWrapSz<char> *)local_88,

+                       (_tlgWrapperByVal<4> *)((longlong)&local_res18 + 8),

+                       (_tlgWrapSz<unsigned_short> *)&local_res18);

+          }

+        }

+        if (lVar11 == 0) {

+          uVar8 = UserGetLastError();

+          if (0 < (int)uVar8) {

+            uVar8 = uVar8 & 0xffff | 0x80070000;

+          }

+          if (((int)uVar8 < 0) && (5 < DAT_2)) {

+            puVar12 = &DAT_2;

+            cVar4 = _tlgKeywordOn(&DAT_2,1);

+            if (cVar4 != '\0') {

+              local_res18._0_8_ = auVar14;

+              uVar8 = UserGetLastError();

+              if (0 < (int)uVar8) {

+                uVar8 = uVar8 & 0xffff | 0x80070000;

+              }

+              local_98._8_4_ = uVar8;

+              local_res18.Data4 = (uchar  [8])0x14034f2e0;

+              _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+              ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                        ((_tlgProvider_t *)puVar12,&DAT_3,p_Var15,p_Var16,

+                         (_tlgWrapSz<char> *)((longlong)&local_res18 + 8),

+                         (_tlgWrapperByVal<4> *)(local_98 + 8),

+                         (_tlgWrapSz<unsigned_short> *)&local_res18);

+            }

+          }

+        }

+      }

+      else {

+        if (5 < DAT_0) {

+          puVar12 = &DAT_0;

+          cVar4 = _tlgKeywordOn(&DAT_0,0x400000000000);

+          if (cVar4 != '\0') {

+            local_res18.Data1 = 0x80070005;

+            local_98._0_8_ = "UnsupportedFormatForLowBoxApp";

+            local_98[8] = '\x01';

+            local_98[9] = '\0';

+            local_98[10] = '\0';

+            local_98[0xb] = '\0';

+            local_98[0xc] = '\0';

+            local_98[0xd] = '\0';

+            local_98[0xe] = '\0';

+            local_98[0xf] = '\0';

+            param_4 = (_GUID *)(local_98 + 8);

+            local_res18.Data4 = auVar14;

+            _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+            ::

+            Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                      ((_tlgProvider_t *)puVar12,&DAT_1,param_3,

+                       (_tlgWrapperByVal<8> *)param_4,(_tlgWrapSz<char> *)local_98,

+                       (_tlgWrapperByVal<4> *)&local_res18,

+                       (_tlgWrapSz<unsigned_short> *)((longlong)&local_res18 + 8));

+          }

+        }

+        if (5 < DAT_2) {

+          puVar12 = &DAT_2;

+          cVar4 = _tlgKeywordOn(&DAT_2,1);

+          if (cVar4 != '\0') {

+            local_res18.Data1 = 0x80070005;

+            local_98._0_8_ = "UnsupportedFormatForLowBoxApp";

+            local_res18.Data4 = auVar14;

+            _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+            ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                      ((_tlgProvider_t *)puVar12,&DAT_3,param_3,param_4,

+                       (_tlgWrapSz<char> *)local_98,(_tlgWrapperByVal<4> *)&local_res18,

+                       (_tlgWrapSz<unsigned_short> *)((longlong)&local_res18 + 8));

+          }

+        }

+        lVar11 = 0;

+        UserSetLastError(5);

+      }

+      goto LAB_6;

+    }

+    UserSetLastError(5);

+    if (5 < DAT_0) {

+      puVar12 = &DAT_0;

+      cVar4 = _tlgKeywordOn(&DAT_0,0x400000000000);

+      if (cVar4 != '\0') {

+        local_res18.Data1 = 0x80070005;

+        local_98._0_8_ = "RestrictedThread";

+        local_98[8] = '\x01';

+        local_98[9] = '\0';

+        local_98[10] = '\0';

+        local_98[0xb] = '\0';

+        local_98[0xc] = '\0';

+        local_98[0xd] = '\0';

+        local_98[0xe] = '\0';

+        local_98[0xf] = '\0';

+        param_4 = (_GUID *)(local_98 + 8);

+        local_res18.Data4 = auVar14;

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+        ::

+        Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                  ((_tlgProvider_t *)puVar12,&DAT_1,param_3,(_tlgWrapperByVal<8> *)param_4,

+                   (_tlgWrapSz<char> *)local_98,(_tlgWrapperByVal<4> *)&local_res18,

+                   (_tlgWrapSz<unsigned_short> *)((longlong)&local_res18 + 8));

+      }

+    }

+    pcVar2 = (char *)local_98._0_8_;

+    if (5 < DAT_2) {

+      puVar12 = &DAT_2;

+      cVar4 = _tlgKeywordOn(&DAT_2,1);

+      pcVar3 = "RestrictedThread";

+      pcVar2 = (char *)local_98._0_8_;

+      goto joined_r0x0001402376f4;

+    }

+  }

+  local_98._0_8_ = pcVar2;

+  lVar11 = 0;

+LAB_6:

   UserSessionSwitchLeaveCrit();

-  return 0;

+  return lVar11;

 }
```

## `NtUserCountClipboardFormats`  (modified)

```diff
--- NtUserCountClipboardFormats
+++ NtUserCountClipboardFormats
@@ -1,242 +1,29 @@
 

-undefined4

-NtUserCountClipboardFormats(undefined8 param_1,int param_2,undefined8 param_3,int param_4)

+ulong NtUserCountClipboardFormats(void)

 

 {

-  undefined4 *_Dst;

-  short sVar1;

-  undefined4 uVar2;

-  undefined8 uVar3;

-  char cVar4;

-  bool bVar5;

-  ulong uVar6;

-  int iVar7;

-  int iVar8;

-  short *psVar9;

-  ulonglong uVar10;

-  longlong lVar11;

-  int iVar12;

-  longlong lVar13;

-  uint uVar14;

-  int *piVar15;

-  void *_Src;

-  undefined4 *unaff_RBX;

-  longlong unaff_RBP;

-  byte bVar16;

-  uint uVar17;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  wchar_t *_Src_00;

-  PFEOBJ *unaff_R12;

-  undefined1 uVar18;

-  uint unaff_R13D;

-  uint unaff_R14D;

-  short *psVar19;

-  longlong unaff_R15;

-  float fVar20;

+  ulong uVar1;

+  tagWINDOWSTATION *ptVar2;

+  longlong *plVar3;

+  ulonglong uVar4;

+  undefined8 local_18;

+  undefined4 local_10;

   

-  if (param_4 < 0) {

-    param_2 = -param_2;

+                    /* 0x236ad0  1564  NtUserCountClipboardFormats */

+  EnterSharedCrit(0);

+  ptVar2 = CheckClipboardAccess();

+  uVar1 = 0;

+  if (ptVar2 != (tagWINDOWSTATION *)0x0) {

+    plVar3 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar4 = 0;

+    if (plVar3 != (longlong *)0x0) {

+      uVar4 = (ulonglong)plVar3 & -(ulonglong)(*plVar3 != 0);

+    }

+    local_18 = *(undefined8 *)(uVar4 + 0x130);

+    local_10 = *(undefined4 *)(uVar4 + 0x138);

+    uVar1 = CountNumClipFormatForIL(&local_18,ptVar2);

   }

-  unaff_RBX[3] = param_2;

-  *(longlong *)(unaff_RBP + -0x31) = unaff_R15;

-  bVar16 = (byte)unaff_RSI;

-  if ((bVar16 & (byte)*(undefined4 *)(unaff_R15 + 0x20)) == 0) {

-    uVar3 = *(undefined8 *)(unaff_RDI + 0x78);

-    *(undefined8 *)(unaff_RBP + -0x51) = uVar3;

-    iVar12 = (int)uVar3;

-    iVar7 = (int)((ulonglong)uVar3 >> 0x20);

-    if ((iVar12 == 0) && (iVar7 == 0)) {

-      iVar12 = 1;

-    }

-    *(float *)(unaff_RBP + -0x49) = (float)iVar12;

-    *(float *)(unaff_RBP + -0x45) = (float)iVar7;

-    EFLOAT::eqLength((EFLOAT *)(unaff_RBP + 0x7f),(POINTFL *)(unaff_RBP + -0x25));

-    *(float *)(unaff_RBP + -0x41) = *(float *)(unaff_RBP + -0x49) / *(float *)(unaff_RBP + 0x7f);

-    *(float *)(unaff_RBP + -0x3d) = *(float *)(unaff_RBP + -0x45) / *(float *)(unaff_RBP + 0x7f);

-    if (((bVar16 & (byte)*(undefined4 *)(*(longlong *)(unaff_RBP + -0x31) + 0x20)) == 0) &&

-       (bVar5 = EXFORMOBJ::bXform((EXFORMOBJ *)(unaff_RBP + -0x31),(VECTORFL *)(unaff_RBP + -0x41),

-                                  (VECTORFL *)(unaff_RBP + -0x41),1), !bVar5)) {

-      return 0;

-    }

-    EFLOAT::eqLength((EFLOAT *)(unaff_RBP + 0x7f),(POINTFL *)(unaff_RBP + -0x21));

-    iVar12 = 0;

-    fVar20 = (float)(int)unaff_RBX[4] * *(float *)(unaff_RBP + 0x7f);

-    uVar14 = (int)fVar20 >> 0x17 & 0xff;

-    if (uVar14 < 0x9f) {

-      uVar10 = (ulonglong)((uint)fVar20 & 0x7fffff) | 0x800000;

-      cVar4 = (char)((int)fVar20 >> 0x17);

-      if (uVar14 < unaff_R14D) {

-        lVar11 = (longlong)uVar10 >> ((char)unaff_R14D - cVar4 & 0x3fU);

-      }

-      else {

-        lVar11 = uVar10 << (cVar4 + 0x8aU & 0x3f);

-      }

-      iVar12 = (int)((ulonglong)(lVar11 + 0x80000000) >> 0x20);

-      if ((int)fVar20 < 0) {

-        iVar12 = -iVar12;

-      }

-    }

-    unaff_RBX[4] = iVar12;

-    uVar3 = *(undefined8 *)(unaff_RDI + 0x78);

-    *(undefined8 *)(unaff_RBP + -0x51) = uVar3;

-    iVar12 = (int)uVar3;

-    iVar7 = (int)((ulonglong)uVar3 >> 0x20);

-    if ((iVar12 == 0) && (iVar7 == 0)) {

-      iVar12 = 1;

-    }

-    *(float *)(unaff_RBP + -0x35) = (float)iVar12;

-    *(float *)(unaff_RBP + -0x39) = (float)-iVar7;

-    EFLOAT::eqLength((EFLOAT *)(unaff_RBP + -0x69),(POINTFL *)(unaff_RBP + -0x1d));

-    *(float *)(unaff_RBP + -0x59) = *(float *)(unaff_RBP + -0x39) / *(float *)(unaff_RBP + -0x69);

-    *(float *)(unaff_RBP + -0x55) = *(float *)(unaff_RBP + -0x35) / *(float *)(unaff_RBP + -0x69);

-    if (((bVar16 & (byte)*(undefined4 *)(*(longlong *)(unaff_RBP + -0x31) + 0x20)) == 0) &&

-       (bVar5 = EXFORMOBJ::bXform((EXFORMOBJ *)(unaff_RBP + -0x31),(VECTORFL *)(unaff_RBP + -0x59),

-                                  (VECTORFL *)(unaff_RBP + -0x59),1), !bVar5)) {

-      return 0;

-    }

-    EFLOAT::eqLength((EFLOAT *)(unaff_RBP + -0x69),(POINTFL *)(unaff_RBP + -0x19));

-    iVar12 = 0;

-    fVar20 = (float)(int)unaff_RBX[3] * *(float *)(unaff_RBP + -0x69);

-    uVar14 = (int)fVar20 >> 0x17 & 0xff;

-    if (uVar14 < 0x9f) {

-      uVar10 = (ulonglong)((uint)fVar20 & 0x7fffff) | 0x800000;

-      cVar4 = (char)((int)fVar20 >> 0x17);

-      if (uVar14 < unaff_R14D) {

-        lVar11 = (longlong)uVar10 >> ((char)unaff_R14D - cVar4 & 0x3fU);

-      }

-      else {

-        lVar11 = uVar10 << (cVar4 + 0x8aU & 0x3f);

-      }

-      iVar12 = (int)((ulonglong)(lVar11 + 0x80000000) >> 0x20);

-      if ((int)fVar20 < 0) {

-        iVar12 = -iVar12;

-      }

-    }

-    unaff_RBX[3] = iVar12;

-  }

-  uVar2 = *(undefined4 *)(*(longlong *)unaff_R12 + 0x80);

-  *(undefined4 *)(unaff_RBP + 0x7f) = uVar2;

-  *unaff_RBX = uVar2;

-  uVar6 = PFEOBJ::dpNtmi(unaff_R12);

-  uVar10 = 0;

-  unaff_RBX[1] = uVar6;

-  if ((((*(uint *)(unaff_RDI + 0x30) >> 0xe & 1) == 0) &&

-      (((((*(uint *)(unaff_RDI + 0x30) & 0x4000001) == 0 || (*(uint *)(unaff_RDI + 4) < 0xd)) ||

-        (uVar14 = *(uint *)(unaff_RDI + 0xcc), uVar14 == 0)) ||

-       ((*(int *)((ulonglong)uVar14 + 4 + unaff_RDI) == 0 ||

-        ((iVar12 = *(int *)((ulonglong)uVar14 + unaff_RDI), iVar12 != 0x8007674 &&

-         (iVar12 != 0x8007663)))))))) || (*(uint *)(unaff_RDI + 4) < 0xd)) {

-    uVar14 = 0;

-    unaff_RBX[0x5a] = 0x8007664;

-  }

-  else {

-    _Src = (void *)(*(int *)(unaff_RDI + 0xcc) + unaff_RDI);

-    uVar14 = *(uint *)((longlong)_Src + 4);

-    if (0x10 < uVar14) {

-      uVar14 = 0x10;

-    }

-    uVar10 = (ulonglong)uVar14;

-    memcpy(unaff_RBX + 0x5a,_Src,uVar10 * 4 + 8);

-  }

-  unaff_RBX[0x5b] = uVar14;

-  _Dst = (undefined4 *)((longlong)unaff_RBX + (ulonglong)uVar6 + 0x6c);

-  if (((*(uint *)(unaff_RDI + 0x30) & 0x4000) == 0) || (*(uint *)(unaff_RDI + 4) < 0x11)) {

-    *(undefined4 *)((longlong)unaff_RBX + (ulonglong)uVar6 + 0x70) = 0;

-    *_Dst = 0x8006c61;

-  }

-  else {

-    memcpy(_Dst,(void *)(*(int *)(unaff_RDI + 0xd0) + unaff_RDI),uVar10 * 0x28 + 8);

-  }

-  iVar12 = *(int *)(unaff_RBP + -0x29);

-  iVar7 = bIFIMetricsToTextMetricW2();

-  if (iVar7 == 0) {

-    return 0;

-  }

-  if (*(int *)(unaff_RBP + 0x77) == 0) {

-    *(undefined2 *)(unaff_RBX + 0x4a) = 0;

-  }

-  else {

-    iVar7 = *(int *)(unaff_RBP + 0x6f);

-    uVar18 = (undefined1)iVar7;

-    *(undefined1 *)((longlong)unaff_RBX + 0x23) = uVar18;

-    *(undefined1 *)((longlong)unaff_RBX + (ulonglong)uVar6 + 0x40) = uVar18;

-    psVar19 = (short *)(unaff_RBX + 0x4a);

-    iVar8 = InitializeScripts();

-    if (iVar8 != 0) {

-      lVar11 = W32GetSessionState();

-      uVar10 = 0;

-      lVar11 = *(longlong *)(lVar11 + 0x60);

-      piVar15 = (int *)(lVar11 + 0x4d58);

-      do {

-        if (*piVar15 == iVar7 + 1000) {

-          lVar11 = *(longlong *)(lVar11 + 0x4d60 + uVar10 * 0x10);

-          goto LAB_0;

-        }

-        uVar14 = (int)uVar10 + 1;

-        uVar10 = (ulonglong)uVar14;

-        piVar15 = piVar15 + 4;

-      } while (uVar14 < 0x13);

-      lVar11 = *(longlong *)(lVar11 + 0x4e80);

-LAB_0:

-      lVar13 = 0x20;

-      lVar11 = lVar11 - (longlong)psVar19;

-      do {

-        if ((lVar13 == -0x7fffffde) || (sVar1 = *(short *)(lVar11 + (longlong)psVar19), sVar1 == 0))

-        break;

-        *psVar19 = sVar1;

-        psVar19 = (short *)((longlong)psVar19 + unaff_RSI);

-        lVar13 = lVar13 + -1;

-      } while (lVar13 != 0);

-      psVar9 = psVar19 + -1;

-      if (lVar13 != 0) {

-        psVar9 = psVar19;

-      }

-      *psVar9 = 0;

-    }

-    unaff_R13D = 4;

-  }

-  _Src_00 = *(wchar_t **)(unaff_RBP + 0x67);

-  if (_Src_00 == (wchar_t *)0x0) {

-    if (*(int *)(unaff_RBP + 0x5f) != 5) goto LAB_1;

-    _Src_00 = (wchar_t *)(unaff_RBX + 0x1a);

-  }

-  wcsncpy_s((wchar_t *)(unaff_RBX + 10),0x20,_Src_00,0x1f);

-  *(undefined2 *)((longlong)unaff_RBX + 0x66) = 0;

-LAB_1:

-  unaff_RBX[2] = 0;

-  uVar14 = *(uint *)(unaff_RDI + 0x30);

-  uVar17 = (uint)unaff_RSI;

-  if ((uVar14 & 1) == 0) {

-    if ((bVar16 & (byte)uVar14) == 0) {

-      unaff_R13D = 0;

-      if ((int)uVar14 < 0) {

-        unaff_RBX[2] = uVar17;

-        unaff_R13D = uVar17;

-      }

-    }

-    else {

-      unaff_RBX[2] = 1;

-      unaff_R13D = 1;

-    }

-  }

-  else {

-    if (((*(char *)(unaff_R15 + 0x32) == '\0') && (*(char *)(unaff_R15 + 0x33) == '\0')) &&

-       (*(char *)(unaff_R15 + 0x34) != '\0')) {

-      unaff_R13D = 6;

-    }

-    unaff_RBX[2] = unaff_R13D;

-  }

-  if (iVar12 != 0) {

-    if ((*(uint *)(unaff_RDI + 0x30) & 0x3000010) == 0) {

-      uVar17 = unaff_R13D | uVar17;

-    }

-    unaff_RBX[2] = uVar17;

-    if (((*(char *)(unaff_R15 + 0x30) != '\0') && (*(char *)(unaff_R15 + 0x31) == '\0')) &&

-       ((*(uint *)(unaff_RDI + 0x30) & 0x3000010) != 0)) {

-      unaff_RBX[2] = uVar17 | 0x80000000;

-    }

-  }

-  return *(undefined4 *)(unaff_RBP + 0x7f);

+  UserSessionSwitchLeaveCrit();

+  return uVar1;

 }
```

## `NtUserConvertPrimaryPointerToMouseDrag`  (modified)

```diff
--- NtUserConvertPrimaryPointerToMouseDrag
+++ NtUserConvertPrimaryPointerToMouseDrag
@@ -1,13 +1,113 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void NtUserConvertPrimaryPointerToMouseDrag(char param_1)

+undefined8 NtUserConvertPrimaryPointerToMouseDrag(void)

 

 {

-  char *unaff_RDI;

+  char cVar1;

+  short sVar2;

+  int iVar3;

+  longlong lVar4;

+  undefined8 uVar5;

+  char cVar6;

+  bool bVar7;

+  longlong local_res8;

+  undefined2 uVar8;

   

-  *unaff_RDI = *unaff_RDI + param_1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+                    /* 0x28c550  1561  NtUserConvertPrimaryPointerToMouseDrag */

+  local_res8 = EnterCrit(0,0);

+  if (*(int *)(local_res8 + 0x5a0) == 2) {

+    cVar1 = IsCapturedByThread(&local_res8);

+    if (cVar1 != '\0') {

+      SetMiPPromotion(local_res8,0x246);

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x200) == 0)) ||

+         (cVar1 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+        cVar1 = '\0';

+      }

+      bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar1 != '\0') || (bVar7)) {

+        lVar4 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar1,bVar7,

+                   *(undefined8 *)(lVar4 + 0x10f98),4,10,0x72,

+                   &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids);

+      }

+LAB_0:

+      uVar5 = 1;

+      goto LAB_1;

+    }

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x200) == 0)) ||

+       ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+      cVar1 = '\0';

+    }

+    else {

+      cVar1 = '\x01';

+    }

+    bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar1 != '\0') || (bVar7)) {

+      lVar4 = W32GetUserSessionState();

+      uVar8 = 0x71;

+LAB_2:

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar1,bVar7,

+                 *(undefined8 *)(lVar4 + 0x10f98),3,10,uVar8,

+                 &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids);

+    }

+  }

+  else {

+    sVar2 = GetPromotablePointerIdForThread(local_res8);

+    if (sVar2 == 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x200) == 0)) ||

+         ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+        cVar1 = '\0';

+      }

+      else {

+        cVar1 = '\x01';

+      }

+      bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar1 != '\0') || (bVar7)) {

+        lVar4 = W32GetUserSessionState();

+        uVar8 = 0x73;

+        goto LAB_2;

+      }

+    }

+    else {

+      cVar1 = '\x01';

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x200) == 0)) ||

+         (cVar6 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+        cVar6 = '\0';

+      }

+      bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar6 != '\0') || (bVar7)) {

+        lVar4 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_d

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar7,

+                   *(undefined8 *)(lVar4 + 0x10f98),4,10,0x74,

+                   &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids,sVar2);

+      }

+      iVar3 = xxxPromotePointerToMouse(sVar2,0x10001);

+      if (iVar3 != 0) goto LAB_0;

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x200) == 0)) ||

+         ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+        cVar1 = '\0';

+      }

+      bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar1 != '\0') || (bVar7)) {

+        lVar4 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_d

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar1,bVar7,

+                   *(undefined8 *)(lVar4 + 0x10f98),3,10,0x75,

+                   &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids,sVar2);

+      }

+    }

+  }

+  uVar5 = 0;

+  UserSetLastError(0x139f);

+LAB_1:

+  UserSessionSwitchLeaveCrit();

+  return uVar5;

 }
```

## `xxxSetWindowLong`  (modified)

```diff
--- xxxSetWindowLong
+++ xxxSetWindowLong
@@ -1,99 +1,172 @@
 

-void xxxSetWindowLong(void)

+/* WARNING: Type propagation algorithm not settling */

+

+int xxxSetWindowLong(longlong param_1,uint param_2,int param_3,undefined4 param_4,int param_5)

 

 {

-  ulonglong uVar1;

-  tagWND *ptVar2;

-  longlong lVar3;

-  longlong lVar4;

-  tagTHREADINFO *ptVar5;

-  undefined8 uVar6;

-  tagWND *ptVar7;

-  byte bVar8;

-  longlong unaff_RBX;

-  tagWND *unaff_RBP;

-  tagWND *unaff_RSI;

-  ushort uVar9;

-  longlong unaff_R12;

-  ulonglong *unaff_R13;

-  undefined8 *unaff_R14;

-  uint unaff_R15D;

-  Win32HMThreadLockBase<tagMENU,0,0> local_res20 [8];

-  undefined8 in_stack_00000070;

-  longlong in_stack_00000080;

+  ushort uVar1;

+  int iVar2;

+  ulonglong uVar3;

+  char cVar4;

+  bool bVar5;

+  int iVar6;

+  longlong *plVar7;

+  longlong *plVar8;

+  longlong lVar9;

+  longlong lVar10;

+  undefined8 uVar11;

+  int *piVar12;

+  uint *puVar13;

+  uint uVar14;

+  ulonglong uVar16;

+  undefined1 uVar17;

+  ulonglong uVar15;

   

-  do {

-    if (((*(byte *)(unaff_RBX + 0x19) & 1) == 0) && (*(char *)(unaff_RBX + 0x18) == '\x01')) {

-      unaff_RSI = (tagWND *)*unaff_R14;

+  uVar15 = 0;

+  bVar5 = false;

+  uVar17 = 0;

+  cVar4 = CanSetWindowLong();

+  if (cVar4 == '\0') {

+LAB_0:

+    UserSetLastError(5);

+    return 0;

+  }

+  if ((-1 < (int)param_2) &&

+     ((ulonglong)*(uint *)(*(longlong *)(param_1 + 0x28) + 0xf8) < (longlong)(int)param_2 + 4U)) {

+    plVar7 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar16 = 0;

+    if (plVar7 != (longlong *)0x0) {

+      uVar16 = (ulonglong)plVar7 & -(ulonglong)(*plVar7 != 0);

     }

-    do {

-      do {

-        if (((unaff_RSI != (tagWND *)0x0) &&

-            ((*(byte *)(*(longlong *)(*(longlong *)(unaff_RSI + 0x88) + 8) + 8) & 4) == 0)) &&

-           (unaff_RSI != unaff_RBP)) {

-          ptVar7 = *(tagWND **)(unaff_RSI + 0x78);

-          if (ptVar7 != (tagWND *)0x0) {

-            lVar3 = *(longlong *)(ptVar7 + 0x28);

-            while (((bVar8 = *(byte *)(lVar3 + 0x1f) & 0xc0, bVar8 != 0 && (bVar8 != 0xc0)) &&

-                   ((ptVar7 != unaff_RBP &&

-                    (ptVar2 = *(tagWND **)(ptVar7 + 0x78), ptVar2 != (tagWND *)0x0))))) {

-              lVar3 = *(longlong *)(ptVar2 + 0x28);

-              ptVar7 = ptVar2;

+    uVar3 = *(ulonglong *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+    if (uVar3 != uVar16) {

+      plVar7 = (longlong *)PsGetCurrentProcessWin32Process(-uVar3);

+      uVar16 = 0;

+      if (plVar7 != (longlong *)0x0) {

+        uVar16 = (ulonglong)plVar7 & -(ulonglong)(*plVar7 != 0);

+      }

+      bVar5 = UIPrivilegeIsolation::CheckAccess

+                        ((tagUIPI_INFO *)(-(ulonglong)(uVar16 != 0) & uVar16 + 0x130),

+                         (tagUIPI_INFO *)(-(ulonglong)(uVar3 != 0) & uVar3 + 0x130),0);

+      if (!bVar5) {

+        plVar7 = (longlong *)PsGetCurrentProcessWin32Process();

+        uVar16 = 0;

+        if (plVar7 != (longlong *)0x0) {

+          uVar16 = (ulonglong)plVar7 & -(ulonglong)(*plVar7 != 0);

+        }

+        if (-1 < *(int *)(uVar16 + 0xc)) goto LAB_0;

+      }

+      KeAttachProcess(**(undefined8 **)(*(longlong *)(param_1 + 0x10) + 0x1d0));

+      bVar5 = true;

+      uVar17 = 1;

+    }

+  }

+  plVar7 = (longlong *)(param_1 + 0x28);

+  if ((*(ushort *)(*plVar7 + 0x2a) & 0x2fff) == 0) {

+LAB_1:

+    if ((int)param_2 < 0) {

+LAB_2:

+      if ((param_2 + 0x15 < 10) && ((0x223U >> (param_2 + 0x15 & 0x1f) & 1) != 0)) {

+        iVar6 = xxxSetWindowData(param_1,param_2,param_3,param_4,uVar17);

+LAB_3:

+        if (bVar5) {

+          KeDetachProcess();

+          return iVar6;

+        }

+        return iVar6;

+      }

+    }

+    else {

+LAB_4:

+      if ((ulonglong)param_2 + 4 <=

+          (ulonglong)(uint)(*(int *)(*plVar7 + 200) + *(int *)(*plVar7 + 0xf8))) {

+        if ((param_5 != 0) &&

+           ((*(ushort *)(*(longlong *)(*(longlong *)(param_1 + 0x88) + 8) + 6) >> 8 & 1) != 0)) {

+          puVar13 = &gDefaultServerClasses;

+          do {

+            lVar10 = W32GetUserSessionState();

+            if (**(short **)(*(longlong *)(param_1 + 0x88) + 8) ==

+                *(short *)(*(longlong *)(lVar10 + 0x4e30) + 0x364 +

+                          (ulonglong)(*puVar13 >> 3 & 0x1f) * 2)) {

+              if ((int)param_2 < *(int *)(&DAT_5 + uVar15 * 0x30)) {

+                if (((byte)*puVar13 & 0xf8) == 0xb0) {

+                  MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x2f0);

+                }

+                uVar11 = 5;

+                goto LAB_6;

+              }

+              break;

             }

+            uVar14 = (int)uVar15 + 1;

+            uVar15 = (ulonglong)uVar14;

+            puVar13 = puVar13 + 0xc;

+          } while (uVar14 < 5);

+        }

+        uVar14 = *(uint *)(*(longlong *)(param_1 + 0x28) + 0xf8);

+        lVar10 = (longlong)(int)param_2;

+        if ((ulonglong)uVar14 < lVar10 + 4U) {

+          piVar12 = (int *)((longlong)(int)(param_2 - uVar14) +

+                           *(longlong *)(*(longlong *)(param_1 + 0x28) + 0x128));

+          iVar6 = *piVar12;

+          *piVar12 = param_3;

+        }

+        else {

+          iVar6 = *(int *)(lVar10 + *(longlong *)(param_1 + 0x118));

+          *(int *)(lVar10 + *(longlong *)(param_1 + 0x118)) = param_3;

+        }

+        goto LAB_3;

+      }

+    }

+  }

+  else {

+    plVar8 = (longlong *)safe_cast_wf_to_PDIALOG(param_1);

+    if (plVar8 != (longlong *)0x0) {

+      if (param_2 == 0) {

+        iVar6 = (int)*plVar8;

+        *plVar8 = (longlong)param_3;

+        goto LAB_3;

+      }

+      if (param_2 == 0x10) {

+        iVar2 = *(int *)(*plVar7 + 0xf8);

+        if ((iVar2 == 0) && (0x1d < *(int *)(*plVar7 + 200))) {

+          iVar6 = (int)plVar8[2];

+          plVar8[2] = (longlong)param_3;

+        }

+        else {

+          iVar6 = 0;

+          if (iVar2 != 0) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x2a1);

           }

-          if (unaff_R12 == 0) {

-            if (ptVar7 == unaff_RBP) {

-LAB_0:

-              lVar3 = *(longlong *)(unaff_RSI + 0x28);

-              if (unaff_R15D < 3) {

-                bVar8 = *(byte *)(lVar3 + 0x1f) & 0x10;

-              }

-              else {

-                bVar8 = *(byte *)(lVar3 + 0x11) & 0x40;

-              }

-              if (bVar8 != 0) {

-                if (in_stack_00000080 == 0) {

-                  Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

-                            (local_res20,(tagMENU *)unaff_RSI);

-                  xxxSendMessage(unaff_RSI,0x18,2 < unaff_R15D);

-                  ptVar5 = PtiCurrent();

-                  Win32HM_UnlockFromThread<0>(ptVar5,(_Win32HMThreadLockItem *)local_res20);

-                }

-                else {

-                  uVar6 = GreCreateRectRgnIndirect(lVar3 + 0x58);

-                  GreCombineRgn(in_stack_00000080,in_stack_00000080,uVar6,2);

-                  GreDeleteObject(uVar6);

-                  SetOrClrWF(1,unaff_RSI,0x140);

-                  SetVisible(unaff_RSI,0);

-                }

-              }

-            }

+          if (*(int *)(*plVar7 + 200) < 0x1e) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x2a2);

           }

-          else if (((ptVar7 != (tagWND *)0x0) && (ptVar7 != unaff_RBP)) &&

-                  ((unaff_R15D != 4 ||

-                   (((*(byte *)(*(longlong *)(ptVar7 + 0x28) + 0x1f) & 0x20) == 0 ||

-                    ((*(byte *)(*(longlong *)(ptVar7 + 0x28) + 0x1f) & 8) != 0))))))

-          goto LAB_0;

         }

-        unaff_RSI = (tagWND *)0x0;

-        unaff_R13 = unaff_R13 + 1;

-        uVar1 = *unaff_R13;

-        if (uVar1 == 1) {

-          FreeHwndList(in_stack_00000070);

-          return;

-        }

-        W32GetCurrentThreadNonPaged();

-        lVar3 = W32GetUserSessionState();

-      } while (*(ulonglong *)(*(longlong *)(lVar3 + 0x4e30) + 8) <= (uVar1 & 0xffff));

-      lVar3 = W32GetUserSessionState();

-      lVar4 = W32GetUserSessionState();

-      unaff_RBX = *(longlong *)(lVar3 + 0x4e40) +

-                  (ulonglong)(uint)((int)(uVar1 & 0xffff) * *(int *)(lVar4 + 0x4e48));

-      unaff_R14 = (undefined8 *)HMPkheFromPhe(unaff_RBX);

-      uVar9 = (ushort)(uVar1 >> 0x10) & 0x7fff;

-    } while (((uVar9 != *(ushort *)(unaff_RBX + 0x1a)) && (uVar9 != 0x7fff)) &&

-            (((uVar1 & 0x7fff0000) != 0 || (lVar3 = PsGetCurrentProcessWow64Process(), lVar3 == 0)))

-            );

-  } while( true );

+        goto LAB_3;

+      }

+      if (param_2 < 0x1e) {

+        uVar11 = 0x587;

+        goto LAB_6;

+      }

+      goto LAB_1;

+    }

+    if ((int)param_2 < 0) goto LAB_2;

+    lVar10 = W32GetUserSessionState();

+    lVar10 = *(longlong *)(lVar10 + 0x4e30);

+    uVar1 = *(ushort *)(*plVar7 + 0x2a);

+    lVar9 = W32GetUserSessionState();

+    if ((int)((uint)*(ushort *)(lVar10 + 0x148 + (ulonglong)((uVar1 & 0xffff2fff) - 0x29a) * 2) -

+             (uint)*(ushort *)(lVar9 + 0x1171c)) <= (int)param_2) goto LAB_1;

+    if (((*(ushort *)(*plVar7 + 0x2a) & 0x2fff) == 0x2a7) &&

+       ((param_2 == 0 ||

+        ((param_2 == 8 && ((**(int **)(*plVar7 + 0x128) == 0 || (*(char *)(*plVar7 + 0x13) < '\0')))

+         ))))) goto LAB_4;

+  }

+  uVar11 = 0x585;

+LAB_6:

+  UserSetLastError(uVar11);

+  if (bVar5) {

+    KeDetachProcess();

+  }

+  return 0;

 }
```

## `NtUserScheduleDispatchNotification`  (modified)

```diff
--- NtUserScheduleDispatchNotification
+++ NtUserScheduleDispatchNotification
@@ -1,10 +1,33 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void NtUserScheduleDispatchNotification(void)

+tagTHREADINFO * NtUserScheduleDispatchNotification(HWND__ *param_1)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  uint uVar1;

+  longlong lVar2;

+  tagWND *ptVar3;

+  undefined8 *puVar4;

+  tagTHREADINFO *ptVar5;

+  undefined8 local_18;

+  tagWND *local_10;

+  

+                    /* 0x15d780  1938  NtUserScheduleDispatchNotification */

+  lVar2 = EnterCrit(0);

+  ptVar3 = ValidateReceivingHwnd(param_1,0);

+  ptVar5 = (tagTHREADINFO *)0x0;

+  if (ptVar3 != (tagWND *)0x0) {

+    local_18 = *(undefined8 *)(lVar2 + 0x1c8);

+    *(undefined8 **)(lVar2 + 0x1c8) = &local_18;

+    local_10 = ptVar3;

+    HMLockObject(ptVar3);

+    uVar1 = _ScheduleDispatchNotification(ptVar3);

+    puVar4 = (undefined8 *)W32GetCurrentThreadNonPaged();

+    if (puVar4 != (undefined8 *)0x0) {

+      ptVar5 = (tagTHREADINFO *)*puVar4;

+    }

+    Win32HM_UnlockFromThread<0>(ptVar5,(_Win32HMThreadLockItem *)&local_18);

+    ptVar5 = (tagTHREADINFO *)(ulonglong)uVar1;

+  }

+  UserSessionSwitchLeaveCrit();

+  return ptVar5;

 }
```

## `NtUserSetClipboardData`  (modified)

```diff
--- NtUserSetClipboardData
+++ NtUserSetClipboardData
@@ -1,10 +1,243 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void NtUserSetClipboardData(void)

+longlong NtUserSetClipboardData(UINT param_1,HANDLE param_2,_GUID *param_3,_GUID *param_4)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  undefined4 uVar1;

+  undefined2 uVar2;

+  undefined2 uVar3;

+  uchar auVar4 [8];

+  uchar auVar5 [8];

+  bool bVar6;

+  char cVar7;

+  int iVar8;

+  uint uVar9;

+  longlong lVar10;

+  tagTHREADINFO *ptVar11;

+  undefined8 uVar12;

+  longlong *plVar13;

+  ushort *puVar14;

+  longlong lVar15;

+  HANDLE pvVar16;

+  uint *puVar17;

+  longlong lVar18;

+  _GUID *p_Var19;

+  _GUID *p_Var20;

+  undefined8 local_res20;

+  _GUID local_78;

+  undefined1 local_68 [24];

+  undefined4 local_50;

+  undefined4 local_4c;

+  undefined8 local_40;

+  

+                    /* 0x23c0c0  1962  NtUserSetClipboardData */

+  local_40 = 0;

+  p_Var19 = param_3;

+  lVar10 = EnterCrit(0,0);

+  ptVar11 = PtiCurrent();

+  lVar18 = *(longlong *)(ptVar11 + 0x1d0) + 0x3d0;

+  local_68._0_8_ = lVar18;

+  ptVar11 = PtiCurrent();

+  uVar1 = *(undefined4 *)(*(longlong *)(ptVar11 + 0x1d0) + 0x38);

+  ptVar11 = PtiCurrent();

+  uVar12 = PsGetProcessCreateTimeQuadPart(**(undefined8 **)(ptVar11 + 0x1d0));

+  local_50 = (undefined4)uVar12;

+  local_4c = (undefined4)((ulonglong)uVar12 >> 0x20);

+  EtwTraceUiAuditWriteClipboard(uVar1,&local_50);

+  bVar6 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(lVar10 + 0x1d0),4);

+  if (bVar6) {

+    plVar13 = (longlong *)PsGetCurrentProcessWin32Process();

+    p_Var19 = (_GUID *)0x0;

+    if (plVar13 != (longlong *)0x0) {

+      p_Var19 = (_GUID *)((ulonglong)plVar13 & -(ulonglong)(*plVar13 != 0));

+    }

+    puVar14 = &p_Var19[0x13].Data2;

+    if (p_Var19 == (_GUID *)0x0) {

+      puVar14 = (ushort *)&DAT_0;

+    }

+    if (*(int *)puVar14 == 0) {

+LAB_1:

+      p_Var19 = *(_GUID **)MmUserProbeAddress_exref;

+      if (param_3 < *(_GUID **)MmUserProbeAddress_exref) {

+        p_Var19 = param_3;

+      }

+      local_40._0_4_ = p_Var19->Data1;

+      uVar2 = p_Var19->Data2;

+      uVar3 = p_Var19->Data3;

+      local_40._4_4_ = CONCAT22(uVar3,uVar2);

+      p_Var19 = (_GUID *)(ulonglong)(local_40._4_4_ != 0);

+      p_Var20 = (_GUID *)(ulonglong)((undefined4)local_40 != 0);

+      pvVar16 = _SetClipboardData(param_1,param_2);

+      iVar8 = (int)pvVar16;

+      if (5 < DAT_2) {

+        puVar17 = &DAT_2;

+        cVar7 = _tlgKeywordOn(&DAT_2,0x400000000000);

+        if (cVar7 != '\0') {

+          if (iVar8 == 0) {

+            local_78._0_8_ = lVar18;

+            uVar9 = UserGetLastError();

+            if (0 < (int)uVar9) {

+              uVar9 = uVar9 & 0xffff | 0x80070000;

+            }

+          }

+          else {

+            uVar9 = 0;

+            local_78._0_8_ = lVar18;

+          }

+          local_res20 = CONCAT44(local_res20._4_4_,uVar9);

+          local_78.Data4 = (uchar  [8])0x14034f2e0;

+          local_68[8] = '\x01';

+          local_68[9] = '\0';

+          local_68[10] = '\0';

+          local_68[0xb] = '\0';

+          local_68[0xc] = '\0';

+          local_68[0xd] = '\0';

+          local_68[0xe] = '\0';

+          local_68[0xf] = '\0';

+          p_Var19 = (_GUID *)(local_68 + 8);

+          _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+          ::

+          Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                    ((_tlgProvider_t *)puVar17,&DAT_3,p_Var20,(_tlgWrapperByVal<8> *)p_Var19

+                     ,(_tlgWrapSz<char> *)local_78.Data4,(_tlgWrapperByVal<4> *)&local_res20,

+                     (_tlgWrapSz<unsigned_short> *)&local_78);

+        }

+      }

+      if (iVar8 == 0) {

+        uVar9 = UserGetLastError();

+        if (0 < (int)uVar9) {

+          uVar9 = uVar9 & 0xffff | 0x80070000;

+        }

+        if (((int)uVar9 < 0) && (5 < DAT_4)) {

+          puVar17 = &DAT_4;

+          cVar7 = _tlgKeywordOn(&DAT_4,1);

+          if (cVar7 != '\0') {

+            local_res20 = lVar18;

+            uVar9 = UserGetLastError();

+            if (0 < (int)uVar9) {

+              uVar9 = uVar9 & 0xffff | 0x80070000;

+            }

+            local_68._0_4_ = uVar9;

+            local_68._8_8_ = "FunctionExit";

+            _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+            ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                      ((_tlgProvider_t *)puVar17,&DAT_5,p_Var20,p_Var19,

+                       (_tlgWrapSz<char> *)(local_68 + 8),(_tlgWrapperByVal<4> *)local_68,

+                       (_tlgWrapSz<unsigned_short> *)&local_res20);

+          }

+        }

+      }

+      goto LAB_6;

+    }

+    ptVar11 = PtiCurrent();

+    lVar10 = *(longlong *)(*(longlong *)(ptVar11 + 0x1f0) + 0x28);

+    lVar15 = W32GetUserSessionState();

+    if ((((*(longlong *)(lVar15 + 0x4a50) == 0) ||

+         (iVar8 = ForegroundInputOwnerMatch(ptVar11,1), iVar8 == 0)) &&

+        (ptVar11 != *(tagTHREADINFO **)(lVar10 + 0x50))) &&

+       ((lVar10 = *(longlong *)(lVar10 + 0x70), lVar10 == 0 ||

+        (*(tagTHREADINFO **)(lVar10 + 0x10) != ptVar11)))) {

+      if (5 < DAT_2) {

+        puVar17 = &DAT_2;

+        cVar7 = _tlgKeywordOn(&DAT_2,0x400000000000);

+        if (cVar7 != '\0') {

+          local_res20 = CONCAT44(local_res20._4_4_,0x80070005);

+          local_78.Data4 = (uchar  [8])0x14035a138;

+          local_68._0_8_ = 1;

+          param_4 = (_GUID *)local_68;

+          local_78._0_8_ = lVar18;

+          _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+          ::

+          Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                    ((_tlgProvider_t *)puVar17,&DAT_3,p_Var19,(_tlgWrapperByVal<8> *)param_4

+                     ,(_tlgWrapSz<char> *)local_78.Data4,(_tlgWrapperByVal<4> *)&local_res20,

+                     (_tlgWrapSz<unsigned_short> *)&local_78);

+        }

+      }

+      auVar4 = local_78.Data4;

+      if (5 < DAT_4) {

+        puVar17 = &DAT_4;

+        cVar7 = _tlgKeywordOn(&DAT_4,1);

+        auVar5 = (uchar  [8])"NoForeground";

+        auVar4 = local_78.Data4;

+joined_r0x00014023c3b5:

+        local_78.Data4 = auVar5;

+        if (cVar7 != '\0') {

+          local_res20._4_4_ = (undefined4)((ulonglong)local_res20 >> 0x20);

+          local_res20 = CONCAT44(local_res20._4_4_,0x80070005);

+          local_78._0_8_ = lVar18;

+          _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+          ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                    ((_tlgProvider_t *)puVar17,&DAT_5,p_Var19,param_4,

+                     (_tlgWrapSz<char> *)local_78.Data4,(_tlgWrapperByVal<4> *)&local_res20,

+                     (_tlgWrapSz<unsigned_short> *)&local_78);

+          auVar4 = local_78.Data4;

+        }

+      }

+    }

+    else {

+      if ((param_1 == 1) || (param_1 == 0xd)) goto LAB_1;

+      if (5 < DAT_2) {

+        puVar17 = &DAT_2;

+        cVar7 = _tlgKeywordOn(&DAT_2,0x400000000000);

+        if (cVar7 != '\0') {

+          local_res20 = CONCAT44(local_res20._4_4_,0x80070005);

+          local_78.Data4 = (uchar  [8])0x140359fd8;

+          local_68._0_8_ = 1;

+          param_4 = (_GUID *)local_68;

+          local_78._0_8_ = lVar18;

+          _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+          ::

+          Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                    ((_tlgProvider_t *)puVar17,&DAT_3,p_Var19,(_tlgWrapperByVal<8> *)param_4

+                     ,(_tlgWrapSz<char> *)local_78.Data4,(_tlgWrapperByVal<4> *)&local_res20,

+                     (_tlgWrapSz<unsigned_short> *)&local_78);

+        }

+      }

+      auVar4 = local_78.Data4;

+      if (5 < DAT_4) {

+        puVar17 = &DAT_4;

+        cVar7 = _tlgKeywordOn(&DAT_4,1);

+        auVar5 = (uchar  [8])"UnsupportedFormatForLowBoxApp";

+        auVar4 = local_78.Data4;

+        goto joined_r0x00014023c3b5;

+      }

+    }

+  }

+  else {

+    EtwTraceUiLimitWriteClipboard(uVar1,&local_50);

+    if (5 < DAT_2) {

+      puVar17 = &DAT_2;

+      cVar7 = _tlgKeywordOn(&DAT_2,0x400000000000);

+      if (cVar7 != '\0') {

+        local_res20 = CONCAT44(local_res20._4_4_,0x80070005);

+        local_78.Data4 = (uchar  [8])0x140359f70;

+        local_78.Data1 = 1;

+        local_78.Data2 = 0;

+        local_78.Data3 = 0;

+        param_4 = &local_78;

+        local_68._0_8_ = lVar18;

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+        ::

+        Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                  ((_tlgProvider_t *)puVar17,&DAT_3,p_Var19,(_tlgWrapperByVal<8> *)param_4,

+                   (_tlgWrapSz<char> *)local_78.Data4,(_tlgWrapperByVal<4> *)&local_res20,

+                   (_tlgWrapSz<unsigned_short> *)local_68);

+      }

+    }

+    auVar4 = local_78.Data4;

+    if (5 < DAT_4) {

+      puVar17 = &DAT_4;

+      cVar7 = _tlgKeywordOn(&DAT_4,1);

+      auVar5 = (uchar  [8])"RestrictedThread";

+      auVar4 = local_78.Data4;

+      goto joined_r0x00014023c3b5;

+    }

+  }

+  local_78.Data4 = auVar4;

+  iVar8 = 0;

+  UserSetLastError(5);

+LAB_6:

+  UserSessionSwitchLeaveCrit();

+  return (longlong)iVar8;

 }
```

## `NtUserSetDisplayMapping`  (modified)

```diff
--- NtUserSetDisplayMapping
+++ NtUserSetDisplayMapping
@@ -1,225 +1,84 @@
 

-/* WARNING: Instruction at (ram,0x000140297ba1) overlaps instruction at (ram,0x000140297ba0)

-    */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-bool NtUserSetDisplayMapping(undefined8 param_1)

+longlong NtUserSetDisplayMapping(undefined8 param_1,undefined8 param_2)

 

 {

-  undefined8 uVar1;

-  undefined8 uVar2;

-  ulonglong uVar3;

-  int iVar4;

-  undefined4 uVar5;

+  bool bVar1;

+  int iVar2;

+  int iVar3;

+  tagTHREADINFO *ptVar4;

+  longlong lVar5;

   longlong lVar6;

-  char cVar7;

-  int iVar8;

-  undefined1 *unaff_RBX;

-  longlong *unaff_RSI;

-  longlong *unaff_RDI;

-  uint uVar9;

-  longlong unaff_R14;

-  uint unaff_R15D;

-  bool bVar10;

-  undefined8 in_XMM0_Qa;

-  undefined4 uVar11;

-  undefined4 in_XMM0_Dc;

-  undefined4 in_XMM0_Dd;

+  longlong lVar7;

+  undefined8 uVar8;

+  undefined1 auStack_58 [32];

+  AtomicExecutionCheck local_38 [8];

+  undefined8 local_30;

+  undefined4 local_28;

+  undefined4 local_24;

+  undefined4 local_20;

+  ulonglong local_18;

   

-  uVar11 = (undefined4)((ulonglong)in_XMM0_Qa >> 0x20);

-  uVar5 = (undefined4)in_XMM0_Qa;

-  while( true ) {

-    unaff_RBX[-0x193eb70d] = unaff_RBX[-0x193eb70d] + (char)param_1;

-    *(longlong **)((longlong)register0x00000020 + -8) = unaff_RDI;

-    *unaff_RBX = 0;

-    *(undefined4 *)((longlong)register0x00000020 + 0x58) = uVar5;

-    *(undefined4 *)((longlong)register0x00000020 + 0x5c) = uVar11;

-    *(undefined4 *)((longlong)register0x00000020 + 0x60) = in_XMM0_Dc;

-    *(undefined4 *)((longlong)register0x00000020 + 100) = in_XMM0_Dd;

-    *(undefined8 *)((longlong)register0x00000020 + 0x68) = param_1;

-    *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297bcf;

-    RtlCopyFromUser((undefined1 *)((longlong)register0x00000020 + 0x58),

-                    unaff_R14 + (longlong)unaff_RBX * 0x18,(int)param_1 + 0x18);

-    uVar3 = *(ulonglong *)((longlong)register0x00000020 + 0x60);

-    *(undefined8 *)((longlong)register0x00000020 + 0x78) =

-         *(undefined8 *)((longlong)register0x00000020 + 0x58);

-    *(ulonglong *)((longlong)register0x00000020 + 0x80) = uVar3;

-    *(undefined8 *)((longlong)register0x00000020 + 0x88) =

-         *(undefined8 *)((longlong)register0x00000020 + 0x68);

-    if (((((uVar3 & 0xfffffff8) != 0) || ((uVar3 >> 0x20 & 0xfffffff8) != 0)) ||

-        ((*(ulonglong *)((longlong)register0x00000020 + 0x68) & 0xfffffffe) != 0)) ||

-       ((*(ulonglong *)((longlong)register0x00000020 + 0x68) >> 0x20 & 0xfffffffe) != 0)) break;

-    uVar1 = *(undefined8 *)PsProcessType_exref;

-    *(undefined8 *)((longlong)register0x00000020 + 0xf0) = 0;

-    *(undefined8 *)((longlong)register0x00000020 + 0x20) = 0;

-    *(undefined1 **)((longlong)register0x00000020 + 0x18) =

-         (undefined1 *)((longlong)register0x00000020 + 0xf0);

-    *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297c68;

-    iVar4 = ObReferenceObjectByHandle

-                      (*(undefined8 *)((longlong)register0x00000020 + 0x58),0x200,uVar1,1);

-    *unaff_RSI = *(longlong *)((longlong)register0x00000020 + 0xf0);

-    if (iVar4 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) {

-        cVar7 = '\0';

+                    /* 0x296cf0  1976  NtUserSetDisplayMapping */

+  local_18 = __security_cookie ^ (ulonglong)auStack_58;

+  EnterCrit(0,0);

+  iVar3 = 0;

+  local_38[0] = (AtomicExecutionCheck)0x0;

+  local_30 = 0;

+  AtomicExecutionCheck::Arm(local_38);

+  iVar2 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 == 0) {

+    local_24 = 0xffffffff;

+    local_20 = 0;

+    local_28 = 0x2000;

+    ptVar4 = PtiCurrent();

+    bVar1 = UIPrivilegeIsolation::CheckAccess

+                      ((tagUIPI_INFO *)(*(longlong *)(ptVar4 + 0x1d0) + 0x130),

+                       (tagUIPI_INFO *)&local_28,0);

+  }

+  else {

+    ptVar4 = PtiCurrent();

+    bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                      ((UIPIAccessor *)

+                       (-(ulonglong)(*(longlong *)(ptVar4 + 0x1d0) != 0) &

+                       *(longlong *)(ptVar4 + 0x1d0) + 0x130U),0x2000);

+  }

+  if (bVar1 == false) {

+    ptVar4 = PtiCurrent();

+    EtwTraceUIPISystemError(*(undefined8 *)(ptVar4 + 0x1d0),0,10);

+LAB_0:

+    uVar8 = 5;

+  }

+  else {

+    lVar5 = HMValidateHandleWithDescriptor(param_1,0x13);

+    if ((lVar5 != 0) && ((char)*(undefined4 *)(lVar5 + 0xb8) < '\0')) {

+      if ((*(uint *)(lVar5 + 0xa8) & 0x2000) == 0) {

+        if (1 < *(int *)(*(longlong *)(lVar5 + 0x1c8) + 0x18) - 6U) {

+          lVar6 = ValidateHmonitor(param_2);

+          if (lVar6 != 0) {

+            iVar3 = 1;

+            lVar7 = ValidateHmonitorNoRip(*(undefined8 *)(lVar5 + 0x540));

+            if (lVar7 != lVar6) {

+              iVar3 = _SetDisplayMapping(*(undefined8 *)(lVar5 + 0x1c8),lVar6);

+            }

+            *(undefined4 *)(lVar5 + 0x548) = 1;

+          }

+          goto LAB_1;

+        }

       }

       else {

-        cVar7 = '\x01';

+        UserSetLastError(5);

       }

-      bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar7 != '\0') || (bVar10)) {

-        *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297ccc;

-        lVar6 = W32GetUserSessionState();

-        uVar1 = *(undefined8 *)(lVar6 + 0x10f98);

-        uVar2 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-        *(undefined **)((longlong)register0x00000020 + 0x30) =

-             &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids;

-        *(undefined2 *)((longlong)register0x00000020 + 0x28) = 0x6c;

-        *(undefined4 *)((longlong)register0x00000020 + 0x20) = 3;

-        *(undefined1 *)((longlong)register0x00000020 + 0x18) = 2;

-        *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297d10;

-        WPP_RECORDER_AND_TRACE_SF_(uVar2,cVar7,bVar10,uVar1);

-      }

-      *unaff_RSI = 0;

-      bVar10 = false;

-      *(undefined4 *)((longlong)register0x00000020 + 0x38) = 0;

-      *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297d24;

-      uVar5 = RtlNtStatusToDosError(iVar4);

-      *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297d30;

-      UserSetLastError(uVar5);

       goto LAB_0;

     }

-    *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297d3c;

-    iVar4 = PsGetProcessSessionIdEx();

-    *(int *)(unaff_RSI + 1) = iVar4;

-    if (iVar4 == -1) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) {

-        cVar7 = '\0';

-      }

-      else {

-        cVar7 = '\x01';

-      }

-      bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar7 != '\0') || (bVar10)) {

-        *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297d95;

-        lVar6 = W32GetUserSessionState();

-        uVar1 = *(undefined8 *)(lVar6 + 0x10f98);

-        uVar2 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-        *(undefined **)((longlong)register0x00000020 + 0x30) =

-             &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids;

-        *(undefined2 *)((longlong)register0x00000020 + 0x28) = 0x6d;

-        *(undefined4 *)((longlong)register0x00000020 + 0x20) = 3;

-        *(undefined1 *)((longlong)register0x00000020 + 0x18) = 2;

-        *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297dd9;

-        WPP_RECORDER_AND_TRACE_SF_(uVar2,cVar7,bVar10,uVar1);

-      }

-      bVar10 = false;

-      *(undefined4 *)((longlong)register0x00000020 + 0x38) = 0;

-      *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297deb;

-      uVar5 = RtlNtStatusToDosError(0xc0000455);

-      *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297df7;

-      UserSetLastError(uVar5);

-      goto LAB_0;

-    }

-    iVar8 = (int)unaff_RBX;

-    if ((iVar8 != 0) && (iVar4 != (int)unaff_RDI[(ulonglong)(iVar8 - 1) * 4 + 1])) {

-      if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0 || ((byte)WPP_GLOBAL_Control[0x29] < 2)))

-         ) {

-        cVar7 = '\0';

-      }

-      else {

-        cVar7 = '\x01';

-      }

-      bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar7 != '\0') || (bVar10)) {

-        *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297e5d;

-        lVar6 = W32GetUserSessionState();

-        uVar1 = *(undefined8 *)(lVar6 + 0x10f98);

-        uVar2 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-        *(undefined **)((longlong)register0x00000020 + 0x30) =

-             &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids;

-        *(undefined2 *)((longlong)register0x00000020 + 0x28) = 0x6e;

-        *(undefined4 *)((longlong)register0x00000020 + 0x20) = 3;

-        *(undefined1 *)((longlong)register0x00000020 + 0x18) = 2;

-        *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297ea1;

-        WPP_RECORDER_AND_TRACE_SF_(uVar2,cVar7,bVar10,uVar1);

-      }

-      bVar10 = false;

-      *(undefined4 *)((longlong)register0x00000020 + 0x38) = 0;

-      *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297eaf;

-      UserSetLastError(0x57);

-      goto LAB_0;

-    }

-    unaff_RSI[2] = (longlong)*(int *)((longlong)register0x00000020 + 0x88) << 0x20 |

-                   (longlong)*(int *)((longlong)register0x00000020 + 0x80);

-    unaff_RSI[3] = (longlong)*(int *)((longlong)register0x00000020 + 0x8c) << 0x20 |

-                   (longlong)*(int *)((longlong)register0x00000020 + 0x84);

-    unaff_RBX = (undefined1 *)(ulonglong)(iVar8 + 1U);

-    if (unaff_R15D <= iVar8 + 1U) {

-      lVar6 = unaff_RDI[1];

-      *(longlong **)((longlong)register0x00000020 + 0x48) = unaff_RDI;

-      *(uint *)((longlong)register0x00000020 + 0x50) = unaff_R15D;

-      *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297fc8;

-      iVar4 = W32AttachToSessionAndExecute<<lambda_e69bc3e064b06eccacaab7fc72a1e15e>_>

-                        ((int)lVar6,(undefined1 *)((longlong)register0x00000020 + 0x48));

-      bVar10 = iVar4 != 0;

-      goto LAB_0;

-    }

-    unaff_RSI = unaff_RDI + (longlong)unaff_RBX * 4;

-    uVar5 = 0;

-    uVar11 = 0;

-    in_XMM0_Dc = 0;

-    in_XMM0_Dd = 0;

-    param_1 = 0;

-    register0x00000020 = (BADSPACEBASE *)((longlong)register0x00000020 + -8);

+    UserSetLastError(6);

+    uVar8 = 6;

   }

-  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)) {

-    cVar7 = '\0';

-  }

-  else {

-    cVar7 = '\x01';

-  }

-  bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar7 != '\0') || (bVar10)) {

-    *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297f39;

-    lVar6 = W32GetUserSessionState();

-    uVar1 = *(undefined8 *)(lVar6 + 0x10f98);

-    uVar2 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-    *(undefined **)((longlong)register0x00000020 + 0x30) =

-         &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids;

-    *(undefined2 *)((longlong)register0x00000020 + 0x28) = 0x6b;

-    *(undefined4 *)((longlong)register0x00000020 + 0x20) = 3;

-    *(undefined1 *)((longlong)register0x00000020 + 0x18) = 2;

-    *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297f7d;

-    WPP_RECORDER_AND_TRACE_SF_(uVar2,cVar7,bVar10,uVar1);

-  }

-  bVar10 = false;

-  *(undefined4 *)((longlong)register0x00000020 + 0x38) = 0;

-  *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297f8b;

-  UserSetLastError(0x57);

-LAB_0:

-  if (unaff_RDI != (longlong *)0x0) {

-    uVar9 = 0;

-    if (unaff_R15D != 0) {

-      do {

-        if (*unaff_RDI == 0) break;

-        *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140297fee;

-        ObfDereferenceObject();

-        uVar9 = uVar9 + 1;

-        unaff_RDI = unaff_RDI + 4;

-      } while (uVar9 < unaff_R15D);

-    }

-    *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140298009;

-    Win32FreePool();

-  }

-  *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x14029801b;

-  AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)((longlong)register0x00000020 + 0x98));

-  *(undefined8 *)((longlong)register0x00000020 + -0x10) = 0x140298022;

+  UserSetLastError(uVar8);

+LAB_1:

+  AtomicExecutionCheck::Disarm(local_38);

   UserSessionSwitchLeaveCrit();

-  return bVar10;

+  return (longlong)iVar3;

 }
```

## `GreMakeBitmapStock`  (modified)

```diff
--- GreMakeBitmapStock
+++ GreMakeBitmapStock
@@ -1,42 +1,55 @@
 

-undefined8 GreMakeBitmapStock(void)

+ulonglong GreMakeBitmapStock(ulonglong param_1)

 

 {

-  longlong lVar1;

+  SESSION_GLOBALS *pSVar1;

   int iVar2;

-  int unaff_ESI;

-  longlong unaff_RDI;

-  undefined4 uStack0000000000000048;

-  undefined4 uStack000000000000004c;

-  undefined4 uStack0000000000000050;

-  undefined4 uStack0000000000000054;

-  undefined8 in_stack_00000058;

-  undefined8 in_stack_00000070;

-  undefined8 in_stack_00000120;

-  int in_stack_00000128;

-  undefined8 in_stack_00000140;

+  SURFACE *pSVar3;

+  SFMLOGICALSURFACE *pSVar4;

+  SESSION_GLOBALS *pSVar5;

+  SURFACE *this;

+  ulonglong uVar6;

+  ulonglong uVar7;

+  SURFACE *local_res10;

   

-  EtwTraceBeginCallback(unaff_ESI);

-  iVar2 = KeUserModeCallback(unaff_ESI,&stack0x00000090,unaff_ESI + 0x57,&stack0x00000120,

-                             &stack0x00000128);

-  EtwTraceEndCallback(unaff_ESI);

-  LeaveEnterUserCritIfAcquired::~LeaveEnterUserCritIfAcquired

-            ((LeaveEnterUserCritIfAcquired *)&stack0x00000148);

-  Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

-            ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x00000060);

-  lVar1 = *(longlong *)(unaff_RDI + 0x208);

-  *(undefined4 *)(lVar1 + 0x40) = uStack0000000000000048;

-  *(undefined4 *)(lVar1 + 0x44) = uStack000000000000004c;

-  *(undefined4 *)(lVar1 + 0x48) = uStack0000000000000050;

-  *(undefined4 *)(lVar1 + 0x4c) = uStack0000000000000054;

-  *(undefined8 *)(lVar1 + 0x50) = in_stack_00000058;

-  if ((iVar2 < 0) || (in_stack_00000128 != 0x18)) {

-    in_stack_00000140 = 0;

+  uVar6 = 0;

+  pSVar3 = (SURFACE *)HmgLock(param_1,5);

+  uVar7 = 0;

+  local_res10 = pSVar3;

+  if (((((pSVar3 != (SURFACE *)0x0) && (*(int *)(pSVar3 + 8) == 0)) &&

+       ((this = pSVar3, iVar2 = SURFACE::bDIBSection(pSVar3), uVar7 = uVar6, iVar2 == 0 ||

+        ((*(short *)(this + 100) == 0 && (*(int *)(this + 0xd8) != 0)))))) &&

+      (((uint)param_1 >> 0x17 & 1) == 0)) && (*(int *)(pSVar3 + 0xa8) == 0)) {

+    if (((*(uint *)(pSVar3 + 0x70) & 0x80000800) == 0) &&

+       (pSVar4 = SURFACE::GetFirstLSurf(this), pSVar4 == (SFMLOGICALSURFACE *)0x0)) {

+      uVar7 = param_1 | 0x800000;

+      pSVar5 = Gre::Base::Globals();

+      pSVar3 = local_res10;

+      LOCK();

+      pSVar1 = pSVar5 + 0x1094;

+      iVar2 = *(int *)pSVar1;

+      *(int *)pSVar1 = *(int *)pSVar1 + -1;

+      UNLOCK();

+      if ((iVar2 + -1 < 0) || (iVar2 = HmgLockAndModifyHandleType(local_res10,uVar7), iVar2 == 0)) {

+        LOCK();

+        *(int *)(pSVar5 + 0x1094) = *(int *)(pSVar5 + 0x1094) + 1;

+        UNLOCK();

+        uVar7 = 0;

+      }

+      else {

+        if ((*(uint *)pSVar3 & 0x800000) != 0) {

+          *(ushort *)(pSVar3 + 0x66) = *(ushort *)(pSVar3 + 0x66) | 0x200;

+        }

+        *(ulonglong *)(pSVar3 + 0x20) = uVar7;

+        HmgSetOwner(uVar7,0,5);

+      }

+    }

+    else if (((*(int *)(pSVar3 + 0xa8) == 0) && ((*(uint *)(pSVar3 + 0x70) >> 0xb & 1) == 0)) &&

+            (-1 < (int)*(uint *)(pSVar3 + 0x70))) {

+      SURFACE::GetFirstLSurf(pSVar3);

+    }

   }

-  else {

-    in_stack_00000140 = 0;

-    RtlCopyFromUser(&stack0x00000140,in_stack_00000120,8);

-  }

-  return in_stack_00000140;

+  SURFREFAPI::~SURFREFAPI((SURFREFAPI *)&local_res10);

+  return uVar7;

 }
```

## `DIBtoDIBV5`  (modified)

```diff
--- DIBtoDIBV5
+++ DIBtoDIBV5
@@ -1,12 +1,62 @@
+

+/* struct BITMAPV5HEADER * __ptr64 __cdecl DIBtoDIBV5(struct tagBITMAPINFOHEADER * __ptr64

+   volatile,unsigned long) */

 

 BITMAPV5HEADER * __cdecl DIBtoDIBV5(tagBITMAPINFOHEADER *param_1,ulong param_2)

 

 {

-  bool in_ZF;

+  undefined8 uVar1;

+  int iVar2;

+  uint uVar3;

+  ulong uVar4;

+  BITMAPV5HEADER *_Dst;

+  ulonglong _Size;

+  ulonglong uVar5;

   

-  if (!in_ZF) {

-    HMUnlockDestroyObject();

+  iVar2 = Feature_3459751226__private_IsEnabledDeviceUsageNoInline();

+  if (((((iVar2 == 0) || (3 < param_2)) && (*(int *)param_1 == 0x28)) &&

+      ((iVar2 = Feature_2529405241__private_IsEnabledDeviceUsageNoInline(), iVar2 == 0 ||

+       (0x27 < param_2)))) &&

+     ((ulonglong)*(ushort *)(param_1 + 0xe) * (ulonglong)*(uint *)(param_1 + 4) < 0x100000000)) {

+    uVar3 = -*(uint *)(param_1 + 8);

+    if ((int)uVar3 < 0) {

+      uVar3 = *(uint *)(param_1 + 8);

+    }

+    uVar5 = (ulonglong)

+            ((int)((ulonglong)*(ushort *)(param_1 + 0xe) * (ulonglong)*(uint *)(param_1 + 4)) +

+             0x1fU >> 3 & 0x1ffffffc) * (ulonglong)uVar3;

+    if (uVar5 < 0x100000000) {

+      uVar4 = SizeOfDibColorTable(param_1);

+      _Size = (ulonglong)uVar4;

+      uVar3 = (uint)uVar5 + 0x7c;

+      if ((((uint)uVar5 <= uVar3) && (uVar3 = uVar3 + uVar4, uVar4 <= uVar3)) &&

+         ((_Size + 0x28 + (uVar5 & 0xffffffff) <= (ulonglong)param_2 &&

+          (_Dst = (BITMAPV5HEADER *)Win32AllocPoolZInit(uVar3), _Dst != (BITMAPV5HEADER *)0x0)))) {

+        memset(_Dst,0,0x7c);

+        uVar1 = *(undefined8 *)(param_1 + 8);

+        *(undefined8 *)_Dst = *(undefined8 *)param_1;

+        *(undefined8 *)(_Dst + 8) = uVar1;

+        uVar1 = *(undefined8 *)(param_1 + 0x18);

+        *(undefined8 *)(_Dst + 0x10) = *(undefined8 *)(param_1 + 0x10);

+        *(undefined8 *)(_Dst + 0x18) = uVar1;

+        *(undefined8 *)(_Dst + 0x20) = *(undefined8 *)(param_1 + 0x20);

+        *(undefined4 *)_Dst = 0x7c;

+        *(undefined4 *)(_Dst + 0x38) = 0x73524742;

+        *(undefined4 *)(_Dst + 0x6c) = 4;

+        if ((*(int *)(param_1 + 0x10) == 3) &&

+           ((*(short *)(param_1 + 0xe) == 0x10 || (*(short *)(param_1 + 0xe) == 0x20)))) {

+          *(undefined4 *)(_Dst + 0x28) = *(undefined4 *)(param_1 + 0x28);

+          *(undefined4 *)(_Dst + 0x2c) = *(undefined4 *)(param_1 + 0x2c);

+          *(undefined4 *)(_Dst + 0x30) = *(undefined4 *)(param_1 + 0x30);

+        }

+        if (uVar4 != 0) {

+          memcpy(_Dst + 0x7c,param_1 + 0x28,_Size);

+        }

+        memcpy(_Dst + _Size + 0x7c,param_1 + _Size + 0x28,uVar5 & 0xffffffff);

+        return _Dst;

+      }

+    }

   }

   return (BITMAPV5HEADER *)0x0;

 }
```

## `NtUserOpenClipboard`  (modified)

```diff
--- NtUserOpenClipboard
+++ NtUserOpenClipboard
@@ -1,10 +1,267 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void NtUserOpenClipboard(void)

+longlong NtUserOpenClipboard(longlong param_1,undefined4 *param_2,_GUID *param_3,_GUID *param_4)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  char cVar1;

+  int iVar2;

+  BOOL BVar3;

+  uint uVar4;

+  tagWND *hWndNewOwner;

+  tagTHREADINFO *ptVar5;

+  longlong lVar6;

+  longlong *plVar7;

+  ushort *puVar8;

+  longlong lVar9;

+  ulonglong uVar10;

+  _tlgProvider_t *p_Var11;

+  undefined8 uVar12;

+  char *pcVar13;

+  char *pcVar14;

+  char *local_res8;

+  char *local_res18;

+  char *local_res20;

+  undefined1 local_48 [32];

+  

+                    /* 0x23a040  1849  NtUserOpenClipboard */

+  local_res8 = (char *)((ulonglong)local_res8 & 0xffffffff00000000);

+  EnterCrit(0);

+  if (param_1 == 0) {

+    hWndNewOwner = (tagWND *)0x0;

+  }

+  else {

+    hWndNewOwner = (tagWND *)ValidateHwnd(param_1);

+    if (hWndNewOwner == (tagWND *)0x0) {

+      BVar3 = 0;

+      goto LAB_0;

+    }

+  }

+  ptVar5 = PtiCurrent();

+  pcVar14 = (char *)(*(longlong *)(ptVar5 + 0x1d0) + 0x3d0);

+  local_res18 = pcVar14;

+  lVar6 = W32GetUserSessionState();

+  if (*(int *)(lVar6 + 0x102b4) == 0) {

+    ptVar5 = PtiCurrent();

+    lVar6 = W32GetUserSessionState();

+    if (*(longlong *)(ptVar5 + 0x1f0) == *(longlong *)(lVar6 + 0xf688)) goto LAB_1;

+    plVar7 = (longlong *)PsGetCurrentProcessWin32Process();

+    param_3 = (_GUID *)0x0;

+    if (plVar7 != (longlong *)0x0) {

+      param_3 = (_GUID *)((ulonglong)plVar7 & -(ulonglong)(*plVar7 != 0));

+    }

+    puVar8 = &param_3[0x13].Data2;

+    if (param_3 == (_GUID *)0x0) {

+      puVar8 = (ushort *)&DAT_2;

+    }

+    if (*(int *)puVar8 != 0) {

+      ptVar5 = PtiCurrent();

+      lVar6 = *(longlong *)(*(longlong *)(ptVar5 + 0x1f0) + 0x28);

+      lVar9 = W32GetUserSessionState();

+      if (((*(longlong *)(lVar9 + 0x4a50) != 0) &&

+          (iVar2 = ForegroundInputOwnerMatch(ptVar5,1), iVar2 != 0)) ||

+         ((lVar6 = *(longlong *)(lVar6 + 0x70), lVar6 != 0 &&

+          (*(tagTHREADINFO **)(lVar6 + 0x10) == ptVar5)))) goto LAB_3;

+      if (5 < DAT_4) {

+        p_Var11 = (_tlgProvider_t *)&DAT_4;

+        cVar1 = _tlgKeywordOn(&DAT_4,0x400000000000);

+        if (cVar1 != '\0') {

+          local_res8 = (char *)CONCAT44(local_res8._4_4_,0x80070005);

+          local_res20 = "NoForeground";

+          local_48._0_8_ = (char *)0x1;

+          param_4 = (_GUID *)local_48;

+          local_res18 = pcVar14;

+          _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+          ::

+          Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                    (p_Var11,&DAT_5,param_3,(_tlgWrapperByVal<8> *)param_4,

+                     (_tlgWrapSz<char> *)&local_res20,(_tlgWrapperByVal<4> *)&local_res8,

+                     (_tlgWrapSz<unsigned_short> *)&local_res18);

+        }

+      }

+      pcVar13 = "NoForeground";

+      if (5 < DAT_6) {

+        p_Var11 = (_tlgProvider_t *)&DAT_6;

+        cVar1 = _tlgKeywordOn(&DAT_6,1);

+        if (cVar1 == '\0') goto LAB_7;

+        goto LAB_8;

+      }

+      goto LAB_7;

+    }

+LAB_3:

+    if (hWndNewOwner == (tagWND *)0x0) {

+LAB_9:

+      Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>

+                ((Win32HMThreadLockBase<tagWND,1,0> *)(local_48 + 8),hWndNewOwner);

+      BVar3 = _OpenClipboard((HWND)hWndNewOwner);

+      Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

+                ((Win32HMThreadLockBase<tagWND,1,0> *)(local_48 + 8));

+      if (*(undefined4 **)MmUserProbeAddress_exref <= param_2) {

+        param_2 = *(undefined4 **)MmUserProbeAddress_exref;

+      }

+      *param_2 = local_res8._0_4_;

+      if (5 < DAT_4) {

+        p_Var11 = (_tlgProvider_t *)&DAT_4;

+        cVar1 = _tlgKeywordOn(&DAT_4,0x400000000000);

+        if (cVar1 != '\0') {

+          local_res20 = pcVar14;

+          if (BVar3 == 0) {

+            uVar4 = UserGetLastError();

+            if (0 < (int)uVar4) {

+              uVar4 = uVar4 & 0xffff | 0x80070000;

+            }

+          }

+          else {

+            uVar4 = 0;

+          }

+          local_res8 = (char *)CONCAT44(local_res8._4_4_,uVar4);

+          local_48._0_8_ = "FunctionExit";

+          local_48[8] = '\x01';

+          local_48[9] = '\0';

+          local_48[10] = '\0';

+          local_48[0xb] = '\0';

+          local_48[0xc] = '\0';

+          local_48[0xd] = '\0';

+          local_48[0xe] = '\0';

+          local_48[0xf] = '\0';

+          param_4 = (_GUID *)(local_48 + 8);

+          _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+          ::

+          Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                    (p_Var11,&DAT_5,param_3,(_tlgWrapperByVal<8> *)param_4,

+                     (_tlgWrapSz<char> *)local_48,(_tlgWrapperByVal<4> *)&local_res8,

+                     (_tlgWrapSz<unsigned_short> *)&local_res20);

+        }

+      }

+      if (BVar3 == 0) {

+        uVar4 = UserGetLastError();

+        if (0 < (int)uVar4) {

+          uVar4 = uVar4 & 0xffff | 0x80070000;

+        }

+        if (((int)uVar4 < 0) && (5 < DAT_6)) {

+          p_Var11 = (_tlgProvider_t *)&DAT_6;

+          cVar1 = _tlgKeywordOn(&DAT_6,1);

+          if (cVar1 != '\0') {

+            local_res8 = pcVar14;

+            uVar4 = UserGetLastError();

+            if (0 < (int)uVar4) {

+              uVar4 = uVar4 & 0xffff | 0x80070000;

+            }

+            local_res18 = (char *)CONCAT44(local_res18._4_4_,uVar4);

+            local_res20 = "FunctionExit";

+            _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+            ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                      (p_Var11,&DAT_10,param_3,param_4,(_tlgWrapSz<char> *)&local_res20,

+                       (_tlgWrapperByVal<4> *)&local_res18,(_tlgWrapSz<unsigned_short> *)&local_res8

+                      );

+          }

+        }

+      }

+      goto LAB_0;

+    }

+    plVar7 = (longlong *)PsGetCurrentProcessWin32Process();

+    param_3 = (_GUID *)0x0;

+    if (plVar7 != (longlong *)0x0) {

+      param_3 = (_GUID *)((ulonglong)plVar7 & -(ulonglong)(*plVar7 != 0));

+    }

+    lVar6._0_4_ = param_3[0x2a].Data1;

+    lVar6._4_2_ = param_3[0x2a].Data2;

+    lVar6._6_2_ = param_3[0x2a].Data3;

+    if (*(longlong *)(*(longlong *)(*(longlong *)(hWndNewOwner + 0x10) + 0x1d0) + 0x2a0) == lVar6)

+    goto LAB_9;

+    plVar7 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar10 = 0;

+    if (plVar7 != (longlong *)0x0) {

+      uVar10 = (ulonglong)plVar7 & -(ulonglong)(*plVar7 != 0);

+    }

+    if (*(longlong *)(uVar10 + 0x2a0) == 0) goto LAB_9;

+    if (*(longlong *)(*(longlong *)(*(longlong *)(hWndNewOwner + 0x10) + 0x1d0) + 0x2a0) == 0) {

+      plVar7 = (longlong *)PsGetCurrentProcessWin32Process();

+      uVar10 = 0;

+      if (plVar7 != (longlong *)0x0) {

+        uVar10 = (ulonglong)plVar7 & -(ulonglong)(*plVar7 != 0);

+      }

+      if ((*(uint *)(*(longlong *)(uVar10 + 0x2a0) + 0x40) & 4) == 0) goto LAB_9;

+    }

+    UserSetLastError(0x57);

+    if (5 < DAT_4) {

+      p_Var11 = (_tlgProvider_t *)&DAT_4;

+      cVar1 = _tlgKeywordOn(&DAT_4,0x400000000000);

+      if (cVar1 != '\0') {

+        local_res8 = (char *)CONCAT44(local_res8._4_4_,0x80070057);

+        local_res20 = "InvalidParameter";

+        local_48._0_8_ = (char *)0x1;

+        param_4 = (_GUID *)local_48;

+        local_res18 = pcVar14;

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+        ::

+        Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                  (p_Var11,&DAT_5,param_3,(_tlgWrapperByVal<8> *)param_4,

+                   (_tlgWrapSz<char> *)&local_res20,(_tlgWrapperByVal<4> *)&local_res8,

+                   (_tlgWrapSz<unsigned_short> *)&local_res18);

+      }

+    }

+    if (5 < DAT_6) {

+      p_Var11 = (_tlgProvider_t *)&DAT_6;

+      cVar1 = _tlgKeywordOn(&DAT_6,1);

+      if (cVar1 != '\0') {

+        local_res8 = (char *)CONCAT44(local_res8._4_4_,0x80070057);

+        local_res20 = "InvalidParameter";

+        local_res18 = pcVar14;

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+        ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                  (p_Var11,&DAT_10,param_3,param_4,(_tlgWrapSz<char> *)&local_res20,

+                   (_tlgWrapperByVal<4> *)&local_res8,(_tlgWrapSz<unsigned_short> *)&local_res18);

+      }

+    }

+    uVar12 = 0;

+  }

+  else {

+LAB_1:

+    if (5 < DAT_4) {

+      p_Var11 = (_tlgProvider_t *)&DAT_4;

+      cVar1 = _tlgKeywordOn(&DAT_4,0x400000000000);

+      if (cVar1 != '\0') {

+        local_res8 = (char *)CONCAT44(local_res8._4_4_,0x80070005);

+        local_res20 = "OnLockscreen";

+        local_48[8] = '\x01';

+        local_48[9] = '\0';

+        local_48[10] = '\0';

+        local_48[0xb] = '\0';

+        local_48[0xc] = '\0';

+        local_48[0xd] = '\0';

+        local_48[0xe] = '\0';

+        local_48[0xf] = '\0';

+        param_4 = (_GUID *)(local_48 + 8);

+        local_res18 = pcVar14;

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

+        ::

+        Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                  (p_Var11,&DAT_5,param_3,(_tlgWrapperByVal<8> *)param_4,

+                   (_tlgWrapSz<char> *)&local_res20,(_tlgWrapperByVal<4> *)&local_res8,

+                   (_tlgWrapSz<unsigned_short> *)&local_res18);

+      }

+    }

+    pcVar13 = "OnLockscreen";

+    if (5 < DAT_6) {

+      p_Var11 = (_tlgProvider_t *)&DAT_6;

+      cVar1 = _tlgKeywordOn(&DAT_6,1);

+      if (cVar1 != '\0') {

+LAB_8:

+        local_res8 = (char *)CONCAT44(local_res8._4_4_,0x80070005);

+        local_res18 = pcVar14;

+        local_res20 = pcVar13;

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+        ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

+                  (p_Var11,&DAT_10,param_3,param_4,(_tlgWrapSz<char> *)&local_res20,

+                   (_tlgWrapperByVal<4> *)&local_res8,(_tlgWrapSz<unsigned_short> *)&local_res18);

+      }

+    }

+LAB_7:

+    uVar12 = 5;

+  }

+  BVar3 = 0;

+  UserSetLastError(uVar12);

+LAB_0:

+  UserSessionSwitchLeaveCrit();

+  return (longlong)BVar3;

 }
```

## `NtUserPostThreadMessage`  (modified)

```diff
--- NtUserPostThreadMessage
+++ NtUserPostThreadMessage
@@ -1,56 +1,80 @@
 

-undefined8

-NtUserPostThreadMessage(_tlgProvider_t *param_1,undefined8 param_2,_GUID *param_3,_GUID *param_4)

+longlong NtUserPostThreadMessage

+                   (undefined4 param_1,uint param_2,undefined8 param_3,undefined8 param_4)

 

 {

   char cVar1;

-  char *in_RAX;

-  _tlgProvider_t *p_Var2;

-  undefined8 unaff_R14;

-  ulong uStack0000000000000048;

-  ushort uStack000000000000004c;

-  ushort uStack000000000000004e;

-  undefined4 in_stack_00000090;

-  undefined8 in_stack_000000a0;

-  char *in_stack_000000a8;

+  bool bVar2;

+  uint uVar3;

+  int iVar4;

+  int iVar5;

+  tagTHREADINFO *this;

+  tagTHREADINFO *this_00;

+  longlong lVar6;

   

-  in_RAX[-0x46] = in_RAX[-0x46] + (char)param_1;

-  cVar1 = (char)in_RAX;

-  *in_RAX = *in_RAX + cVar1;

-  *in_RAX = *in_RAX + cVar1;

-  *in_RAX = *in_RAX + cVar1;

-  in_RAX[-0x73] = in_RAX[-0x73] + (char)param_1;

-  cVar1 = _tlgKeywordOn();

-  if (cVar1 != '\0') {

-    in_stack_00000090 = 0x80070005;

-    in_stack_000000a8 = "OnLockscreen";

-    uStack0000000000000048 = 1;

-    uStack000000000000004c = 0;

-    uStack000000000000004e = 0;

-    param_4 = (_GUID *)&stack0x00000048;

-    in_stack_000000a0 = unaff_R14;

-    _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteAgg(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,void_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),void_const*___ptr64>

-    ::Write<_tlgWrapperByVal<8>,_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

-              (param_1,&DAT_0,param_3,(_tlgWrapperByVal<8> *)param_4,

-               (_tlgWrapSz<char> *)&stack0x000000a8,(_tlgWrapperByVal<4> *)&stack0x00000090,

-               (_tlgWrapSz<unsigned_short> *)&stack0x000000a0);

+                    /* 0x23a7d0  1863  NtUserPostThreadMessage */

+  EnterCrit(0,0);

+  if ((param_2 & 0xfffe0000) != 0) {

+    UserSetLastError(0x57);

+    iVar5 = 0;

+    goto LAB_0;

   }

-  if (5 < DAT_1) {

-    p_Var2 = (_tlgProvider_t *)&DAT_1;

-    cVar1 = _tlgKeywordOn(&DAT_1,1);

-    if (cVar1 != '\0') {

-      in_stack_00000090 = 0x80070005;

-      in_stack_000000a8 = "OnLockscreen";

-      in_stack_000000a0 = unaff_R14;

-      _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

-      ::Write<_tlgWrapSz<char>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>_>

-                (p_Var2,&DAT_2,param_3,param_4,(_tlgWrapSz<char> *)&stack0x000000a8,

-                 (_tlgWrapperByVal<4> *)&stack0x00000090,

-                 (_tlgWrapSz<unsigned_short> *)&stack0x000000a0);

+  this = (tagTHREADINFO *)PtiFromThreadId(param_1);

+  iVar5 = 0;

+  if (this == (tagTHREADINFO *)0x0) goto LAB_1;

+  this_00 = PtiCurrent();

+  if (*(longlong *)(this_00 + 0x1f0) != *(longlong *)(this + 0x1f0)) {

+    LOCK();

+    uVar3 = *(uint *)(this_00 + 0x210);

+    if (uVar3 == 0) {

+      *(uint *)(this_00 + 0x210) = 0;

+      uVar3 = 0;

+    }

+    UNLOCK();

+    if (((uVar3 & 8) == 0) && (lVar6 = GetDesktopView(*(undefined8 *)(this_00 + 0x1d0)), lVar6 == 0)

+       ) {

+      cVar1 = HasTcbPrivilege();

+      if (cVar1 != '\0') {

+        bVar2 = UIPrivilegeIsolation::CheckAccess

+                          ((tagUIPI_INFO *)

+                           (-(ulonglong)(*(longlong *)(this_00 + 0x1d0) != 0) &

+                           *(longlong *)(this_00 + 0x1d0) + 0x130U),

+                           (tagUIPI_INFO *)

+                           (-(ulonglong)(*(longlong *)(this + 0x1d0) != 0) &

+                           *(longlong *)(this + 0x1d0) + 0x130U),0);

+        if (bVar2) goto LAB_2;

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x8000) == 0)) ||

+           (cVar1 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 3)) {

+          cVar1 = '\0';

+        }

+        bVar2 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar1 != '\0') || (bVar2)) {

+          tagTHREADINFO::GetTID(this);

+          tagTHREADINFO::GetTID(this_00);

+          lVar6 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_LDD

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar1,bVar2,

+                     *(undefined8 *)(lVar6 + 0x10f98));

+        }

+        EtwTraceUIPIMsgError

+                  (*(undefined8 *)(this_00 + 0x1d0),*(undefined8 *)(this + 0x1d0),param_2,param_3,

+                   param_4);

+      }

+LAB_1:

+      UserSetLastError(0x5a4);

+      goto LAB_0;

     }

   }

-  UserSetLastError(5);

+LAB_2:

+  iVar4 = CheckForMessageAccessCrossIL

+                    (*(undefined8 *)(this_00 + 0x1d0),*(undefined8 *)(this + 0x1d0),0,param_2,

+                     param_3,param_4);

+  if (iVar4 != 0) {

+    iVar5 = _PostThreadMessage(this,param_2,param_3,param_4);

+  }

+LAB_0:

   UserSessionSwitchLeaveCrit();

-  return 0;

+  return (longlong)iVar5;

 }
```

## `NtUserRegisterPointerDeviceNotifications`  (modified)

```diff
--- NtUserRegisterPointerDeviceNotifications
+++ NtUserRegisterPointerDeviceNotifications
@@ -1,10 +1,67 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-void NtUserRegisterPointerDeviceNotifications(void)

+longlong NtUserRegisterPointerDeviceNotifications(undefined8 param_1,int param_2)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  bool bVar1;

+  int iVar2;

+  int iVar3;

+  longlong lVar4;

+  longlong *plVar5;

+  tagTHREADINFO *ptVar6;

+  ulonglong uVar7;

+  undefined1 auStack_48 [32];

+  undefined4 local_28;

+  undefined4 local_24;

+  undefined4 local_20;

+  ulonglong local_18;

+  

+                    /* 0x23b510  1897  NtUserRegisterPointerDeviceNotifications */

+  local_18 = __security_cookie ^ (ulonglong)auStack_48;

+  EnterCrit(0);

+  lVar4 = ValidateHwnd(param_1);

+  iVar3 = 0;

+  if (lVar4 != 0) {

+    plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar7 = 0;

+    if (plVar5 != (longlong *)0x0) {

+      uVar7 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

+    }

+    if (*(ulonglong *)(*(longlong *)(lVar4 + 0x10) + 0x1d0) == uVar7) {

+      if (param_2 != 0) {

+        iVar2 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+        if (iVar2 == 0) {

+          local_24 = 0xffffffff;

+          local_20 = 0;

+          local_28 = 0x2000;

+          ptVar6 = PtiCurrent();

+          bVar1 = UIPrivilegeIsolation::CheckAccess

+                            ((tagUIPI_INFO *)(*(longlong *)(ptVar6 + 0x1d0) + 0x130),

+                             (tagUIPI_INFO *)&local_28,0);

+        }

+        else {

+          ptVar6 = PtiCurrent();

+          bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                            ((UIPIAccessor *)

+                             (-(ulonglong)(*(longlong *)(ptVar6 + 0x1d0) != 0) &

+                             *(longlong *)(ptVar6 + 0x1d0) + 0x130U),0x2000);

+        }

+        if (bVar1 == false) {

+          ptVar6 = PtiCurrent();

+          EtwTraceUIPISystemError(*(undefined8 *)(ptVar6 + 0x1d0),0,9);

+          UserSetLastError(5);

+          goto LAB_0;

+        }

+      }

+      iVar3 = _RegisterPointerDeviceNotifications(lVar4,param_2);

+    }

+    else {

+      iVar3 = 5;

+    }

+  }

+LAB_0:

+  UserSessionSwitchLeaveCrit();

+  return (longlong)iVar3;

 }
```

## `UMPDDrvBitBlt`  (modified)

```diff
--- UMPDDrvBitBlt
+++ UMPDDrvBitBlt
@@ -1,22 +1,165 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl UMPDDrvBitBlt(struct _SURFOBJ * __ptr64,struct _SURFOBJ * __ptr64,struct _SURFOBJ *

+   __ptr64,struct _CLIPOBJ * __ptr64,struct _XLATEOBJ * __ptr64,struct _RECTL * __ptr64,struct

+   _POINTL * __ptr64,struct _POINTL * __ptr64,struct _BRUSHOBJ * __ptr64,struct _POINTL *

+   __ptr64,unsigned long) */

 

 int __cdecl

 UMPDDrvBitBlt(_SURFOBJ *param_1,_SURFOBJ *param_2,_SURFOBJ *param_3,_CLIPOBJ *param_4,

              _XLATEOBJ *param_5,_RECTL *param_6,_POINTL *param_7,_POINTL *param_8,_BRUSHOBJ *param_9

              ,_POINTL *param_10,ulong param_11)

 

 {

-  char *pcVar1;

-  uint in_EAX;

+  _SURFOBJ *p_Var1;

   int iVar2;

-  undefined8 *unaff_RDI;

-  undefined8 unaff_R13;

+  int iVar3;

+  ulong uVar4;

+  UMPDOBJ *this;

+  int iVar5;

+  int iVar6;

+  int iVar7;

+  int iVar8;

+  undefined1 auStackY_208 [32];

+  ulong local_178;

+  int local_174;

+  int local_170;

+  int local_16c;

+  int local_168;

+  int local_164;

+  int local_160 [2];

+  _SURFOBJ *local_158;

+  _SURFOBJ *local_150;

+  void *local_148;

+  void *local_140;

+  void *local_138;

+  void *local_130;

+  void *local_128;

+  void *local_120;

+  _SURFOBJ *local_118;

+  UMPDOBJ *local_110;

+  _SURFOBJ *local_108;

+  _CLIPOBJ *local_100;

+  _RECTL *local_f8;

+  _POINTL *local_f0;

+  _POINTL *local_e8;

+  _BRUSHOBJ *local_e0;

+  _POINTL *local_d8;

+  UMPDOBJ local_c8 [4];

+  undefined4 local_c4;

+  undefined8 local_b8;

+  _SURFOBJ *local_b0;

+  _SURFOBJ *local_a8;

+  _SURFOBJ *local_a0;

+  _CLIPOBJ *local_98;

+  _XLATEOBJ *local_90;

+  _RECTL *local_88;

+  _POINTL *local_80;

+  _POINTL *local_78;

+  _BRUSHOBJ *local_70;

+  _POINTL *local_68;

+  ulong local_60;

+  ulonglong local_58;

   

-  pcVar1 = (char *)((ulonglong)((in_EAX & 0xffffff20) + 0xd9b77e8) - 0x75);

-  *pcVar1 = *pcVar1 + (char)param_1;

-  iVar2 = (**(code **)(ulonglong)*(uint *)param_1)((char)param_1,1);

-  *unaff_RDI = unaff_R13;

-  return iVar2;

+  local_58 = __security_cookie ^ (ulonglong)auStackY_208;

+  iVar7 = 0;

+  local_f8 = param_6;

+  local_f0 = param_7;

+  local_e8 = param_8;

+  local_e0 = param_9;

+  local_d8 = param_10;

+  local_178 = 1;

+  local_160[0] = 0;

+  local_164 = 0;

+  local_168 = 0;

+  local_174 = 0;

+  local_170 = 0;

+  local_16c = 0;

+  local_158 = param_1;

+  local_150 = param_2;

+  local_118 = param_3;

+  local_108 = param_3;

+  local_100 = param_4;

+  XUMPDOBJ::XUMPDOBJ((XUMPDOBJ *)&local_110);

+  local_120 = (void *)0x0;

+  local_130 = (void *)0x0;

+  this = local_c8;

+  local_140 = (void *)0x0;

+  local_128 = (void *)0x0;

+  local_138 = (void *)0x0;

+  local_148 = (void *)0x0;

+  memset(this,0,0x70);

+  if ((local_110 == (UMPDOBJ *)0x0) ||

+     (iVar2 = UMPDOBJ::bPrepareBitmapsForClient(this,&local_150,&local_108), p_Var1 = local_150,

+     iVar2 == 0)) goto LAB_0;

+  iVar8 = iVar7;

+  iVar2 = 0;

+  iVar5 = 0;

+  if (local_110[0x1c8] == (UMPDOBJ)0x0) {

+LAB_1:

+    local_c4 = 0x12;

+    local_c8[0] = (UMPDOBJ)0x0;

+    local_b8 = *(undefined8 *)local_110;

+    local_b0 = local_158;

+    local_98 = local_100;

+    local_88 = local_f8;

+    local_80 = local_f0;

+    local_78 = local_e8;

+    local_70 = local_e0;

+    local_68 = local_d8;

+    local_60 = param_11;

+    local_a8 = p_Var1;

+    local_90 = param_5;

+    local_a0 = param_3;

+    iVar3 = UMPDOBJ::pso(local_110,(_DDIOBJMAP *)(local_110 + 0x50),&local_b0,iVar8);

+    iVar6 = 0;

+    iVar7 = 0;

+    if (((((iVar3 != 0) &&

+          (iVar3 = UMPDOBJ::pso(local_110,(_DDIOBJMAP *)(local_110 + 0x60),&local_a8,iVar5),

+          iVar3 != 0)) &&

+         (iVar3 = UMPDOBJ::pso(local_110,(_DDIOBJMAP *)(local_110 + 0x70),&local_a0,iVar2),

+         iVar7 = iVar6, iVar3 != 0)) &&

+        ((((iVar3 = UMPDOBJ::ThunkDDIOBJ

+                              (local_110,(_DDIOBJMAP *)(local_110 + 0x80),&local_98,0x18,(void *)0x0

+                              ), iVar3 != 0 &&

+           (iVar3 = UMPDOBJ::pxlo(local_110,&local_90), iVar3 != 0)) &&

+          ((iVar3 = UMPDOBJ::ThunkMemBlock(local_110,&local_88,0x10), iVar3 != 0 &&

+           ((iVar3 = UMPDOBJ::ThunkMemBlock(local_110,&local_80,8), iVar3 != 0 &&

+            (iVar3 = UMPDOBJ::ThunkMemBlock(local_110,&local_78,8), iVar3 != 0)))))) &&

+         (iVar3 = UMPDOBJ::ThunkDDIOBJ

+                            (local_110,(_DDIOBJMAP *)(local_110 + 0xa0),&local_70,0x18,(void *)0x0),

+         iVar3 != 0)))) &&

+       (((iVar3 = UMPDOBJ::ThunkMemBlock(local_110,&local_68,8), iVar3 != 0 &&

+         (uVar4 = UMPDOBJ::Thunk(local_110,local_c8,0x70,&local_178,4), uVar4 != 0xffffffff)) &&

+        (local_178 != 0)))) {

+      iVar7 = 1;

+    }

+  }

+  else {

+    if (param_5 == (_XLATEOBJ *)0x0) {

+      local_178 = 0xd0;

+    }

+    else {

+      local_178 = (*(int *)(param_5 + 0xc) * 4 + 7U & 0xfffffff8) + 0xe8;

+    }

+    local_178 = UMPDOBJ::bThunkLargeBitmaps

+                          (local_110,local_158,local_150,param_3,&local_120,&local_128,&local_130,

+                           &local_138,&local_140,&local_148,local_160,&local_174,&local_164,

+                           &local_170,&local_168,&local_16c,&local_178);

+    param_3 = local_118;

+    iVar2 = local_16c;

+    iVar5 = local_170;

+    iVar8 = local_174;

+    iVar7 = 0;

+    if (local_178 != 0) goto LAB_1;

+  }

+  if (local_110[0x1c8] != (UMPDOBJ)0x0) {

+    UMPDOBJ::RestoreBitmaps

+              (local_110,local_158,p_Var1,local_118,local_120,local_128,local_130,local_138,

+               local_140,local_148,local_160[0],iVar8,local_164,iVar5,local_168,iVar2);

+  }

+LAB_0:

+  XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_110);

+  return iVar7;

 }
```

## `xxxRealDrawMenuItem`  (modified)

```diff
--- xxxRealDrawMenuItem
+++ xxxRealDrawMenuItem
@@ -1,11 +1,585 @@
 

-void xxxRealDrawMenuItem(void)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+

+undefined8

+xxxRealDrawMenuItem(HDC__ *param_1,undefined8 *param_2,int param_3,int param_4,uint param_5,

+                   int param_6)

 

 {

-  code *pcVar1;

+  __uint64 _Var1;

+  __uint64 _Var2;

+  char cVar3;

+  bool bVar4;

+  undefined4 uVar5;

+  int iVar6;

+  uint uVar7;

+  tagTHREADINFO *ptVar8;

+  longlong lVar9;

+  tagWND *ptVar10;

+  tagCURSOR *hIcon;

+  longlong lVar11;

+  longlong lVar12;

+  int iVar13;

+  uint uVar14;

+  int iVar15;

+  ushort *puVar16;

+  int iVar17;

+  uint uVar18;

+  tagITEM *ptVar19;

+  ulonglong uVar20;

+  tagITEM *ptVar21;

+  tagITEM *ptVar22;

+  uint uVar23;

+  longlong lVar24;

+  longlong lVar25;

+  uint *puVar26;

+  undefined1 auStackY_1b8 [32];

+  uint local_144;

+  tagITEM *local_138;

+  uint local_130;

+  longlong *local_128 [2];

+  longlong local_118;

+  uint *local_110;

+  uint local_108;

+  longlong local_100;

+  undefined8 local_f8;

+  int iStack_f0;

+  undefined4 uStack_ec;

+  undefined4 uStack_e8;

+  undefined4 uStack_e4;

+  undefined4 uStack_e0;

+  undefined4 uStack_dc;

+  undefined4 local_d8;

+  undefined4 uStack_d4;

+  undefined4 local_d0;

+  undefined1 local_c8 [16];

+  ushort local_b8;

+  ushort local_b6;

+  short local_9a;

+  int local_98;

+  ulonglong local_58;

   

-  pcVar1 = (code *)swi(3);

-  (*pcVar1)();

-  return;

+  local_58 = __security_cookie ^ (ulonglong)auStackY_1b8;

+  SmartObjStackRef<tagMENU>::SmartObjStackRef<tagMENU>((SmartObjStackRef<tagMENU> *)local_128);

+  iVar17 = 0;

+  uVar23 = 0;

+  local_108 = 0;

+  ptVar8 = PtiCurrent();

+  local_118 = 0;

+  SmartObjStackRefBase<tagMENU>::operator=

+            ((SmartObjStackRefBase<tagMENU> *)local_128,(tagMENU *)*param_2);

+  ptVar19 = (tagITEM *)param_2[1];

+  uVar14 = *(uint *)(*(longlong *)(*local_128[0] + 0x28) + 0x28) & 1;

+  local_138 = ptVar19;

+  if (uVar14 == 0) {

+    iVar6 = MNIsFlatMenu();

+    if (iVar6 == 0) {

+      local_108 = (uint)((*(byte *)(*(longlong *)ptVar19 + 4) & 0x80) != 0);

+      uVar23 = 0;

+    }

+  }

+  else {

+    iVar17 = 2;

+    if (*(int *)(*(longlong *)(*local_128[0] + 0x28) + 0x28) < 0) {

+      iVar17 = 4;

+      uVar23 = 0;

+    }

+    else {

+      if (param_5 == 0) {

+        uVar23 = DrawMenuItemCheckMark(param_1,ptVar19,8);

+      }

+      else {

+        lVar9 = *(longlong *)ptVar19;

+        if ((*(uint *)(lVar9 + 4) & 8) == 0) {

+          lVar9 = *(longlong *)(lVar9 + 0x20);

+        }

+        else {

+          lVar9 = *(longlong *)(lVar9 + 0x18);

+        }

+        uVar23 = (uint)(lVar9 != 0);

+      }

+      if (((((*(uint *)(*(longlong *)(*local_128[0] + 0x28) + 0x28) >> 0x1a & 1) == 0) ||

+           (*(longlong *)(*(longlong *)ptVar19 + 0x60) == 0)) || (uVar23 != 0)) &&

+         ((**(uint **)ptVar19 & 0x2000) == 0)) {

+        lVar9 = GetOemBitmapInfoForCurrentThread(0x3f);

+        iVar17 = *(short *)(lVar9 + 4) + 4;

+      }

+    }

+  }

+  if ((*(longlong *)(*(longlong *)ptVar19 + 0x60) != 0) &&

+     ((uVar23 == 0 || ((*(uint *)(*(longlong *)(*local_128[0] + 0x28) + 0x28) >> 0x1a & 1) == 0))))

+  {

+    if (param_5 == 0) {

+      lVar9 = *(longlong *)ptVar19;

+      lVar12 = *(longlong *)(lVar9 + 0x60);

+      if ((*(uint *)(lVar9 + 4) >> 0x1d & 1) == 0) {

+        if (lVar12 == -1) {

+          xxxSendMenuDrawItemMessage

+                    (param_1,1,(SmartObjStackRef<tagMENU> *)local_128,ptVar19,1,iVar17,(tagWND *)0x0

+                    );

+          goto LAB_0;

+        }

+        if ((0x400 < *(ushort *)(ptVar8 + 0x2a0)) ||

+           (((*(longlong *)(lVar9 + 0x38) == 0 || (*(longlong *)(ptVar19 + 0x18) != 0)) &&

+            ((uVar14 != 0 ||

+             ((((ptVar19 != *(tagITEM **)(*local_128[0] + 0x58) ||

+                (*(uint *)(*(longlong *)(*local_128[0] + 0x28) + 0x2c) < 2)) ||

+               (*(longlong *)(*(longlong *)(*(longlong *)(*local_128[0] + 0x58) + 0x60) + 0x60) != 0

+               )) || (*(longlong *)(ptVar19 + 0x10) == 0)))))))) goto LAB_1;

+      }

+      else if (lVar12 != 1) {

+        iVar6 = iVar17;

+        if (lVar12 == 2) {

+          iVar15 = 0x1a;

+LAB_2:

+          if ((char)*(uint *)(lVar9 + 4) < '\0') {

+            iVar15 = iVar15 + 1;

+          }

+        }

+        else {

+          if (lVar12 == 3) {

+            iVar15 = 0x16;

+            iVar6 = iVar17 + 2;

+            goto LAB_2;

+          }

+          if (lVar12 == 5) {

+            iVar15 = 0x12;

+            goto LAB_2;

+          }

+          if (lVar12 == 6) {

+            iVar15 = 0x15;

+          }

+          else {

+            if (lVar12 != 7) {

+              lVar9 = PrepareHDCBITSBitmap(0);

+              if (lVar9 != 0) {

+                GetOemBitmapInfoForCurrentThread

+                          ((int)*(undefined8 *)(*(longlong *)ptVar19 + 0x60) + 0x4f);

+                BltColor(param_1,0,lVar9,iVar17);

+              }

+              goto LAB_0;

+            }

+            iVar15 = 0x19;

+            iVar6 = iVar17 + 2;

+          }

+        }

+        BitBltSysBmp(param_1,iVar6,2,iVar15);

+        goto LAB_0;

+      }

+      while( true ) {

+        if ((*(longlong *)(*(longlong *)ptVar19 + 0x38) == 0) &&

+           (*(longlong *)(*local_128[0] + 0x50) != 0)) {

+          SetupFakeMDIAppStuff((SmartObjStackRef<tagMENU> *)local_128,ptVar19);

+        }

+        ptVar10 = (tagWND *)HMValidateHandleNoRip(*(undefined8 *)(*(longlong *)ptVar19 + 0x38),1);

+        if (ptVar10 != (tagWND *)0x0) break;

+        if (*(longlong *)(*(longlong *)ptVar19 + 0x38) == 0) goto LAB_3;

+        *(undefined8 *)(*(longlong *)ptVar19 + 0x38) = 0;

+      }

+      hIcon = GetWindowSmIcon(ptVar10);

+      if (hIcon != (tagCURSOR *)0x0) goto LAB_4;

+LAB_3:

+      lVar9 = W32GetUserSessionState();

+      hIcon = *(tagCURSOR **)(lVar9 + 0x89c8);

+LAB_4:

+      uVar7 = param_4 - 2;

+      uVar23 = param_3 - 4;

+      if ((uVar14 != 0) && (uVar7 < uVar23)) {

+        uVar23 = uVar7;

+      }

+      lVar9 = W32GetUserSessionState();

+      _DrawIconEx(param_1,iVar17 + 4,1,(HICON)hIcon,uVar23,uVar7,0,

+                  *(HBRUSH *)(*(longlong *)(lVar9 + 0x4e30) + 0x1278),0x13);

+    }

+    else {

+LAB_1:

+      lVar9 = *(longlong *)ptVar19;

+      iVar6 = *(int *)(lVar9 + 0x68);

+      iVar15 = *(int *)(lVar9 + 0x6c);

+      if (uVar14 == 0) {

+        uVar5 = GetDpiForSystem();

+        iVar13 = GetDpiDependentMetric(0x1a,uVar5);

+        if (iVar13 < iVar15) {

+          iVar15 = *(int *)(*(longlong *)ptVar19 + 0x6c);

+        }

+        else {

+          uVar5 = GetDpiForSystem();

+          iVar15 = GetDpiDependentMetric(0x1a,uVar5);

+        }

+        local_130 = 0;

+        uVar23 = 0;

+        if (*(longlong *)(ptVar19 + 0x18) != 0) {

+          lVar9 = GetDpiMetricsForCurrentThread();

+          iVar17 = iVar17 + *(int *)(lVar9 + 0x10);

+          uVar23 = 0;

+        }

+      }

+      else {

+        iVar13 = *(int *)(lVar9 + 0x4c) - iVar15;

+        uVar23 = iVar13 / 2;

+        local_130 = uVar23;

+        if (iVar13 < 1) {

+          uVar23 = 0;

+          local_130 = 0;

+        }

+      }

+      lVar9 = W32GetUserSessionState();

+      local_100 = GreSelectBitmap(*(undefined8 *)(lVar9 + 0xa980));

+      if (local_100 == 0) goto LAB_0;

+      memset(local_c8,0,0x68);

+      iVar13 = GreExtGetObjectW(*(undefined8 *)(*(longlong *)ptVar19 + 0x60),0x68,local_c8);

+      lVar12 = 0;

+      lVar9 = 0;

+      if ((param_5 == 0) || (**(int **)ptVar19 == 4)) {

+        if (((iVar13 != 0x68) || ((local_9a != 0x20 || (local_98 != 0)))) ||

+           (**(int **)ptVar19 == 4)) {

+          if ((uint)local_b6 * (uint)local_b8 != 1) {

+            MNDrawHilite((SmartObjStackRef<tagMENU> *)local_128,ptVar19);

+          }

+          W32GetUserSessionState();

+          GreBitBltInternal(param_1,local_108 + iVar17,local_108 + uVar23,iVar6);

+        }

+      }

+      else {

+        lVar24 = 0;

+        lVar25 = lVar12;

+        if (param_6 == 0) {

+          lVar11 = W32GetUserSessionState();

+          lVar11 = *(longlong *)(lVar11 + 0xa980);

+          if (lVar11 != 0) goto LAB_5;

+LAB_6:

+          if (param_6 == 0) goto LAB_7;

+          if (lVar12 != -1) goto LAB_8;

+        }

+        else {

+          local_110 = (uint *)0x0;

+          local_f8 = 0;

+          iStack_f0 = 0;

+          uStack_ec = 0;

+          local_d8 = 0;

+          uStack_d4 = 0;

+          uStack_e8 = 0;

+          uStack_e4 = 0;

+          uStack_e0 = 0;

+          uStack_dc = 0;

+          local_d0 = 0;

+          lVar11 = GreCreateCompatibleDC();

+          if (lVar11 != 0) {

+            uStack_d4 = 0;

+            local_d0 = 0;

+            uStack_e4 = 0;

+            uStack_e0 = 0;

+            uStack_dc = 0;

+            local_d8 = 0;

+            local_f8 = CONCAT44(iVar6,0x28);

+            uStack_ec = 0x200001;

+            uStack_e8 = 0;

+            iStack_f0 = iVar15;

+            lVar24 = GreCreateDIBitmapReal(lVar11,0,0,&local_f8);

+            lVar9 = lVar12;

+            if ((lVar24 != 0) && (lVar9 = GreSelectBitmap(lVar11,lVar24), lVar9 != -1)) {

+              W32GetUserSessionState();

+              GreAlphaBlend(lVar11,0,0,iVar6);

+              if (0 < iVar15 * iVar6) {

+                uVar20 = (ulonglong)(uint)(iVar15 * iVar6);

+                do {

+                  uVar23 = (uint)(byte)*local_110 * 0x4d + 0x81 +

+                           (uint)*(byte *)((longlong)local_110 + 1) * 0x96 +

+                           (uint)*(byte *)((longlong)local_110 + 2) * 0x1d >> 8;

+                  *local_110 = (((uint)*(byte *)((longlong)local_110 + 3) << 8 | uVar23) << 8 |

+                               uVar23) << 8 | uVar23;

+                  local_110 = local_110 + 1;

+                  uVar20 = uVar20 - 1;

+                  ptVar19 = local_138;

+                } while (uVar20 != 0);

+              }

+            }

+LAB_5:

+            GreAlphaBlend(param_1,local_108 + iVar17,local_130 + local_108,iVar6);

+            lVar12 = lVar9;

+            lVar25 = lVar24;

+            goto LAB_6;

+          }

+LAB_8:

+          GreSelectBitmap(lVar11,lVar12);

+        }

+        if (lVar25 != 0) {

+          GreDecBitmapExclusiveRefCnt(lVar25);

+          GreDeleteObject(lVar25);

+        }

+        if (lVar11 != 0) {

+          GreDeleteDC(lVar11);

+        }

+      }

+LAB_7:

+      lVar9 = W32GetUserSessionState();

+      GreSelectBitmap(*(undefined8 *)(lVar9 + 0xa980),local_100);

+    }

+  }

+LAB_0:

+  ptVar22 = (tagITEM *)0x0;

+  lVar9 = local_118;

+  if (local_118 == 0) {

+    lVar9 = *local_128[0];

+  }

+  lVar12 = local_118;

+  cVar3 = MNIspItemValid(lVar9,ptVar19);

+  if ((((cVar3 == '\0') || (param_5 != (uint)ptVar22)) ||

+      (puVar16 = *(ushort **)(ptVar19 + 0x18), puVar16 == (ushort *)0x0)) ||

+     (uVar23 = *(uint *)(*(longlong *)ptVar19 + 0x30), uVar23 == 0)) goto LAB_9;

+  _Var1 = *(__uint64 *)(ptVar19 + 0x58);

+  if ((uVar14 == 0) || (*(uint *)(*local_128[0] + 0x48) == (uint)ptVar22)) {

+    if (*(tagITEM **)(*(longlong *)ptVar19 + 0x60) != ptVar22) {

+      iVar17 = iVar17 + 2 + *(int *)(*(longlong *)ptVar19 + 0x68);

+    }

+  }

+  else {

+    iVar17 = *(int *)(*local_128[0] + 0x48);

+  }

+  local_110 = (uint *)GetDpiMetricsForCurrentThread();

+  lVar9 = *(longlong *)ptVar19;

+  local_144 = local_110[7];

+  iVar6 = ((*(int *)(lVar9 + 0x4c) - local_110[5]) - local_144) + -1;

+  if (0 < iVar6) {

+    local_144 = local_144 + iVar6 / 2;

+  }

+  if ((uVar14 == 0) && (*(longlong *)(lVar9 + 0x60) == 0)) {

+    iVar17 = iVar17 + local_110[4];

+  }

+  uVar20 = 8;

+  if ((*puVar16 == 8) && (uVar14 == 0)) {

+    puVar16 = puVar16 + 1;

+    uVar23 = uVar23 - 1;

+    lVar12 = local_118;

+    ptVar22 = (tagITEM *)0x0;

+    if (uVar23 == 0) goto LAB_9;

+  }

+  local_130 = FindCharPosition(puVar16,9);

+  uVar7 = FindCharPosition(puVar16,uVar20 & 0xffffffff);

+  iVar6 = *(int *)(lVar9 + 0x48);

+  lVar9 = GetOemBitmapInfoForCurrentThread(0x3f);

+  ptVar21 = (tagITEM *)0x0;

+  iVar6 = (iVar6 - *(short *)(lVar9 + 4)) + -2;

+  if ((uVar7 == 0) || (uVar7 == uVar23)) {

+    puVar26 = local_110;

+    uVar18 = local_130;

+    if ((local_130 != 0) && (uVar7 == uVar23)) {

+      if ((**(uint **)ptVar19 & 0x2000) != 0) {

+        local_138 = (tagITEM *)0x0;

+        xxxPSMGetTextExtent(param_1,puVar16,local_130,&local_138);

+        ptVar22 = (tagITEM *)0x0;

+        lVar9 = local_118;

+        if (local_118 == 0) {

+          lVar9 = *local_128[0];

+        }

+        lVar12 = local_118;

+        cVar3 = MNIspItemValid(lVar9,ptVar19);

+        if (cVar3 == '\0') goto LAB_9;

+        iVar17 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+        ptVar21 = (tagITEM *)0x0;

+        if (iVar17 == 0) {

+          lVar12 = local_118;

+          ptVar22 = (tagITEM *)0x0;

+          if (_Var1 != *(__uint64 *)(ptVar19 + 0x58)) goto LAB_9;

+        }

+        else {

+          bVar4 = MNIspItemStringUnchanged(ptVar19,puVar16,_Var1);

+          lVar12 = local_118;

+          ptVar22 = ptVar21;

+          if (!bVar4) goto LAB_9;

+        }

+        iVar17 = iVar6 - (int)local_138;

+        if ((uVar14 == (uint)ptVar21) && (*(tagITEM **)(*(longlong *)ptVar19 + 0x60) == ptVar21)) {

+          iVar17 = iVar17 + local_110[4];

+        }

+      }

+      puVar26 = local_110;

+      uVar18 = local_130;

+      xxxDrawMenuItemText((SmartObjStackRef<tagMENU> *)local_128,ptVar19,param_1,local_108 + iVar17,

+                          local_108 + local_144,puVar16,local_130,

+                          *(uint *)(*(longlong *)(*local_128[0] + 0x28) + 0x28) & 4);

+      ptVar22 = (tagITEM *)0x0;

+      lVar9 = local_118;

+      if (local_118 == 0) {

+        lVar9 = *local_128[0];

+      }

+      lVar12 = local_118;

+      cVar3 = MNIspItemValid(lVar9,ptVar19);

+      if (cVar3 == '\0') goto LAB_9;

+      iVar17 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+      ptVar21 = (tagITEM *)0x0;

+      if (iVar17 == 0) {

+        _Var2 = *(__uint64 *)(ptVar19 + 0x58);

+        goto joined_r0x0001401cbfd3;

+      }

+      bVar4 = MNIspItemStringUnchanged(ptVar19,puVar16,_Var1);

+joined_r0x0001401cbfeb:

+      lVar12 = local_118;

+      ptVar22 = ptVar21;

+      if (!bVar4) goto LAB_9;

+    }

+  }

+  else {

+    if (((**(uint **)ptVar19 & 0x2000) != 0) && (uVar14 != 0)) {

+      local_138 = (tagITEM *)0x0;

+      xxxPSMGetTextExtent(param_1,puVar16,uVar7,&local_138);

+      ptVar22 = (tagITEM *)0x0;

+      lVar9 = local_118;

+      if (local_118 == 0) {

+        lVar9 = *local_128[0];

+      }

+      lVar12 = local_118;

+      cVar3 = MNIspItemValid(lVar9,ptVar19);

+      if (cVar3 == '\0') goto LAB_9;

+      iVar17 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+      ptVar22 = (tagITEM *)0x0;

+      if (iVar17 == 0) {

+        lVar12 = local_118;

+        if (_Var1 != *(__uint64 *)(ptVar19 + 0x58)) goto LAB_9;

+      }

+      else {

+        bVar4 = MNIspItemStringUnchanged(ptVar19,puVar16,_Var1);

+        lVar12 = local_118;

+        if (!bVar4) goto LAB_9;

+      }

+      iVar17 = iVar6 - (int)local_138;

+    }

+    xxxDrawMenuItemText((SmartObjStackRef<tagMENU> *)local_128,ptVar19,param_1,local_108 + iVar17,

+                        local_144 + local_108,puVar16,uVar7,

+                        *(uint *)(*(longlong *)(*local_128[0] + 0x28) + 0x28) & 4);

+    ptVar22 = (tagITEM *)0x0;

+    lVar9 = local_118;

+    if (local_118 == 0) {

+      lVar9 = *local_128[0];

+    }

+    lVar12 = local_118;

+    cVar3 = MNIspItemValid(lVar9,ptVar19);

+    if (cVar3 == '\0') goto LAB_9;

+    iVar17 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+    ptVar21 = (tagITEM *)0x0;

+    if (iVar17 == 0) {

+      lVar12 = local_118;

+      ptVar22 = ptVar21;

+      if (_Var1 != *(__uint64 *)(ptVar19 + 0x58)) goto LAB_9;

+    }

+    else {

+      bVar4 = MNIspItemStringUnchanged(ptVar19,puVar16,_Var1);

+      lVar12 = local_118;

+      ptVar22 = ptVar21;

+      if (!bVar4) goto LAB_9;

+    }

+    uVar18 = local_130;

+    puVar26 = local_110;

+    if (uVar7 + 1 < local_130) {

+      if (((**(uint **)ptVar19 & 0x2000) == 0) || (uVar14 == (uint)ptVar21)) {

+        local_138 = ptVar21;

+        xxxPSMGetTextExtent(param_1,puVar16 + (ulonglong)uVar7 + 1,(local_130 - uVar7) + -1,

+                            &local_138);

+        ptVar22 = (tagITEM *)0x0;

+        lVar9 = local_118;

+        if (local_118 == 0) {

+          lVar9 = *local_128[0];

+        }

+        lVar12 = local_118;

+        cVar3 = MNIspItemValid(lVar9,ptVar19);

+        if (cVar3 == '\0') goto LAB_9;

+        iVar17 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+        ptVar22 = (tagITEM *)0x0;

+        if (iVar17 == 0) {

+          lVar12 = local_118;

+          ptVar22 = (tagITEM *)0x0;

+          if (_Var1 != *(__uint64 *)(ptVar19 + 0x58)) goto LAB_9;

+        }

+        else {

+          bVar4 = MNIspItemStringUnchanged(ptVar19,puVar16,_Var1);

+          lVar12 = local_118;

+          if (!bVar4) goto LAB_9;

+        }

+        iVar6 = *(int *)(*(longlong *)ptVar19 + 0x50) - (int)local_138;

+      }

+      else {

+        iVar6 = iVar6 - (*(uint **)ptVar19)[0x14];

+      }

+      xxxPSMTextOut(param_1,iVar6,local_144,puVar16 + (ulonglong)uVar7 + 1);

+      ptVar22 = (tagITEM *)0x0;

+      lVar9 = local_118;

+      if (local_118 == 0) {

+        lVar9 = *local_128[0];

+      }

+      lVar12 = local_118;

+      cVar3 = MNIspItemValid(lVar9,ptVar19);

+      if (cVar3 == '\0') goto LAB_9;

+      iVar17 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+      ptVar21 = (tagITEM *)0x0;

+      if (iVar17 != 0) {

+        bVar4 = MNIspItemStringUnchanged(ptVar19,puVar16,_Var1);

+        puVar26 = local_110;

+        goto joined_r0x0001401cbfeb;

+      }

+      _Var2 = *(__uint64 *)(ptVar19 + 0x58);

+      puVar26 = local_110;

+joined_r0x0001401cbfd3:

+      ptVar21 = (tagITEM *)0x0;

+      lVar12 = local_118;

+      ptVar22 = (tagITEM *)0x0;

+      if (_Var1 != _Var2) goto LAB_9;

+    }

+  }

+  lVar12 = local_118;

+  ptVar22 = ptVar21;

+  if (uVar18 < uVar23 - 1) {

+    if (((**(uint **)ptVar19 & 0x2000) == 0) || (uVar14 == (uint)ptVar21)) {

+      iVar17 = (*(uint **)ptVar19)[0x14] + puVar26[4];

+    }

+    else {

+      local_138 = ptVar21;

+      xxxPSMGetTextExtent(param_1,puVar16 + (ulonglong)uVar18 + 1,(uVar23 - uVar18) + -1,&local_138)

+      ;

+      ptVar22 = (tagITEM *)0x0;

+      lVar9 = local_118;

+      if (local_118 == 0) {

+        lVar9 = *local_128[0];

+      }

+      lVar12 = local_118;

+      cVar3 = MNIspItemValid(lVar9,ptVar19);

+      if (cVar3 == '\0') goto LAB_9;

+      iVar17 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+      ptVar22 = (tagITEM *)0x0;

+      if (iVar17 == 0) {

+        lVar12 = local_118;

+        ptVar22 = (tagITEM *)0x0;

+        if (_Var1 != *(__uint64 *)(ptVar19 + 0x58)) goto LAB_9;

+      }

+      else {

+        bVar4 = MNIspItemStringUnchanged(ptVar19,puVar16,_Var1);

+        lVar12 = local_118;

+        if (!bVar4) goto LAB_9;

+      }

+      iVar17 = (*(int *)(*(longlong *)ptVar19 + 0x48) - *(int *)(*(longlong *)ptVar19 + 0x50)) -

+               (int)local_138;

+    }

+    xxxPSMTextOut(param_1,iVar17,local_144,puVar16 + (ulonglong)uVar18 + 1);

+    lVar12 = local_118;

+    ptVar22 = (tagITEM *)0x0;

+  }

+LAB_9:

+  if (lVar12 == 0) {

+    lVar12 = *local_128[0];

+  }

+  cVar3 = MNIspItemValid(lVar12,ptVar19);

+  if ((((cVar3 != '\0') && (param_5 == (uint)ptVar22)) && (uVar14 != (uint)ptVar22)) &&

+     (((*(tagITEM **)(ptVar19 + 0x10) != ptVar22 &&

+       (lVar9 = GetOemBitmapInfoForCurrentThread

+                          ((-((**(uint **)ptVar19 & 0x2000) != 0) & 0x1eU) + 0x3e),

+       (int)*(short *)(lVar9 + 6) <= *(int *)(*(longlong *)ptVar19 + 0x4c))) &&

+      (lVar12 = PrepareHDCBITSBitmap(), lVar12 != 0)))) {

+    iVar17 = (int)*(short *)(lVar9 + 4);

+    if ((**(uint **)ptVar19 & 0x2000) == 0) {

+      iVar17 = (*(uint **)ptVar19)[0x12] - iVar17;

+    }

+    BltColor(param_1,0,lVar12,iVar17);

+  }

+  SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>((SmartObjStackRef<tagMENU> *)local_128);

+  return 1;

 }
```

## `IsMessageAllowedAcrossILByReceiver`  (modified)

```diff
--- IsMessageAllowedAcrossILByReceiver
+++ IsMessageAllowedAcrossILByReceiver
@@ -1,90 +1,19 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl IsMessageAllowedAcrossILByReceiver(struct tagPROCESSINFO const * __ptr64,struct

+   tagWND * __ptr64,unsigned int) */

 

 int __cdecl IsMessageAllowedAcrossILByReceiver(tagPROCESSINFO *param_1,tagWND *param_2,uint param_3)

 

 {

-  longlong *plVar1;

-  undefined4 uVar2;

-  undefined4 uVar3;

-  undefined8 uVar4;

-  undefined8 uVar5;

-  ulong uVar6;

-  undefined4 uVar7;

-  int iVar8;

-  int extraout_EAX;

-  int *in_RAX;

-  undefined4 *puVar9;

-  tagMONITOR *ptVar10;

-  ERECTL *this;

-  SmartObjStackRefBase<tagPOPUPMENU> *unaff_RBX;

-  longlong unaff_RBP;

-  ushort unaff_SI;

-  tagMONITOR *unaff_RDI;

-  LPRECT unaff_R14;

-  int unaff_R15D;

+  int iVar1;

+  void **ppvVar2;

   

-  if (*in_RAX < (int)in_RAX) {

-    uVar6 = GetWindowCompositedDpiContext(*(tagWND **)(**(longlong **)unaff_RBX + 0x10));

-    GetMonitorMenuRectForDpi((tagRECT *)(unaff_RBP + -9),unaff_RDI,(ushort)(uVar6 >> 8) & unaff_SI);

-    puVar9 = (undefined4 *)(unaff_RBP + -9);

-    *(undefined8 *)(unaff_RBP + -9) = *(undefined8 *)(unaff_RBP + -9);

-    *(undefined8 *)(unaff_RBP + -1) = *(undefined8 *)(unaff_RBP + -1);

+  iVar1 = IsMessageAllowedByFilterEx

+                    (*(void ***)(param_1 + 0x350),param_3,(void ***)0x0,(void ***)0x0);

+  if ((iVar1 == 0) && (param_2 != (tagWND *)0x0)) {

+    ppvVar2 = GetWindowMessageFilter(param_2);

+    iVar1 = IsMessageAllowedByFilterEx(ppvVar2,param_3,(void ***)0x0,(void ***)0x0);

   }

-  else {

-    puVar9 = (undefined4 *)(unaff_RBP + 0x17);

-    *(undefined8 *)(unaff_RBP + 0x17) = *(undefined8 *)(unaff_RBP + -0x29);

-    *(undefined8 *)(unaff_RBP + 0x1f) = *(undefined8 *)(unaff_RBP + -0x21);

-  }

-  uVar7 = puVar9[1];

-  uVar2 = puVar9[2];

-  uVar3 = puVar9[3];

-  plVar1 = *(longlong **)unaff_RBX;

-  *(undefined4 *)(unaff_RBP + -0x19) = *puVar9;

-  *(undefined4 *)(unaff_RBP + -0x15) = uVar7;

-  *(undefined4 *)(unaff_RBP + -0x11) = uVar2;

-  *(undefined4 *)(unaff_RBP + -0xd) = uVar3;

-  if (((byte)*(undefined4 *)(*(longlong *)(*(longlong *)(*plVar1 + 0x10) + 0x28) + 0x120) & 0xf) ==

-      2) {

-LAB_0:

-    if (unaff_R15D == 0) {

-LAB_1:

-      uVar4 = *(undefined8 *)(unaff_RBP + -0x19);

-      uVar5 = *(undefined8 *)(unaff_RBP + -0x11);

-      unaff_R14->left = (int)uVar4;

-      unaff_R14->top = (int)((ulonglong)uVar4 >> 0x20);

-      unaff_R14->right = (int)uVar5;

-      unaff_R14->bottom = (int)((ulonglong)uVar5 >> 0x20);

-      goto LAB_2;

-    }

-  }

-  else {

-    ptVar10 = (tagMONITOR *)

-              ValidateHmonitorNoRip

-                        (*(undefined8 *)

-                          (*(longlong *)(*(longlong *)(**(longlong **)unaff_RBX + 0x10) + 0x28) +

-                          0x100));

-    *(tagMONITOR **)(unaff_RBP + -0x39) = ptVar10;

-    if ((ptVar10 == (tagMONITOR *)0x0) || (ptVar10 == unaff_RDI)) goto LAB_0;

-    uVar7 = W32GetCurrentThreadDpiAwarenessContext();

-    if (*(int *)**(undefined8 **)unaff_RBX < 0) {

-      this = (ERECTL *)(unaff_RDI + 0x70);

-      iVar8 = ERECTL::bWrapped(this);

-      if (iVar8 != 0) goto LAB_3;

-      PhysicalToLogicalDPIRect(unaff_RBP + -0x19,this,uVar7,unaff_RBP + -0x39);

-    }

-    else {

-LAB_3:

-      PhysicalToLogicalDPIRect

-                (unaff_RBP + -0x19,*(longlong *)(unaff_RDI + 0x28) + 0x1c,uVar7,unaff_RBP + -0x39);

-    }

-    if (unaff_R15D == 0) goto LAB_1;

-    PhysicalToLogicalDPIRect

-              (unaff_RBP + 7,*(longlong *)(unaff_RDI + 0x28) + 0x1c,uVar7,unaff_RBP + -0x39);

-  }

-  SubtractRect(unaff_R14,(RECT *)(unaff_RBP + 7),(RECT *)(unaff_RBP + -0x19));

-LAB_2:

-  SmartObjStackRefBase<tagPOPUPMENU>::~SmartObjStackRefBase<tagPOPUPMENU>(unaff_RBX);

-  return extraout_EAX;

+  return iVar1;

 }
```

## `CheckCursorClipAccess`  (modified)

```diff
--- CheckCursorClipAccess
+++ FixupMonitorRgn
@@ -1,74 +1,25 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* void __cdecl FixupMonitorRgn(struct tagWND * __ptr64,bool) */

 

-bool CheckCursorClipAccess(int param_1,int param_2)

+void __cdecl FixupMonitorRgn(tagWND *param_1,bool param_2)

 

 {

   int iVar1;

-  uint uVar2;

-  tagTHREADINFO *ptVar3;

-  longlong lVar4;

-  int *piVar5;

-  undefined1 auStack_48 [32];

-  tagRECT local_28;

-  ulonglong local_18;

+  longlong lVar2;

+  undefined4 uVar3;

   

-                    /* 0x225990  21  CheckCursorClipAccess */

-  local_18 = __security_cookie ^ (ulonglong)auStack_48;

-  ptVar3 = _GetCurrentLogicalCursorThread();

-  if (param_1 == 0) {

-    lVar4 = W32GetUserGdiSessionState();

-    if ((**(longlong **)(ptVar3 + 0x1d0) != *(longlong *)(lVar4 + 0x28)) &&

-       (iVar1 = CheckWinstaAttributeAccess(0x10), iVar1 == 0)) {

-      iVar1 = IsImmersiveAppRestricted(*(undefined8 *)(ptVar3 + 0x1d0));

-      if (iVar1 == 0) {

-        return false;

-      }

-      iVar1 = IsGpqForegroundAccessibleForPti(ptVar3,1);

-      if (iVar1 == 0) {

-        return false;

-      }

-    }

-    lVar4 = W32GetUserSessionState();

-    CCursorClip::GetClip(*(CCursorClip **)(lVar4 + 0x8e20),&local_28);

-    lVar4 = W32GetUserSessionState();

-    if ((*(longlong *)(ptVar3 + 0x1d8) != *(longlong *)(lVar4 + 0x4a50)) && (param_2 == 0)) {

-      iVar1 = ERECTL::bWrapped((ERECTL *)&local_28);

-      return iVar1 == 0;

-    }

-  }

-  else {

-    if (param_1 == 1) {

-      uVar2 = CheckGrantedAccess(*(undefined4 *)(*(longlong *)(ptVar3 + 0x1d0) + 0x2b0),2);

+  if ((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x15) & 8) != 0) {

+    lVar2 = W32GetUserSessionState();

+    if ((*(uint *)**(undefined8 **)(lVar2 + 0xdf10) < 2) ||

+       (iVar1 = IsSmallerThanScreen(param_1), iVar1 != 0)) {

+      uVar3 = 0;

     }

     else {

-      if (param_1 != 2) {

-        return true;

-      }

-      iVar1 = IsDesktopApp(*(undefined8 *)(ptVar3 + 0x1d0));

-      if (iVar1 != 0) {

-        return false;

-      }

-      piVar5 = (int *)(*(longlong *)(ptVar3 + 0x1d0) + 0x134);

-      if (*(longlong *)(ptVar3 + 0x1d0) == 0) {

-        piVar5 = (int *)&DAT_0;

-      }

-      if (*piVar5 == 0) {

-        return false;

-      }

-      iVar1 = InForegroundQueue(ptVar3,0);

-      if (iVar1 == 0) {

-        return false;

-      }

-      if (*(longlong *)(*(longlong *)(ptVar3 + 0x1d0) + 0x340) == 0) {

-        return false;

-      }

-      uVar2 = *(uint *)(*(longlong *)(*(longlong *)(ptVar3 + 0x1d0) + 0x340) + 100) & 1;

+      uVar3 = 2;

     }

-    if (uVar2 == 0) {

-      return false;

-    }

+    SelectWindowRgn(param_1,uVar3,param_2);

+    return;

   }

-  return true;

+  return;

 }
```

## `xxxAdviseData`  (modified)

```diff
--- xxxAdviseData
+++ xxxAdvise
@@ -1,112 +1,19 @@
 

-/* unsigned long __cdecl xxxAdviseData(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

-   __ptr64) */

-

-ulong __cdecl xxxAdviseData(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

+ulong __cdecl xxxAdvise(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

-  tagINTDDEINFO *ptVar1;

-  ushort uVar2;

-  ulong uVar3;

-  int iVar4;

-  tagDDECONV *ptVar5;

-  tagPUBOBJ *ptVar6;

-  void *pvVar7;

-  longlong lVar8;

-  tagXSTATE *ptVar9;

-  uint uVar10;

-  bool bVar11;

-  ulong local_res20 [2];

-  tagINTDDEINFO *local_38;

-  void *local_30;

+  ulong uVar1;

+  longlong lVar2;

+  uint unaff_EBX;

   

-  local_res20[0] = 0x83;

-  pvVar7 = (void *)0x0;

-  local_38 = (tagINTDDEINFO *)0x0;

-  local_30 = (void *)0x0;

-  uVar3 = xxxCopyDdeIn((void *)*param_2,local_res20,&local_30,&local_38);

-  iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-  if (iVar4 == 0) {

-    lVar8 = _HMPheFromObject(param_3);

-    bVar11 = (bool)(~*(byte *)(lVar8 + 0x19) & 1);

+  lVar2 = _HMPheFromObject((tagDDECONV *)(ulonglong)(unaff_EBX >> 0x17));

+  if ((~*(byte *)(lVar2 + 0x19) & 1) == 0) {

+    uVar1 = 0;

   }

   else {

-    ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

-    bVar11 = ptVar5 == param_3;

+    PopState((tagDDECONV *)(ulonglong)(unaff_EBX >> 0x17));

+    uVar1 = 2;

   }

-  ptVar1 = local_38;

-  if (bVar11 == false) {

-    if (local_38 != (tagINTDDEINFO *)0x0) {

-      Win32FreePool();

-      return 3;

-    }

-    return 3;

-  }

-  if (uVar3 != 2) {

-    return uVar3;

-  }

-  uVar2 = *(ushort *)(local_38 + 0x48);

-  if ((uVar2 & 0xa000) == 0) {

-    uVar2 = uVar2 | 0x2000;

-    *(ushort *)(local_38 + 0x48) = uVar2;

-  }

-  if ((uVar2 & 0x2000) == 0) {

-    iVar4 = AddPublicObject((uint)*(ushort *)(local_38 + 0x4a),*(void **)(local_38 + 0x30),

-                            *(ulong *)(*(longlong *)

-                                        (*(longlong *)(*(longlong *)(param_3 + 0x28) + 0x10) + 0x1d0

-                                        ) + 0x38));

-    uVar10 = local_res20[0];

-    if (iVar4 != 0) {

-      uVar10 = local_res20[0] | 0x2000;

-    }

-  }

-  else {

-    ptVar6 = IsObjectPublic(*(void **)(local_38 + 0x30));

-    if (ptVar6 != (tagPUBOBJ *)0x0) {

-      Win32FreePool(ptVar1);

-      return 3;

-    }

-    iVar4 = GiveObject((uint)*(ushort *)(ptVar1 + 0x4a),*(void **)(ptVar1 + 0x30),

-                       *(ulong *)(*(longlong *)

-                                   (*(longlong *)(*(longlong *)(param_3 + 0x30) + 0x10) + 0x1d0) +

-                                 0x38));

-    uVar3 = local_res20[0];

-    if (iVar4 != 0) {

-      uVar3 = local_res20[0] | 0x4000;

-    }

-    uVar10 = uVar3 | 0x400;

-  }

-  *param_1 = *param_1 | 0x80000000;

-  if (*(short *)(ptVar1 + 0x48) < 0) {

-    pvVar7 = AnticipatePost(*(tagDDECONV **)(param_3 + 0x20),xxxAdviseDataAck,(void *)0x0,local_30,

-                            ptVar1,uVar10);

-  }

-  else {

-    xxxClientFreeDDEHandle(local_30);

-    iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-    if (iVar4 == 0) {

-      lVar8 = _HMPheFromObject(param_3);

-      bVar11 = (bool)(~*(byte *)(lVar8 + 0x19) & 1);

-    }

-    else {

-      ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3);

-      bVar11 = ptVar5 == param_3;

-    }

-    if (bVar11 == false) {

-      *param_2 = 0;

-      return 3;

-    }

-    ptVar9 = Createpxs((_func_ulong_ulong_ptr___int64_ptr_tagDDECONV_ptr *)0x0,(void *)0x0,

-                       (void *)0x0,ptVar1,uVar10 | 0x200);

-    if (ptVar9 != (tagXSTATE *)0x0) {

-      *(undefined8 *)(ptVar9 + 0x10) = *(undefined8 *)(*(longlong *)(param_3 + 0x30) + 0x10);

-      pvVar7 = *(void **)ptVar9;

-    }

-  }

-  *param_2 = (__int64)pvVar7;

-  if (pvVar7 == (void *)0x0) {

-    return 3;

-  }

-  return 2;

+  return uVar1;

 }
```

## `xxxDrawClipboard`  (modified)

```diff
--- xxxDrawClipboard
+++ xxxDrawClipboard
@@ -1,254 +1,52 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* void __cdecl xxxDrawClipboard(struct tagWINDOWSTATION * __ptr64) */

 

 void __cdecl xxxDrawClipboard(tagWINDOWSTATION *param_1)

 

 {

-  char *pcVar1;

-  char cVar2;

-  char cVar3;

-  PFE PVar4;

-  uint uVar5;

-  EFSOBJ *pEVar6;

-  tagWINDOWSTATION tVar7;

-  int iVar8;

-  int iVar9;

-  longlong lVar10;

-  tagPvtData *ptVar11;

-  char *pcVar12;

-  longlong in_RAX;

-  undefined8 *puVar13;

-  longlong lVar14;

-  ushort uVar15;

-  undefined4 *puVar16;

-  PFE *unaff_RBX;

-  tagWINDOWSTATION *ptVar17;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  uint uVar18;

-  undefined8 *puVar20;

-  char cVar21;

-  tagWINDOWSTATION *unaff_RDI;

-  _ENUMFONTSTYLE _Var22;

-  longlong unaff_R12;

-  int *unaff_R13;

-  uint unaff_R14D;

-  longlong *plVar23;

-  tagWINDOWSTATION *unaff_R15;

-  bool bVar24;

-  undefined1 in_ZF;

-  ulonglong uVar19;

+  ulong uVar1;

+  tagTHREADINFO *ptVar2;

+  undefined8 *puVar3;

+  tagWND *ptVar4;

+  undefined8 uVar5;

+  undefined1 auStackY_68 [32];

+  undefined8 local_38;

+  undefined4 local_30;

+  undefined8 local_28;

+  undefined4 local_20;

+  ulonglong local_18;

   

-  out(2,(char)in_RAX);

-code_r0x0001400f71fa:

-  if ((!(bool)in_ZF) && (*(undefined1 *)(unaff_RBP + -0x35) = 2, unaff_ESI == 1)) {

-    if ((int)param_1 == 0) {

-      tVar7 = *(tagWINDOWSTATION *)(in_RAX + 0x2c);

+  local_18 = __security_cookie ^ (ulonglong)auStackY_68;

+  *(uint *)(param_1 + 0x40) = *(uint *)(param_1 + 0x40) & 0xffffffbf;

+  if ((*(longlong *)(param_1 + 0x58) == 0) && (*(longlong *)(param_1 + 0x68) != 0)) {

+    ptVar2 = PtiCurrent();

+    *(tagTHREADINFO **)(param_1 + 0x58) = ptVar2;

+    Win32HM_LockIntoThread<0>

+              (ptVar2,*(_HEAD **)(param_1 + 0x68),(_Win32HMThreadLockItem *)&local_38);

+    uVar5 = 0;

+    if (*(undefined8 **)(param_1 + 0x70) != (undefined8 *)0x0) {

+      uVar5 = **(undefined8 **)(param_1 + 0x70);

     }

-    else {

-      tVar7 = *unaff_RDI;

+    xxxSendNotifyMessage(*(undefined8 *)(param_1 + 0x68),0x308,uVar5);

+    *(undefined8 *)(param_1 + 0x58) = 0;

+    Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+              ((Win32HMThreadLockBase<tagWND,0,0> *)&local_38);

+  }

+  for (ptVar4 = *(tagWND **)(param_1 + 0x98); ptVar4 != (tagWND *)0x0;

+      ptVar4 = *(tagWND **)(ptVar4 + 0xf0)) {

+    local_28 = 0;

+    local_20 = 0;

+    puVar3 = (undefined8 *)(*(longlong *)(*(longlong *)(ptVar4 + 0x10) + 0x1d0) + 0x130);

+    if (*(longlong *)(*(longlong *)(ptVar4 + 0x10) + 0x1d0) == 0) {

+      puVar3 = &local_28;

     }

-    *(tagWINDOWSTATION *)(unaff_RBP + -0x34) = tVar7;

+    local_38 = *puVar3;

+    local_30 = *(undefined4 *)(puVar3 + 1);

+    uVar1 = CountNumClipFormatForIL(&local_38,param_1);

+    _PostTransformableMessageExtended

+              (ptVar4,0x31d,(ulonglong)uVar1,0,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

   }

-  EFSOBJ::WriteEFE(*(EFSOBJ **)(unaff_RBP + -0x31),(_EFENTRY *)(unaff_RBP + -0x39),

-                   (PFEOBJ *)(unaff_RBP + -0x21));

-  uVar19 = 0;

-  if (unaff_R14D == 0) {

-    if (*(int *)(unaff_RBX + 0x84) == 0) goto LAB_0;

-    pEVar6 = *(EFSOBJ **)(unaff_RBP + -0x31);

-    *(undefined1 *)(unaff_RBP + -0x35) = 3;

-    do {

-      PVar4 = unaff_RBX[uVar19 + 0x8c];

-      *(ushort *)(unaff_RBP + -0x33) = (ushort)(byte)PVar4;

-      lVar14 = W32GetSessionState();

-      *(undefined1 *)(unaff_RBP + -0x34) =

-           *(undefined1 *)

-            (*(longlong *)(*(longlong *)(lVar14 + 0x60) + 0x4ce0) + 0x80 +

-            (ulonglong)(byte)PVar4 * 0xc4);

-      EFSOBJ::WriteEFE(pEVar6,(_EFENTRY *)(unaff_RBP + -0x39),(PFEOBJ *)(unaff_RBP + -0x21));

-      uVar18 = (int)uVar19 + 1;

-      uVar19 = (ulonglong)uVar18;

-    } while (uVar18 < *(uint *)(unaff_RBX + 0x84));

-  }

-  else {

-    if ((unaff_ESI != 1) || (*(int *)(*(longlong *)(unaff_RBX + 0x20) + 0x28) == 0))

-    goto LAB_0;

-    ptVar17 = unaff_RDI + 1;

-    tVar7 = *ptVar17;

-    if (tVar7 == (tagWINDOWSTATION)0x1) goto LAB_0;

-    pEVar6 = *(EFSOBJ **)(unaff_RBP + -0x31);

-    do {

-      if ((0xfd < (byte)tVar7) || (unaff_R15 <= ptVar17)) break;

-      *(undefined4 *)(unaff_RBP + -0x39) = 0;

-      *(undefined1 *)(unaff_RBP + -0x35) = 2;

-      *(undefined2 *)(unaff_RBP + -0x33) = 0;

-      *(tagWINDOWSTATION *)(unaff_RBP + -0x34) = tVar7;

-      EFSOBJ::WriteEFE(pEVar6,(_EFENTRY *)(unaff_RBP + -0x39),(PFEOBJ *)(unaff_RBP + -0x21));

-      ptVar17 = ptVar17 + 1;

-      tVar7 = *ptVar17;

-    } while (tVar7 != (tagWINDOWSTATION)0x1);

-  }

-  unaff_R13 = *(int **)(unaff_RBP + -0x19);

-LAB_0:

-  do {

-    iVar8 = 0;

-    do {

-      unaff_R12 = *(longlong *)(unaff_R12 + 0x30);

-      if (unaff_R12 == 0) {

-        return;

-      }

-      plVar23 = *(longlong **)(unaff_R12 + 8);

-    } while ((plVar23 == (longlong *)0x0) || ((*(uint *)(unaff_R12 + 0x20) & 2) != 0));

-    unaff_R13[7] = 1;

-    iVar9 = *(int *)(unaff_R12 + 0x18);

-    *(undefined8 *)(unaff_RBP + -1) = 0;

-    *(undefined8 *)(unaff_RBP + 7) = 0;

-    unaff_R13[8] = iVar9;

-    *(undefined4 *)(unaff_RBP + -0x39) = 0;

-    do {

-      unaff_RBX = (PFE *)plVar23[1];

-      uVar18 = *(uint *)(unaff_RBX + 0xc);

-      lVar14 = *(longlong *)(unaff_RBX + 0x20);

-      if ((((((((uVar18 & 2) == 0) && (uVar5 = *(uint *)(lVar14 + 0x30), (uVar5 >> 0x17 & 1) == 0))

-             && ((uVar18 & 8) == 0)) &&

-            (((unaff_R13[6] == 0 || ((uVar5 & 2) == 0)) &&

-             ((unaff_R13[3] == 0 || ((uVar5 & 1) == 0)))))) &&

-           ((unaff_R13[4] == 0 || ((uVar5 & 1) != 0)))) &&

-          ((*unaff_R13 == 0 ||

-           (((uVar18 & 1) != 0 || (uVar5 & 2) == 0 ||

-            ((unaff_R13[1] == *(int *)(lVar14 + 0x80) && (unaff_R13[2] == *(int *)(lVar14 + 0x84))))

-            ))))) && ((unaff_R13[7] == 0 || ((unaff_R13[8] == 0 || ((uVar5 & 2) == 0)))))) {

-        lVar14 = *(longlong *)unaff_RBX;

-        bVar24 = true;

-        *(longlong *)(unaff_RBP + -0x11) = lVar14;

-        lVar10 = W32GetSessionState();

-        if (*(longlong *)(lVar14 + 0x88) == *(longlong *)(*(longlong *)(lVar10 + 0x60) + 0x4fb8)) {

-          ptVar11 = PFFOBJ::pPvtDataMatch((PFFOBJ *)(unaff_RBP + -0x11),(ulong *)0x0);

-          if (ptVar11 != (tagPvtData *)0x0) {

-            bVar24 = *(int *)(ptVar11 + 4) != 0;

-          }

-          if (!bVar24) {

-LAB_1:

-            if (((unaff_R13[5] == 0) || ((*(uint *)(unaff_RBX + 0xc) & 1) != 0)) &&

-               ((*(uint *)(unaff_RBX + 0xc) & 0x44) == 0)) {

-              if (unaff_R13[9] != 1) {

-                lVar14 = *(longlong *)(unaff_RBX + 0x20);

-                cVar2 = (char)unaff_R13[9];

-                if (*(int *)(lVar14 + 0x28) == 0) {

-                  cVar21 = *(char *)(lVar14 + 0x2c);

-                }

-                else {

-                  if (cVar2 == '\x01') {

-                    lVar10 = W32GetSessionState();

-                    cVar2 = *(char *)(*(longlong *)(lVar10 + 0x60) + 0x4d18);

-                  }

-                  if (cVar2 == -2) {

-                    cVar21 = -2;

-                  }

-                  else {

-                    pcVar12 = (char *)(*(int *)(lVar14 + 0x28) + lVar14);

-                    cVar3 = *pcVar12;

-                    pcVar1 = pcVar12 + 0x10;

-                    for (; pcVar12 < pcVar1; pcVar12 = pcVar12 + 1) {

-                      cVar21 = cVar2;

-                      if (*pcVar12 == cVar2) goto LAB_2;

-                      if (*pcVar12 == '\x01') break;

-                    }

-                    cVar21 = cVar3;

-                    if (*(longlong *)(unaff_RBX + 0x78) != 0) {

-                      puVar20 = *(undefined8 **)(*(longlong *)(unaff_RBX + 0x78) + 0x10);

-                      while( true ) {

-                        if (*(longlong *)(unaff_RBX + 0x78) == 0) {

-                          lVar14 = W32GetSessionState();

-                          puVar13 = (undefined8 *)(*(longlong *)(lVar14 + 0x60) + 0x3738);

-                        }

-                        else {

-                          puVar13 = (undefined8 *)(*(longlong *)(unaff_RBX + 0x78) + 0x10);

-                        }

-                        cVar21 = cVar3;

-                        if (puVar20 == puVar13) break;

-                        lVar14 = *(longlong *)(puVar20[4] + 0x20);

-                        if (*(int *)(lVar14 + 0x28) == 0) {

-                          cVar21 = cVar2;

-                          if (*(char *)(lVar14 + 0x2c) == cVar2) break;

-                        }

-                        else {

-                          pcVar12 = (char *)(*(int *)(lVar14 + 0x28) + lVar14);

-                          pcVar1 = pcVar12 + 0x10;

-                          for (; pcVar12 < pcVar1; pcVar12 = pcVar12 + 1) {

-                            cVar21 = cVar2;

-                            if (*pcVar12 == cVar2) goto LAB_2;

-                            if (*pcVar12 == '\x01') break;

-                          }

-                        }

-                        puVar20 = (undefined8 *)*puVar20;

-                      }

-                    }

-LAB_2:

-                    iVar8 = *(int *)(unaff_RBP + -0x39);

-                  }

-                }

-                if (cVar21 != (char)unaff_R13[9]) goto LAB_3;

-              }

-              _Var22 = 0;

-              if (*(int *)(unaff_RBP + -0x29) != 1) {

-                in_RAX = *(longlong *)(unaff_RBX + 0x20);

-                unaff_ESI = unaff_R13[9];

-                *(undefined8 *)(unaff_RBP + -0x39) = 0;

-                param_1 = (tagWINDOWSTATION *)(longlong)*(int *)(in_RAX + 0x28);

-                *(PFE **)(unaff_RBP + -0x21) = unaff_RBX;

-                *(char *)(unaff_RBP + -0x34) = (char)unaff_ESI;

-                unaff_RDI = param_1 + in_RAX;

-                unaff_R15 = unaff_RDI + 0x10;

-                unaff_R14D = *(uint *)(unaff_RBP + -0x25) & 2;

-                in_ZF = unaff_R14D == 0;

-                goto code_r0x0001400f71fa;

-              }

-              lVar14 = *(longlong *)(unaff_RBX + 0x20);

-              uVar15 = *(ushort *)(lVar14 + 0x34) & 0x21;

-              if (uVar15 == 1) {

-                iVar9 = *(int *)(unaff_RBP + 7);

-                puVar16 = (undefined4 *)(unaff_RBP + 7);

-                _Var22 = 2;

-              }

-              else if (uVar15 == 0x20) {

-                iVar9 = *(int *)(unaff_RBP + 3);

-                puVar16 = (undefined4 *)(unaff_RBP + 3);

-                _Var22 = 1;

-              }

-              else if (uVar15 == 0x21) {

-                iVar9 = *(int *)(unaff_RBP + 0xb);

-                puVar16 = (undefined4 *)(unaff_RBP + 0xb);

-                _Var22 = 3;

-              }

-              else {

-                iVar9 = *(int *)(unaff_RBP + -1);

-                puVar16 = (undefined4 *)(unaff_RBP + -1);

-              }

-              if (iVar9 == 0) {

-                *puVar16 = 1;

-              }

-              else {

-                iVar9 = _wcsicmp((wchar_t *)(*(int *)(lVar14 + 8) + lVar14),

-                                 (wchar_t *)(*(int *)(lVar14 + 0x10) + lVar14));

-                _Var22 = (iVar9 != 0) + 4;

-              }

-              if ((iVar8 == 0) || (_Var22 == 5)) {

-                iVar8 = EFSOBJ::bAdd(*(EFSOBJ **)(unaff_RBP + -0x31),unaff_RBX,_Var22,0,1);

-                if (iVar8 == 0) {

-                  return;

-                }

-                iVar8 = 1;

-                *(undefined4 *)(unaff_RBP + -0x39) = 1;

-              }

-            }

-          }

-        }

-        else if (*(int *)(lVar14 + 0x38) != 0) goto LAB_1;

-      }

-LAB_3:

-      plVar23 = (longlong *)*plVar23;

-    } while (plVar23 != (longlong *)0x0);

-  } while( true );

+  return;

 }
```

## `ApiSetpIsFeatureEnabled`  (modified)

```diff
--- ApiSetpIsFeatureEnabled
+++ ApiSetpIsFeatureEnabled
@@ -1,9 +1,17 @@
 

-byte ApiSetpIsFeatureEnabled(void)

+bool ApiSetpIsFeatureEnabled(int param_1)

 

 {

-  byte in_AL;

+  char cVar1;

+  int iVar2;

   

-  return in_AL & 0x40;

+  if (param_1 == 0x3a132a5) {

+    iVar2 = Feature_DriverSetup_ReofferFingerprinting_v2__private_IsEnabledDeviceUsageNoInline();

+    cVar1 = (iVar2 != 0) + '\x01';

+  }

+  else {

+    cVar1 = '\0';

+  }

+  return cVar1 == '\x02';

 }
```

## `NtUserPostMessage`  (modified)

```diff
--- NtUserPostMessage
+++ xxxSleepThread2
@@ -1,92 +1,22 @@
 

-longlong NtUserPostMessage(longlong param_1,uint param_2,__uint64 param_3,__int64 param_4)

+int xxxSleepThread2(uint param_1,ulong param_2,int param_3,int param_4,SLEEP_STATUS *param_5)

 

 {

   bool bVar1;

   int iVar2;

-  uint uVar3;

-  tagWND *ptVar4;

-  tagQMSG *ptVar5;

-  tagWND *ptVar6;

-  tagTHREADINFO *ptVar7;

-  undefined8 uVar8;

+  tagTHREADINFO *ptVar3;

   

-                    /* 0x1d230  1861  NtUserPostMessage */

-  EnterCrit(0,1);

-  if ((param_2 & 0xfffe0000) != 0) {

-    UserSetLastError(0x57);

-    uVar3 = 0;

-    goto LAB_0;

+  bVar1 = false;

+  if ((((byte)param_1 & 7) == 7) ||

+     (((param_1 & 6) != 0 &&

+      (ptVar3 = PtiCurrent(), *(longlong *)(*(longlong *)(ptVar3 + 0x1d8) + 0x80) != 0)))) {

+    bVar1 = true;

+    xxxUpdateInputHangInfo((tagWND *)0x0,0);

   }

-  if ((param_2 < 0x400) && ((*(ushort *)(&MessageTable + (ulonglong)param_2 * 2) >> 0xd & 1) != 0))

-  {

-    uVar8 = 5;

+  iVar2 = xxxRealSleepThread(param_1,param_2,param_3,param_4,param_5);

+  if (bVar1) {

+    xxxUpdateInputHangInfo((tagWND *)0x0,1);

   }

-  else {

-    uVar3 = 0;

-    ptVar4 = (tagWND *)0x0;

-    if (param_1 != 0) {

-      if ((param_1 == 0xffff) || (param_1 == -1)) {

-        ptVar4 = (tagWND *)0xffffffffffffffff;

-      }

-      else {

-        ptVar4 = (tagWND *)ValidateHwnd(param_1);

-        if (ptVar4 == (tagWND *)0x0) {

-          uVar3 = (uint)(param_2 == 0x3e1);

-          goto LAB_0;

-        }

-      }

-    }

-    if (param_2 < 0x240) {

-      if ((param_2 - 0x119 & 0xfffffffd) != 0) {

-LAB_1:

-        if ((3 < param_2 - 0x241) && (iVar2 = IsPointerInputClientMessage(param_2), iVar2 == 0)) {

-          bVar1 = false;

-          if ((param_2 - 0x3e0 < 9) &&

-             (iVar2 = ValidateDDEConvPair(param_3,ptVar4), bVar1 = false, iVar2 != 0)) {

-            bVar1 = true;

-          }

-          if ((param_2 == 0x112) && (param_3 == 0xf030)) {

-            ptVar7 = PtiCurrent();

-            iVar2 = IAMThreadAccessGranted(ptVar7);

-            if (iVar2 != 0) {

-              bVar1 = true;

-            }

-          }

-          if ((ptVar4 + -1 < (tagWND *)0xfffffffffffffffe) && (!bVar1)) {

-            uVar8 = *(undefined8 *)(*(longlong *)(ptVar4 + 0x10) + 0x1d0);

-            ptVar6 = (tagWND *)PsGetCurrentProcessWin32Process();

-            if ((ptVar6 != (tagWND *)0x0) && (*(longlong *)ptVar6 == 0)) {

-              ptVar6 = (tagWND *)0x0;

-            }

-            iVar2 = CheckForMessageAccessCrossIL(ptVar6,uVar8,ptVar4,param_2,param_3,param_4);

-            if (iVar2 == 0) goto LAB_0;

-          }

-          ptVar5 = _PostTransformableMessageExtended

-                             (ptVar4,param_2,param_3,param_4,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

-          if (*(tagQMSG **)MmSystemRangeStart_exref <= ptVar5) {

-            ptVar5 = (tagQMSG *)(ulonglong)(ptVar5 != (tagQMSG *)0x0);

-          }

-          uVar3 = (uint)ptVar5;

-          goto LAB_0;

-        }

-      }

-      uVar8 = 0x3ea;

-    }

-    else {

-      if (0x240 < param_2) goto LAB_1;

-      if (ptVar4 + -1 < (tagWND *)0xfffffffffffffffe) {

-        ptVar7 = PtiCurrent();

-        uVar3 = ForwardTouchMessage(ptVar7,ptVar4,param_2,param_3,param_4,1,0,0,0);

-        goto LAB_0;

-      }

-      uVar8 = 0x578;

-    }

-  }

-  uVar3 = 0;

-  UserSetLastError(uVar8);

-LAB_0:

-  UserSessionSwitchLeaveCrit();

-  return (longlong)(int)uVar3;

+  return iVar2;

 }
```

## `UMPDDrvEnableSurface`  (modified)

```diff
--- UMPDDrvEnableSurface
+++ UMPDDrvEnableSurface
@@ -1,40 +1,173 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* struct HSURF__ * __ptr64 __cdecl UMPDDrvEnableSurface(struct DHPDEV__ * __ptr64) */

 

 HSURF__ * __cdecl UMPDDrvEnableSurface(DHPDEV__ *param_1)

 

 {

-  int iVar1;

-  longlong in_RAX;

-  undefined8 uVar2;

-  uint unaff_EBX;

-  int unaff_ESI;

-  bool in_ZF;

-  APIDCOBJ aAStackX_20 [8];

-  APIDCOBJ *in_stack_000000a8;

+  uint uVar1;

+  longlong lVar2;

+  bool bVar3;

+  char cVar4;

+  ulong uVar5;

+  _GRETHREAD *p_Var6;

+  _tlgWrapperByVal<4> *p_Var7;

+  _tlgProvider_t *p_Var8;

+  UMPDOBJ *this;

+  HSURF__ *pHVar9;

+  HSURF__ *pHVar10;

+  HSURF__ *pHVar11;

+  _GUID *p_Var12;

+  _GUID *p_Var13;

+  undefined1 auStackY_c8 [32];

+  _tlgWrapperByVal<4> *p_Var14;

+  undefined4 local_88;

+  undefined4 local_84;

+  HSURF__ *local_80;

+  undefined8 local_78;

+  UMPDOBJ *local_70;

+  SURFREF local_68 [32];

+  _GUID *local_48;

+  undefined1 local_40;

+  undefined2 local_3f;

+  undefined1 local_3d;

+  undefined4 local_3c;

+  undefined8 local_38;

+  undefined8 local_30;

+  DHPDEV__ *local_28;

+  ulonglong local_20;

   

-  if (!in_ZF) {

-    in_stack_000000a8 = aAStackX_20;

-    if (((*(uint *)(in_RAX + 0x1ec) != unaff_EBX) && ((*(uint *)(in_RAX + 0x24) & 0x4000) != 0)) &&

-       (iVar1 = DWMSCREENREADMODIFYWRITEASSIST::bInPathBracket

-                          ((DWMSCREENREADMODIFYWRITEASSIST *)&stack0x00000090), iVar1 == 0)) {

-      DWMSCREENREADMODIFYWRITEASSIST::vSaveAccumBoundsAndDisableSpriteUpdates

-                ((DWMSCREENREADMODIFYWRITEASSIST *)&stack0x00000090);

-      iVar1 = func_0x0001402041d8(aAStackX_20);

-      if (iVar1 != 0) {

-        unaff_ESI = DWMSCREENREADMODIFYWRITEASSIST::bReadFromAccumulatedBounds

-                              ((DWMSCREENREADMODIFYWRITEASSIST *)&stack0x00000090);

+  local_20 = __security_cookie ^ (ulonglong)auStackY_c8;

+  pHVar11 = (HSURF__ *)0x0;

+  local_3f = 0;

+  local_3d = 0;

+  local_38 = 0;

+  local_80 = (HSURF__ *)0x0;

+  XUMPDOBJ::XUMPDOBJ((XUMPDOBJ *)&local_70);

+  local_3f = 0;

+  local_3d = 0;

+  local_38 = 0;

+  pHVar9 = pHVar11;

+  if (local_70 == (UMPDOBJ *)0x0) goto LAB_0;

+  local_3c = 3;

+  local_40 = 0;

+  local_30 = *(undefined8 *)local_70;

+  local_28 = param_1;

+  uVar5 = UMPDOBJ::Thunk(local_70,&local_40,0x20,&local_80,8);

+  pHVar10 = local_80;

+  if (uVar5 == 0xffffffff) {

+    pHVar10 = pHVar11;

+  }

+  pHVar9 = pHVar10;

+  if (pHVar10 == (HSURF__ *)0x0) goto LAB_0;

+  SURFREF::SURFREF(local_68,pHVar10);

+  pHVar9 = pHVar11;

+  if (local_48 == (_GUID *)0x0) {

+LAB_1:

+    COLORSPACEREF::~COLORSPACEREF((COLORSPACEREF *)local_68);

+  }

+  else {

+    p_Var6 = GreGetCurrentThread();

+    if ((p_Var6 != (_GRETHREAD *)0x0) &&

+       (p_Var12 = *(_GUID **)(p_Var6 + 0x150), p_Var12 != (_GUID *)0x0)) {

+      for (; pHVar9 < *(HSURF__ **)p_Var12[1].Data4; pHVar9 = pHVar9 + 1) {

+        if (*(uint *)(*(longlong *)p_Var12[2].Data4 + (longlong)pHVar9 * 4) ==

+            ((uint)((ulonglong)pHVar10 >> 8) & 0xff0000 | (uint)pHVar10 & 0xffff))

+        goto LAB_2;

       }

-      DWMSCREENREADMODIFYWRITEASSIST::vRestoreAccumBoundsAndEnableSpriteUpdates

-                ((DWMSCREENREADMODIFYWRITEASSIST *)&stack0x00000090);

+      bVar3 = ThreadRestrictNewHandlesRegion::Protect(*(_GRETHREAD **)p_Var12,pHVar10);

+      if (!bVar3) {

+        MicrosoftTelemetryAssertTriggeredNoArgsKM();

+        COLORSPACEREF::~COLORSPACEREF((COLORSPACEREF *)local_68);

+        XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_70);

+        return (HSURF__ *)0x0;

+      }

+LAB_2:

+      if (*(int *)local_48->Data4 == 1) {

+        lVar2._0_4_ = local_48[3].Data1;

+        lVar2._4_2_ = local_48[3].Data2;

+        lVar2._6_2_ = local_48[3].Data3;

+        if (lVar2 == 0) {

+          if (5 < DAT_3) {

+            p_Var8 = (_tlgProvider_t *)&DAT_3;

+            cVar4 = _tlgKeywordOn(&DAT_3,0x400000000000);

+            if (cVar4 != '\0') {

+              local_88 = 0x12094;

+LAB_4:

+              p_Var14 = (_tlgWrapperByVal<4> *)&local_80;

+              p_Var7 = (_tlgWrapperByVal<4> *)&local_88;

+              local_80 = (HSURF__ *)((ulonglong)local_80 & 0xffffffff00000000);

+              goto LAB_5;

+            }

+          }

+        }

+        else {

+          uVar1 = local_48[7].Data1;

+          this = (UMPDOBJ *)(ulonglong)uVar1;

+          if ((uVar1 >> 0x12 & 1) != 0) {

+            if ((local_48[6].Data2 == 1) && (((byte)uVar1 & 0x29) != 0x29)) {

+              pHVar10 = pHVar11;

+            }

+            p_Var13 = local_48;

+            if (((uVar1 >> 0x1a & 1) != 0) && (pHVar10 = pHVar11, 5 < DAT_3)) {

+              this = (UMPDOBJ *)&DAT_3;

+              cVar4 = _tlgKeywordOn(&DAT_3,0x400000000000);

+              if (cVar4 != '\0') {

+                local_80 = (HSURF__ *)((ulonglong)local_80 & 0xffffffff00000000);

+                local_84 = 1;

+                local_78 = 0x1000000;

+                local_88 = 0xfd02;

+                _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+                ::

+                Write<_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>_>

+                          ((_tlgProvider_t *)this,&DAT_6,p_Var12,p_Var13,

+                           (_tlgWrapperByVal<4> *)&local_88,(_tlgWrapperByVal<8> *)&local_78,

+                           (_tlgWrapperByVal<4> *)&local_84,(_tlgWrapperByVal<4> *)&local_80);

+                p_Var13 = local_48;

+              }

+            }

+            pHVar9 = pHVar10;

+            if (local_70[0x1c8] != (UMPDOBJ)0x0) {

+              if (p_Var13 != (_GUID *)0x0) {

+                pHVar11 = (HSURF__ *)p_Var13[1].Data4;

+              }

+              UMPDOBJ::vClient(this,pHVar11);

+            }

+            goto LAB_1;

+          }

+          if (5 < DAT_3) {

+            p_Var8 = (_tlgProvider_t *)&DAT_3;

+            cVar4 = _tlgKeywordOn(&DAT_3,0x400000000000);

+            if (cVar4 != '\0') {

+              local_88 = 0x1192c;

+              goto LAB_4;

+            }

+          }

+        }

+      }

+      else if (5 < DAT_3) {

+        p_Var8 = (_tlgProvider_t *)&DAT_3;

+        cVar4 = _tlgKeywordOn(&DAT_3,0x400000000000);

+        if (cVar4 != '\0') {

+          p_Var14 = (_tlgWrapperByVal<4> *)&local_88;

+          local_88 = 0;

+          local_80 = (HSURF__ *)CONCAT44(local_80._4_4_,0x127ee);

+          p_Var7 = (_tlgWrapperByVal<4> *)&local_80;

+LAB_5:

+          local_84 = 1;

+          local_78 = 0x1000000;

+          _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+          ::Write<_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>_>

+                    (p_Var8,&DAT_6,p_Var12,local_48,p_Var7,(_tlgWrapperByVal<8> *)&local_78,

+                     (_tlgWrapperByVal<4> *)&local_84,p_Var14);

+        }

+      }

     }

-    unaff_EBX = func_0x0001402041d8(aAStackX_20);

-    if (unaff_ESI != 0) {

-      uVar2 = UserReferenceDwmApiPort();

-      DwmSyncFlushAndWaitForBatch(uVar2);

-    }

+    COLORSPACEREF::~COLORSPACEREF((COLORSPACEREF *)local_68);

+    pHVar9 = pHVar11;

   }

-  APIDCOBJ::~APIDCOBJ(aAStackX_20);

-  return (HSURF__ *)(ulonglong)unaff_EBX;

+LAB_0:

+  XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_70);

+  return pHVar9;

 }
```

## `CheckClipboardAccessForIntegrityLevel`  (modified)

```diff
--- CheckClipboardAccessForIntegrityLevel
+++ CheckClipboardAccessForIntegrityLevel
@@ -1,244 +1,50 @@
 

-int __cdecl CheckClipboardAccessForIntegrityLevel(short param_1,longlong param_2)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl CheckClipboardAccessForIntegrityLevel(struct tagUIPI_INFO,struct tagUIPI_INFO) */

+

+int __cdecl CheckClipboardAccessForIntegrityLevel(undefined8 *param_1,tagUIPI_INFO *param_2)

 

 {

-  undefined8 *puVar1;

-  byte bVar2;

-  int iVar3;

-  char cVar4;

-  char cVar5;

-  undefined8 uVar6;

-  bool bVar7;

-  ulonglong uVar8;

-  longlong lVar9;

-  uint uVar10;

-  uint uVar11;

-  uint uVar12;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  uint unaff_ESI;

-  longlong unaff_RDI;

-  longlong in_R10;

-  undefined8 unaff_R12;

-  ulonglong unaff_R13;

-  longlong *unaff_R14;

-  int unaff_R15D;

-  bool in_ZF;

-  char in_SF;

-  char in_OF;

-  float fVar13;

-  float fVar14;

+  undefined4 uVar1;

+  bool bVar2;

+  undefined4 uVar3;

+  ulonglong uVar4;

+  uint uVar5;

+  uint *puVar6;

+  undefined1 auStack_58 [32];

+  undefined8 local_38;

+  undefined4 local_28;

+  undefined4 uStack_24;

+  undefined4 local_20;

+  ulonglong local_18;

   

-  if (in_ZF || in_OF != in_SF) {

-    param_1 = (short)&stack0x00000000;

+  local_18 = __security_cookie ^ (ulonglong)auStack_58;

+  local_38 = *param_1;

+  puVar6 = (uint *)&DAT_0;

+  local_20 = 0;

+  uVar4 = 0;

+  do {

+    uVar5 = (int)uVar4 + 1;

+    if ((*puVar6 <= (uint)local_38) &&

+       ((uint)local_38 < *(uint *)(&DAT_0 + (ulonglong)uVar5 * 4))) break;

+    puVar6 = puVar6 + 8;

+    uVar4 = (ulonglong)uVar5;

+  } while (uVar5 < 5);

+  uVar3 = DAT_1;

+  uVar1 = DAT_2;

+  if ((int)uVar4 != 5) {

+    while ((uint)uVar4 < 5) {

+      uVar5 = (uint)uVar4 + 1;

+      if ((&DAT_3)[(ulonglong)uVar5 * 8] != 0) {

+        uVar3 = *(undefined4 *)((longlong)&DAT_0 + uVar4 * 0x20 + 4);

+        uVar1 = *(undefined4 *)(&DAT_0 + uVar4 * 4);

+        break;

+      }

+      uVar4 = (ulonglong)uVar5;

+    }

   }

-  *(int *)(param_2 + 0x18) = (int)param_1;

-  *(int *)(param_2 + 0x1c) = (int)*(short *)(unaff_RDI + 0x4c);

-  *(int *)(unaff_RBX + 0x20) = (int)*(short *)(unaff_RDI + 0x4e);

-  *(longlong *)(unaff_RBP + -0x10) = in_R10;

-  uVar10 = (uint)unaff_R12;

-  if ((*(uint *)(in_R10 + 0x20) & 2) == 0) {

-    *(uint *)(unaff_RBP + -0x1c) = *(uint *)(unaff_RBP + -0x1c) & uVar10;

-    *(undefined4 *)(unaff_RBP + -0x20) = 0x3f800000;

-    bVar7 = EXFORMOBJ::bXform((EXFORMOBJ *)(unaff_RBP + -0x10),(VECTORFL *)(unaff_RBP + -0x20),

-                              (VECTORFL *)(unaff_RBP + -0x20),1);

-    if (!bVar7) {

-      return 0;

-    }

-    EFLOAT::eqLength((EFLOAT *)(unaff_RBP + 0x60),(POINTFL *)(unaff_RBP + 0x50));

-    *(uint *)(unaff_RBP + -0x18) = *(uint *)(unaff_RBP + -0x18) & uVar10;

-    *(undefined4 *)(unaff_RBP + -0x14) = 0x3f800000;

-    if (((*(uint *)(*(longlong *)(unaff_RBP + -0x10) + 0x20) & 2) == 0) &&

-       (bVar7 = EXFORMOBJ::bXform((EXFORMOBJ *)(unaff_RBP + -0x10),(VECTORFL *)(unaff_RBP + -0x18),

-                                  (VECTORFL *)(unaff_RBP + -0x18),1), !bVar7)) {

-      return 0;

-    }

-    EFLOAT::eqLength((EFLOAT *)(unaff_RBP + 0x48),(POINTFL *)(unaff_RBP + 0x50));

-    fVar14 = *(float *)(unaff_RBP + 0x48);

-    fVar13 = (float)*(int *)(unaff_RBX + 8) * fVar14;

-    uVar12 = (int)fVar13 >> 0x17 & 0xff;

-    cVar5 = (char)unaff_ESI;

-    uVar11 = uVar10;

-    if (uVar12 < 0x9f) {

-      uVar8 = (uint)fVar13 & unaff_R13 | 0x800000;

-      cVar4 = (char)((int)fVar13 >> 0x17);

-      if (uVar12 < unaff_ESI) {

-        lVar9 = (longlong)uVar8 >> (cVar5 - cVar4 & 0x3fU);

-      }

-      else {

-        lVar9 = uVar8 << (cVar4 + 0x8aU & 0x3f);

-      }

-      uVar11 = (uint)((ulonglong)(lVar9 + 0x80000000) >> 0x20);

-      if ((int)fVar13 < 0) {

-        uVar11 = -uVar11;

-      }

-    }

-    *(uint *)(unaff_RBX + 8) = uVar11;

-    fVar13 = (float)*(int *)(unaff_RBX + 0xc) * fVar14;

-    uVar12 = (int)fVar13 >> 0x17 & 0xff;

-    uVar11 = uVar10;

-    if (uVar12 < 0x9f) {

-      uVar8 = (uint)fVar13 & unaff_R13 | 0x800000;

-      cVar4 = (char)((int)fVar13 >> 0x17);

-      if (uVar12 < unaff_ESI) {

-        lVar9 = (longlong)uVar8 >> (cVar5 - cVar4 & 0x3fU);

-      }

-      else {

-        lVar9 = uVar8 << (cVar4 + 0x8aU & 0x3f);

-      }

-      uVar11 = (uint)((ulonglong)(lVar9 + 0x80000000) >> 0x20);

-      if ((int)fVar13 < 0) {

-        uVar11 = -uVar11;

-      }

-    }

-    *(uint *)(unaff_RBX + 0xc) = uVar11;

-    fVar13 = (float)*(int *)(unaff_RBX + 0x1c) * *(float *)(unaff_RBP + 0x60);

-    uVar12 = (int)fVar13 >> 0x17 & 0xff;

-    uVar11 = uVar10;

-    if (uVar12 < 0x9f) {

-      uVar8 = (uint)fVar13 & unaff_R13 | 0x800000;

-      cVar4 = (char)((int)fVar13 >> 0x17);

-      if (uVar12 < unaff_ESI) {

-        lVar9 = (longlong)uVar8 >> (cVar5 - cVar4 & 0x3fU);

-      }

-      else {

-        lVar9 = uVar8 << (cVar4 + 0x8aU & 0x3f);

-      }

-      uVar11 = (uint)((ulonglong)(lVar9 + 0x80000000) >> 0x20);

-      if ((int)fVar13 < 0) {

-        uVar11 = -uVar11;

-      }

-    }

-    *(uint *)(unaff_RBX + 0x1c) = uVar11;

-    fVar13 = (float)*(int *)(unaff_RBX + 0x20) * *(float *)(unaff_RBP + 0x60);

-    uVar12 = (int)fVar13 >> 0x17 & 0xff;

-    uVar11 = uVar10;

-    if (uVar12 < 0x9f) {

-      uVar8 = (uint)fVar13 & unaff_R13 | 0x800000;

-      cVar4 = (char)((int)fVar13 >> 0x17);

-      if (uVar12 < unaff_ESI) {

-        lVar9 = (longlong)uVar8 >> (cVar5 - cVar4 & 0x3fU);

-      }

-      else {

-        lVar9 = uVar8 << (cVar4 + 0x8aU & 0x3f);

-      }

-      uVar11 = (uint)((ulonglong)(lVar9 + 0x80000000) >> 0x20);

-      if ((int)fVar13 < 0) {

-        uVar11 = -uVar11;

-      }

-    }

-    *(uint *)(unaff_RBX + 0x20) = uVar11;

-    fVar13 = (float)*(int *)(unaff_RBX + 0x14) * fVar14;

-    uVar12 = (int)fVar13 >> 0x17 & 0xff;

-    uVar11 = uVar10;

-    if (uVar12 < 0x9f) {

-      uVar8 = (uint)fVar13 & unaff_R13 | 0x800000;

-      cVar4 = (char)((int)fVar13 >> 0x17);

-      if (uVar12 < unaff_ESI) {

-        lVar9 = (longlong)uVar8 >> (cVar5 - cVar4 & 0x3fU);

-      }

-      else {

-        lVar9 = uVar8 << (cVar4 + 0x8aU & 0x3f);

-      }

-      uVar11 = (uint)((ulonglong)(lVar9 + 0x80000000) >> 0x20);

-      if ((int)fVar13 < 0) {

-        uVar11 = -uVar11;

-      }

-    }

-    *(uint *)(unaff_RBX + 0x14) = uVar11;

-    fVar14 = (float)*(int *)(unaff_RBX + 0x18) * fVar14;

-    uVar12 = (int)fVar14 >> 0x17 & 0xff;

-    uVar11 = uVar10;

-    if (uVar12 < 0x9f) {

-      uVar8 = (uint)fVar14 & unaff_R13 | 0x800000;

-      cVar4 = (char)((int)fVar14 >> 0x17);

-      if (uVar12 < unaff_ESI) {

-        lVar9 = (longlong)uVar8 >> (cVar5 - cVar4 & 0x3fU);

-      }

-      else {

-        lVar9 = uVar8 << (cVar4 + 0x8aU & 0x3f);

-      }

-      uVar11 = (uint)((ulonglong)(lVar9 + 0x80000000) >> 0x20);

-      if ((int)fVar14 < 0) {

-        uVar11 = -uVar11;

-      }

-    }

-    *(uint *)(unaff_RBX + 0x18) = uVar11;

-  }

-  *(undefined4 *)(unaff_RBX + 0x2c) = *(undefined4 *)(unaff_RBP + 0x70);

-  *(undefined4 *)(unaff_RBX + 0x30) = *(undefined4 *)(unaff_RBP + 0x78);

-  *(int *)(unaff_RBX + 0x10) = *(int *)(unaff_RBX + 8) - *(int *)(unaff_RBX + 0xc);

-  *(uint *)(unaff_RBX + 0x24) = (uint)*(ushort *)(unaff_RDI + 0x2e);

-  *(char *)(unaff_RBX + 0x3c) = -((*(byte *)(unaff_RDI + 0x34) & 1) != 0);

-  *(byte *)(unaff_RBX + 0x3d) = *(byte *)(unaff_RDI + 0x34) & 2;

-  *(byte *)(unaff_RBX + 0x3e) = *(byte *)(unaff_RDI + 0x34) & 0x10;

-  *(undefined2 *)(unaff_RBX + 0x34) = *(undefined2 *)(unaff_RDI + 0x70);

-  *(undefined2 *)(unaff_RBX + 0x36) = *(undefined2 *)(unaff_RDI + 0x72);

-  *(undefined2 *)(unaff_RBX + 0x38) = *(undefined2 *)(unaff_RDI + 0x74);

-  *(undefined2 *)(unaff_RBX + 0x3a) = *(undefined2 *)(unaff_RDI + 0x76);

-  *(undefined1 *)(unaff_RBX + 0x40) = *(undefined1 *)(unaff_RDI + 0x2c);

-  uVar11 = *(uint *)(unaff_RDI + 0x30);

-  bVar2 = *(byte *)(unaff_RDI + 0x2d);

-  *(uint *)(unaff_RBX + 0x28) = uVar10;

-  *(uint *)(unaff_RBX + 0x44) = uVar10;

-  *(byte *)(unaff_RBX + 0x3f) =

-       (uVar11 & 0x401000) == 0 | -((uVar11 & 8) != 0) & 10U | -((uVar11 & 1) != 0) & 6U |

-       (byte)(uVar11 >> 1) & 2 | bVar2 & 0xf0 | -(unaff_R15D != 0) & 8U;

-  if ((*(ushort *)(unaff_RDI + 0x34) & 0x21) == 0) {

-    uVar10 = 0x40;

-  }

-  else {

-    if ((*(ushort *)(unaff_RDI + 0x34) & 1) != 0) {

-      *(undefined4 *)(unaff_RBX + 0x44) = 1;

-      uVar10 = 1;

-    }

-    if ((*(byte *)(unaff_RDI + 0x34) & 0x20) == 0) goto LAB_0;

-    uVar10 = uVar10 | 0x20;

-  }

-  *(uint *)(unaff_RBX + 0x44) = uVar10;

-LAB_0:

-  if ((*(uint *)(unaff_RDI + 0x30) & 0x20000000) != 0) {

-    uVar10 = uVar10 | 0x10000;

-    *(uint *)(unaff_RBX + 0x44) = uVar10;

-  }

-  if ((int)*(uint *)(unaff_RDI + 0x30) < 0) {

-    if ((*(uint *)(unaff_RDI + 0x30) >> 0xe & 1) != 0) {

-      uVar10 = uVar10 | 0x80000;

-      *(uint *)(unaff_RBX + 0x44) = uVar10;

-    }

-    if ((*(uint *)(unaff_RDI + 0x30) & 0x4000000) == 0) {

-      uVar10 = uVar10 | 0x100000;

-    }

-    else {

-      uVar10 = uVar10 | 0x20000;

-    }

-    *(uint *)(unaff_RBX + 0x44) = uVar10;

-  }

-  if (((*(uint *)(unaff_RDI + 0x30) & 0x40000) != 0) &&

-     (*(uint *)(unaff_RBX + 0x44) = uVar10 | 0x200000, (*(uint *)(unaff_RDI + 0x30) & 1) != 0)) {

-    *(uint *)(unaff_RBX + 0x44) = uVar10 | 0x240000;

-  }

-  *(int *)(unaff_RBX + 0x48) = (int)*(short *)(unaff_RDI + 0x38);

-  *(int *)(unaff_RBX + 0x4c) = (int)*(short *)(unaff_RDI + 0x3c) + (int)*(short *)(unaff_RDI + 0x3e)

-  ;

-  *(int *)(unaff_RBX + 0x50) = (int)*(short *)(unaff_RDI + 0x4c);

-  *(undefined1 *)(unaff_RBX + 4) = *(undefined1 *)(unaff_RDI + 0x6c);

-  *(undefined1 *)(unaff_RBX + 5) = *(undefined1 *)(unaff_RDI + 0x6d);

-  *(undefined1 *)(unaff_RBX + 6) = *(undefined1 *)(unaff_RDI + 0x6e);

-  *(undefined1 *)(unaff_RBX + 7) = *(undefined1 *)(unaff_RDI + 0x6f);

-  if ((*(uint *)(*(longlong *)(*unaff_R14 + 0x20) + 4) < 5) ||

-     (iVar3 = *(int *)(*(longlong *)(*unaff_R14 + 0x20) + 0xc4), iVar3 == 0)) {

-    *(undefined8 *)(unaff_RBX + 0x54) = 0;

-    *(undefined8 *)(unaff_RBX + 0x5c) = 0;

-    *(undefined8 *)(unaff_RBX + 100) = unaff_R12;

-  }

-  else {

-    puVar1 = (undefined8 *)(iVar3 + unaff_RDI);

-    uVar6 = puVar1[1];

-    *(undefined8 *)(unaff_RBX + 0x54) = *puVar1;

-    *(undefined8 *)(unaff_RBX + 0x5c) = uVar6;

-    *(undefined8 *)(unaff_RBX + 100) = *(undefined8 *)((longlong)iVar3 + 0x10 + unaff_RDI);

-  }

-  return 1;

+  _local_28 = CONCAT44(uVar3,uVar1);

+  bVar2 = UIPrivilegeIsolation::CheckAccess((tagUIPI_INFO *)&local_28,param_2,0);

+  return (int)bVar2;

 }
```

## `UMPDDrvTextOut`  (modified)

```diff
--- UMPDDrvTextOut
+++ UMPDDrvTextOut
@@ -1,73 +1,172 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl UMPDDrvTextOut(struct _SURFOBJ * __ptr64,struct _STROBJ * __ptr64,struct _FONTOBJ *

+   __ptr64,struct _CLIPOBJ * __ptr64,struct _RECTL * __ptr64,struct _RECTL * __ptr64,struct

+   _BRUSHOBJ * __ptr64,struct _BRUSHOBJ * __ptr64,struct _POINTL * __ptr64,unsigned long) */

 

 int __cdecl

 UMPDDrvTextOut(_SURFOBJ *param_1,_STROBJ *param_2,_FONTOBJ *param_3,_CLIPOBJ *param_4,

               _RECTL *param_5,_RECTL *param_6,_BRUSHOBJ *param_7,_BRUSHOBJ *param_8,_POINTL *param_9

               ,ulong param_10)

 

 {

-  int extraout_EAX;

-  longlong lVar1;

-  undefined8 uVar2;

-  HDC hWnd;

-  longlong in_RAX;

-  HDC hDC;

-  undefined8 *unaff_RBX;

-  longlong unaff_RBP;

-  HWND unaff_R14;

-  uint *unaff_R15;

-  undefined4 uVar3;

-  undefined8 in_stack_00000020;

-  int in_stack_000000a8;

-  int in_stack_000000ac;

-  undefined8 in_stack_000000b0;

+  _RECTL *p_Var1;

+  _RECTL *p_Var2;

+  ulonglong uVar3;

+  _FONTOBJ *p_Var4;

+  int iVar5;

+  ulong uVar6;

+  uint uVar7;

+  ulong uVar8;

+  ulonglong uVar9;

+  uint uVar10;

+  _RECTL *p_Var11;

+  int iVar12;

+  ulong uVar13;

+  int iVar14;

+  undefined1 auStackY_178 [32];

+  int in_stack_fffffffffffffea8;

+  int *piVar15;

+  ulong local_130 [2];

+  _FONTOBJ *local_128;

+  int local_120 [2];

+  void *local_118;

+  void *local_110;

+  UMPDOBJ *local_108;

+  _FONTOBJ *local_100;

+  _CLIPOBJ *local_f8;

+  _RECTL *local_f0;

+  _BRUSHOBJ *local_e8;

+  _BRUSHOBJ *local_e0;

+  _POINTL *local_d8;

+  undefined1 local_c8;

+  undefined2 local_c7;

+  undefined1 local_c5;

+  undefined4 local_c4;

+  undefined8 local_c0;

+  undefined8 local_b8;

+  _SURFOBJ *local_b0;

+  _STROBJ *local_a8;

+  _FONTOBJ *local_a0;

+  _CLIPOBJ *local_98;

+  _RECTL *local_90;

+  _RECTL *local_88;

+  _BRUSHOBJ *local_80;

+  _BRUSHOBJ *local_78;

+  _POINTL *local_70;

+  ulong local_68;

+  undefined4 local_64;

+  ulonglong local_58;

   

-  uVar3 = (undefined4)((ulonglong)in_stack_00000020 >> 0x20);

-  *(char *)(in_RAX + -0x7b) = *(char *)(in_RAX + -0x7b) - (char)param_1;

-  *(undefined1 *)(unaff_RBP + 6) = 0;

-  *(int *)(unaff_RBX + 5) = (int)unaff_RBP;

-  unaff_R15[0] = 0;

-  unaff_R15[1] = 0;

-  unaff_R15[2] = 0;

-  unaff_R15[3] = 0;

-  if (unaff_RBX[5] != 0) {

-    xxxInternalInvalidate(0,unaff_RBX[5],0x485);

-    DeleteMaybeSpecialRgn(unaff_RBX[5]);

-    unaff_RBX[5] = 0;

+  local_58 = __security_cookie ^ (ulonglong)auStackY_178;

+  uVar8 = 1;

+  local_f0 = param_6;

+  local_e8 = param_7;

+  local_e0 = param_8;

+  local_d8 = param_9;

+  iVar12 = 1;

+  local_130[0] = 1;

+  local_120[0] = 0;

+  local_128 = (_FONTOBJ *)((ulonglong)local_128 & 0xffffffff00000000);

+  local_100 = param_3;

+  local_f8 = param_4;

+  XUMPDOBJ::XUMPDOBJ((XUMPDOBJ *)&local_108);

+  uVar13 = 0;

+  local_c7 = 0;

+  local_110 = (void *)0x0;

+  local_118 = (void *)0x0;

+  local_c5 = 0;

+  local_c0 = 0;

+  local_64 = 0;

+  uVar6 = 0;

+  if (local_108 == (UMPDOBJ *)0x0) goto LAB_0;

+  if (param_5 != (_RECTL *)0x0) {

+    p_Var11 = param_5;

+    if (*(int *)param_5 != *(int *)(param_5 + 8)) {

+      do {

+        p_Var1 = p_Var11 + 0x10;

+        iVar12 = iVar12 + 1;

+        p_Var2 = p_Var11 + 0x18;

+        p_Var11 = p_Var1;

+      } while (*(int *)p_Var1 != *(int *)p_Var2);

+    }

+    uVar13 = iVar12 << 4;

   }

-  if ((int)unaff_RBP == 0) {

-    uVar2 = *unaff_RBX;

-    if ((*(byte *)(*(longlong *)(unaff_R14 + 10) + 0x1a) & 8) == 0) {

-      lVar1 = W32GetUserSessionState();

-      uVar2 = GreSelectBitmap(*(undefined8 *)(lVar1 + 0xa978),uVar2);

-      SetOrClrWF(0);

-      hWnd = _GetDCEx(unaff_R14,(HRGN)0x0,0x40010003);

-      W32GetUserSessionState();

-      hDC = (HDC)(ulonglong)*unaff_R15;

-      GreBitBltInternal(hWnd,hDC,unaff_R15[1],unaff_R15[2] - *unaff_R15,

-                        CONCAT44(uVar3,unaff_R15[3] - unaff_R15[1]));

-      _ReleaseDC((HWND)hWnd,hDC);

-      SetOrClrWF(1);

-      lVar1 = W32GetUserSessionState();

+  iVar12 = 0;

+  iVar14 = 0;

+  if (local_108[0x1c8] != (UMPDOBJ)0x0) {

+    uVar7 = 0x110;

+    if (param_2 != (_STROBJ *)0x0) {

+      uVar3 = (ulonglong)*(uint *)param_2 * 2;

+      if (((0xffffffff < uVar3) || (uVar9 = (ulonglong)*(uint *)param_2 * 0x18, 0xffffffff < uVar9))

+         || (uVar7 = (uint)uVar3, uVar10 = uVar7 + 7, uVar10 < uVar7)) goto LAB_0;

+      uVar7 = (uint)uVar9;

+      if (((uVar7 + 7 < uVar7) || (uVar10 = (uVar10 & 0xfffffff8) + 0x140, uVar10 < 0x140)) ||

+         (uVar7 = uVar10 + uVar7, uVar7 < uVar10)) goto LAB_0;

     }

-    else {

-      in_stack_000000b0 = 0;

-      lVar1 = W32GetUserSessionState();

-      uVar2 = GreSelectBitmap(*(undefined8 *)(lVar1 + 0xa978),uVar2);

-      lVar1 = *(longlong *)(unaff_R14 + 10);

-      in_stack_000000a8 = *(int *)(lVar1 + 0x60) - *(int *)(lVar1 + 0x58);

-      in_stack_000000ac = *(int *)(lVar1 + 100) - *(int *)(lVar1 + 0x5c);

-      W32GetUserSessionState();

-      lVar1 = W32GetUserSessionState();

-      UpdateSprite(*(undefined8 *)(*(longlong *)(lVar1 + 0xdf10) + 0x30));

-      lVar1 = W32GetUserSessionState();

+    if ((uVar13 + 7 < uVar13) || (uVar13 + uVar7 < uVar7)) goto LAB_0;

+    piVar15 = local_120;

+    local_130[0] = uVar13 + uVar7;

+    uVar8 = UMPDOBJ::bThunkLargeBitmap

+                      (local_108,param_1,&local_110,&local_118,piVar15,(int *)&local_128,local_130);

+    in_stack_fffffffffffffea8 = (int)piVar15;

+    iVar12 = local_120[0];

+    iVar14 = (int)local_128;

+    local_130[0] = uVar8;

+  }

+  p_Var4 = local_100;

+  local_c4 = 0x17;

+  local_c8 = 0;

+  local_b8 = *(undefined8 *)local_108;

+  local_98 = local_f8;

+  local_88 = local_f0;

+  local_80 = local_e8;

+  local_78 = local_e0;

+  local_90 = param_5;

+  local_70 = local_d8;

+  local_68 = param_10;

+  local_a0 = local_100;

+  local_b0 = param_1;

+  local_a8 = param_2;

+  if ((((uVar8 != 0) &&

+       (iVar5 = UMPDOBJ::pso(local_108,(_DDIOBJMAP *)(local_108 + 0x50),&local_b0,iVar14),

+       iVar5 != 0)) && (iVar5 = UMPDOBJ::pstro(local_108,&local_a8), iVar5 != 0)) &&

+     (iVar5 = UMPDOBJ::pfo(local_108,&local_a0), iVar5 != 0)) {

+    in_stack_fffffffffffffea8 = 0;

+    iVar5 = UMPDOBJ::ThunkDDIOBJ

+                      (local_108,(_DDIOBJMAP *)(local_108 + 0x80),&local_98,0x18,(void *)0x0);

+    if (((iVar5 != 0) && (iVar5 = UMPDOBJ::ThunkMemBlock(local_108,&local_90,uVar13), iVar5 != 0))

+       && (iVar5 = UMPDOBJ::ThunkMemBlock(local_108,&local_88,0x10), iVar5 != 0)) {

+      in_stack_fffffffffffffea8 = 0;

+      iVar5 = UMPDOBJ::ThunkDDIOBJ

+                        (local_108,(_DDIOBJMAP *)(local_108 + 0xa0),&local_80,0x18,(void *)0x0);

+      if (iVar5 != 0) {

+        in_stack_fffffffffffffea8 = 0;

+        iVar5 = UMPDOBJ::ThunkDDIOBJ

+                          (local_108,(_DDIOBJMAP *)(local_108 + 0xb0),&local_78,0x18,(void *)0x0);

+        if ((iVar5 != 0) && (iVar5 = UMPDOBJ::ThunkMemBlock(local_108,&local_70,8), iVar5 != 0)) {

+          local_128 = p_Var4;

+          UMPDReleaseRFONTSem((RFONTOBJ *)&local_128,local_108,(ulong *)0x0,(ulong *)0x0,(int **)0x0

+                             );

+          uVar6 = UMPDOBJ::Thunk(local_108,&local_c8,0x68,local_130,4);

+          in_stack_fffffffffffffea8 = 0;

+          uVar8 = local_130[0];

+          if (uVar6 == 0xffffffff) {

+            uVar8 = 0;

+          }

+          UMPDAcquireRFONTSem((RFONTOBJ *)&local_128,local_108,0,0,(int *)0x0);

+          local_128 = (_FONTOBJ *)0x0;

+          RFONTOBJ::~RFONTOBJ((RFONTOBJ *)&local_128);

+        }

+      }

     }

-    GreSelectBitmap(*(undefined8 *)(lVar1 + 0xa978),uVar2);

-    unaff_R15[0] = 0;

-    unaff_R15[1] = 0;

-    unaff_R15[2] = 0;

-    unaff_R15[3] = 0;

   }

-  AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)&stack0x00000060);

-  return extraout_EAX;

+  uVar6 = uVar8;

+  if (iVar12 != 0) {

+    UMPDOBJ::RestoreBitmap(local_108,param_1,local_110,local_118,in_stack_fffffffffffffea8,iVar14);

+  }

+LAB_0:

+  XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_108);

+  return uVar6;

 }
```

## `IsHotKey`  (modified)

```diff
--- IsHotKey
+++ IsHotKey
@@ -1,10 +1,86 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* struct tagHOTKEY * __ptr64 __cdecl IsHotKey(unsigned int,unsigned int) */

 

 tagHOTKEY * __cdecl IsHotKey(uint param_1,uint param_2)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  undefined8 uVar1;

+  undefined4 uVar2;

+  bool bVar3;

+  uint uVar4;

+  longlong lVar5;

+  char cVar6;

+  tagHOTKEY *ptVar7;

+  undefined8 local_38;

+  undefined4 local_30;

+  

+  lVar5 = W32GetUserSessionState();

+  ptVar7 = *(tagHOTKEY **)(lVar5 + 0x3290 + (ulonglong)(param_2 & 0x7f) * 8);

+  while( true ) {

+    if (ptVar7 == (tagHOTKEY *)0x0) {

+      return (tagHOTKEY *)0x0;

+    }

+    if (((*(ushort *)(ptVar7 + 0x20) == param_1) && (*(uint *)(ptVar7 + 0x24) == param_2)) &&

+       ((*(ushort *)(ptVar7 + 0x22) >> 8 & 1) == 0)) break;

+    ptVar7 = *(tagHOTKEY **)(ptVar7 + 0x30);

+  }

+  LOCK();

+  uVar4 = *(uint *)(*(longlong *)ptVar7 + 0x210);

+  if (uVar4 == 0) {

+    *(uint *)(*(longlong *)ptVar7 + 0x210) = 0;

+    uVar4 = 0;

+  }

+  UNLOCK();

+  if ((uVar4 & 0xc) != 0) {

+    return ptVar7;

+  }

+  lVar5 = W32GetUserSessionState();

+  lVar5 = GetDesktopView(*(undefined8 *)(*(longlong *)ptVar7 + 0x1d0),

+                         *(undefined8 *)(lVar5 + 0x4b58));

+  if (lVar5 != 0) {

+    if (((byte)ptVar7[0x20] & 0xb) != 0) {

+      return ptVar7;

+    }

+    lVar5 = W32GetUserSessionState();

+    if (*(longlong *)(lVar5 + 0x4a50) == 0) {

+      return ptVar7;

+    }

+    if (param_2 - 0xad < 7) {

+      return ptVar7;

+    }

+    if (param_2 == 7) {

+      return ptVar7;

+    }

+    lVar5 = W32GetUserSessionState();

+    bVar3 = UIPrivilegeIsolation::CheckAccess

+                      ((tagUIPI_INFO *)

+                       (-(ulonglong)(*(longlong *)(*(longlong *)ptVar7 + 0x1d0) != 0) &

+                       *(longlong *)(*(longlong *)ptVar7 + 0x1d0) + 0x130U),

+                       *(tagUIPI_INFO **)(lVar5 + 0x4a50),0);

+    if (bVar3) {

+      return ptVar7;

+    }

+    lVar5 = W32GetUserSessionState();

+    uVar1 = **(undefined8 **)(lVar5 + 0x4a50);

+    uVar2 = *(undefined4 *)(*(undefined8 **)(lVar5 + 0x4a50) + 1);

+    lVar5 = W32GetUserSessionState();

+    local_38 = uVar1;

+    local_30 = uVar2;

+    EtwTraceUIPIInputError(*(longlong *)ptVar7,0,*(undefined8 *)(lVar5 + 0x4a50),&local_38,7);

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20) == 0)) ||

+       (cVar6 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+      cVar6 = '\0';

+    }

+    bVar3 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar3)) {

+      W32GetUserSessionState();

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_DDqq

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar3,

+                 *(undefined8 *)(lVar5 + 0x10f98));

+    }

+  }

+  return (tagHOTKEY *)0x0;

 }
```

## `GetWindowProcessHandle`  (modified)

```diff
--- GetWindowProcessHandle
+++ GetWindowProcessHandle
@@ -1,217 +1,194 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* void * __ptr64 __cdecl GetWindowProcessHandle(struct tagWND * __ptr64,struct tagTHREADINFO const

+   * __ptr64,unsigned long) */

 

 void * __cdecl GetWindowProcessHandle(tagWND *param_1,tagTHREADINFO *param_2,ulong param_3)

 

 {

-  undefined4 uVar1;

-  undefined4 uVar2;

-  undefined8 uVar3;

-  undefined8 *puVar4;

-  _ACCESS_ALLOWED_ACE *p_Var5;

-  undefined4 uVar6;

-  long lVar7;

-  int *in_RAX;

-  undefined8 *puVar8;

-  undefined8 *puVar9;

-  undefined8 *puVar10;

-  _ACCESS_ALLOWED_ACE *p_Var11;

-  longlong lVar12;

-  HWINSTA__ *unaff_RDI;

-  undefined4 in_register_00000084;

-  longlong lVar13;

-  _ACCESS_ALLOWED_ACE *unaff_R14;

-  char cVar14;

-  _OBJECT_ATTRIBUTES *unaff_R15;

-  undefined2 in_FS;

-  bool bVar15;

-  undefined4 in_XMM1_Da;

-  ulong in_stack_00000064;

-  ulong in_stack_00000068;

-  HWINSTA__ *in_stack_00000070;

-  HWINSTA__ *in_stack_00000078;

-  HWINSTA__ *in_stack_00000080;

-  long in_stack_0000008c;

-  void *in_stack_000000a8;

-  ulong in_stack_00000a20;

-  uint in_stack_00000a38;

-  uint in_stack_00000a40;

+  uint uVar1;

+  int iVar2;

+  undefined4 uVar3;

+  longlong lVar4;

+  longlong lVar5;

+  char cVar6;

+  tagWND *ptVar7;

+  char cVar8;

+  char cVar9;

+  char cVar10;

+  ulong uVar11;

+  undefined *puVar12;

+  undefined8 uVar13;

+  bool bVar14;

+  tagWND *local_res8;

+  undefined4 in_stack_ffffffffffffff40;

+  undefined4 in_stack_ffffffffffffff44;

+  CLockProcessByPid local_88 [8];

+  int local_80;

+  undefined8 local_70;

   

-  *(undefined2 *)((longlong)in_RAX + (longlong)param_1 * 2) = in_FS;

-  *in_RAX = *in_RAX + (int)in_RAX;

-  RtlCopyFromUser(&stack0x00000148,in_XMM1_Da,CONCAT44(in_register_00000084,param_3));

-  lVar12 = 6;

-  lVar13 = 6;

-  puVar4 = (undefined8 *)&stack0x00000148;

-  puVar9 = (undefined8 *)&stack0x00000460;

-  do {

-    puVar10 = puVar9;

-    puVar8 = puVar4;

-    uVar3 = puVar8[1];

-    *puVar10 = *puVar8;

-    puVar10[1] = uVar3;

-    uVar3 = puVar8[3];

-    puVar10[2] = puVar8[2];

-    puVar10[3] = uVar3;

-    uVar3 = puVar8[5];

-    puVar10[4] = puVar8[4];

-    puVar10[5] = uVar3;

-    uVar3 = puVar8[7];

-    puVar10[6] = puVar8[6];

-    puVar10[7] = uVar3;

-    uVar3 = puVar8[9];

-    puVar10[8] = puVar8[8];

-    puVar10[9] = uVar3;

-    uVar3 = puVar8[0xb];

-    puVar10[10] = puVar8[10];

-    puVar10[0xb] = uVar3;

-    uVar3 = puVar8[0xd];

-    puVar10[0xc] = puVar8[0xc];

-    puVar10[0xd] = uVar3;

-    uVar3 = puVar8[0xf];

-    puVar10[0xe] = puVar8[0xe];

-    puVar10[0xf] = uVar3;

-    lVar13 = lVar13 + -1;

-    puVar4 = puVar8 + 0x10;

-    puVar9 = puVar10 + 0x10;

-  } while (lVar13 != 0);

-  uVar3 = puVar8[0x11];

-  puVar10[0x10] = puVar8[0x10];

-  puVar10[0x11] = uVar3;

-  puVar10[0x12] = puVar8[0x12];

-  puVar4 = (undefined8 *)&stack0x00000460;

-  p_Var5 = unaff_R14;

-  do {

-    p_Var11 = p_Var5;

-    puVar9 = puVar4;

-    uVar3 = puVar9[1];

-    *(undefined8 *)p_Var11 = *puVar9;

-    *(undefined8 *)(p_Var11 + 8) = uVar3;

-    uVar3 = puVar9[3];

-    *(undefined8 *)(p_Var11 + 0x10) = puVar9[2];

-    *(undefined8 *)(p_Var11 + 0x18) = uVar3;

-    uVar3 = puVar9[5];

-    *(undefined8 *)(p_Var11 + 0x20) = puVar9[4];

-    *(undefined8 *)(p_Var11 + 0x28) = uVar3;

-    uVar3 = puVar9[7];

-    *(undefined8 *)(p_Var11 + 0x30) = puVar9[6];

-    *(undefined8 *)(p_Var11 + 0x38) = uVar3;

-    uVar3 = puVar9[9];

-    *(undefined8 *)(p_Var11 + 0x40) = puVar9[8];

-    *(undefined8 *)(p_Var11 + 0x48) = uVar3;

-    uVar3 = puVar9[0xb];

-    *(undefined8 *)(p_Var11 + 0x50) = puVar9[10];

-    *(undefined8 *)(p_Var11 + 0x58) = uVar3;

-    uVar3 = puVar9[0xd];

-    *(undefined8 *)(p_Var11 + 0x60) = puVar9[0xc];

-    *(undefined8 *)(p_Var11 + 0x68) = uVar3;

-    uVar6 = *(undefined4 *)((longlong)puVar9 + 0x74);

-    uVar1 = *(undefined4 *)(puVar9 + 0xf);

-    uVar2 = *(undefined4 *)((longlong)puVar9 + 0x7c);

-    *(undefined4 *)(p_Var11 + 0x70) = *(undefined4 *)(puVar9 + 0xe);

-    *(undefined4 *)(p_Var11 + 0x74) = uVar6;

-    *(undefined4 *)(p_Var11 + 0x78) = uVar1;

-    *(undefined4 *)(p_Var11 + 0x7c) = uVar2;

-    lVar12 = lVar12 + -1;

-    puVar4 = puVar9 + 0x10;

-    p_Var5 = p_Var11 + 0x80;

-  } while (lVar12 != 0);

-  uVar6 = *(undefined4 *)((longlong)puVar9 + 0x84);

-  uVar1 = *(undefined4 *)(puVar9 + 0x11);

-  uVar2 = *(undefined4 *)((longlong)puVar9 + 0x8c);

-  *(undefined4 *)(p_Var11 + 0x80) = *(undefined4 *)(puVar9 + 0x10);

-  *(undefined4 *)(p_Var11 + 0x84) = uVar6;

-  *(undefined4 *)(p_Var11 + 0x88) = uVar1;

-  *(undefined4 *)(p_Var11 + 0x8c) = uVar2;

-  *(undefined8 *)(p_Var11 + 0x90) = puVar9[0x12];

-  if (*(uint *)unaff_R14 < 8) {

-    in_stack_0000008c =

-         ProbeAndDeepCaptureWinStaDesktopObjectAttributes

-                   (1,unaff_R15,(ushort *)&stack0x000007b0,(_OBJECT_ATTRIBUTES *)&stack0x00000100,

-                    (_SECURITY_QUALITY_OF_SERVICE *)&stack0x00000780,&stack0x00000078,

-                    (_UNICODE_STRING *)&stack0x000000d8,(ushort **)&stack0x00000080);

-    if (in_stack_0000008c < 0) {

-      in_stack_00000070 = unaff_RDI;

-      uVar6 = RtlNtStatusToDosError(in_stack_0000008c);

-      UserSetLastError(uVar6);

-      unaff_RDI = in_stack_00000080;

+  lVar5 = *(longlong *)(param_1 + 0x10);

+  cVar9 = '\x01';

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    cVar10 = '\0';

+  }

+  else {

+    cVar10 = '\x01';

+  }

+  bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  local_res8 = param_1;

+  if ((cVar10 != '\0') || (puVar12 = WPP_GLOBAL_Control, bVar14)) {

+    lVar4 = W32GetUserSessionState();

+    puVar12 = *(undefined **)(lVar4 + 0x10f98);

+    in_stack_ffffffffffffff40 = 3;

+    WPP_RECORDER_AND_TRACE_SF_DDD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar14);

+  }

+  ptVar7 = local_res8;

+  uVar11 = (ulong)puVar12;

+  cVar10 = '\x01';

+  LOCK();

+  uVar1 = *(uint *)(lVar5 + 0x210);

+  if (uVar1 == 0) {

+    *(uint *)(lVar5 + 0x210) = 0;

+    uVar1 = 0;

+  }

+  UNLOCK();

+  cVar8 = '\0';

+  if ((uVar1 & 0xc) == 0) {

+    iVar2 = IsProcessDwm(**(undefined8 **)(param_2 + 0x1d0));

+    if (iVar2 == 0) {

+      lVar4 = *(longlong *)(param_2 + 0x1d0);

+      if (*(longlong *)(*(longlong *)(ptVar7 + 0x10) + 0x1d0) == lVar4) {

+LAB_0:

+        CLockProcessByPid::CLockProcessByPid

+                  (local_88,(void *)(longlong)*(int *)(*(longlong *)(lVar5 + 0x1d0) + 0x38),0,uVar11

+                   ,1,CONCAT44(in_stack_ffffffffffffff44,in_stack_ffffffffffffff40));

+        iVar2 = local_80;

+        if (-1 < local_80) {

+          local_res8 = (tagWND *)0x0;

+          iVar2 = ObOpenObjectByPointer

+                            (local_70,0,0,param_3,*(undefined8 *)PsProcessType_exref,cVar10,

+                             &local_res8);

+          ptVar7 = local_res8;

+          if (-1 < iVar2) goto LAB_1;

+        }

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+          cVar9 = '\0';

+        }

+        bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar9 != '\0') || (bVar14)) {

+          lVar5 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_d

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar14,

+                     *(undefined8 *)(lVar5 + 0x10f98),3,3,0x38,

+                     &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids,iVar2);

+        }

+        uVar3 = RtlNtStatusToDosError(iVar2);

+        UserSetLastError(uVar3);

+        ptVar7 = (tagWND *)0x0;

+LAB_1:

+        CLockProcessByPid::~CLockProcessByPid(local_88);

+        return ptVar7;

+      }

+      uVar11 = *(uint *)(lVar4 + 0xc) >> 0x1f;

+      iVar2 = IsShellProcess(lVar4);

+      if (iVar2 == 0) {

+        if ((char)uVar11 == '\0') {

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+            cVar9 = '\0';

+          }

+          bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar9 == '\0') && (!bVar14)) goto LAB_2;

+          lVar5 = W32GetUserSessionState();

+          uVar13 = 0x36;

+        }

+        else {

+          if (param_3 == 0x78) goto LAB_3;

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+            cVar9 = '\0';

+          }

+          bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar9 == '\0') && (!bVar14)) goto LAB_2;

+          lVar5 = W32GetUserSessionState();

+          uVar13 = 0x35;

+        }

+      }

+      else {

+        if (param_3 == 0x1000) {

+          if ((char)uVar11 != '\0') {

+LAB_3:

+            bVar14 = UIPrivilegeIsolation::CheckAccess

+                               ((tagUIPI_INFO *)(-(ulonglong)(lVar4 != 0) & lVar4 + 0x130U),

+                                (tagUIPI_INFO *)

+                                (-(ulonglong)(*(longlong *)(lVar5 + 0x1d0) != 0) &

+                                *(longlong *)(lVar5 + 0x1d0) + 0x130U),0);

+            if (bVar14) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) ||

+                 (cVar6 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 3)) {

+                cVar6 = cVar8;

+              }

+              bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+              cVar10 = cVar8;

+              if ((cVar6 != '\0') || (bVar14)) {

+                lVar4 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar4 + 0x10f98);

+                in_stack_ffffffffffffff40 = 3;

+                WPP_RECORDER_AND_TRACE_SF_

+                          (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar14,uVar13,3,3,0x37,

+                           &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids);

+                uVar11 = (ulong)uVar13;

+              }

+            }

+          }

+          goto LAB_0;

+        }

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+          cVar9 = '\0';

+        }

+        bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar9 == '\0') && (!bVar14)) goto LAB_2;

+        lVar5 = W32GetUserSessionState();

+        uVar13 = 0x34;

+      }

     }

     else {

-      Win32RawOptionalLockedItem<tagQMSG,0>::Win32RawOptionalLockedItem<tagQMSG,0>

-                ((Win32RawOptionalLockedItem<tagQMSG,0> *)&stack0x000000e8);

-      if (in_stack_00000078 != (HWINSTA__ *)0x0) {

-        Win32RawLockedItemBase<void,0,1,1,1>::ManualLock<void>

-                  ((Win32RawLockedItemBase<void,0,1,1,1> *)&stack0x000000e8,in_stack_00000078,

-                   CleanupSecurityDescriptor);

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3)

+         ) {

+        cVar9 = '\0';

       }

-      Win32RawLockedItemNoCleanup<_ACCESS_ALLOWED_ACE,0>::

-      Win32RawLockedItemNoCleanup<_ACCESS_ALLOWED_ACE,0>

-                ((Win32RawLockedItemNoCleanup<_ACCESS_ALLOWED_ACE,0> *)&stack0x00000130,unaff_R14,

-                 Win32FreePool_exref);

-      if ((in_stack_00000a40 & 2) != 0) {

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0)) ||

-           (cVar14 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-          cVar14 = (char)unaff_RDI;

-        }

-        bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-        if ((cVar14 != '\0') || (bVar15)) {

-          W32GetCurrentWin32kSessionId();

-          lVar12 = W32GetUserSessionState();

-          WPP_RECORDER_AND_TRACE_SF_d

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,bVar15,

-                     *(undefined8 *)(lVar12 + 0x10f98),4);

-        }

-        lVar12 = W32GetUserSessionState();

-        *(undefined4 *)(lVar12 + 0x15c) = 1;

-      }

-      Win32RawOptionalLockedItem<tagQMSG,0>::Win32RawOptionalLockedItem<tagQMSG,0>

-                ((Win32RawOptionalLockedItem<tagQMSG,0> *)&stack0x000000b8);

-      if (in_stack_00000080 != (HWINSTA__ *)0x0) {

-        Win32RawLockedItemBase<void,0,1,1,1>::ManualLock<void>

-                  ((Win32RawLockedItemBase<void,0,1,1,1> *)&stack0x000000b8,in_stack_00000080,

-                   Win32FreePool_exref);

-      }

-      lVar7 = xxxCreateWindowStation

-                        ((_OBJECT_ATTRIBUTES *)&stack0x00000100,(char)unaff_RDI,in_stack_00000068,

-                         in_stack_000000a8,in_stack_00000064,in_stack_00000a20,

-                         (tagKBDTABLE_MULT_INTERNAL *)unaff_R14,(ushort *)&stack0x00000790,

-                         in_stack_00000a38,(tagWINDOWSTATIONFLAGS)unaff_RDI,0xffffffff,

-                         &stack0x00000070);

-      in_stack_00000078 = unaff_RDI;

-      if ((lVar7 < 0) && ((in_stack_00000a40 & 2) != 0)) {

-        lVar12 = W32GetUserSessionState();

-        *(tagWINDOWSTATIONFLAGS *)(lVar12 + 0x15c) = (tagWINDOWSTATIONFLAGS)unaff_RDI;

-      }

-      Win32RawOptionalLockedItem<void,0>::~Win32RawOptionalLockedItem<void,0>

-                ((Win32RawOptionalLockedItem<void,0> *)&stack0x000000b8);

-      Win32RawLockedItemNoCleanup<tagINPUT,0>::~Win32RawLockedItemNoCleanup<tagINPUT,0>

-                ((Win32RawLockedItemNoCleanup<tagINPUT,0> *)&stack0x00000130);

-      Win32RawOptionalLockedItem<void,0>::~Win32RawOptionalLockedItem<void,0>

-                ((Win32RawOptionalLockedItem<void,0> *)&stack0x000000e8);

-      if (lVar7 < 0) {

-        in_stack_00000070 = unaff_RDI;

-        uVar6 = RtlNtStatusToDosError(lVar7);

-        UserSetLastError(uVar6);

-      }

+      bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar9 == '\0') && (!bVar14)) goto LAB_2;

+      lVar5 = W32GetUserSessionState();

+      uVar13 = 0x33;

     }

   }

   else {

-    in_stack_00000070 = unaff_RDI;

-    UserSetLastError(0x57);

-    unaff_RDI = in_stack_00000080;

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3))

+    {

+      cVar9 = '\0';

+    }

+    bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar9 == '\0') && (!bVar14)) goto LAB_2;

+    lVar5 = W32GetUserSessionState();

+    uVar13 = 0x32;

   }

-  if (unaff_R14 != (_ACCESS_ALLOWED_ACE *)0x0) {

-    Win32FreePool();

-  }

-  if (unaff_RDI != (HWINSTA__ *)0x0) {

-    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x34a);

-    Win32FreePool(unaff_RDI);

-  }

-  if (in_stack_00000078 != (HWINSTA__ *)0x0) {

-    SeReleaseSecurityDescriptor(in_stack_00000078,1,0);

-  }

-  UserSessionSwitchLeaveCrit();

-  return in_stack_00000070;

+  WPP_RECORDER_AND_TRACE_SF_

+            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar14,

+             *(undefined8 *)(lVar5 + 0x10f98),3,3,uVar13,

+             &WPP_8e5091f686af382c62aeaa4cb2aa4e1b_Traceguids);

+LAB_2:

+  UserSetLastError(5);

+  return (void *)0x0;

 }
```

## `_PostMessageCheckIL`  (modified)

```diff
--- _PostMessageCheckIL
+++ _PostMessageCheckIL
@@ -1,13 +1,34 @@
 

-undefined4 _PostMessageCheckIL(UMPDENGCALL *param_1)

+void _PostMessageCheckIL(longlong param_1,int param_2,undefined8 param_3,undefined8 param_4)

 

 {

-  longlong in_RAX;

-  undefined4 unaff_EBX;

-  float10 in_ST0;

+  undefined8 uVar1;

+  bool bVar2;

+  int iVar3;

+  longlong *plVar4;

+  ulonglong uVar5;

   

-  *(int *)(in_RAX + -0x73) = (int)in_ST0;

-  UMPDOBJ::UMPDENGCALL::~UMPDENGCALL(param_1);

-  return unaff_EBX;

+  bVar2 = false;

+  if (param_2 - 0x3e0U < 9) {

+    iVar3 = ValidateDDEConvPair(param_3,param_1);

+    bVar2 = false;

+    if (iVar3 != 0) {

+      bVar2 = true;

+    }

+  }

+  if ((param_1 - 1U < 0xfffffffffffffffe) && (!bVar2)) {

+    uVar1 = *(undefined8 *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+    plVar4 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar5 = 0;

+    if (plVar4 != (longlong *)0x0) {

+      uVar5 = (ulonglong)plVar4 & -(ulonglong)(*plVar4 != 0);

+    }

+    iVar3 = CheckForMessageAccessCrossIL(uVar5,uVar1,param_1,param_2,param_3,param_4);

+    if (iVar3 == 0) {

+      return;

+    }

+  }

+  _PostMessage(param_1,param_2,param_3,param_4);

+  return;

 }
```

## `UMPDDrvFillPath`  (modified)

```diff
--- UMPDDrvFillPath
+++ UMPDDrvFillPath
@@ -1,49 +1,121 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* int __cdecl UMPDDrvFillPath(struct _SURFOBJ * __ptr64,struct _PATHOBJ * __ptr64,struct _CLIPOBJ *

+   __ptr64,struct _BRUSHOBJ * __ptr64,struct _POINTL * __ptr64,unsigned long,unsigned long) */

 

 int __cdecl

 UMPDDrvFillPath(_SURFOBJ *param_1,_PATHOBJ *param_2,_CLIPOBJ *param_3,_BRUSHOBJ *param_4,

                _POINTL *param_5,ulong param_6,ulong param_7)

 

 {

-  undefined8 uVar1;

-  undefined4 uVar2;

-  longlong lVar3;

-  int unaff_EBP;

-  char unaff_SIL;

-  undefined8 *unaff_RDI;

-  undefined4 *unaff_R12;

-  short unaff_R13W;

-  char cVar4;

-  bool in_CF;

-  char in_SF;

-  char in_OF;

-  undefined8 uStack0000000000000040;

-  undefined4 uStack0000000000000048;

+  ulong uVar1;

+  int iVar2;

+  int iVar3;

+  int iVar4;

+  int iVar5;

+  void *pvVar6;

+  int iVar7;

+  undefined1 auStackY_148 [32];

+  int in_stack_fffffffffffffed8;

+  int *piVar8;

+  ulong local_108;

+  int local_104;

+  int local_100 [2];

+  UMPDOBJ *local_f8;

+  void *local_f0;

+  void *local_e8;

+  _PATHOBJ *local_e0;

+  _CLIPOBJ *local_d8;

+  _BRUSHOBJ *local_d0;

+  _POINTL *local_c8;

+  undefined1 local_b8 [4];

+  undefined4 local_b4;

+  undefined8 local_a8;

+  _SURFOBJ *local_a0;

+  _PATHOBJ *local_98;

+  _CLIPOBJ *local_90 [2];

+  _BRUSHOBJ *local_80;

+  _POINTL *local_78 [3];

+  ulong local_60;

+  ulong local_5c;

+  ulonglong local_58;

   

-  if (in_OF == in_SF) {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-    halt_baddata();

+  local_58 = __security_cookie ^ (ulonglong)auStackY_148;

+  local_c8 = param_5;

+  local_108 = 1;

+  local_104 = 0;

+  local_100[0] = 0;

+  local_e0 = param_2;

+  local_d8 = param_3;

+  local_d0 = param_4;

+  XUMPDOBJ::XUMPDOBJ((XUMPDOBJ *)&local_f8);

+  local_e8 = (void *)0x0;

+  local_f0 = (void *)0x0;

+  memset(local_b8,0,0x60);

+  if (local_f8 == (UMPDOBJ *)0x0) {

+    XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_f8);

+    iVar3 = 0;

   }

-  cVar4 = unaff_SIL;

-  if (in_CF) {

-    cVar4 = (char)unaff_R13W;

+  else {

+    uVar1 = 1;

+    pvVar6 = (void *)0x0;

+    iVar7 = 0;

+    iVar5 = 0;

+    if (local_f8[0x1c8] != (UMPDOBJ)0x0) {

+      local_108 = 0xa8;

+      piVar8 = &local_104;

+      uVar1 = UMPDOBJ::bThunkLargeBitmap

+                        (local_f8,param_1,&local_f0,&local_e8,piVar8,local_100,&local_108);

+      in_stack_fffffffffffffed8 = (int)piVar8;

+      pvVar6 = local_f0;

+      iVar7 = local_100[0];

+      iVar5 = local_104;

+      local_108 = uVar1;

+    }

+    iVar3 = 0;

+    if (uVar1 != 0) {

+      local_b4 = 0xf;

+      iVar3 = 0;

+      iVar4 = 0;

+      local_b8[0] = 0;

+      local_a8 = *(undefined8 *)local_f8;

+      local_98 = local_e0;

+      local_90[0] = local_d8;

+      local_80 = local_d0;

+      local_78[0] = local_c8;

+      local_60 = param_6;

+      local_5c = param_7;

+      local_a0 = param_1;

+      iVar2 = UMPDOBJ::pso(local_f8,(_DDIOBJMAP *)(local_f8 + 0x50),&local_a0,iVar7);

+      if (iVar2 != 0) {

+        in_stack_fffffffffffffed8 = 0;

+        iVar2 = UMPDOBJ::ThunkDDIOBJ

+                          (local_f8,(_DDIOBJMAP *)(local_f8 + 0xf0),&local_98,8,(void *)0x0);

+        if (iVar2 != 0) {

+          in_stack_fffffffffffffed8 = 0;

+          iVar2 = UMPDOBJ::ThunkDDIOBJ

+                            (local_f8,(_DDIOBJMAP *)(local_f8 + 0x80),local_90,0x18,(void *)0x0);

+          if (iVar2 != 0) {

+            in_stack_fffffffffffffed8 = 0;

+            iVar2 = UMPDOBJ::ThunkDDIOBJ

+                              (local_f8,(_DDIOBJMAP *)(local_f8 + 0xa0),&local_80,0x18,(void *)0x0);

+            iVar3 = iVar4;

+            if ((iVar2 != 0) && (iVar2 = UMPDOBJ::ThunkMemBlock(local_f8,local_78,8), iVar2 != 0)) {

+              in_stack_fffffffffffffed8 = 4;

+              uVar1 = UMPDOBJ::Thunk(local_f8,local_b8,0x60,&local_108,4);

+              if ((uVar1 != 0xffffffff) && (local_108 != 0)) {

+                iVar3 = 1;

+              }

+            }

+          }

+        }

+      }

+    }

+    if (iVar5 != 0) {

+      UMPDOBJ::RestoreBitmap(local_f8,param_1,pvVar6,local_e8,in_stack_fffffffffffffed8,iVar7);

+    }

+    XUMPDOBJ::~XUMPDOBJ((XUMPDOBJ *)&local_f8);

   }

-  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

-     (*(short *)(param_1 + 0x48) == unaff_R13W)) {

-    unaff_SIL = (char)unaff_R13W;

-  }

-  if ((cVar4 != '\0') || (unaff_SIL != '\0')) {

-    uVar2 = PsGetThreadId(*(undefined8 *)unaff_RDI[2],(char)param_2,(char)param_3);

-    uVar1 = *unaff_RDI;

-    lVar3 = W32GetUserSessionState();

-    uStack0000000000000040 = uVar1;

-    uStack0000000000000048 = uVar2;

-    WPP_RECORDER_AND_TRACE_SF_qd

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,unaff_SIL,

-               *(undefined8 *)(lVar3 + 0x10f98),5);

-  }

-  *unaff_R12 = 2;

-  return unaff_EBP;

+  return iVar3;

 }
```

## `EditionActivateMitInput`  (modified)

```diff
--- EditionActivateMitInput
+++ EditionActivateMitInput
@@ -1,11 +1,37 @@
 

-void EditionActivateMitInput(void)

+uint EditionActivateMitInput(void)

 

 {

-  code *pcVar1;

+  int iVar1;

+  uint uVar2;

+  longlong lVar3;

   

-  pcVar1 = (code *)swi(3);

-  (*pcVar1)();

-  return;

+                    /* 0x2355b0  106  EditionActivateMitInput */

+  iVar1 = Feature_NoBugcheckForSetupIOCP__private_IsEnabledDeviceUsageNoInline();

+  if (iVar1 == 0) {

+    AddThreadWakeEventDispatcherToIOCP();

+  }

+  else {

+    uVar2 = AddThreadWakeEventDispatcherToIOCP();

+    if ((int)uVar2 < 0) goto LAB_0;

+  }

+  lVar3 = W32GetUserSessionState();

+  uVar2 = InitializeSensorExplicitly(2,*(undefined8 *)(lVar3 + 0x4ba0));

+LAB_0:

+  if (-1 < (int)uVar2) {

+    lVar3 = W32GetUserSessionState();

+    *(undefined4 *)(lVar3 + 0x49d0) = 1;

+    lVar3 = W32GetUserSessionState();

+    *(undefined4 *)(lVar3 + 0x49e8) = 0;

+    lVar3 = W32GetUserSessionState();

+    LOCK();

+    *(uint *)(lVar3 + 0x49c0) = *(uint *)(lVar3 + 0x49c0) & 0xfffffffe;

+    UNLOCK();

+    lVar3 = W32GetUserSessionState();

+    CursorApiRouter::RefreshRoutingState(*(CursorApiRouter **)(lVar3 + 0x8e68));

+    lVar3 = W32GetUserSessionState();

+    CursorApiRouter::ForceResendCursorState(*(CursorApiRouter **)(lVar3 + 0x8e68));

+  }

+  return ~uVar2 >> 0x1f;

 }
```

## `EditionChangeForegroundQueueForMouseInput`  (modified)

```diff
--- EditionChangeForegroundQueueForMouseInput
+++ EditionChangeForegroundQueueForMouseInput
@@ -1,86 +1,76 @@
 

-undefined8 EditionChangeForegroundQueueForMouseInput(undefined8 param_1)

+undefined8 EditionChangeForegroundQueueForMouseInput(longlong param_1,tagUIPI_INFO *param_2)

 

 {

-  tagUIPI_INFO *ptVar1;

-  longlong lVar2;

-  byte bVar3;

+  short sVar1;

+  tagWND *ptVar2;

+  undefined8 *puVar3;

   bool bVar4;

-  uint uVar5;

-  int *in_RAX;

-  char *pcVar6;

-  __int64 _Var7;

-  undefined8 uVar8;

-  byte bVar9;

-  byte *in_RCX;

-  byte bVar10;

-  undefined8 unaff_RBX;

-  undefined8 *puVar11;

-  int unaff_EBP;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  tagUIPI_INFO_INT *unaff_R12;

-  tagHOOK *unaff_R13;

-  __int64 unaff_R15;

-  undefined4 uStack0000000000000030;

-  undefined4 uStack0000000000000034;

-  ulonglong in_stack_00000038;

-  undefined8 in_stack_00000048;

-  undefined8 in_stack_00000050;

-  undefined8 in_stack_00000058;

-  int in_stack_000000c0;

+  char cVar5;

+  bool bVar6;

+  int iVar7;

+  tagTHREADINFO *ptVar8;

+  tagWND *ptVar9;

+  longlong lVar10;

+  longlong lVar11;

+  tagWND *ptVar12;

+  undefined8 local_28;

+  undefined8 local_20;

   

-  ptVar1 = (tagUIPI_INFO *)(unaff_RDI + 1);

-  bVar3 = (byte)in_RAX;

-  *(byte *)(unaff_RSI + 1) = *(byte *)(unaff_RSI + 1) ^ bVar3;

-  *(byte *)in_RAX = (char)*in_RAX + bVar3;

-  bVar10 = (byte)unaff_RBX;

-  uVar5 = (int)in_RAX + *in_RAX;

-  *(byte *)(ulonglong)uVar5 = *(byte *)(ulonglong)uVar5 & (byte)uVar5;

-  bVar9 = (byte)((ulonglong)in_RCX >> 8);

-  puVar11 = (undefined8 *)

-            CONCAT71((int7)(CONCAT62((int6)((ulonglong)unaff_RBX >> 0x10),

-                                     CONCAT11((char)((ulonglong)unaff_RBX >> 8) + bVar3,bVar10)) >>

-                           8),bVar10 + bVar9);

-  uVar5 = uVar5 + 0x80100ff2 + (uint)CARRY1(bVar10,bVar9);

-  pcVar6 = (char *)(ulonglong)uVar5;

-  bVar3 = (byte)uVar5;

-  *in_RCX = *in_RCX ^ bVar3;

-  *pcVar6 = *pcVar6 + bVar3;

-  *puVar11 = param_1;

-  *(undefined4 *)(puVar11 + 1) = *(undefined4 *)(pcVar6 + 0x138);

-  if ((unaff_EBP == 0) || (*(int *)(unaff_R12 + 0xc) != 0)) {

-    UIPrivilegeIsolation::ResetUIPIInfo(ptVar1);

+                    /* 0x226a30  114  EditionChangeForegroundQueueForMouseInput */

+  ptVar8 = PtiCurrent();

+  ptVar2 = *(tagWND **)(param_1 + 0x50);

+  if (param_2 == (tagUIPI_INFO *)0x0) {

+    bVar6 = false;

   }

   else {

-    lVar2 = *(longlong *)(unaff_RSI + 0x1d1);

-    *(undefined8 *)ptVar1 = *(undefined8 *)(lVar2 + 0x130);

-    *(undefined4 *)(unaff_RDI + 9) = *(undefined4 *)(lVar2 + 0x138);

+    bVar6 = true;

+    bVar4 = UIPrivilegeIsolation::CheckAccess

+                      (param_2,*(tagUIPI_INFO **)(*(longlong *)(ptVar2 + 0x10) + 0x1d8),0);

+    if (!bVar4) {

+      puVar3 = *(undefined8 **)(*(longlong *)(ptVar2 + 0x10) + 0x1d8);

+      local_28 = *puVar3;

+      local_20 = CONCAT44(local_20._4_4_,*(undefined4 *)(puVar3 + 1));

+      EtwTraceUIPIInputError(ptVar8,*(longlong *)(ptVar2 + 0x10),puVar3,&local_28,1);

+      return 0;

+    }

   }

-  _Var7 = xxxCallHook2(unaff_R13,0,in_stack_00000038 >> 0x20,unaff_R15,3);

-  *(undefined8 *)(unaff_RSI + 0x639) = in_stack_00000058;

-  *(undefined8 *)ptVar1 = in_stack_00000048;

-  *(undefined4 *)(unaff_RDI + 9) = uStack0000000000000030;

-  *puVar11 = in_stack_00000050;

-  *(undefined4 *)(puVar11 + 1) = uStack0000000000000034;

-  if (_Var7 == 0) {

-    if (in_stack_000000c0 != 0) {

-      bVar4 = IsGpqForegroundAccessibleOnInputThread(SUB41(unaff_EBP,0),unaff_R12);

-      if (!bVar4) {

-        MSGLUA_GPQFOREGROUND();

-        goto LAB_0;

+  ptVar12 = ptVar2;

+  iVar7 = IsIndependentInputWindow(ptVar2);

+  ptVar9 = ptVar2;

+  if ((iVar7 != 0) && (ptVar9 = GetCompositionInputWindowUIOwner(ptVar12), ptVar9 == (tagWND *)0x0))

+  {

+    return 0;

+  }

+  if ((*(uint *)(ptVar9 + 0x17c) & 0x2000) == 0) {

+    lVar10 = GetNonChildAncestor(ptVar9);

+    if (((((*(byte *)(*(longlong *)(lVar10 + 0x28) + 0x1b) & 8) == 0) &&

+         (sVar1 = **(short **)(*(longlong *)(lVar10 + 0x88) + 8), lVar11 = W32GetUserSessionState(),

+         sVar1 != *(short *)(*(longlong *)(lVar11 + 0x4e30) + 0x382))) &&

+        ((*(byte *)(*(longlong *)(*(longlong *)(lVar10 + 0x88) + 8) + 10) & 1) == 0)) &&

+       (cVar5 = IsKeyboardDelegationTarget(*(undefined8 *)(ptVar9 + 0x10)), cVar5 == '\0')) {

+      local_20 = 0;

+      local_28 = 0xffffffffffffffff;

+      if (ptVar9 != ptVar2) {

+        Win32HM_LockIntoThread<0>(ptVar8,(_HEAD *)ptVar9,(_Win32HMThreadLockItem *)&local_28);

+      }

+      iVar7 = Feature_FixAsyncActivationChildWindowGuard__private_IsEnabledDeviceUsageNoInline();

+      xxxForceForegroundWindowNoRestoreFocus(ptVar9,-(uint)(iVar7 != 0) & 0x400);

+      Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

+                ((Win32HMOptionalThreadLockAlways<tagWND> *)&local_28);

+      if ((bVar6) && (lVar10 = W32GetUserSessionState(), *(longlong *)(lVar10 + 0x4a50) != 0)) {

+        lVar10 = W32GetUserSessionState();

+        bVar6 = UIPrivilegeIsolation::CheckAccess(param_2,*(tagUIPI_INFO **)(lVar10 + 0x4a50),0);

+        if (!bVar6) {

+          MSGLUA_GPQFOREGROUND();

+          return 0;

+        }

       }

     }

-    InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion

-              ((ThreadLockedPerfRegion *)&stack0x00000040);

-    uVar8 = 0;

+    else {

+      UpdateDelegationTargetForMouseInput(*(undefined8 *)(ptVar9 + 0x10));

+    }

   }

-  else {

-LAB_0:

-    InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion

-              ((ThreadLockedPerfRegion *)&stack0x00000040);

-    uVar8 = 1;

-  }

-  return uVar8;

+  return 1;

 }
```

## `EditionForegroundQAccessibleToMouseProducer`  (modified)

```diff
--- EditionForegroundQAccessibleToMouseProducer
+++ EditionForegroundQAccessibleToMouseProducer
@@ -1,7 +1,26 @@
 

-void EditionForegroundQAccessibleToMouseProducer(void)

+undefined8

+EditionForegroundQAccessibleToMouseProducer(tagUIPI_INFO *param_1,int param_2,int param_3)

 

 {

-  return;

+  bool bVar1;

+  longlong lVar2;

+  

+                    /* 0x226c40  150  EditionForegroundQAccessibleToMouseProducer */

+  lVar2 = W32GetUserSessionState();

+  if (*(longlong *)(lVar2 + 0x4a50) != 0) {

+    lVar2 = W32GetUserSessionState();

+    bVar1 = UIPrivilegeIsolation::CheckAccess(param_1,*(tagUIPI_INFO **)(lVar2 + 0x4a50),0);

+    if (!bVar1) {

+      if (param_2 != 0) {

+        MSGLUA_GPQFOREGROUND();

+      }

+      if (param_3 != 0) {

+        WakeInjectedFlushWaiter();

+      }

+      return 0;

+    }

+  }

+  return 1;

 }
```

## `xxxPoke`  (modified)

```diff
--- xxxPoke
+++ xxxPoke
@@ -1,17 +1,79 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* unsigned long __cdecl xxxPoke(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

+   __ptr64) */

 

 ulong __cdecl xxxPoke(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

-  byte *pbVar1;

-  undefined1 uVar2;

-  undefined7 in_register_00000001;

+  tagINTDDEINFO *ptVar1;

+  ulong uVar2;

+  int iVar3;

+  ulong uVar4;

+  uint uVar5;

+  tagDDECONV *ptVar6;

+  longlong lVar7;

+  tagPUBOBJ *ptVar8;

+  void *pvVar9;

+  bool bVar10;

+  ulong local_res20 [2];

+  tagINTDDEINFO *local_38;

+  void *local_30;

   

-  uVar2 = in((short)param_2);

-  pbVar1 = (byte *)(CONCAT71(in_register_00000001,uVar2) + -0x75);

-  *pbVar1 = *pbVar1 & (byte)param_1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  local_38 = (tagINTDDEINFO *)0x0;

+  local_30 = (void *)0x0;

+  local_res20[0] = 0x83;

+  uVar2 = xxxCopyDdeIn((void *)*param_2,local_res20,&local_30,&local_38);

+  iVar3 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+  if (iVar3 == 0) {

+    lVar7 = _HMPheFromObject(param_3);

+    bVar10 = (bool)(~*(byte *)(lVar7 + 0x19) & 1);

+  }

+  else {

+    ptVar6 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

+    bVar10 = ptVar6 == param_3;

+  }

+  ptVar1 = local_38;

+  if (bVar10 == false) {

+    uVar2 = 3;

+    if (local_38 != (tagINTDDEINFO *)0x0) {

+      Win32FreePool();

+    }

+  }

+  else if (uVar2 == 2) {

+    if ((*(ushort *)(local_38 + 0x48) & 0x2000) == 0) {

+      iVar3 = AddPublicObject((uint)*(ushort *)(local_38 + 0x4a),*(void **)(local_38 + 0x30),

+                              *(ulong *)(*(longlong *)

+                                          (*(longlong *)(*(longlong *)(param_3 + 0x28) + 0x10) +

+                                          0x1d0) + 0x38));

+      uVar5 = local_res20[0];

+      if (iVar3 != 0) {

+        uVar5 = local_res20[0] | 0x2000;

+      }

+    }

+    else {

+      ptVar8 = IsObjectPublic(*(void **)(local_38 + 0x30));

+      if (ptVar8 != (tagPUBOBJ *)0x0) {

+        Win32FreePool(ptVar1);

+        return 3;

+      }

+      iVar3 = GiveObject((uint)*(ushort *)(ptVar1 + 0x4a),*(void **)(ptVar1 + 0x30),

+                         *(ulong *)(*(longlong *)

+                                     (*(longlong *)(*(longlong *)(param_3 + 0x30) + 0x10) + 0x1d0) +

+                                   0x38));

+      uVar4 = local_res20[0];

+      if (iVar3 != 0) {

+        uVar4 = local_res20[0] | 0x4000;

+      }

+      uVar5 = uVar4 | 0x400;

+    }

+    *param_1 = *param_1 | 0x80000000;

+    pvVar9 = AnticipatePost(*(tagDDECONV **)(param_3 + 0x20),xxxPokeAck,local_30,(void *)0x0,ptVar1,

+                            uVar5);

+    *param_2 = (__int64)pvVar9;

+    if (pvVar9 == (void *)0x0) {

+      uVar2 = 3;

+    }

+  }

+  return uVar2;

 }
```

## `xxxCallHook2`  (modified)

```diff
--- xxxCallHook2
+++ xxxCallHook2
@@ -1,137 +1,709 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

+/* __int64 __cdecl xxxCallHook2(struct tagHOOK * __ptr64,int,unsigned __int64,__int64,enum

+   CallHookHints) */

 

 __int64 __cdecl

 xxxCallHook2(tagHOOK *param_1,int param_2,__uint64 param_3,__int64 param_4,CallHookHints param_5)

 

 {

-  longlong lVar1;

-  longlong lVar2;

-  int iVar3;

-  uint uVar4;

-  ulong uVar5;

-  RGNOBJ *this;

-  undefined4 in_register_00000014;

-  ulonglong uVar6;

-  undefined1 local_88 [32];

-  longlong lStack_68;

-  longlong lStack_60;

-  longlong lStack_58;

-  undefined8 local_50;

-  undefined8 uStack_48;

-  undefined4 uStack_40;

-  undefined4 uStack_3c;

-  ulonglong uStack_38;

+  tagPROCESSINFO *this;

+  tagTHREADINFO *ptVar1;

+  undefined8 uVar2;

+  code *pcVar3;

+  char cVar4;

+  bool bVar5;

+  bool bVar6;

+  short sVar7;

+  short sVar8;

+  int iVar9;

+  int iVar10;

+  undefined4 uVar11;

+  undefined4 uVar12;

+  longlong lVar13;

+  undefined8 *puVar14;

+  undefined8 uVar15;

+  longlong *plVar16;

+  __int64 _Var17;

+  tagUIPI_INFO *ptVar18;

+  tagUIPI_INFO *ptVar19;

+  ObjectLock<> *this_00;

+  undefined1 *puVar20;

+  tagTHREADINFO *ptVar21;

+  tagWND *ptVar22;

+  uint uVar23;

+  uint uVar24;

+  char cVar25;

+  undefined4 uVar26;

+  undefined1 auStack_328 [8];

+  undefined1 auStack_320 [96];

+  undefined8 local_2c0;

+  __int64 local_2b8;

+  __uint64 local_298;

+  undefined8 local_288;

+  ulonglong local_50;

   

-  lStack_58 = CONCAT44(in_register_00000014,param_2);

-  uStack_38 = __security_cookie ^ (ulonglong)local_88;

-  lVar1 = *(longlong *)(param_1 + 0xa0);

-  uVar6 = 0;

-  iVar3 = (int)param_3;

-  if (iVar3 == 5) {

-    if (lStack_58 == 0) {

-      if (lVar1 == 0) {

-        return (ulonglong)(param_2 + 2);

+  local_50 = __security_cookie ^ (ulonglong)auStack_328;

+  ptVar21 = (tagTHREADINFO *)0x0;

+  local_288 = 0;

+  local_2c0 = 0;

+  local_2b8 = param_4;

+  local_298 = param_3;

+  lVar13 = W32GetUserSessionState();

+  uVar15 = *(undefined8 *)(lVar13 + 0xa5e8);

+  lVar13 = W32GetUserSessionState();

+  puVar20 = auStack_328;

+  if ((*(int *)(lVar13 + 0x4dc0) == 0) &&

+     (lVar13 = PsGetCurrentThreadWin32Thread(), puVar20 = auStack_328,

+     ((byte)*(undefined4 *)(lVar13 + 0x18) & 0xc) != 8)) {

+    lVar13 = PsGetCurrentThreadWin32Thread();

+    if ((*(uint *)(lVar13 + 0x18) & 0xc) != 0) {

+      cVar4 = ExIsResourceAcquiredExclusiveLite(uVar15);

+      if ((cVar4 == '\x01') ||

+         (iVar9 = ExIsResourceAcquiredSharedLite(uVar15), bVar6 = false, iVar9 != 0)) {

+        bVar6 = true;

       }

-      *(int *)(lVar1 + 0x4c) = *(int *)(lVar1 + 0x4c) + -1;

-      if (*(int *)(lVar1 + 0x4c) == 0) {

-        lStack_58 = lVar1;

-        RGNOBJ::vDeleteRGNOBJ((RGNOBJ *)&lStack_58);

+      puVar20 = auStack_328;

+      if (bVar6) goto LAB_0;

+    }

+    pcVar3 = (code *)swi(0x2c);

+    (*pcVar3)();

+    puVar20 = auStack_320;

+  }

+LAB_0:

+  if (param_1 != (tagHOOK *)0x0) {

+    iVar9 = *(int *)(param_1 + 0x30);

+    *(int *)(puVar20 + 100) = iVar9;

+    *(undefined8 *)(puVar20 + -8) = 0x1400d9ea9;

+    puVar14 = (undefined8 *)PsGetCurrentThreadWin32Thread();

+    if (puVar14 != (undefined8 *)0x0) {

+      ptVar21 = (tagTHREADINFO *)*puVar14;

+    }

+    *(undefined8 *)(puVar20 + -8) = 0x1400d9ec2;

+    lVar13 = W32GetUserSessionState();

+    if (((ptVar21 != *(tagTHREADINFO **)(lVar13 + 0x4970)) || (iVar9 == 0xd)) || (iVar9 == 0xe)) {

+      LOCK();

+      uVar23 = *(uint *)(ptVar21 + 0x210);

+      if (uVar23 == 0) {

+        *(uint *)(ptVar21 + 0x210) = 0;

+        uVar23 = 0;

       }

-      *(undefined8 *)(param_1 + 0xa0) = 0;

-      return (ulonglong)(param_2 + 2);

-    }

-LAB_0:

-    lStack_60 = lVar1;

-    if ((lVar1 != 0) && (*(int *)(lVar1 + 0x4c) == 1)) {

-      iVar3 = RGNOBJ::bCopy((RGNOBJ *)&lStack_60,(RGNOBJ *)&lStack_58);

-      lVar1 = lStack_60;

-      if (iVar3 == 0) {

-        return 0;

+      UNLOCK();

+      if (((uVar23 & 0x10000001) == 0) &&

+         ((*(longlong *)(ptVar21 + 0x1f0) != 0 || (*(int *)(param_1 + 0x30) == 0xe)))) {

+        *(undefined8 *)(puVar20 + -8) = 0x1400d9f13;

+        iVar10 = IsPointerInputHookCall(iVar9,param_4);

+        if ((iVar10 == 0) || (((iVar9 == 3 || (iVar9 == 4)) || (iVar9 == 0xc)))) {

+          uVar26 = 200;

+          do {

+            bVar6 = false;

+            *(undefined8 *)(puVar20 + -8) = 0x1400d9f4d;

+            SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::ObjectLock<>::

+            ObjectLock<>((ObjectLock<> *)(puVar20 + 0x268));

+            *(undefined8 *)(puVar20 + -8) = 0x1400d9f57;

+            lVar13 = _HMPheFromObject(param_1);

+            if (((*(byte *)(lVar13 + 0x19) & 1) == 0) && ((*(uint *)(param_1 + 0x40) & 0x1000) == 0)

+               ) {

+              *(undefined8 *)(puVar20 + -8) = 0x1400d9f80;

+              SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::ObjectLock<>::

+              ~ObjectLock<>((ObjectLock<> *)(puVar20 + 0x268));

+              if ((iVar9 == 0xe) && (*(longlong *)(param_1 + 0x10) != 0)) {

+                *(undefined8 *)(puVar20 + -8) = 0x1400d9f95;

+                cVar4 = IsSpatialDelegationEnabledForThread();

+                if (cVar4 != '\0') {

+                  *(undefined8 *)(puVar20 + -8) = 0x1400d9fa6;

+                  param_1 = (tagHOOK *)PhkNextValid(param_1);

+                  goto LAB_1;

+                }

+              }

+              if ((iVar9 == 0xd) && (*(longlong *)(param_1 + 0x10) != 0)) {

+                *(undefined8 *)(puVar20 + -8) = 0x1400d9fc3;

+                cVar4 = IsKeyboardDelegationEnabledForThread();

+                if (cVar4 != '\0') {

+                  *(undefined8 *)(puVar20 + -8) = 0x1400d9fd4;

+                  param_1 = (tagHOOK *)PhkNextValid(param_1);

+                  goto LAB_1;

+                }

+              }

+              uVar23 = *(uint *)(&DAT_2 + (longlong)*(int *)(param_1 + 0x30) * 4);

+              if (*(int *)(param_1 + 0x30) == 10) {

+                LOCK();

+                uVar24 = *(uint *)(ptVar21 + 0x210);

+                if (uVar24 == 0) {

+                  *(uint *)(ptVar21 + 0x210) = 0;

+                  uVar24 = 0;

+                }

+                UNLOCK();

+                if ((((uVar24 & 8) != 0) && ((param_2 - 4U & 0xfffffff3) == 0)) && (param_2 != 0x10)

+                   ) {

+                  uVar23 = uVar23 | 0x10;

+                }

+              }

+              if (*(int *)(param_1 + 0x30) == 10) {

+                LOCK();

+                uVar24 = *(uint *)(ptVar21 + 0x210);

+                if (uVar24 == 0) {

+                  *(uint *)(ptVar21 + 0x210) = 0;

+                  uVar24 = 0;

+                }

+                UNLOCK();

+                if (((uVar24 & 4) != 0) && (param_2 == 0xb)) {

+                  uVar23 = uVar23 | 0x10;

+                }

+              }

+              if (*(tagTHREADINFO **)(param_1 + 0x10) != ptVar21) {

+                if ((uVar23 & 0x20) == 0) {

+                  uVar15 = **(undefined8 **)(*(tagTHREADINFO **)(param_1 + 0x10) + 0x1d0);

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da05a;

+                  sVar7 = PsGetProcessMachine(uVar15);

+                  uVar15 = **(undefined8 **)(ptVar21 + 0x1d0);

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da073;

+                  sVar8 = PsGetProcessMachine(uVar15);

+                  if (sVar8 == sVar7) {

+                    LOCK();

+                    uVar24 = *(uint *)(ptVar21 + 0x210);

+                    if (uVar24 == 0) {

+                      *(uint *)(ptVar21 + 0x210) = 0;

+                      uVar24 = 0;

+                    }

+                    UNLOCK();

+                    if (((uVar24 & 0xc) == 0) ||

+                       (*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) ==

+                        *(longlong *)(ptVar21 + 0x1d0))) {

+                      uVar15 = **(undefined8 **)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+                      *(undefined8 *)(puVar20 + -8) = 0x1400da0d0;

+                      iVar9 = IsProcessDwm(uVar15);

+                      if (iVar9 == 0) {

+                        if ((*(undefined8 **)(param_1 + 0x10))[0x3a] !=

+                            *(longlong *)(ptVar21 + 0x1d0)) {

+                          uVar15 = **(undefined8 **)(param_1 + 0x10);

+                          *(undefined8 *)(puVar20 + -8) = 0x1400da0fe;

+                          cVar4 = IsRestricted(uVar15);

+                          if (cVar4 != '\0') {

+                            bVar6 = true;

+                          }

+                        }

+                      }

+                      else {

+                        bVar6 = true;

+                      }

+                      iVar9 = *(int *)(puVar20 + 100);

+                    }

+                    else {

+                      bVar6 = true;

+                      iVar9 = *(int *)(puVar20 + 100);

+                    }

+                  }

+                  else {

+                    bVar6 = true;

+                    iVar9 = *(int *)(puVar20 + 100);

+                  }

+                }

+                else {

+                  bVar6 = true;

+                }

+              }

+              if (*(int *)(param_1 + 0x30) - 0xdU < 2) {

+                if ((puVar20[0x350] & 2) == 0) {

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da1d4;

+                  lVar13 = W32GetUserSessionState();

+                  if (*(longlong *)(lVar13 + 0x4a50) == 0) goto LAB_3;

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da1ee;

+                  lVar13 = W32GetUserSessionState();

+                  ptVar18 = *(tagUIPI_INFO **)(lVar13 + 0x4a50);

+                  ptVar19 = (tagUIPI_INFO *)

+                            (*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) + 0x130);

+                  if (*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) == 0) {

+                    ptVar19 = (tagUIPI_INFO *)0x0;

+                  }

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da222;

+                  bVar5 = UIPrivilegeIsolation::CheckAccess(ptVar19,ptVar18,0);

+                  if (bVar5) goto LAB_3;

+                  ptVar1 = *(tagTHREADINFO **)(param_1 + 0x10);

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da234;

+                  iVar9 = IsForegroundShellFrameQueueAccessible(ptVar1);

+                  if ((iVar9 != 0) ||

+                     (*(int *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) + 0xc) < 0))

+                  goto LAB_3;

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da250;

+                  lVar13 = W32GetUserSessionState();

+                  uVar2 = **(undefined8 **)(lVar13 + 0x4a50);

+                  uVar11 = *(undefined4 *)(*(undefined8 **)(lVar13 + 0x4a50) + 1);

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da26a;

+                  lVar13 = W32GetUserSessionState();

+                  uVar15 = *(undefined8 *)(lVar13 + 0x4a50);

+                  lVar13 = *(longlong *)(param_1 + 0x10);

+                  *(undefined8 *)(puVar20 + 0xe0) = uVar2;

+                  *(undefined4 *)(puVar20 + 0xe8) = uVar11;

+LAB_4:

+                  *(undefined4 *)(puVar20 + 0x20) = 6;

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da335;

+                  EtwTraceUIPIInputError(lVar13,0,uVar15);

+                  uVar23 = uVar23 & 0xffffffef;

+                }

+                else {

+LAB_3:

+                  if (*(int *)(param_1 + 0x30) == 0xe) {

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da2af;

+                    bVar5 = UIPrivilegeIsolation::IsUIPIInfoValid((tagUIPI_INFO *)(ptVar21 + 0x62c))

+                    ;

+                    if (bVar5) {

+                      lVar13 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+                      *(undefined8 *)(puVar20 + -8) = 0x1400da2df;

+                      bVar5 = UIPrivilegeIsolation::CheckAccess

+                                        ((tagUIPI_INFO *)(lVar13 + 0x130),

+                                         (tagUIPI_INFO *)(ptVar21 + 0x62c),0);

+                      if ((!bVar5) &&

+                         (lVar13 = *(longlong *)(param_1 + 0x10),

+                         -1 < *(int *)(*(longlong *)(lVar13 + 0x1d0) + 0xc))) {

+                        *(undefined8 *)(puVar20 + 0xf0) = *(undefined8 *)(ptVar21 + 0x62c);

+                        *(undefined4 *)(puVar20 + 0xf8) = *(undefined4 *)(ptVar21 + 0x634);

+                        uVar15 = 0;

+                        goto LAB_4;

+                      }

+                    }

+                  }

+                }

+              }

+              else {

+                ptVar19 = (tagUIPI_INFO *)(*(longlong *)(ptVar21 + 0x1d0) + 0x130);

+                if (*(longlong *)(ptVar21 + 0x1d0) == 0) {

+                  ptVar19 = (tagUIPI_INFO *)0x0;

+                }

+                ptVar18 = (tagUIPI_INFO *)

+                          (*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) + 0x130);

+                if (*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) == 0) {

+                  ptVar18 = (tagUIPI_INFO *)0x0;

+                }

+                *(undefined8 *)(puVar20 + -8) = 0x1400da15b;

+                bVar5 = UIPrivilegeIsolation::CheckAccess(ptVar18,ptVar19,0);

+                if (!bVar5) {

+                  uVar24 = uVar23;

+                  if (-1 < *(int *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) + 0xc)) {

+                    uVar24 = uVar23 & 0xffffffef;

+                    *(undefined8 *)(puVar20 + 0x38) = *(undefined8 *)(puVar20 + 0x70);

+                    *(undefined8 *)(puVar20 + 0x30) = *(undefined8 *)(puVar20 + 0x90);

+                    *(int *)(puVar20 + 0x28) = param_2;

+                    *(int *)(puVar20 + 0x20) = iVar9;

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da1ae;

+                    EtwTraceUIPIHookError(param_1,uVar23 & 0xef);

+                  }

+                  bVar6 = true;

+                  uVar23 = uVar24;

+                }

+              }

+              if ((!bVar6) && ((*(uint *)(param_1 + 0x40) & 1) != 0)) {

+                uVar15 = *(undefined8 *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+                *(undefined8 *)(puVar20 + -8) = 0x1400da368;

+                iVar9 = IsImmersiveBroker(uVar15);

+                if ((iVar9 == 0) &&

+                   (((lVar13 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0),

+                     -1 < *(int *)(lVar13 + 0xc) && (lVar13 != *(longlong *)(ptVar21 + 0x1d0))) &&

+                    ((*(uint *)(lVar13 + 0x330) >> 8 & 1) == 0)))) {

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da3a5;

+                  iVar9 = IsImmersiveAppRestricted();

+                  if (iVar9 == 0) {

+                    *(undefined8 *)(puVar20 + 200) = 0;

+                    *(undefined4 *)(puVar20 + 200) = 6;

+                    *(undefined8 *)(puVar20 + 0x20) = 0;

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da3e2;

+                    iVar9 = ZwQueryInformationProcess(0xffffffffffffffff,0x34,puVar20 + 200);

+                    if ((-1 < iVar9) && ((puVar20[0xcc] & 1) == 0)) goto LAB_5;

+                  }

+                  bVar6 = true;

+                }

+              }

+LAB_5:

+              *(undefined8 *)(puVar20 + -8) = 0x1400da407;

+              Win32HMThreadLockAlways<tagHOOK>::Win32HMThreadLockAlways<tagHOOK>

+                        ((Win32HMThreadLockAlways<tagHOOK> *)(puVar20 + 0x78),ptVar21,param_1);

+              if (bVar6) {

+                if ((uVar23 & 0x10) != 0) {

+                  *(undefined4 *)(puVar20 + 0x1ac) = 0;

+                  *(undefined8 *)(puVar20 + 0x1b8) = 0;

+                  *(undefined8 *)(puVar20 + 0x1c0) = 0;

+                  *(undefined8 *)(puVar20 + 0x1c8) = 0;

+                  *(undefined8 *)(puVar20 + 0x1d0) = 0;

+                  *(undefined8 *)(puVar20 + 0x1b0) = *(undefined8 *)(puVar20 + 0x70);

+                  *(tagHOOK **)(puVar20 + 0x1a0) = param_1;

+                  *(int *)(puVar20 + 0x1a8) = param_2;

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da84b;

+                  UIPrivilegeIsolation::ResetUIPIInfo((tagUIPI_INFO *)(puVar20 + 0x1bc));

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da85f;

+                  UIPrivilegeIsolation::ResetUIPIInfo((tagUIPI_INFO *)(puVar20 + 0x1c8));

+                  *(undefined4 *)(puVar20 + 0x1b8) = 0;

+                  this = *(tagPROCESSINFO **)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da87d;

+                  bVar6 = tagPROCESSINFO::SyncAndTestFreeze(this);

+                  if (!bVar6) {

+                    ptVar22 = *(tagWND **)(ptVar21 + 0x2d8);

+                    *(tagWND **)(puVar20 + 0x70) = ptVar22;

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da8ac;

+                    Win32HMOptionalThreadLock<tagWND>::Win32HMOptionalThreadLock<tagWND>

+                              ((Win32HMOptionalThreadLock<tagWND> *)(puVar20 + 0x140),ptVar21,

+                               ptVar22);

+                    *(tagTHREADINFO **)(puVar20 + 0x130) = ptVar21 + 0x2d8;

+                    *(tagHOOK **)(puVar20 + 0x138) = param_1;

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da8cd;

+                    HMAssignmentLock(puVar20 + 0x130,0);

+                    if (*(longlong *)(ptVar21 + 0x208) != 0) {

+                      *(undefined8 *)(puVar20 + -8) = 0x1400da8e6;

+                      puVar14 = (undefined8 *)PhkNextValid(param_1);

+                      *(undefined8 *)(puVar20 + 0xa0) =

+                           *(undefined8 *)(*(longlong *)(ptVar21 + 0x208) + 0x30);

+                      if (puVar14 == (undefined8 *)0x0) {

+                        uVar15 = 0;

+                      }

+                      else {

+                        uVar15 = *puVar14;

+                      }

+                      *(undefined8 *)(*(longlong *)(ptVar21 + 0x208) + 0x30) = uVar15;

+                    }

+                    if ((uVar23 & 0x20) != 0) {

+                      if ((*(uint *)(param_1 + 0x40) & 0x40) == 0) {

+                        *(undefined8 *)(puVar20 + -8) = 0x1400da959;

+                        lVar13 = W32GetUserSessionState();

+                        uVar26 = *(undefined4 *)(lVar13 + 0xfb50);

+                      }

+                      else {

+                        uVar26 = 30000;

+                      }

+                      if ((*(uint *)(param_1 + 0x40) & 0x4000) != 0) {

+                        uVar26 = 0x14;

+                      }

+                    }

+                    if ((uVar23 & 0x20) == 0) {

+                      LOCK();

+                      uVar24 = *(uint *)(ptVar21 + 0x210);

+                      if (uVar24 == 0) {

+                        *(uint *)(ptVar21 + 0x210) = 0;

+                        uVar24 = 0;

+                      }

+                      UNLOCK();

+                      if ((uVar24 & 0xc) != 0) goto LAB_6;

+                      *(undefined4 *)(puVar20 + 0x40) = 0;

+                      *(undefined4 *)(puVar20 + 0x38) = 1;

+                      *(undefined8 *)(puVar20 + 0x30) = 0;

+                      *(undefined8 *)(puVar20 + 0x28) = *(undefined8 *)(param_1 + 0x10);

+                      *(undefined4 *)(puVar20 + 0x20) = 1;

+                      *(undefined8 *)(puVar20 + -8) = 0x1400da9c7;

+                      uVar15 = xxxInterSendMsgEx(0,0x314,*(undefined8 *)(puVar20 + 0x90),

+                                                 puVar20 + 0x1a0);

+                      *(undefined8 *)(puVar20 + 0x68) = uVar15;

+                    }

+                    else {

+LAB_6:

+                      *(undefined8 *)(puVar20 + 0x154) = 0;

+                      *(undefined8 *)(puVar20 + 0x15c) = 0;

+                      *(undefined8 *)(puVar20 + 0x164) = 0;

+                      *(undefined4 *)(puVar20 + 0x16c) = 0;

+                      *(undefined4 *)(puVar20 + 0x150) = 2;

+                      *(undefined4 *)(puVar20 + 0x170) = 2;

+                      *(undefined4 *)(puVar20 + 0x174) = uVar26;

+                      *(undefined1 **)(puVar20 + 0x178) = puVar20 + 0x68;

+                      if ((uVar23 & 0x20) != 0) {

+                        *(undefined8 *)(puVar20 + 0x1bc) = *(undefined8 *)(ptVar21 + 0x620);

+                        *(undefined4 *)(puVar20 + 0x1c4) = *(undefined4 *)(ptVar21 + 0x628);

+                        *(undefined8 *)(puVar20 + 0x1c8) = *(undefined8 *)(ptVar21 + 0x62c);

+                        *(undefined4 *)(puVar20 + 0x1d0) = *(undefined4 *)(ptVar21 + 0x634);

+                        *(undefined8 *)(puVar20 + 0x1b0) = *(undefined8 *)(ptVar21 + 0x638);

+                      }

+                      LOCK();

+                      uVar24 = *(uint *)(ptVar21 + 0x210);

+                      if (uVar24 == 0) {

+                        *(uint *)(ptVar21 + 0x210) = 0;

+                        uVar24 = 0;

+                      }

+                      UNLOCK();

+                      if ((uVar24 >> 0x11 & 1) == 0) {

+                        ptVar1 = *(tagTHREADINFO **)(param_1 + 0x10);

+                        *(undefined8 *)(puVar20 + -8) = 0x1400daa8b;

+                        bVar6 = IsThreadHung(ptVar1);

+                        if (bVar6) goto LAB_7;

+                        *(undefined8 *)(puVar20 + -8) = 0x1400daaa6;

+                        cVar4 = BoostHook(ptVar21,param_1,*(CallHookHints *)(puVar20 + 0x350));

+                        puVar20[0x61] = cVar4;

+                        if ((bool)cVar4) {

+                          *(uint *)(puVar20 + 0x1b8) = *(uint *)(puVar20 + 0x1b8) | 1;

+                        }

+                        *(undefined4 *)(puVar20 + 0x40) = 0;

+                        *(undefined4 *)(puVar20 + 0x38) = 1;

+                        *(undefined1 **)(puVar20 + 0x30) = puVar20 + 0x150;

+                        *(undefined8 *)(puVar20 + 0x28) = *(undefined8 *)(param_1 + 0x10);

+                        *(undefined4 *)(puVar20 + 0x20) = 1;

+                        *(undefined8 *)(puVar20 + -8) = 0x1400daafd;

+                        lVar13 = xxxInterSendMsgEx(0,0x314,*(undefined8 *)(puVar20 + 0x90),

+                                                   puVar20 + 0x1a0);

+                        if ((lVar13 == 0) &&

+                           (*(undefined8 *)(puVar20 + 0x68) = 0,

+                           -1 < (char)*(undefined4 *)(param_1 + 0x40))) {

+                          if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                             (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x10) == 0 ||

+                              ((byte)WPP_GLOBAL_Control[0x29] < 4)))) {

+                            cVar25 = '\0';

+                          }

+                          else {

+                            cVar25 = '\x01';

+                          }

+                          puVar20[0x60] =

+                               (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                          if ((cVar25 != '\0') ||

+                             ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED))

+                          {

+                            uVar26 = *(undefined4 *)(param_1 + 0x30);

+                            uVar15 = **(undefined8 **)(param_1 + 0x10);

+                            *(undefined8 *)(puVar20 + -8) = 0x1400dab6e;

+                            uVar12 = PsGetThreadId(uVar15);

+                            uVar11 = *(undefined4 *)

+                                      (*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) + 0x38);

+                            *(undefined8 *)(puVar20 + -8) = 0x1400dab8c;

+                            lVar13 = W32GetUserSessionState();

+                            uVar15 = *(undefined8 *)(lVar13 + 0x10f98);

+                            uVar2 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+                            *(undefined4 *)(puVar20 + 0x50) = uVar26;

+                            *(undefined4 *)(puVar20 + 0x48) = uVar12;

+                            *(undefined4 *)(puVar20 + 0x40) = uVar11;

+                            *(undefined2 *)(puVar20 + 0x30) = 0x22;

+                            *(undefined8 *)(puVar20 + -8) = 0x1400dabc6;

+                            WPP_RECORDER_AND_TRACE_SF_DDd(uVar2,cVar25,puVar20[0x60],uVar15);

+                            cVar4 = puVar20[0x61];

+                            ptVar22 = *(tagWND **)(puVar20 + 0x70);

+                          }

+                        }

+                        if (cVar4 != '\0') {

+                          *(undefined8 *)(puVar20 + -8) = 0x1400dabdc;

+                          DeBoostHook(param_1);

+                        }

+                      }

+                      else {

+LAB_7:

+                        *(undefined8 *)(puVar20 + 0x68) = 0;

+                      }

+                      if (((uVar23 & 0x20) != 0) && (*(longlong *)(puVar20 + 0x68) != 0)) {

+                        LOCK();

+                        *(int *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1e8) + 0x14) =

+                             (int)((ulonglong)_DAT_8 * _DAT_fffff78000000320 >> 0x18)

+                        ;

+                        UNLOCK();

+                      }

+                    }

+                    *(tagTHREADINFO **)(puVar20 + 0x90) = ptVar21 + 0x2d8;

+                    *(tagWND **)(puVar20 + 0x98) = ptVar22;

+                    *(undefined8 *)(puVar20 + -8) = 0x1400dac4d;

+                    HMAssignmentLock(puVar20 + 0x90,1);

+                    if (*(longlong *)(ptVar21 + 0x208) != 0) {

+                      *(undefined8 *)(*(longlong *)(ptVar21 + 0x208) + 0x30) =

+                           *(undefined8 *)(puVar20 + 0xa0);

+                    }

+                    _Var17 = *(__int64 *)(puVar20 + 0x68);

+                    *(undefined8 *)(puVar20 + -8) = 0x1400dac8e;

+                    Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

+                              ((Win32HMThreadLockBase<tagWND,1,0> *)(puVar20 + 0x140));

+                    *(undefined8 *)(puVar20 + -8) = 0x1400dac98;

+                    Win32HMOptionalThreadLockAlways<tagWND>::

+                    ~Win32HMOptionalThreadLockAlways<tagWND>

+                              ((Win32HMOptionalThreadLockAlways<tagWND> *)(puVar20 + 0x78));

+                    goto LAB_9;

+                  }

+                }

+              }

+              else if (*(int *)(param_1 + 0x44) == -1) {

+LAB_10:

+                if ((((*(uint *)(**(longlong **)(ptVar21 + 0x1f8) + 0x10) |

+                      *(uint *)(ptVar21 + 0x2d0)) >> 10 & 1) == 0) ||

+                   (*(int *)(param_1 + 0x30) == 9)) {

+LAB_11:

+                  ptVar22 = *(tagWND **)(ptVar21 + 0x2d8);

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da5f1;

+                  Win32HMOptionalThreadLock<tagWND>::Win32HMOptionalThreadLock<tagWND>

+                            ((Win32HMOptionalThreadLock<tagWND> *)(puVar20 + 0x100),ptVar21,ptVar22)

+                  ;

+                  if (*(longlong *)(ptVar21 + 0x208) != 0) {

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da605;

+                    puVar14 = (undefined8 *)PhkNextValid(param_1);

+                    *(undefined8 *)(puVar20 + 0xa0) =

+                         *(undefined8 *)(*(longlong *)(ptVar21 + 0x208) + 0x30);

+                    if (puVar14 == (undefined8 *)0x0) {

+                      uVar15 = 0;

+                    }

+                    else {

+                      uVar15 = *puVar14;

+                    }

+                    *(undefined8 *)(*(longlong *)(ptVar21 + 0x208) + 0x30) = uVar15;

+                  }

+                  *(tagTHREADINFO **)(puVar20 + 0x110) = ptVar21 + 0x2d8;

+                  *(tagHOOK **)(puVar20 + 0x118) = param_1;

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da685;

+                  HMAssignmentLock(puVar20 + 0x110,1);

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da69b;

+                  uVar15 = xxxHkCallHook(param_1,param_2);

+                  *(undefined8 *)(puVar20 + 0x68) = uVar15;

+                  *(tagTHREADINFO **)(puVar20 + 0x120) = ptVar21 + 0x2d8;

+                  *(tagWND **)(puVar20 + 0x128) = ptVar22;

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da6cb;

+                  HMAssignmentLock(puVar20 + 0x120,1);

+                  if (*(longlong *)(ptVar21 + 0x208) != 0) {

+                    *(undefined8 *)(*(longlong *)(ptVar21 + 0x208) + 0x30) =

+                         *(undefined8 *)(puVar20 + 0xa0);

+                  }

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da725;

+                  Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

+                            ((Win32HMThreadLockBase<tagWND,1,0> *)(puVar20 + 0x100));

+                  if ((*(uint *)(param_1 + 0x40) & 0x10) != 0) {

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da738;

+                    param_1 = (tagHOOK *)PhkNextValid(param_1);

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da742;

+                    plVar16 = (longlong *)PsGetCurrentThreadWin32Thread();

+                    lVar13 = 0;

+                    if (plVar16 != (longlong *)0x0) {

+                      lVar13 = *plVar16;

+                    }

+                    puVar14 = *(undefined8 **)(lVar13 + 0x1c8);

+                    if (puVar14 != (undefined8 *)(puVar20 + 0x78)) {

+                      *(undefined8 *)(puVar20 + 0x20) = 0;

+                    /* WARNING: Subroutine does not return */

+                      *(undefined8 *)(puVar20 + -8) = 0x1400da785;

+                      KeBugCheckEx(0x164,0x3b,lVar13,puVar20 + 0x78);

+                    }

+                    *(undefined8 *)(lVar13 + 0x1c8) = *puVar14;

+                    uVar15 = puVar14[1];

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da7a0;

+                    lVar13 = HMUnlockObject(uVar15);

+                    *(undefined8 *)(puVar20 + 0x80) = 0;

+                    *(undefined8 *)(puVar20 + 0x78) = 0xffffffffffffffff;

+                    if (lVar13 != 0) {

+                      *(undefined8 *)(puVar20 + -8) = 0x1400da7c3;

+                      FreeHook(lVar13);

+                    }

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da7cd;

+                    Win32HMOptionalThreadLockAlways<tagWND>::

+                    ~Win32HMOptionalThreadLockAlways<tagWND>

+                              ((Win32HMOptionalThreadLockAlways<tagWND> *)(puVar20 + 0x78));

+                    iVar9 = *(int *)(puVar20 + 100);

+                    goto LAB_1;

+                  }

+                  _Var17 = *(__int64 *)(puVar20 + 0x68);

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da7ec;

+                  Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

+                            ((Win32HMOptionalThreadLockAlways<tagWND> *)(puVar20 + 0x78));

+                  goto LAB_9;

+                }

+                *(undefined4 *)(puVar20 + 500) = 0;

+                *(undefined8 *)(puVar20 + -8) = 0x1400da4fc;

+                uVar11 = PsGetThreadId();

+                *(undefined4 *)(puVar20 + 0x1d8) = uVar11;

+                *(undefined4 *)(puVar20 + 0x1dc) = 0;

+                *(int *)(puVar20 + 0x1f0) = param_2;

+                *(undefined8 *)(puVar20 + 0x1e8) = *(undefined8 *)(puVar20 + 0x90);

+                *(undefined8 *)(puVar20 + 0x1e0) = *(undefined8 *)(puVar20 + 0x70);

+                iVar9 = *(int *)(param_1 + 0x30);

+                *(undefined8 *)(puVar20 + -8) = 0x1400da54b;

+                iVar9 = xxxCallHook(0,(longlong)iVar9,(__int64)(puVar20 + 0x1d8),9);

+                if (iVar9 == 0) {

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da55c;

+                  SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::

+                  ObjectLock<>::ObjectLock<>((ObjectLock<> *)(puVar20 + 0x230));

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da566;

+                  lVar13 = _HMPheFromObject(param_1);

+                  if (((*(byte *)(lVar13 + 0x19) & 1) == 0) &&

+                     ((*(uint *)(param_1 + 0x40) & 0x1000) == 0)) {

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da587;

+                    SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::

+                    ObjectLock<>::~ObjectLock<>((ObjectLock<> *)(puVar20 + 0x230));

+                    goto LAB_11;

+                  }

+                  this_00 = (ObjectLock<> *)(puVar20 + 0x230);

+LAB_12:

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da596;

+                  SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::

+                  ObjectLock<>::~ObjectLock<>(this_00);

+                }

+              }

+              else {

+                *(undefined8 *)(puVar20 + -8) = 0x1400da420;

+                uVar15 = PsGetCurrentProcess();

+                *(undefined8 *)(puVar20 + -8) = 0x1400da42f;

+                iVar9 = PsIsProtectedProcess(uVar15);

+                if (iVar9 == 0) {

+                  *(undefined8 *)(puVar20 + -8) = 0x1400da443;

+                  iVar9 = PsGetWin32KFilterSet();

+                  if (iVar9 != 5) {

+                    uVar11 = *(undefined4 *)(param_1 + 0x44);

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da461;

+                    SharedUserCritOnly::UnlockDomainShared<DLT_HOOK>::UnlockDomainExclusive<>::

+                    UnlockObjectLock<>::UnlockObjectLock<>((UnlockObjectLock<> *)(puVar20 + 0x2a0));

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da468;

+                    lVar13 = xxxLoadHmodIndex(uVar11);

+                    *(undefined8 *)(puVar20 + -8) = 0x1400da478;

+                    SharedUserCritOnly::UnlockDomainShared<DLT_HOOK>::UnlockDomainExclusive<>::

+                    UnlockObjectLock<>::~UnlockObjectLock<>((UnlockObjectLock<> *)(puVar20 + 0x2a0))

+                    ;

+                    if (lVar13 != 0) {

+                      *(undefined8 *)(puVar20 + -8) = 0x1400da48e;

+                      SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::

+                      ObjectLock<>::ObjectLock<>((ObjectLock<> *)(puVar20 + 0x1f8));

+                      *(undefined8 *)(puVar20 + -8) = 0x1400da498;

+                      lVar13 = _HMPheFromObject(param_1);

+                      if (((*(byte *)(lVar13 + 0x19) & 1) == 0) &&

+                         ((*(uint *)(param_1 + 0x40) & 0x1000) == 0)) {

+                        *(undefined8 *)(puVar20 + -8) = 0x1400da4c1;

+                        SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::

+                        ObjectLock<>::~ObjectLock<>((ObjectLock<> *)(puVar20 + 0x1f8));

+                        goto LAB_10;

+                      }

+                      this_00 = (ObjectLock<> *)(puVar20 + 0x1f8);

+                      goto LAB_12;

+                    }

+                  }

+                }

+              }

+              lVar13 = 0;

+              *(undefined8 *)(puVar20 + -8) = 0x1400da5a0;

+              param_1 = (tagHOOK *)PhkNextValid(param_1);

+              *(undefined8 *)(puVar20 + -8) = 0x1400da5aa;

+              plVar16 = (longlong *)PsGetCurrentThreadWin32Thread();

+              if (plVar16 != (longlong *)0x0) {

+                lVar13 = *plVar16;

+              }

+              puVar14 = *(undefined8 **)(lVar13 + 0x1c8);

+              if (puVar14 != (undefined8 *)(puVar20 + 0x78)) {

+                *(undefined8 *)(puVar20 + 0x20) = 0;

+                    /* WARNING: Subroutine does not return */

+                *(undefined8 *)(puVar20 + -8) = 0x1400dacd2;

+                KeBugCheckEx(0x164,0x3b,lVar13,puVar20 + 0x78);

+              }

+              *(undefined8 *)(lVar13 + 0x1c8) = *puVar14;

+              uVar15 = puVar14[1];

+              *(undefined8 *)(puVar20 + -8) = 0x1400daced;

+              lVar13 = HMUnlockObject(uVar15);

+              *(undefined8 *)(puVar20 + 0x80) = 0;

+              *(undefined8 *)(puVar20 + 0x78) = 0xffffffffffffffff;

+              if ((lVar13 != 0) && ((*(uint *)(lVar13 + 0x40) & 0x10) != 0)) {

+                *(undefined8 *)(puVar20 + -8) = 0x1400dad18;

+                FreeHook(lVar13);

+              }

+              *(undefined8 *)(puVar20 + -8) = 0x1400dad22;

+              Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

+                        ((Win32HMOptionalThreadLockAlways<tagWND> *)(puVar20 + 0x78));

+              iVar9 = *(int *)(puVar20 + 100);

+            }

+            else {

+              *(undefined8 *)(puVar20 + -8) = 0x1400dad37;

+              param_1 = (tagHOOK *)PhkNextValid(param_1);

+              *(undefined8 *)(puVar20 + -8) = 0x1400dad47;

+              SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::ObjectLock<>::

+              ~ObjectLock<>((ObjectLock<> *)(puVar20 + 0x268));

+            }

+LAB_1:

+          } while (param_1 != (tagHOOK *)0x0);

+        }

       }

-      uVar4 = RGNOBJ::iComplexity((RGNOBJ *)&lStack_60);

-      *(longlong *)(param_1 + 0xa0) = lVar1;

-      return (ulonglong)uVar4;

-    }

-    uVar5 = func_0x0001400b6a8c(lStack_58 + 0x18);

-    RGNMEMOBJ::RGNMEMOBJ((RGNMEMOBJ *)&lStack_68,uVar5);

-    if (lStack_68 == 0) {

-      return 0;

-    }

-    RGNOBJ::vCopy((RGNOBJ *)&lStack_68,(RGNOBJ *)&lStack_58);

-    lVar2 = lStack_68;

-    *(int *)(lStack_68 + 0x4c) = *(int *)(lStack_68 + 0x4c) + 1;

-    uVar4 = RGNOBJ::iComplexity((RGNOBJ *)&lStack_68);

-    *(longlong *)(param_1 + 0xa0) = lVar2;

-    uVar6 = (ulonglong)uVar4;

-    if (lVar1 == 0) {

-      return uVar6;

-    }

-    *(int *)(lStack_60 + 0x4c) = *(int *)(lStack_60 + 0x4c) + -1;

-    iVar3 = *(int *)(lStack_60 + 0x4c);

-LAB_1:

-    if (iVar3 != 0) {

-      return uVar6;

     }

   }

-  else {

-    if (((iVar3 == 1) && (lStack_58 != 0)) && (lVar1 == 0)) goto LAB_0;

-    RGNMEMOBJ::RGNMEMOBJ((RGNMEMOBJ *)&lStack_60);

-    if (lStack_60 == 0) {

-      return 0;

-    }

-    if (lVar1 == 0) {

-      RGNMEMOBJTMP::RGNMEMOBJTMP((RGNMEMOBJTMP *)&lStack_68);

-      local_50 = (HSEMAPHORE__ *)0x0;

-      if (lStack_68 != 0) {

-        DC::vGet_sizlWindow((DC *)param_1,(tagSIZE *)&local_50);

-        lVar1 = *(longlong *)(param_1 + 0x30);

-        uStack_40 = (undefined4)local_50;

-        uStack_3c = local_50._4_4_;

-        uStack_48 = 0;

-        if (*(longlong *)(param_1 + 0x1f0) != 0) {

-          SEMOBJSHARED<1>::SEMOBJSHARED<1>((SEMOBJSHARED<1> *)&local_50);

-          if (((*(uint *)(lVar1 + 0x28) & 0x20000) != 0) &&

-             (*(int *)(*(longlong *)(param_1 + 0x1f0) + 0x70) < 0)) {

-            ERECTL::bOffsetAdd((ERECTL *)&uStack_48,(_POINTL *)(lVar1 + 0xa10),0);

-          }

-          GreReleaseSemaphoreCommon<1,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

-                    (GreReleaseSemaphoreSharedInternal_exref,local_50);

-        }

-        ERECTL::bOffsetSubtract

-                  ((ERECTL *)&uStack_48,

-                   (_POINTL *)(param_1 + ((ulonglong)(*(uint *)(param_1 + 0x28) & 1) + 0x7f) * 8),0)

-        ;

-        RGNOBJ::vSet((RGNOBJ *)&lStack_68,(_RECTL *)&uStack_48);

-        uVar4 = RGNOBJ::iCombine((RGNOBJ *)&lStack_60,(RGNOBJ *)&lStack_68,(RGNOBJ *)&lStack_58,

-                                 iVar3);

-        uVar6 = (ulonglong)uVar4;

-        if (uVar4 != 0) {

-          *(int *)(lStack_60 + 0x4c) = *(int *)(lStack_60 + 0x4c) + 1;

-          *(longlong *)(param_1 + 0xa0) = lStack_60;

-        }

-      }

-      RGNMEMOBJTMP::~RGNMEMOBJTMP((RGNMEMOBJTMP *)&lStack_68);

-      iVar3 = (int)uVar6;

-      goto LAB_1;

-    }

-    lStack_68 = lVar1;

-    uVar4 = RGNOBJ::iCombine((RGNOBJ *)&lStack_60,(RGNOBJ *)&lStack_68,(RGNOBJ *)&lStack_58,iVar3);

-    uVar6 = (ulonglong)uVar4;

-    if (uVar4 != 0) {

-      *(int *)(lStack_60 + 0x4c) = *(int *)(lStack_60 + 0x4c) + 1;

-      *(longlong *)(param_1 + 0xa0) = lStack_60;

-      *(int *)(lStack_68 + 0x4c) = *(int *)(lStack_68 + 0x4c) + -1;

-      if (*(int *)(lStack_68 + 0x4c) != 0) {

-        return uVar6;

-      }

-      this = (RGNOBJ *)&lStack_68;

-      goto LAB_2;

-    }

-  }

-  this = (RGNOBJ *)&lStack_60;

-LAB_2:

-  RGNOBJ::vDeleteRGNOBJ(this);

-  return uVar6;

+  _Var17 = 0;

+LAB_9:

+  *(undefined8 *)(puVar20 + -8) = 0x1400dad62;

+  return _Var17;

 }
```

## `_PostTransformableMessageIL`  (modified)

```diff
--- _PostTransformableMessageIL
+++ _PostTransformableMessageIL
@@ -1,52 +1,42 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-

-void _PostTransformableMessageIL(char param_1,longlong param_2)

+tagQMSG * _PostTransformableMessageIL

+                    (tagWND *param_1,uint param_2,__uint64 param_3,__int64 param_4,int param_5)

 

 {

-  char cVar1;

-  char cVar2;

-  int iVar3;

-  ulonglong in_RAX;

-  int *piVar4;

-  char *unaff_RBX;

-  undefined8 *puVar5;

-  undefined8 *unaff_RBP;

-  undefined1 *unaff_RSI;

-  undefined1 *unaff_RDI;

-  longlong in_FS_OFFSET;

-  code *pcStack_8c01;

-  undefined1 auStack_8bd1 [72];

-  longlong alStack_8b89 [40];

-  undefined1 auStack_8a49 [512];

-  undefined1 auStack_8849 [34849];

-  undefined1 *puStack_28;

-  undefined8 uStack_10;

+  undefined8 uVar1;

+  int iVar2;

+  tagQMSG *ptVar3;

+  longlong *plVar4;

+  tagTHREADINFO *ptVar5;

+  int iVar6;

   

-  piVar4 = (int *)(in_RAX & 0xffffffffffffff60);

-  iVar3 = (int)piVar4;

-  *piVar4 = *piVar4 + iVar3;

-  cVar2 = (char)piVar4;

-  *unaff_RBX = *unaff_RBX + cVar2;

-  puStack_28 = &stack0xfffffffffffffff8;

-  puVar5 = (undefined8 *)&stack0xfffffffffffffff8;

-  cVar1 = '\x03';

-  do {

-    unaff_RBP = unaff_RBP + -1;

-    puVar5 = puVar5 + -1;

-    *puVar5 = *unaff_RBP;

-    cVar1 = cVar1 + -1;

-  } while ('\0' < cVar1);

-  *(int *)(in_FS_OFFSET + (longlong)piVar4) = *(int *)(in_FS_OFFSET + (longlong)piVar4) + iVar3;

-  *(char *)((longlong)piVar4 + -0x75) = *(char *)((longlong)piVar4 + -0x75) + param_1;

-  *(char *)piVar4 = (char)*piVar4 + cVar2;

-  unaff_RBX[0x24848900] = unaff_RBX[0x24848900] + param_1;

-  *unaff_RDI = *unaff_RSI;

-  *piVar4 = *piVar4 + iVar3;

-  *(char *)piVar4 = (char)*piVar4 + cVar2;

-  alStack_8b89[0] = param_2 + 0x11c8;

-  (*pcStack_8c01)(alStack_8b89,auStack_8bd1,auStack_8a49,auStack_8849);

-  return;

+  if ((8 < param_2 - 0x3e0) || (iVar2 = ValidateDDEConvPair(param_3,param_1), iVar6 = 1, iVar2 == 0)

+     ) {

+    iVar6 = param_5;

+  }

+  if ((param_2 == 0x112) && (param_3 == 0xf030)) {

+    ptVar5 = PtiCurrent();

+    iVar2 = IAMThreadAccessGranted(ptVar5);

+    if (iVar2 != 0) {

+      iVar6 = 1;

+    }

+  }

+  if ((param_1 + -1 < (tagWND *)0xfffffffffffffffe) && (iVar6 == 0)) {

+    uVar1 = *(undefined8 *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+    plVar4 = (longlong *)PsGetCurrentProcessWin32Process();

+    if ((plVar4 != (longlong *)0x0) && (*plVar4 == 0)) {

+      plVar4 = (longlong *)0x0;

+    }

+    ptVar3 = (tagQMSG *)CheckForMessageAccessCrossIL(plVar4,uVar1,param_1,param_2,param_3,param_4);

+    if ((int)ptVar3 == 0) {

+      return ptVar3;

+    }

+  }

+  ptVar3 = _PostTransformableMessageExtended

+                     (param_1,param_2,param_3,param_4,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

+  if (*(tagQMSG **)MmSystemRangeStart_exref <= ptVar3) {

+    ptVar3 = (tagQMSG *)(ulonglong)(ptVar3 != (tagQMSG *)0x0);

+  }

+  return ptVar3;

 }
```

## `ApiSetpSearchForSectionIndex_V7`  (modified)

```diff
--- ApiSetpSearchForSectionIndex_V7
+++ ApiSetpSearchForSectionIndex_V7
@@ -1,22 +1,55 @@
 

-void ApiSetpSearchForSectionIndex_V7(void)

+undefined2

+ApiSetpSearchForSectionIndex_V7

+          (longlong param_1,longlong param_2,undefined8 param_3,undefined1 param_4)

 

 {

-  int iVar1;

-  undefined8 in_RAX;

-  undefined8 *unaff_RBX;

+  byte bVar1;

+  byte bVar2;

+  char cVar3;

+  uint uVar4;

+  uint uVar5;

+  ulonglong uVar6;

+  undefined7 uVar7;

+  char cVar8;

+  ulonglong uVar9;

+  undefined7 uVar10;

+  byte bVar11;

+  undefined2 local_res10 [4];

   

-  *unaff_RBX = in_RAX;

-  LOCK();

-  iVar1 = *(int *)(unaff_RBX + 1);

-  if (iVar1 == 0) {

-    *(int *)(unaff_RBX + 1) = -1;

-    iVar1 = 0;

+  uVar9 = CONCAT71((int7)((ulonglong)param_3 >> 8),*(byte *)(param_1 + 2)) & 0xffffffffffffff10;

+  bVar1 = *(byte *)(param_1 + 2) & 8;

+  uVar6 = CONCAT71((int7)((ulonglong)param_2 >> 8),*(byte *)(param_2 + 9)) & 0xffffffffffffff02;

+  bVar11 = *(byte *)(param_2 + 9) & 4;

+  uVar10 = (undefined7)(uVar9 >> 8);

+  uVar7 = (undefined7)(uVar6 >> 8);

+  cVar8 = (char)uVar9;

+  cVar3 = (char)uVar6;

+  if (bVar11 == 0) {

+    uVar4 = ApiSetpGetSearchKeyHash

+                      (param_3,CONCAT71(uVar7,cVar3 != '\0'),CONCAT71(uVar10,bVar1 != 0),

+                       cVar8 != '\0',*(undefined1 *)(param_2 + 10));

   }

-  UNLOCK();

-  if (iVar1 != 1) {

-    KeWaitForSingleObject(&stack0x00000030,6,0,0,0);

+  else {

+    bVar2 = ApiSetpGetSearchKeyHash

+                      (param_3,CONCAT71(uVar7,cVar3 != '\0'),CONCAT71(uVar10,bVar1 != 0),

+                       cVar8 != '\0',*(undefined1 *)(param_2 + 10));

+    uVar4 = (uint)bVar2;

   }

-  return;

+  if (bVar11 == 0) {

+    uVar5 = ApiSetpGetSearchKeyHash

+                      (param_3,param_4,bVar1 != 0,cVar8 != '\0',*(undefined1 *)(param_2 + 0xb));

+  }

+  else {

+    bVar1 = ApiSetpGetSearchKeyHash

+                      (param_3,param_4,bVar1 != 0,cVar8 != '\0',*(undefined1 *)(param_2 + 0xb));

+    uVar5 = (uint)bVar1;

+  }

+  local_res10[0] = 0;

+  cVar3 = ApiSetpFindHashtableIndexAndVerify_V7(param_1,param_2,uVar4,uVar5,local_res10);

+  if (cVar3 == '\0') {

+    local_res10[0] = 0xffff;

+  }

+  return local_res10[0];

 }
```

## `xxxDrawMenuItemText`  (modified)

```diff
--- xxxDrawMenuItemText
+++ xxxDrawMenuItemText
@@ -1,23 +1,87 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* void __cdecl xxxDrawMenuItemText(class SmartObjStackRef<struct tagMENU> const & __ptr64,struct

+   tagITEM * __ptr64,struct HDC__ * __ptr64,int,int,unsigned short * __ptr64,int,int) */

 

 void __cdecl

 xxxDrawMenuItemText(SmartObjStackRef<tagMENU> *param_1,tagITEM *param_2,HDC__ *param_3,int param_4,

                    int param_5,ushort *param_6,int param_7,int param_8)

 

 {

-  ulonglong unaff_RBX;

-  undefined4 unaff_ESI;

-  undefined4 in_stack_0000002c;

+  char cVar1;

+  bool bVar2;

+  int iVar3;

+  ushort *puVar4;

+  longlong lVar5;

+  ulonglong uVar6;

+  undefined1 auStackY_2e8 [32];

+  undefined8 local_2a8;

+  undefined8 uStack_2a0;

+  longlong local_298;

+  uint local_290;

+  __uint64 local_288;

+  tagTHREADINFO *local_280;

+  ushort *local_278;

+  undefined8 local_260;

+  ushort local_258 [256];

+  ulonglong local_58;

   

-  ProbeForRead(CONCAT44(in_stack_0000002c,param_5),unaff_RBX & 0xffffffff);

-  memcpy(&stack0x00000050,(void *)CONCAT44(in_stack_0000002c,param_5),unaff_RBX & 0xffffffff);

-  func_0x000140029d80(unaff_ESI,&stack0x00000050,unaff_RBX & 0xffffffff);

-  if (CONCAT44(in_stack_0000002c,param_5) != 0) {

-    ProbeForWrite(CONCAT44(in_stack_0000002c,param_5));

-    memcpy((void *)CONCAT44(in_stack_0000002c,param_5),&stack0x00000050,unaff_RBX);

+  local_58 = __security_cookie ^ (ulonglong)auStackY_2e8;

+  local_278 = param_6;

+  local_280 = PtiCurrent();

+  local_260 = 0;

+  local_288 = *(__uint64 *)(param_2 + 0x58);

+  local_2a8 = 0;

+  uStack_2a0 = 0;

+  local_298 = -1;

+  if (param_7 < 0xff) {

+    puVar4 = local_258;

   }

-  UserSessionSwitchLeaveCrit();

+  else {

+    puVar4 = (ushort *)Win32AllocPoolZInit((longlong)(param_7 + 1) * 2,0x74727355);

+    if (puVar4 == (ushort *)0x0) goto LAB_0;

+    Win32RawLockedItemBase<void,0,0,1,1>::ManualLock<void>

+              ((Win32RawLockedItemBase<void,0,0,1,1> *)&local_2a8,puVar4,Win32FreePool_exref);

+  }

+  local_290 = GetPrefixCount(param_6,param_7,puVar4);

+  iVar3 = CALL_LPK(local_280);

+  if (iVar3 == 0) {

+    GreExtTextOutW(param_3,param_4,param_5);

+  }

+  else {

+    xxxClientExtTextOutW();

+    lVar5 = *(longlong *)(param_1 + 0x10);

+    if (lVar5 == 0) {

+      lVar5 = **(longlong **)param_1;

+    }

+    cVar1 = MNIspItemValid(lVar5,param_2);

+    if (cVar1 == '\0') goto LAB_0;

+    iVar3 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+    if (iVar3 == 0) {

+      if (local_288 != *(__uint64 *)(param_2 + 0x58)) goto LAB_0;

+    }

+    else {

+      bVar2 = MNIspItemStringUnchanged(param_2,local_278,local_288);

+      if (!bVar2) goto LAB_0;

+    }

+  }

+  if ((((param_8 != 0) ||

+       (lVar5 = W32GetUserSessionState(), (*(uint *)(lVar5 + 0x10650) & 0x20000) != 0)) ||

+      (lVar5 = W32GetUserSessionState(), (*(uint *)(lVar5 + 0x10654) & 0x20) != 0)) ||

+     ((lVar5 = W32GetUserSessionState(), -1 < *(int *)(lVar5 + 0x10654) ||

+      (uVar6 = GetAppCompatFlags2(0x400), (uVar6 & 2) != 0)))) {

+    iVar3 = CALL_LPK(local_280);

+    if (iVar3 == 0) {

+      xxxDrawItemUnderline(param_1,param_2,param_3,param_4,param_5,puVar4,local_290 & 0xffff);

+    }

+    else {

+      xxxPSMTextOut(param_3,param_4,param_5,local_278);

+    }

+  }

+LAB_0:

+  if (local_298 != -1) {

+    PopAndFreeW32ThreadLock(&local_2a8);

+  }

   return;

 }
```

## `xxxRequestAck`  (modified)

```diff
--- xxxRequestAck
+++ xxxPoke
@@ -1,147 +1,17 @@
 

-/* unsigned long __cdecl xxxRequestAck(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

-   __ptr64) */

+/* WARNING: Control flow encountered bad instruction data */

 

-ulong __cdecl xxxRequestAck(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

+ulong __cdecl xxxPoke(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

-  tagINTDDEINFO *ptVar1;

-  ulong uVar2;

-  uint uVar3;

-  int iVar4;

-  tagDDECONV *ptVar5;

-  longlong lVar6;

-  tagPUBOBJ *ptVar7;

-  void *pvVar8;

-  tagXSTATE *ptVar9;

-  longlong lVar10;

-  uint uVar11;

-  bool bVar12;

-  ulong local_res8 [2];

-  tagINTDDEINFO *local_48;

-  void *local_40;

+  byte *pbVar1;

+  undefined1 uVar2;

+  undefined7 in_register_00000001;

   

-  pvVar8 = (void *)0x0;

-  local_48 = (tagINTDDEINFO *)0x0;

-  local_40 = (void *)0x0;

-  if (*param_1 == 0x3e4) {

-    uVar2 = xxxCopyAckIn(param_1,param_2,param_3,&local_48);

-    iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-    if (iVar4 == 0) {

-      lVar10 = _HMPheFromObject(param_3);

-      bVar12 = (bool)(~*(byte *)(lVar10 + 0x19) & 1);

-    }

-    else {

-      ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

-      bVar12 = ptVar5 == param_3;

-    }

-    if (bVar12 == false) {

-      return 0;

-    }

-    if (uVar2 != 2) {

-      return uVar2;

-    }

-    PopState(param_3);

-    return 2;

-  }

-  if (*param_1 != 0x3e5) {

-    uVar2 = xxxUnexpectedServerPost(param_1,param_2,param_3);

-    return uVar2;

-  }

-  lVar10 = *(longlong *)(param_3 + 0x38);

-  local_res8[0] = 0x83;

-  uVar3 = xxxClientGetDDEFlags(*param_2);

-  iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-  if (iVar4 == 0) {

-    lVar6 = _HMPheFromObject(param_3);

-    bVar12 = (bool)(~*(byte *)(lVar6 + 0x19) & 1);

-  }

-  else {

-    ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

-    bVar12 = ptVar5 == param_3;

-  }

-  if ((bVar12 == false) || (*(longlong *)(param_3 + 0x38) != lVar10)) {

-LAB_0:

-    uVar2 = 3;

-  }

-  else {

-    if ((uVar3 >> 0xc & 1) == 0) {

-      uVar2 = xxxAdviseData(param_1,param_2,param_3);

-      return uVar2;

-    }

-    uVar2 = xxxCopyDdeIn((void *)*param_2,local_res8,&local_40,&local_48);

-    iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-    if (iVar4 == 0) {

-      lVar6 = _HMPheFromObject(param_3);

-      bVar12 = (bool)(~*(byte *)(lVar6 + 0x19) & 1);

-    }

-    else {

-      ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

-      bVar12 = ptVar5 == param_3;

-    }

-    ptVar1 = local_48;

-    if ((bVar12 == false) || (*(longlong *)(param_3 + 0x38) != lVar10)) {

-      if (local_48 == (tagINTDDEINFO *)0x0) {

-        return 3;

-      }

-      Win32FreePool();

-      return 3;

-    }

-    if (uVar2 != 2) {

-      return uVar2;

-    }

-    if ((*(ushort *)(local_48 + 0x48) & 0xa000) == 0) {

-      *(ushort *)(local_48 + 0x48) = *(ushort *)(local_48 + 0x48) | 0x2000;

-    }

-    if ((uVar3 & 0x2000) == 0) {

-      iVar4 = AddPublicObject((uint)*(ushort *)(local_48 + 0x4a),*(void **)(local_48 + 0x30),

-                              *(ulong *)(*(longlong *)

-                                          (*(longlong *)(*(longlong *)(param_3 + 0x28) + 0x10) +

-                                          0x1d0) + 0x38));

-      uVar11 = local_res8[0];

-      if (iVar4 != 0) {

-        uVar11 = local_res8[0] | 0x2000;

-      }

-    }

-    else {

-      ptVar7 = IsObjectPublic(*(void **)(local_48 + 0x30));

-      if (ptVar7 != (tagPUBOBJ *)0x0) {

-        Win32FreePool(ptVar1);

-        goto LAB_0;

-      }

-      iVar4 = GiveObject((uint)*(ushort *)(ptVar1 + 0x4a),*(void **)(ptVar1 + 0x30),

-                         *(ulong *)(*(longlong *)

-                                     (*(longlong *)(*(longlong *)(param_3 + 0x30) + 0x10) + 0x1d0) +

-                                   0x38));

-      uVar2 = local_res8[0];

-      if (iVar4 != 0) {

-        uVar2 = local_res8[0] | 0x4000;

-      }

-      uVar11 = uVar2 | 0x400;

-    }

-    *param_1 = *param_1 | 0x80000000;

-    if ((uVar3 & 0x8000) == 0) {

-      FreeListAdd(param_3,local_40,uVar11 & 0xfffffffe);

-      ptVar9 = Createpxs((_func_ulong_ulong_ptr___int64_ptr_tagDDECONV_ptr *)0x0,(void *)0x0,

-                         (void *)0x0,ptVar1,uVar11 | 0x200);

-      if (ptVar9 != (tagXSTATE *)0x0) {

-        pvVar8 = *(void **)ptVar9;

-        *(undefined8 *)(ptVar9 + 0x10) = *(undefined8 *)(*(longlong *)(param_3 + 0x30) + 0x10);

-      }

-    }

-    else {

-      pvVar8 = AnticipatePost(*(tagDDECONV **)(param_3 + 0x20),xxxAdviseDataAck,(void *)0x0,local_40

-                              ,ptVar1,uVar11);

-    }

-    *param_2 = (__int64)pvVar8;

-    if (pvVar8 == (void *)0x0) {

-      uVar2 = 3;

-    }

-    else {

-      PopState(param_3);

-      uVar2 = 2;

-    }

-  }

-  return uVar2;

+  uVar2 = in((short)param_2);

+  pbVar1 = (byte *)(CONCAT71(in_register_00000001,uVar2) + -0x75);

+  *pbVar1 = *pbVar1 & (byte)param_1;

+                    /* WARNING: Bad instruction - Truncating control flow here */

+  halt_baddata();

 }
```

## `xxxCopyAckIn`  (modified)

```diff
--- xxxCopyAckIn
+++ xxxCopyAckIn
@@ -1,14 +1,70 @@
+

+/* unsigned long __cdecl xxxCopyAckIn(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

+   __ptr64,struct tagINTDDEINFO * __ptr64 * __ptr64) */

 

 ulong __cdecl

 xxxCopyAckIn(ulong *param_1,__int64 *param_2,tagDDECONV *param_3,tagINTDDEINFO **param_4)

 

 {

-  int iVar1;

+  longlong lVar1;

+  tagINTDDEINFO *ptVar2;

+  ulong uVar3;

+  int iVar4;

+  tagDDECONV *ptVar5;

+  longlong lVar6;

+  tagXSTATE *ptVar7;

+  bool bVar8;

+  ulong local_res18 [4];

   

-  iVar1 = SeImpersonateClientEx(param_1 + 4,uRam0000000000000188);

-  if (-1 >= iVar1) {

-    SetLastNtError(iVar1);

+  lVar1 = *(longlong *)(param_3 + 0x38);

+  local_res18[0] = 0x1001;

+  uVar3 = xxxCopyDdeIn((void *)*param_2,local_res18,(void **)0x0,param_4);

+  iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+  if (iVar4 == 0) {

+    lVar6 = _HMPheFromObject(param_3);

+    bVar8 = (bool)(~*(byte *)(lVar6 + 0x19) & 1);

   }

-  return (uint)(-1 < iVar1);

+  else {

+    ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

+    bVar8 = ptVar5 == param_3;

+  }

+  if ((bVar8 == false) || (*(longlong *)(param_3 + 0x38) != lVar1)) {

+    uVar3 = 3;

+    if (*param_4 != (tagINTDDEINFO *)0x0) {

+      Win32FreePool();

+    }

+  }

+  else if (uVar3 == 2) {

+    ptVar2 = *param_4;

+    if (((*(uint *)(*(longlong *)(param_3 + 0x38) + 0x40) & 0x4000) != 0) &&

+       (-1 < *(short *)(ptVar2 + 0x48))) {

+      lVar1 = *(longlong *)(*(longlong *)(param_3 + 0x38) + 0x38);

+      GiveObject((uint)*(ushort *)(lVar1 + 0x4a),*(void **)(lVar1 + 0x30),

+                 *(ulong *)(*(longlong *)

+                             (*(longlong *)(*(longlong *)(param_3 + 0x30) + 0x10) + 0x1d0) + 0x38));

+    }

+    if ((*(uint *)(*(longlong *)(param_3 + 0x38) + 0x40) & 0x2000) != 0) {

+      lVar1 = *(longlong *)(*(longlong *)(param_3 + 0x38) + 0x38);

+      RemovePublicObject((uint)*(ushort *)(lVar1 + 0x4a),*(void **)(lVar1 + 0x30));

+      *(uint *)(*(longlong *)(param_3 + 0x38) + 0x40) =

+           *(uint *)(*(longlong *)(param_3 + 0x38) + 0x40) & 0xffffdfff;

+    }

+    ptVar7 = Createpxs((_func_ulong_ulong_ptr___int64_ptr_tagDDECONV_ptr *)0x0,(void *)0x0,

+                       (void *)0x0,ptVar2,local_res18[0] | 0x200);

+    if (ptVar7 == (tagXSTATE *)0x0) {

+      *param_2 = 0;

+    }

+    else {

+      *(undefined8 *)(ptVar7 + 0x10) = *(undefined8 *)(*(longlong *)(param_3 + 0x30) + 0x10);

+      lVar1 = *(longlong *)ptVar7;

+      *param_2 = lVar1;

+      if (lVar1 != 0) {

+        *param_1 = *param_1 | 0x80000000;

+        return 2;

+      }

+    }

+    uVar3 = 3;

+  }

+  return uVar3;

 }
```

## `xxxGetDummyPalette`  (modified)

```diff
--- xxxGetDummyPalette
+++ xxxGetDummyPalette
@@ -1,80 +1,63 @@
 

-/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

+/* void * __ptr64 __cdecl xxxGetDummyPalette(struct tagWINDOWSTATION * __ptr64,struct

+   tagGETCLIPBDATA * __ptr64) */

 

 void * __cdecl xxxGetDummyPalette(tagWINDOWSTATION *param_1,tagGETCLIPBDATA *param_2)

 

 {

   uint uVar1;

-  int iVar2;

-  undefined **ppuVar3;

-  longlong lVar4;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  uint uVar5;

-  longlong unaff_RDI;

-  char cVar6;

-  int unaff_R12D;

-  uint uVar7;

-  bool bVar8;

+  uint uVar2;

+  int iVar3;

+  uint uVar4;

+  tagCLIP *ptVar5;

+  longlong lVar6;

+  void *pvVar7;

+  undefined8 uVar8;

+  uint uVar9;

   

-  uVar7 = 0;

-  do {

-    if (*(uint *)(unaff_RBX + 0x20) <= uVar7) {

+  uVar8 = 0x11;

+  ptVar5 = FindClipFormat(param_1,0x11,1);

+  if ((ptVar5 != (tagCLIP *)0x0) && (*(longlong *)(ptVar5 + 8) == 2)) {

+    uVar8 = 8;

+    ptVar5 = FindClipFormat(param_1,8,1);

+    if (ptVar5 == (tagCLIP *)0x0) {

+      return (void *)0x0;

+    }

+    if (*(longlong *)(ptVar5 + 8) == 2) {

+      return (void *)0x0;

+    }

+  }

+  lVar6 = xxxGetClipboardData(param_1,uVar8,param_2);

+  if (((lVar6 != 0) && (lVar6 = HMValidateHandleWithDescriptor(lVar6,6), lVar6 != 0)) &&

+     (ptVar5 = FindClipFormat(param_1,9,1), ptVar5 != (tagCLIP *)0x0)) {

+    iVar3 = Feature_3996097849__private_IsEnabledDeviceUsageNoInline();

+    if (iVar3 == 0) {

+      uVar4 = *(uint *)(lVar6 + 0x34);

 LAB_0:

-      _DAT_1 = unaff_R12D;

-      ppuVar3 = (undefined **)Win32FreePool();

-LAB_2:

-      if (unaff_RBX != 0) {

-        ppuVar3 = (undefined **)Win32FreePool();

+      pvVar7 = (void *)CreateDIBPalette(lVar6 + 0x14,uVar4);

+      if (pvVar7 != (void *)0x0) {

+        UT_FreeCBFormat(ptVar5);

+        *(void **)(ptVar5 + 8) = pvVar7;

+        GreSetPaletteOwner(pvVar7,0);

+        return pvVar7;

       }

-      if (*(longlong *)(unaff_RBP + 0x48) != 0) {

-        ppuVar3 = (undefined **)ZwClose();

+      return (void *)0x0;

+    }

+    uVar1 = *(uint *)(lVar6 + 0x10);

+    if (3 < uVar1) {

+      uVar2 = *(uint *)(lVar6 + 0x14);

+      if (uVar2 == 0xc) {

+        uVar4 = 0;

+        goto LAB_0;

       }

-      return ppuVar3;

+      if (((0x27 < uVar2) && (0x27 < uVar1)) && (uVar2 <= uVar1)) {

+        uVar4 = *(uint *)(lVar6 + 0x34);

+        if ((((ulonglong)uVar4 << 2 < 0x100000000) &&

+            (uVar9 = uVar2 + (int)((ulonglong)uVar4 << 2), uVar2 <= uVar9)) && (uVar9 <= uVar1))

+        goto LAB_0;

+      }

     }

-    iVar2 = ZwEnumerateValueKey(*(undefined8 *)(unaff_RBP + 0x48),uVar7,0);

-    if (iVar2 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)

-         ) {

-        cVar6 = '\0';

-      }

-      else {

-        cVar6 = (char)unaff_R12D;

-      }

-      ppuVar3 = &WPP_RECORDER_INITIALIZED;

-      bVar8 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar6 != '\0') || (bVar8)) {

-        lVar4 = W32GetUserSessionState();

-        ppuVar3 = (undefined **)

-                  WPP_RECORDER_AND_TRACE_SF_

-                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar8,

-                             *(undefined8 *)(lVar4 + 0x10f98),4);

-      }

-      DAT_3 = 0;

-      DAT_4._0_4_ = 0;

-      DAT_5 = 0;

-      _DAT_6 = unaff_R12D;

-      DAT_7 = unaff_R12D;

-      _DAT_1 = unaff_R12D;

-      if (unaff_RDI == 0) goto LAB_2;

-      goto LAB_0;

-    }

-    if (*(int *)(unaff_RDI + 4) == unaff_R12D) {

-      uVar1 = *(uint *)(unaff_RDI + 8);

-      for (uVar5 = 0; uVar5 < 5; uVar5 = uVar5 + 1) {

-        iVar2 = _wcsnicmp((wchar_t *)(&gaClipILDef)[(ulonglong)uVar5 * 4],

-                          (wchar_t *)(unaff_RDI + 0xc),(ulonglong)(uVar1 >> 1));

-        if (iVar2 == 0) {

-          unaff_R12D = 1;

-          (&DAT_5)[(ulonglong)uVar5 * 8] = 1;

-          goto LAB_8;

-        }

-      }

-      unaff_R12D = 1;

-    }

-LAB_8:

-    uVar7 = uVar7 + unaff_R12D;

-  } while( true );

+  }

+  return (void *)0x0;

 }
```

## `HandleDisplayChangeForInactiveDesktops`  (modified)

```diff
--- HandleDisplayChangeForInactiveDesktops
+++ xxxSetModernAppWindow
@@ -1,89 +1,19 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Instruction at (ram,0x000140243afb) overlaps instruction at (ram,0x000140243afa)

+    */

 

-void HandleDisplayChangeForInactiveDesktops(void)

+void xxxSetModernAppWindow(undefined8 param_1)

 

 {

-  longlong lVar1;

-  int iVar2;

-  undefined8 uVar3;

-  undefined8 uVar4;

-  undefined8 uVar5;

-  uint uVar6;

-  int unaff_EBX;

-  tagWND *ptVar7;

-  longlong unaff_RBP;

-  tagWND *unaff_RSI;

-  longlong unaff_RDI;

-  int unaff_R13D;

-  MinMaxOptions MVar8;

-  tagWND *unaff_R14;

-  tagWND *unaff_R15;

-  undefined4 uVar9;

+  byte bVar1;

   

-  *(uint *)(unaff_RDI + 0x70) = *(uint *)(unaff_RDI + 0x70) | (uint)unaff_RDI;

-  MVar8 = (MinMaxOptions)unaff_R14;

-  if (*(char *)(*(longlong *)(unaff_RSI + 0x28) + 0x1a) < '\0') {

-    SetOrClrWF((ulonglong)unaff_R14 & 0xffffffff);

+  bVar1 = (byte)((ulonglong)param_1 >> 8);

+  if (!CARRY1((byte)param_1,bVar1) && (byte)((byte)param_1 + bVar1) != '\0') {

+                    /* WARNING: Bad instruction - Truncating control flow here */

+    halt_baddata();

   }

-  uVar3 = *(undefined8 *)(*(longlong *)(unaff_RSI + 0x28) + 0x60);

-  *(undefined8 *)(unaff_RBP + -0x18) = *(undefined8 *)(*(longlong *)(unaff_RSI + 0x28) + 0x58);

-  *(undefined8 *)(unaff_RBP + -0x10) = uVar3;

-  xxxEnableChildWindowDpiMessageX(unaff_R15,MVar8);

-  if (((byte)*(undefined4 *)(*(longlong *)(unaff_RSI + 0x28) + 0x120) & 0xf) != 2) {

-    uVar3 = ValidateHmonitor(*(undefined8 *)(*(longlong *)(unaff_RSI + 0x28) + 0x100));

-    lVar1 = *(longlong *)(unaff_RSI + 0x28);

-    *(undefined8 *)(unaff_RBP + -0x20) = uVar3;

-    uVar9 = LogicalToPhysicalDPIRect

-                      (unaff_RBP + -0x18,unaff_RBP + -0x18,*(undefined4 *)(lVar1 + 0x120),

-                       unaff_RBP + -0x20);

-    if (unaff_EBX != 0) {

-      xxxSetWindowPos(uVar9,0,*(int *)(unaff_RBP + -0x18),*(undefined4 *)(unaff_RBP + -0x14),

-                      *(int *)(unaff_RBP + -0x10) - *(int *)(unaff_RBP + -0x18));

-    }

-  }

-  if (unaff_R13D == 0) {

-    if (unaff_EBX == 0) goto LAB_0;

-    MVar8 = 0x11;

-    uVar6 = 3;

-  }

-  else {

-    uVar6 = 7;

-  }

-  xxxMinMaximize(unaff_R15,uVar6,MVar8);

-  _CopyWindowCheckpoint(unaff_RSI,unaff_R15);

-LAB_0:

-  iVar2 = IsWindowDesktopComposed();

-  if (iVar2 != 0) {

-    uVar3 = *(undefined8 *)unaff_R15;

-    uVar5 = *(undefined8 *)unaff_RSI;

-    uVar4 = ReferenceDwmApiPort();

-    DwmAsyncGhostChange(uVar4,uVar5,uVar3);

-    uVar3 = *(undefined8 *)unaff_RSI;

-    uVar5 = ReferenceDwmApiPort();

-    DwmAsyncNotifyAnimationChange(uVar5,0,uVar3);

-    uVar3 = *(undefined8 *)unaff_R15;

-    uVar5 = ReferenceDwmApiPort();

-    DwmAsyncNotifyAnimationChange(uVar5,0,uVar3);

-  }

-  SetOrClrWF(0);

-  ptVar7 = unaff_RSI;

-  if ((*(byte *)(*(longlong *)(unaff_RSI + 0x28) + 0x14) & 0x20) != 0) {

-    SetOrClrWF(0);

-    SetOrClrWF((ulonglong)unaff_R14 & 0xffffffff);

-    ptVar7 = unaff_R14;

-  }

-  SetVisible(unaff_RSI,0x10);

-  W32GetUserSessionState();

-  uVar9 = xxxWindowEvent(0x8003);

-  xxxSetWindowPos(uVar9,ptVar7,*(int *)(unaff_RBP + -0x18),*(undefined4 *)(unaff_RBP + -0x14),

-                  *(int *)(unaff_RBP + -0x10) - *(int *)(unaff_RBP + -0x18));

-  xxxNotifyShellOfWindowSwap(unaff_RSI,unaff_R15);

-  if (iVar2 != 0) {

-    uVar3 = *(undefined8 *)unaff_R15;

-    uVar5 = ReferenceDwmApiPort();

-    DwmAsyncNotifyAnimationChange(uVar5,(ulonglong)unaff_R14 & 0xffffffff,uVar3);

-  }

-  return;

+                    /* WARNING: Bad instruction - Truncating control flow here */

+  halt_baddata();

 }
```

## `xxxHardErrorControl`  (modified)

```diff
--- xxxHardErrorControl
+++ xxxHardErrorControl
@@ -1,82 +1,233 @@
 

-undefined8 xxxHardErrorControl(SGRDPgbDisconnectHardErrorAttach<int> *param_1)

+byte xxxHardErrorControl(SGRDPgbDisconnectHardErrorAttach<int> *param_1,undefined8 param_2,

+                        SGRDPgbDisconnectHardErrorAttach<int> *param_3)

 

 {

-  int *piVar1;

-  bool bVar2;

-  int iVar3;

-  ulonglong in_RAX;

-  longlong lVar4;

-  longlong lVar5;

-  tagQ *this;

-  longlong unaff_RBX;

-  tagWINDOWSTATION *ptVar6;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  int iVar7;

-  longlong unaff_R13;

-  int unaff_R15D;

+  longlong *plVar1;

+  int *piVar2;

+  bool bVar3;

+  int iVar4;

+  int iVar5;

+  tagTHREADINFO *ptVar6;

+  longlong lVar7;

+  longlong lVar8;

+  longlong lVar9;

+  longlong lVar10;

+  wchar_t *this;

+  tagQ *this_00;

+  tagWINDOWSTATION *ptVar11;

+  int local_res8 [2];

+  AtomicExecutionCheck local_48 [8];

+  undefined8 local_40;

+  longlong local_38;

   

-  if ((unaff_RBX !=

-       *(longlong *)

-        (CONCAT71((int7)(in_RAX >> 8),(char)(char *)(in_RAX | 0xde) - *(char *)(in_RAX | 0xde)) +

-        0xf690)) || (lVar4 = W32GetUserSessionState(), *(longlong *)(lVar4 + 0x4b60) != unaff_R13))

-  {

-    lVar4 = W32GetUserSessionState();

-    lVar4 = *(longlong *)(lVar4 + 0x4b58);

-    lVar5 = W32GetUserSessionState();

-    if (lVar4 == *(longlong *)(lVar5 + 0xf690)) {

-      lVar4 = W32GetUserSessionState();

-      lVar4 = *(longlong *)(lVar4 + 0x4b60);

-      lVar5 = W32GetUserSessionState();

-      if (lVar4 == *(longlong *)(lVar5 + 0xf690)) {

+  this = (wchar_t *)param_1;

+  ptVar6 = PtiCurrent();

+  lVar7 = W32GetUserSessionState();

+  lVar10 = 0;

+  *(undefined8 *)(lVar7 + 0x4a88) = 0;

+  lVar7 = W32GetUserSessionState();

+  iVar4 = (int)param_1;

+  plVar1 = (longlong *)(lVar7 + 0x4b10);

+  if (iVar4 == 0) {

+    lVar10 = W32GetUserSessionState();

+    if (*(longlong *)(lVar10 + 0x4b58) == 0) {

+      return 1;

+    }

+    if (*plVar1 != 0) {

+      return 1;

+    }

+    *plVar1 = (longlong)ptVar6;

+    goto LAB_0;

+  }

+  if (iVar4 == 1) {

+    if ((tagTHREADINFO *)*plVar1 == ptVar6) {

+      *plVar1 = 0;

+      return 0;

+    }

+    return 1;

+  }

+  if (iVar4 != 2) {

+    if (iVar4 != 3) {

+      if (iVar4 == 4) {

+        LOCK();

+        *(uint *)(ptVar6 + 0x210) = *(uint *)(ptVar6 + 0x210) & 0xbfffffff;

+        UNLOCK();

+        if (*(int *)(*(longlong *)(lVar7 + 0x4b18) + 0x218) == 0) {

+          local_res8[0] = 0x20000;

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+        }

+        piVar2 = (int *)(*(longlong *)(lVar7 + 0x4b18) + 0x218);

+        *piVar2 = *piVar2 + -1;

+        lVar10 = W32GetUserSessionState();

+        local_48[0] = (AtomicExecutionCheck)0x0;

+        local_40 = 0;

+        *(int *)(lVar10 + 0x114d8) = *(int *)(lVar10 + 0x114d8) + 1;

+        AtomicExecutionCheck::Arm(local_48);

+        if (*(longlong *)(ptVar6 + 0x1d8) != *(longlong *)(lVar7 + 0x4b18)) {

+          iVar4 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+          if (iVar4 == 0) {

+            AllocQueue(0,*(tagQ **)(lVar7 + 0x4b18));

+          }

+          else {

+            tagQ::Reinitialize(*(tagQ **)(lVar7 + 0x4b18),ptVar6);

+          }

+          tagQ::zzzAttachToQueue(*(tagQ **)(lVar7 + 0x4b18),ptVar6,(tagQ *)0x0,false);

+        }

+        *(undefined8 *)(lVar7 + 0x4b18) = 0;

+        AtomicExecutionCheck::Disarm(local_48);

+        zzzEndDeferWinEventNotify();

+LAB_1:

+        lVar10 = *(longlong *)(ptVar6 + 0x1f0);

+        xxxRestoreCsrssThreadDesktop(param_3,0);

+        lVar7 = W32GetUserSessionState();

+        if (*(int *)(lVar7 + 0x10e70) == 0) {

+          lVar7 = W32GetUserSessionState();

+          return -(lVar10 != *(longlong *)(lVar7 + 0x4b58)) & 3;

+        }

+        local_res8[0] = 0;

+        SGRDPgbDisconnectHardErrorAttach<int>::operator=(param_3,local_res8);

+        return 3;

+      }

+      if (iVar4 == 5) goto LAB_2;

+      if (iVar4 == 6) goto LAB_1;

+      if (iVar4 != 8) {

+        return 0;

+      }

+    }

+    lVar8 = W32GetUserSessionState();

+    if (*(longlong *)(lVar8 + 0x4b58) == 0) {

+      return 1;

+    }

+    lVar8 = W32GetUserSessionState();

+    lVar8 = *(longlong *)(lVar8 + 0x4b58);

+    lVar9 = W32GetUserSessionState();

+    if ((lVar8 == *(longlong *)(lVar9 + 0xf690)) &&

+       (lVar8 = W32GetUserSessionState(), *(longlong *)(lVar8 + 0x4b60) == 0)) {

+      return 1;

+    }

+    lVar8 = W32GetUserSessionState();

+    lVar8 = *(longlong *)(lVar8 + 0x4b58);

+    lVar9 = W32GetUserSessionState();

+    if (lVar8 == *(longlong *)(lVar9 + 0xf690)) {

+      lVar8 = W32GetUserSessionState();

+      lVar8 = *(longlong *)(lVar8 + 0x4b60);

+      lVar9 = W32GetUserSessionState();

+      if (lVar8 == *(longlong *)(lVar9 + 0xf690)) {

         return 1;

       }

     }

-    iVar7 = (int)unaff_R13;

-    *(int *)(unaff_RBP + 0x30) = iVar7;

-    SGRDPgbDisconnectHardErrorAttach<int>::operator=(param_1,(int *)(unaff_RBP + 0x30));

-    lVar4 = W32GetUserSessionState();

-    lVar4 = *(longlong *)(lVar4 + 0x4b58);

-    lVar5 = W32GetUserSessionState();

-    if (lVar4 == *(longlong *)(lVar5 + 0xf690)) {

-      lVar4 = W32GetUserSessionState();

-      *(undefined4 *)(unaff_RBP + 0x30) = 1;

-      ptVar6 = *(tagWINDOWSTATION **)(lVar4 + 0x4b60);

-      SGRDPgbDisconnectHardErrorAttach<int>::operator=(param_1,(int *)(unaff_RBP + 0x30));

+    lVar8 = W32GetUserSessionState();

+    lVar8 = *(longlong *)(lVar8 + 0x4b58);

+    lVar9 = W32GetUserSessionState();

+    if (lVar8 == *(longlong *)(lVar9 + 0xf690)) {

+      lVar8 = W32GetUserSessionState();

+      this = *(wchar_t **)(lVar8 + 0x4b60);

+      lVar8 = ObQueryNameInfo();

+      if (lVar8 != 0) {

+        lVar10 = W32GetUserSessionState();

+        this = *(wchar_t **)(lVar10 + 0x4b60);

+LAB_3:

+        lVar10 = ObQueryNameInfo();

+        lVar10 = lVar10 + 8;

+      }

+      if (lVar10 != 0) {

+        iVar5 = _wcsicmp(L"Winlogon",*(wchar_t **)(lVar10 + 8));

+        if ((iVar5 == 0) || (iVar5 = _wcsicmp(L"Disconnect",*(wchar_t **)(lVar10 + 8)), iVar5 == 0))

+        {

+LAB_4:

+          UserSetLastError(5);

+          return 2;

+        }

+        this = L"Screen-saver";

+        iVar5 = _wcsicmp(L"Screen-saver",*(wchar_t **)(lVar10 + 8));

+        if (iVar5 == 0) goto LAB_4;

+      }

     }

     else {

-      lVar4 = W32GetUserSessionState();

-      ptVar6 = *(tagWINDOWSTATION **)(lVar4 + 0x4b58);

-    }

-    Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

-              ((Win32RawLockedNtObject<tagWINDOWSTATION> *)(unaff_RBP + -0x20),ptVar6);

-    iVar3 = xxxSetCsrssThreadDesktop(ptVar6);

-    if (*(longlong *)(unaff_RBP + -0x10) != -1) {

-      PopAndFreeW32ThreadLock(unaff_RBP + -0x20);

-    }

-    if (-1 < iVar3) {

+      lVar10 = W32GetUserSessionState();

+      this = *(wchar_t **)(lVar10 + 0x4b58);

+      lVar10 = ObQueryNameInfo();

+      if (lVar10 != 0) {

+        lVar10 = W32GetUserSessionState();

+        this = *(wchar_t **)(lVar10 + 0x4b58);

+        goto LAB_3;

+      }

+    }

+    if (iVar4 == 8) {

+LAB_0:

+      LOCK();

+      *(uint *)(ptVar6 + 0x210) = *(uint *)(ptVar6 + 0x210) & 0xbfffffff;

+      UNLOCK();

       return 0;

     }

-    if (unaff_R15D != 5) {

-      *(longlong *)(unaff_RSI + 8) = unaff_R13;

-      if (*(int *)(*(longlong *)(unaff_RDI + 0x1d8) + 0x218) == iVar7) {

-        *(undefined4 *)(unaff_RBP + 0x30) = 0x20000;

-        MicrosoftTelemetryAssertTriggeredArgsKM

-                  ("IXPTelAssert",*(undefined4 *)(unaff_RBP + 0x30),0x1ab);

-      }

-      piVar1 = (int *)(*(longlong *)(unaff_RDI + 0x1d8) + 0x218);

-      *piVar1 = *piVar1 + -1;

-      this = *(tagQ **)(unaff_RDI + 0x1d8);

-      if (((*(int *)(this + 0x218) == iVar7) && (bVar2 = tagQ::IsAnyThreadAttached(this), !bVar2))

-         && ((*(uint *)(this + 0x214) & 0x4000000) != 0)) {

-        *(undefined4 *)(unaff_RBP + 0x30) = 0x20000;

-        MicrosoftTelemetryAssertTriggeredArgsKM

-                  ("IXPTelAssert",*(undefined4 *)(unaff_RBP + 0x30),0x1b5);

+  }

+  *(undefined8 *)(lVar7 + 0x4b18) = *(undefined8 *)(ptVar6 + 0x1d8);

+  *(int *)(*(longlong *)(ptVar6 + 0x1d8) + 0x218) =

+       *(int *)(*(longlong *)(ptVar6 + 0x1d8) + 0x218) + 1;

+LAB_2:

+  lVar10 = W32GetUserSessionState();

+  if (*(longlong *)(lVar10 + 0x4b58) != 0) {

+    lVar10 = W32GetUserSessionState();

+    lVar10 = *(longlong *)(lVar10 + 0x4b58);

+    lVar8 = W32GetUserSessionState();

+    if ((lVar10 != *(longlong *)(lVar8 + 0xf690)) ||

+       (lVar10 = W32GetUserSessionState(), *(longlong *)(lVar10 + 0x4b60) != 0)) {

+      lVar10 = W32GetUserSessionState();

+      lVar10 = *(longlong *)(lVar10 + 0x4b58);

+      lVar8 = W32GetUserSessionState();

+      if (lVar10 == *(longlong *)(lVar8 + 0xf690)) {

+        lVar10 = W32GetUserSessionState();

+        lVar10 = *(longlong *)(lVar10 + 0x4b60);

+        lVar8 = W32GetUserSessionState();

+        if (lVar10 == *(longlong *)(lVar8 + 0xf690)) {

+          return 1;

+        }

+      }

+      local_res8[0] = 0;

+      SGRDPgbDisconnectHardErrorAttach<int>::operator=

+                ((SGRDPgbDisconnectHardErrorAttach<int> *)this,local_res8);

+      lVar10 = W32GetUserSessionState();

+      lVar10 = *(longlong *)(lVar10 + 0x4b58);

+      lVar8 = W32GetUserSessionState();

+      if (lVar10 == *(longlong *)(lVar8 + 0xf690)) {

+        lVar10 = W32GetUserSessionState();

+        local_res8[0] = 1;

+        ptVar11 = *(tagWINDOWSTATION **)(lVar10 + 0x4b60);

+        SGRDPgbDisconnectHardErrorAttach<int>::operator=

+                  ((SGRDPgbDisconnectHardErrorAttach<int> *)this,local_res8);

+      }

+      else {

+        lVar10 = W32GetUserSessionState();

+        ptVar11 = *(tagWINDOWSTATION **)(lVar10 + 0x4b58);

+      }

+      Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

+                ((Win32RawLockedNtObject<tagWINDOWSTATION> *)local_48,ptVar11);

+      iVar5 = xxxSetCsrssThreadDesktop(ptVar11,param_3);

+      if (local_38 != -1) {

+        PopAndFreeW32ThreadLock(local_48);

+      }

+      if (-1 < iVar5) {

+        return 0;

+      }

+      if (iVar4 != 5) {

+        *(undefined8 *)(lVar7 + 0x4b18) = 0;

+        if (*(int *)(*(longlong *)(ptVar6 + 0x1d8) + 0x218) == 0) {

+          local_res8[0] = 0x20000;

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x1ab);

+        }

+        *(int *)(*(longlong *)(ptVar6 + 0x1d8) + 0x218) =

+             *(int *)(*(longlong *)(ptVar6 + 0x1d8) + 0x218) + -1;

+        this_00 = *(tagQ **)(ptVar6 + 0x1d8);

+        if (((*(int *)(this_00 + 0x218) == 0) &&

+            (bVar3 = tagQ::IsAnyThreadAttached(this_00), !bVar3)) &&

+           ((*(uint *)(this_00 + 0x214) & 0x4000000) != 0)) {

+          local_res8[0] = 0x20000;

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x1b5);

+        }

       }

     }

   }

   return 1;

 }
```

## `PrepareHDCBITSBitmap`  (modified)

```diff
--- PrepareHDCBITSBitmap
+++ PrepareHDCBITSBitmap
@@ -1,140 +1,45 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-

-HDC__ * __cdecl PrepareHDCBITSBitmap(HDC__ *param_1)

+undefined8 PrepareHDCBITSBitmap(longlong param_1)

 

 {

-  ushort uVar1;

-  uint uVar2;

-  ulonglong uVar3;

-  longlong lVar4;

+  undefined4 uVar1;

+  int iVar2;

+  int iVar3;

+  ulonglong uVar4;

   longlong lVar5;

-  HDC__ *pHVar6;

-  longlong unaff_RBP;

-  short *unaff_RSI;

-  ushort unaff_DI;

-  undefined2 *puVar7;

-  short sVar8;

-  ulonglong uVar9;

-  short *psVar10;

-  ulonglong uVar11;

-  undefined8 *unaff_R12;

-  int iVar12;

-  ulonglong unaff_R13;

-  ulonglong unaff_R14;

-  undefined4 unaff_R15D;

-  int iStack0000000000000028;

-  undefined1 *puStack0000000000000030;

-  ushort in_stack_00000040;

-  ushort in_stack_00000042;

-  undefined2 *in_stack_00000048;

-  int iStack0000000000000050;

-  undefined8 in_stack_00000058;

-  ushort in_stack_00000060;

-  undefined2 *in_stack_00000068;

-  undefined8 uStack0000000000000070;

+  longlong *plVar6;

+  undefined8 uVar7;

   

-  puVar7 = in_stack_00000048;

-  iVar12 = (int)unaff_R13;

-  if (((((in_stack_00000040 & 1) == 0) && ((in_stack_00000042 & 1) == 0)) &&

-      (in_stack_00000040 <= in_stack_00000042)) && (in_stack_00000042 <= unaff_DI)) {

-    if ((in_stack_00000048 == (undefined2 *)0x0) &&

-       ((in_stack_00000040 != 0 || (in_stack_00000042 != 0)))) {

-      unaff_DI = 0xfffe;

-      goto LAB_0;

+  uVar1 = GetDpiForSystem();

+  iVar2 = GetDpiCacheIndex(uVar1);

+  uVar4 = W32GetCurrentThreadDpiAwarenessContext();

+  if (((uVar4 & 0xf) == 0) && (param_1 != 0)) {

+    iVar3 = GreGetDCDpiScaleValue(param_1);

+    if (1 < iVar3) {

+      iVar2 = GetDpiCacheIndex(iVar3 * 0x60);

     }

-    uVar11 = (ulonglong)(in_stack_00000042 >> 1);

-    uVar9 = unaff_R13;

-    uVar2 = RtlUnicodeStringValidateWorker(&stack0x00000060);

-    sVar8 = (short)uVar9;

-    pHVar6 = (HDC__ *)(ulonglong)uVar2;

-    if (-1 < (int)uVar2) {

-      pHVar6 = (HDC__ *)(unaff_R13 & 0xffffffff);

-      uVar3 = (ulonglong)(in_stack_00000060 >> 1);

-      for (; uVar11 != 0; uVar11 = uVar11 - 1) {

-        sVar8 = (short)uVar9;

-        if (uVar3 == 0) goto LAB_1;

-        uVar3 = uVar3 - 1;

-        *puVar7 = *in_stack_00000068;

-        in_stack_00000068 = in_stack_00000068 + 1;

-        puVar7 = puVar7 + 1;

-        uVar9 = uVar9 + 1;

-        sVar8 = (short)uVar9;

-      }

-      if (uVar3 != 0) {

-        pHVar6 = (HDC__ *)(unaff_R14 & 0xffffffff);

-      }

-    }

-LAB_1:

-    in_stack_00000040 = sVar8 * 2;

-    unaff_DI = 0xfffe;

+  }

+  if (iVar2 == -1) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x2a2);

+  }

+  lVar5 = W32GetUserSessionState();

+  iVar3 = Feature_DpiMetricsInUserMode__private_IsEnabledDeviceUsageNoInline();

+  if (iVar3 == 0) {

+    plVar6 = (longlong *)((longlong)iVar2 * 0x2f8 + lVar5 + 0xa9a0);

   }

   else {

-LAB_0:

-    pHVar6 = (HDC__ *)0xc000000d;

+    plVar6 = (longlong *)GetOemBitmapSetForIndex(iVar2);

   }

-  RtlFreeUnicodeString(&stack0x00000060);

-  if ((int)pHVar6 < 0) {

-    return pHVar6;

+  if (*plVar6 == 0) {

+    CreateGlobalDpiBitmapStrip(iVar2);

   }

-  if (((((in_stack_00000040 & 1) != 0) || ((in_stack_00000042 & 1) != 0)) ||

-      ((in_stack_00000042 < in_stack_00000040 || (unaff_DI < in_stack_00000042)))) ||

-     ((in_stack_00000048 == (undefined2 *)0x0 &&

-      ((in_stack_00000040 != 0 || (in_stack_00000042 != 0)))))) {

-    pHVar6 = (HDC__ *)0xc000000d;

-    goto LAB_2;

-  }

-  pHVar6 = (HDC__ *)(unaff_R13 & 0xffffffff);

-  uVar1 = in_stack_00000040 >> 1;

-  lVar5 = 0x7fff;

-  psVar10 = in_stack_00000048 + uVar1;

-  lVar4 = (ulonglong)(in_stack_00000042 >> 1) - (ulonglong)uVar1;

-  uVar9 = unaff_R13;

-  if (lVar4 == 0) {

-LAB_3:

-    sVar8 = (short)uVar9;

-    if (*unaff_RSI != (short)unaff_R13) {

-      pHVar6 = (HDC__ *)(unaff_R14 & 0xffffffff);

-    }

+  if (*plVar6 == 0) {

+    uVar7 = 0;

   }

   else {

-    do {

-      sVar8 = (short)uVar9;

-      if (lVar5 == 0) goto LAB_4;

-      if (*unaff_RSI == 0) break;

-      *psVar10 = *unaff_RSI;

-      unaff_RSI = unaff_RSI + 1;

-      psVar10 = psVar10 + 1;

-      lVar5 = lVar5 + -1;

-      uVar9 = uVar9 + 1;

-      lVar4 = lVar4 + -1;

-    } while (lVar4 != 0);

-    sVar8 = (short)uVar9;

-    if ((lVar4 == 0) && (lVar5 != 0)) goto LAB_3;

+    uVar7 = *(undefined8 *)(*(longlong *)(lVar5 + 0xdf10) + 0x48);

+    GreSelectBitmap(uVar7);

   }

-LAB_4:

-  in_stack_00000040 = (uVar1 + sVar8) * 2;

-LAB_2:

-  if (-1 < (int)pHVar6) {

-    *(ushort **)(unaff_RBP + -0x80) = &stack0x00000040;

-    uStack0000000000000070 = 0x30;

-    *(undefined8 *)(unaff_RBP + -0x78) = 0x240;

-    *(undefined8 *)(unaff_RBP + -0x70) = 0;

-    *(undefined8 *)(unaff_RBP + -0x68) = 0;

-    if (*(int *)(unaff_RBP + 0x2e0) == iVar12) {

-      uVar2 = ZwOpenKey();

-    }

-    else {

-      puStack0000000000000030 = (undefined1 *)&stack0x00000050;

-      iStack0000000000000028 = iVar12;

-      iStack0000000000000050 = iVar12;

-      uVar2 = ZwCreateKey(&stack0x00000058,unaff_R15D,&stack0x00000070,0);

-    }

-    pHVar6 = (HDC__ *)(ulonglong)uVar2;

-    if (-1 < (int)uVar2) {

-      *unaff_R12 = in_stack_00000058;

-    }

-  }

-  return pHVar6;

+  return uVar7;

 }
```

## `NtUserSetWindowMessageCapability`  (modified)

```diff
--- NtUserSetWindowMessageCapability
+++ NtUserSetWindowMessageCapability
@@ -1,21 +1,45 @@
 

-undefined8 NtUserSetWindowMessageCapability(void)

+bool NtUserSetWindowMessageCapability(HWND__ *param_1,uint param_2,undefined8 param_3,int param_4)

 

 {

-  int iVar1;

-  int in_stack_00000050;

-  undefined8 in_stack_00000060;

-  undefined8 in_stack_00000068;

+  undefined1 uVar1;

+  bool bVar2;

+  int iVar3;

+  longlong lVar4;

+  longlong *plVar5;

+  ulonglong uVar6;

+  void *local_38;

+  AtomicExecutionCheck local_30 [8];

+  undefined8 local_28;

   

-  iVar1 = KeUserModeCallback(0x39,&stack0x00000058,4,&stack0x00000060);

-  EtwTraceEndCallback(0x39);

-  if ((iVar1 < 0) || (in_stack_00000050 != 0x18)) {

-    in_stack_00000068 = 0;

+                    /* 0x23dc40  2046  NtUserSetWindowMessageCapability */

+  EnterCrit(0);

+  bVar2 = false;

+  local_30[0] = (AtomicExecutionCheck)0x0;

+  local_28 = 0;

+  AtomicExecutionCheck::Arm(local_30);

+  lVar4 = ValidateHwndStrict(param_1);

+  if (lVar4 != 0) {

+    local_38 = (void *)0x0;

+    plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar6 = 0;

+    if (plVar5 != (longlong *)0x0) {

+      uVar6 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

+    }

+    if (*(ulonglong *)(*(longlong *)(lVar4 + 0x10) + 0x1d0) == uVar6) {

+      uVar1 = ExGetPreviousMode();

+      iVar3 = UserCaptureSid(param_3,uVar1,&local_38);

+      if (-1 < iVar3) {

+        bVar2 = UserSetWindowMessageCapability(param_1,param_2,local_38,param_4 != 0);

+        Win32FreePool(local_38);

+      }

+    }

+    else {

+      UserSetLastError(5);

+    }

   }

-  else {

-    in_stack_00000068 = 0;

-    RtlCopyFromUser(&stack0x00000068,in_stack_00000060,8);

-  }

-  return in_stack_00000068;

+  AtomicExecutionCheck::Disarm(local_30);

+  UserSessionSwitchLeaveCrit();

+  return bVar2;

 }
```

## `_EnsureDpiDepSysMetCacheForPlateau`  (modified)

```diff
--- _EnsureDpiDepSysMetCacheForPlateau
+++ _EnsureDpiDepSysMetCacheForPlateau
@@ -1,28 +1,33 @@
 

-undefined2 _EnsureDpiDepSysMetCacheForPlateau(void)

+undefined8 _EnsureDpiDepSysMetCacheForPlateau(undefined4 param_1)

 

 {

-  ushort uVar1;

-  undefined2 uVar2;

-  int iVar3;

-  int unaff_EBX;

-  undefined8 in_R9;

-  int in_R11D;

-  int iVar4;

+  int iVar1;

+  undefined4 uVar2;

+  longlong lVar3;

+  undefined8 uVar4;

+  uint uVar5;

+  longlong lVar6;

   

-  iVar4 = in_R11D - (int)((ulonglong)in_R9 >> 0x20);

-  iVar3 = -iVar4;

-  if (iVar3 < 0) {

-    iVar3 = iVar4;

+  iVar1 = GetDpiCacheIndex();

+  if (iVar1 == -1) {

+    uVar4 = 0;

   }

-  uVar1 = (ushort)iVar3;

-  if (0x14 < iVar3) {

-    uVar1 = 0x14;

+  else {

+    uVar5 = 0;

+    lVar6 = (longlong)iVar1 * 0x78 + 0x8ec;

+    do {

+      lVar3 = W32GetUserSessionState();

+      if (*(int *)(lVar6 + *(longlong *)(lVar3 + 0x4e30)) == -1) {

+        uVar2 = _ScaleSystemMetricForDPIWithoutCache(uVar5,param_1);

+        lVar3 = W32GetUserSessionState();

+        *(undefined4 *)(lVar6 + *(longlong *)(lVar3 + 0x4e30)) = uVar2;

+      }

+      uVar5 = uVar5 + 1;

+      lVar6 = lVar6 + 4;

+    } while (uVar5 < 0x1e);

+    uVar4 = 1;

   }

-  uVar2 = 0xffd;

-  if ((int)((uint)uVar1 + unaff_EBX) < 0xffd) {

-    uVar2 = (short)((uint)uVar1 + unaff_EBX);

-  }

-  return uVar2;

+  return uVar4;

 }
```

## `ForegroundInputOwnerMatch`  (modified)

```diff
--- ForegroundInputOwnerMatch
+++ ForegroundInputOwnerMatch
@@ -1,13 +1,60 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* int __cdecl ForegroundInputOwnerMatch(struct tagTHREADINFO const * __ptr64,int) */

 

 int __cdecl ForegroundInputOwnerMatch(tagTHREADINFO *param_1,int param_2)

 

 {

-  char *unaff_RDI;

+  bool bVar1;

+  int iVar2;

+  longlong lVar3;

+  longlong lVar4;

+  longlong lVar5;

+  UIPIAccessor *pUVar6;

   

-  *unaff_RDI = *unaff_RDI + (char)param_1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  lVar3 = W32GetUserSessionState();

+  lVar5 = 0;

+  lVar4 = lVar5;

+  if (*(longlong *)(*(longlong *)(lVar3 + 0x4a50) + 0x78) != 0) {

+    lVar4 = W32GetUserSessionState();

+    lVar4 = *(longlong *)(*(longlong *)(*(longlong *)(lVar4 + 0x4a50) + 0x78) + 0x1d0);

+  }

+  lVar3 = W32GetUserSessionState();

+  if (*(longlong *)(*(longlong *)(lVar3 + 0x4a50) + 0x70) != 0) {

+    lVar5 = W32GetUserSessionState();

+    lVar5 = *(longlong *)(*(longlong *)(*(longlong *)(lVar5 + 0x4a50) + 0x70) + 0x1d0);

+  }

+  lVar3 = *(longlong *)(param_1 + 0x1d0);

+  if ((lVar4 == lVar3) || (lVar5 == lVar3)) {

+LAB_0:

+    iVar2 = 1;

+  }

+  else {

+    if (param_2 != 0) {

+      pUVar6 = (UIPIAccessor *)(-(ulonglong)(lVar3 != 0) & lVar3 + 0x130U);

+      if (*(int *)(pUVar6 + 4) != 0) {

+        lVar3 = W32GetUserSessionState(-lVar3);

+        bVar1 = UIPrivilegeIsolation::IsSameAppContainer

+                          (*(UIPIAccessor **)(lVar3 + 0x4a50),pUVar6,0);

+        if ((bVar1) ||

+           ((lVar4 != 0 &&

+            (bVar1 = UIPrivilegeIsolation::IsSameAppContainer

+                               ((UIPIAccessor *)(lVar4 + 0x130),

+                                (UIPIAccessor *)

+                                (-(ulonglong)(*(longlong *)(param_1 + 0x1d0) != 0) &

+                                *(longlong *)(param_1 + 0x1d0) + 0x130U),0), bVar1))))

+        goto LAB_0;

+        if (lVar5 != 0) {

+          bVar1 = UIPrivilegeIsolation::IsSameAppContainer

+                            ((UIPIAccessor *)(lVar5 + 0x130),

+                             (UIPIAccessor *)

+                             (-(ulonglong)(*(longlong *)(param_1 + 0x1d0) != 0) &

+                             *(longlong *)(param_1 + 0x1d0) + 0x130U),0);

+          return (uint)bVar1;

+        }

+      }

+    }

+    iVar2 = 0;

+  }

+  return iVar2;

 }
```

## `MergeDeferredMessagesOfThreadOnQueue`  (modified)

```diff
--- MergeDeferredMessagesOfThreadOnQueue
+++ MergeDeferredMessagesOfThreadOnQueue
@@ -1,71 +1,99 @@
 

-longlong MergeDeferredMessagesOfThreadOnQueue(void)

+void MergeDeferredMessagesOfThreadOnQueue(longlong param_1)

 

 {

-  bool bVar1;

-  int in_EAX;

-  longlong *plVar2;

-  ulonglong uVar3;

-  undefined8 uVar4;

-  longlong unaff_RBX;

-  int unaff_EBP;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

+  longlong lVar1;

+  tagQMSG *ptVar2;

+  int iVar3;

+  int iVar4;

   longlong lVar5;

-  longlong unaff_R14;

-  longlong unaff_R15;

+  tagQMSG *ptVar6;

+  int iVar7;

+  tagQMSG *ptVar8;

+  longlong *plVar9;

+  char cVar10;

+  tagMLIST *ptVar11;

+  bool bVar12;

   

-  if (in_EAX == 0) {

-LAB_0:

-    uVar4 = 0x57;

-  }

-  else {

-    if ((*(char *)(*(longlong *)(unaff_RSI + 0x28) + 0x13) < (char)unaff_RBX) ||

-       (*(char *)(*(longlong *)(unaff_RSI + 0x28) + 0x14) < (char)unaff_RBX)) goto LAB_0;

-    plVar2 = (longlong *)PsGetCurrentProcessWin32Process();

-    uVar3 = 0;

-    if (plVar2 != (longlong *)0x0) {

-      uVar3 = (ulonglong)plVar2 & -(ulonglong)(*plVar2 != 0);

-    }

-    lVar5 = *(longlong *)(unaff_RSI + 0x10);

-    if (*(ulonglong *)(lVar5 + 0x1d0) == uVar3) {

-      if (*(int *)(unaff_RSI + 0x104) == 0) {

-        if ((lVar5 != unaff_RDI) &&

-           (*(ulonglong *)(lVar5 + 0x1d0) == *(ulonglong *)(unaff_RDI + 0x1d0))) {

-          bVar1 = tagQ::AreMultipleThreadsAttached(*(tagQ **)(unaff_RDI + 0x1d8));

-          if ((!bVar1) &&

-             ((*(longlong *)(lVar5 + 0x1f0) == *(longlong *)(unaff_RDI + 0x1f0) &&

-              (*(longlong *)(lVar5 + 0x5d0) == unaff_RBX)))) {

-            *(longlong *)(unaff_RSI + 0x108) = unaff_RDI;

-            *(int *)(unaff_RSI + 0x104) = unaff_EBP;

-            *(ulonglong *)(unaff_RDI + 0x550) = *(ulonglong *)(unaff_RDI + 0x550) | 0x2000;

-            LOCK();

-            *(uint *)(unaff_RDI + 0x210) = *(uint *)(unaff_RDI + 0x210) | 0x40;

-            UNLOCK();

-            *(int *)(unaff_RDI + 0x5f8) = *(int *)(unaff_RDI + 0x5f8) + 1;

-            unaff_RBX = 1;

-            *(longlong *)(unaff_RDI + 0x5d0) = unaff_R14;

-            *(longlong *)(unaff_RDI + 0x5d8) = unaff_R15;

-            *(int *)(lVar5 + 0x5f8) = *(int *)(lVar5 + 0x5f8) + 1;

-            goto LAB_1;

-          }

+  lVar1 = *(longlong *)(param_1 + 0x1d8);

+  ptVar11 = (tagMLIST *)(lVar1 + 0x28);

+  iVar7 = 0;

+  plVar9 = *(longlong **)(lVar1 + 0x30);

+  ptVar6 = *(tagQMSG **)(lVar1 + 0x40);

+  while (ptVar6 != (tagQMSG *)0x0) {

+    if (plVar9 == (longlong *)0x0) goto LAB_0;

+    if (*(longlong *)(ptVar6 + 0x68) == param_1) {

+      if (*(uint *)(plVar9 + 6) < *(uint *)(ptVar6 + 0x30)) {

+        iVar4 = IsHiddenByInputService(ptVar6);

+        ptVar8 = ptVar6 + 8;

+        ptVar2 = *(tagQMSG **)ptVar8;

+        iVar3 = iVar7 + 1;

+        if (iVar4 != 0) {

+          iVar3 = iVar7;

         }

-        goto LAB_2;

+        iVar7 = iVar3;

+        RemoveQMsgFromDeferList(ptVar11,ptVar6);

+        *(longlong *)ptVar6 = *plVar9;

+        *(longlong **)ptVar8 = plVar9;

+        if (plVar9 == *(longlong **)(lVar1 + 0x30)) {

+          *(tagQMSG **)(lVar1 + 0x30) = ptVar6;

+        }

+        else {

+          *(tagQMSG **)(*plVar9 + 8) = ptVar6;

+        }

+        *plVar9 = (longlong)ptVar6;

+        ptVar6 = ptVar2;

       }

-      if ((((unaff_R15 != 0) || (*(longlong *)(unaff_RSI + 0x108) != unaff_RDI)) ||

-          (*(longlong *)(unaff_RDI + 0x5d0) != unaff_R14)) ||

-         ((*(longlong *)(unaff_RDI + 0x5d8) != unaff_RBX ||

-          (*(int *)(unaff_RSI + 0x104) != unaff_EBP)))) goto LAB_2;

-      uVar4 = 0x4da;

+      else {

+        plVar9 = (longlong *)plVar9[1];

+      }

     }

     else {

-LAB_2:

-      uVar4 = 5;

+      ptVar6 = *(tagQMSG **)(ptVar6 + 8);

     }

   }

-  UserSetLastError(uVar4);

 LAB_1:

-  UserSessionSwitchLeaveCrit();

-  return unaff_RBX;

+  *(int *)(lVar1 + 0x38) = *(int *)(lVar1 + 0x38) + iVar7;

+  return;

+LAB_0:

+  do {

+    if (*(longlong *)(ptVar6 + 0x68) == param_1) {

+      iVar3 = IsHiddenByInputService(ptVar6);

+      if (iVar3 == 0) {

+        iVar7 = iVar7 + 1;

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20000) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+          cVar10 = '\0';

+        }

+        else {

+          cVar10 = '\x01';

+        }

+        bVar12 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar10 != '\0') || (bVar12)) {

+          lVar5 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_qiqdd

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar12,

+                     *(undefined8 *)(lVar5 + 0x10f98));

+        }

+      }

+      ptVar8 = *(tagQMSG **)(ptVar6 + 8);

+      RemoveQMsgFromDeferList(ptVar11,ptVar6);

+      *(undefined8 *)ptVar6 = *(undefined8 *)ptVar11;

+      if (*(longlong *)ptVar11 != 0) {

+        *(tagQMSG **)(*(longlong *)ptVar11 + 8) = ptVar6;

+      }

+      *(tagQMSG **)ptVar11 = ptVar6;

+      if (*(longlong *)(lVar1 + 0x30) == 0) {

+        *(tagQMSG **)(lVar1 + 0x30) = ptVar6;

+      }

+      *(undefined8 *)(ptVar6 + 8) = 0;

+    }

+    else {

+      ptVar8 = *(tagQMSG **)(ptVar6 + 8);

+    }

+    ptVar6 = ptVar8;

+  } while (ptVar8 != (tagQMSG *)0x0);

+  goto LAB_1;

 }
```

## `GreSetDIBitsToDeviceInternalImpl`  (modified)

```diff
--- GreSetDIBitsToDeviceInternalImpl
+++ PFFOBJ::vDeleteRFONTRef
@@ -1,29 +1,119 @@
 

-/* int __cdecl GreSetDIBitsToDeviceInternalImpl(struct HDC__ * __ptr64,int,int,unsigned

-   long,unsigned long,int,int,unsigned long,unsigned long,class umptr_r<unsigned char> &

-   __ptr64,struct tagBITMAPINFO * __ptr64,unsigned long,unsigned int,int,void * __ptr64) */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* public: void __cdecl PFFOBJ::vDeleteRFONTRef(void) __ptr64 */

 

-int __cdecl

-GreSetDIBitsToDeviceInternalImpl

-          (HDC__ *param_1,int param_2,int param_3,ulong param_4,ulong param_5,int param_6,

-          int param_7,ulong param_8,ulong param_9,umptr_r<unsigned_char> *param_10,

-          tagBITMAPINFO *param_11,ulong param_12,uint param_13,int param_14,void *param_15)

+void __thiscall PFFOBJ::vDeleteRFONTRef(PFFOBJ *this)

 

 {

-  int iVar1;

-  longlong local_78 [14];

+  char *pcVar1;

+  ulonglong uVar2;

+  bool bVar3;

+  void *pvVar4;

+  char cVar5;

+  int iVar6;

+  int iVar7;

+  longlong lVar8;

+  longlong *plVar9;

+  undefined8 uVar10;

+  ulonglong uVar11;

+  longlong lVar12;

+  ulonglong *puVar13;

+  longlong local_38;

+  longlong lStack_30;

+  longlong local_28;

   

-  APIDCOBJ::APIDCOBJ((APIDCOBJ *)local_78,param_1);

-  iVar1 = 0;

-  if (local_78[0] == 0) {

-    EngSetLastError(0x57);

+  local_38 = 0;

+  lStack_30 = 0;

+  local_28 = 0;

+  bVar3 = false;

+  lVar8 = W32GetSessionState();

+  lVar8 = *(longlong *)(*(longlong *)(lVar8 + 0x60) + 0x4f78);

+  GreAcquireSemaphoreInternal(lVar8);

+  pvVar4 = SystemReserved1[0xf];

+  lVar12 = 0;

+  cVar5 = KeIsAttachedProcess();

+  if (cVar5 == '\0') {

+LAB_0:

+    plVar9 = (longlong *)PsGetThreadWin32Thread(pvVar4);

+    if (plVar9 != (longlong *)0x0) {

+      lVar12 = *plVar9;

+    }

   }

   else {

-    iVar1 = GrepSetDIBitsToDeviceInternalImpl

-                      ((XDCOBJ *)local_78,param_2,param_3,param_4,param_5,param_6,param_7,param_8,

-                       param_9,param_10,param_11,param_12,param_13,param_14,param_15);

+    iVar6 = W32GetCurrentWin32kSessionId();

+    uVar10 = PsGetCurrentThreadProcess();

+    iVar7 = PsGetProcessSessionIdEx(uVar10);

+    if (iVar6 == iVar7) goto LAB_0;

   }

-  APIDCOBJ::~APIDCOBJ((APIDCOBJ *)local_78);

-  return iVar1;

+  puVar13 = (ulonglong *)(-(ulonglong)(lVar12 != 0) & lVar12 + 8U);

+  if (puVar13 != (ulonglong *)0x0) {

+    uVar2 = *puVar13;

+    if ((uVar2 >> 0x11 & 1) == 0 && (uVar2 & 0xfffffffffffe0000) != 0) {

+      uVar11 = 0;

+      iVar6 = 0x25;

+      do {

+        iVar7 = (int)uVar11;

+        if ((uVar2 >> (uVar11 & 0x3f) & 1) == 0) {

+          iVar7 = iVar6;

+        }

+        uVar11 = uVar11 + 1;

+        iVar6 = iVar7;

+      } while (uVar11 < 0x40);

+      if (0x11 < iVar7) {

+        MicrosoftTelemetryAssertTriggeredNoArgsKM();

+      }

+    }

+    cVar5 = *(char *)((longlong)puVar13 + 0x19);

+    *(char *)((longlong)puVar13 + 0x19) = cVar5 + '\x01';

+    if (cVar5 == '\0') {

+      *puVar13 = *puVar13 | 0x20000;

+    }

+  }

+  *(int *)(*(longlong *)this + 0x44) = *(int *)(*(longlong *)this + 0x44) + -1;

+  lVar12 = *(longlong *)this;

+  if ((((*(int *)(lVar12 + 0x38) == 0) && (*(int *)(lVar12 + 0x3c) == 0)) &&

+      (*(longlong *)(lVar12 + 0x98) == 0)) &&

+     ((bVar3 = false, *(int *)(lVar12 + 0x44) == 0 && (*(int *)(lVar12 + 0x40) == 0)))) {

+    vPFFC_Delete(this,(PFFCLEANUP *)&local_38);

+    bVar3 = true;

+  }

+  if (lVar8 == -2) {

+    GrepReleasePublicPFTSemaphoreEx();

+    goto LAB_1;

+  }

+  if (lVar8 == 0) goto LAB_1;

+  EtwTraceGreLockReleaseSemaphore(L"PublicPFT",lVar8);

+  lVar12 = 0;

+  cVar5 = KeIsAttachedProcess();

+  if (cVar5 == '\0') {

+LAB_2:

+    plVar9 = (longlong *)PsGetThreadWin32Thread();

+    if (plVar9 != (longlong *)0x0) {

+      lVar12 = *plVar9;

+    }

+  }

+  else {

+    iVar6 = W32GetCurrentWin32kSessionId();

+    PsGetCurrentThreadProcess();

+    iVar7 = PsGetProcessSessionIdEx();

+    if (iVar6 == iVar7) goto LAB_2;

+  }

+  puVar13 = (ulonglong *)(-(ulonglong)(lVar12 != 0) & lVar12 + 8U);

+  if (puVar13 != (ulonglong *)0x0) {

+    pcVar1 = (char *)((longlong)puVar13 + 0x19);

+    *pcVar1 = *pcVar1 + -1;

+    if (*pcVar1 == '\0') {

+      *puVar13 = *puVar13 & 0xfffffffffffdffff;

+    }

+    if (*puVar13 == 0) {

+      GrepOnAllLocksReleased();

+    }

+  }

+  GreReleaseSemaphoreExclusiveInternal(lVar8);

+LAB_1:

+  if (((bVar3) && (lStack_30 != 0)) && (local_28 == 0)) {

+    (**(code **)(local_38 + 0xbe8))();

+  }

+  return;

 }
```

## `ApiSetpResolveHost`  (modified)

```diff
--- ApiSetpResolveHost
+++ ApiSetpResolveHost
@@ -1,18 +1,141 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void ApiSetpResolveHost(byte param_1,undefined2 param_2,longlong param_3)

+undefined8

+ApiSetpResolveHost(longlong param_1,undefined8 param_2,ulonglong param_3,undefined8 param_4,

+                  undefined8 param_5,undefined1 *param_6,short *param_7)

 

 {

-  byte *pbVar1;

-  undefined1 uVar2;

-  undefined7 in_register_00000001;

+  short sVar1;

+  char cVar2;

+  ushort uVar3;

+  uint uVar4;

+  byte bVar5;

+  longlong lVar6;

+  byte bVar7;

+  ulonglong uVar8;

+  undefined7 uVar9;

+  undefined1 uVar10;

+  uint *puVar11;

+  ulonglong uVar12;

+  undefined8 local_48;

+  undefined8 uStack_40;

+  undefined8 local_38;

+  undefined8 uStack_30;

+  undefined8 local_28;

   

-  uVar2 = in(param_2);

-  pbVar1 = (byte *)(CONCAT71(in_register_00000001,uVar2) + -0x75);

-  *pbVar1 = *pbVar1 & param_1;

-  *(byte *)(param_3 + -0x75) = *(byte *)(param_3 + -0x75) & param_1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  local_28 = 0;

+  uVar10 = 0;

+  param_7[0] = 0;

+  param_7[1] = 0;

+  param_7[2] = 0;

+  param_7[3] = 0;

+  param_7[4] = 0;

+  param_7[5] = 0;

+  param_7[6] = 0;

+  param_7[7] = 0;

+  local_48 = 0;

+  uStack_40 = 0;

+  local_38 = 0;

+  uStack_30 = 0;

+  cVar2 = ApiSetpGetContractKeyInfo(param_2,param_3 & 0xffff,param_3,&local_48);

+  if (cVar2 == '\0') goto LAB_0;

+  if (uStack_40._4_4_ == 1) {

+    lVar6 = param_1 + 0x2c;

+    uVar3 = ApiSetpSearchForSectionIndex_V7(param_1,lVar6,&local_48,1);

+    if (uVar3 == 0xffff) goto LAB_0;

+    uVar12 = (ulonglong)*(ushort *)(param_1 + 0x12);

+    puVar11 = (uint *)((ulonglong)*(uint *)(param_1 + 0x2c) +

+                      ((ulonglong)uVar3 * (ulonglong)*(byte *)(param_1 + 0x34) - uVar12) + param_1);

+    uVar8 = CONCAT71((int7)((ulonglong)lVar6 >> 8),*(byte *)(param_1 + 2)) & 0xffffffffffffff10;

+    bVar5 = *(byte *)(param_1 + 2) & 8;

+    uVar9 = (undefined7)(uVar8 >> 8);

+    cVar2 = (char)uVar8;

+    if ((*(byte *)(param_1 + 0x35) & 4) == 0) {

+      uVar4 = ApiSetpGetSearchKeyHash

+                        (&local_48,CONCAT71(uVar9,1),bVar5 != 0,cVar2 != '\0',

+                         *(undefined1 *)(param_1 + 0x37));

+    }

+    else {

+      bVar5 = ApiSetpGetSearchKeyHash

+                        (&local_48,CONCAT71(uVar9,1),bVar5 != 0,cVar2 != '\0',

+                         *(undefined1 *)(param_1 + 0x37));

+      uVar4 = (uint)bVar5;

+    }

+    if (*puVar11 != uVar4) goto LAB_0;

+    bVar5 = *(byte *)((longlong)puVar11 + 10);

+    uVar3 = (ushort)puVar11[1];

+  }

+  else if (uStack_40._4_4_ == 2) {

+    uVar10 = 1;

+    uVar3 = ApiSetpSearchForSectionIndex_V7(param_1,param_1 + 0x38,&local_48,0);

+    if (uVar3 == 0xffff) goto LAB_0;

+    puVar11 = (uint *)((ulonglong)*(uint *)(param_1 + 0x38) +

+                      param_1 + ((ulonglong)*(byte *)(param_1 + 0x40) * (ulonglong)uVar3 -

+                                (ulonglong)*(ushort *)(param_1 + 0x12)));

+    bVar7 = *(byte *)(param_1 + 2) & 0x10;

+    bVar5 = *(byte *)(param_1 + 2) & 8;

+    if ((*(byte *)(param_1 + 0x41) & 4) == 0) {

+      uVar4 = ApiSetpGetSearchKeyHash

+                        (&local_48,0,bVar5 != 0,bVar7 != 0,*(undefined1 *)(param_1 + 0x43));

+    }

+    else {

+      bVar5 = ApiSetpGetSearchKeyHash

+                        (&local_48,0,bVar5 != 0,bVar7 != 0,*(undefined1 *)(param_1 + 0x43));

+      uVar4 = (uint)bVar5;

+    }

+    if (*puVar11 != uVar4) {

+      uVar10 = 0;

+      goto LAB_0;

+    }

+    if (((*(byte *)((longlong)puVar11 + 6) & 4) != 0) &&

+       (((*(byte *)((longlong)puVar11 + 6) & 2) != 0 ||

+        ((puVar11[2] != 0 && (cVar2 = ApiSetpIsFeatureEnabled(), cVar2 == '\0'))))))

+    goto LAB_0;

+    uVar12 = (ulonglong)*(ushort *)(param_1 + 0x12);

+    lVar6 = ((ulonglong)(ushort)puVar11[1] * (ulonglong)*(byte *)(param_1 + 0x34) +

+            (ulonglong)*(uint *)(param_1 + 0x2c)) - (ulonglong)*(ushort *)(param_1 + 0x12);

+    bVar5 = *(byte *)(lVar6 + 10 + param_1);

+    uVar3 = *(ushort *)(lVar6 + 4 + param_1);

+  }

+  else {

+    if (uStack_40._4_4_ != 3) goto LAB_0;

+    uVar3 = ApiSetpSearchForSectionIndex_V7(param_1,param_1 + 0x44,&local_48,0);

+    if (uVar3 == 0xffff) goto LAB_0;

+    uVar12 = (ulonglong)*(ushort *)(param_1 + 0x12);

+    puVar11 = (uint *)((ulonglong)*(uint *)(param_1 + 0x44) +

+                      ((ulonglong)uVar3 * (ulonglong)*(byte *)(param_1 + 0x4c) - uVar12) + param_1);

+    bVar7 = *(byte *)(param_1 + 2) & 0x10;

+    bVar5 = *(byte *)(param_1 + 2) & 8;

+    if ((*(byte *)(param_1 + 0x4d) & 4) == 0) {

+      uVar4 = ApiSetpGetSearchKeyHash

+                        (&local_48,0,bVar5 != 0,bVar7 != 0,*(undefined1 *)(param_1 + 0x4f));

+    }

+    else {

+      bVar5 = ApiSetpGetSearchKeyHash

+                        (&local_48,0,bVar5 != 0,bVar7 != 0,*(undefined1 *)(param_1 + 0x4f));

+      uVar4 = (uint)bVar5;

+    }

+    if ((*puVar11 != uVar4) ||

+       (((*(byte *)((longlong)puVar11 + 10) & 4) != 0 &&

+        (*(byte *)((longlong)puVar11 + 9) < (ushort)uStack_30)))) goto LAB_0;

+    lVar6 = ((ulonglong)(ushort)puVar11[1] * (ulonglong)*(byte *)(param_1 + 0x34) +

+            (ulonglong)*(uint *)(param_1 + 0x2c)) - uVar12;

+    bVar5 = *(byte *)(lVar6 + 10 + param_1);

+    uVar3 = *(ushort *)(lVar6 + 4 + param_1);

+  }

+  uVar10 = 1;

+  if (((bVar5 >> 1 & 1) != 0) &&

+     (lVar6 = ((ulonglong)*(byte *)(param_1 + 100) * (ulonglong)uVar3 +

+              (ulonglong)*(uint *)(param_1 + 0x5c)) - uVar12,

+     *(byte *)(lVar6 + 10 + param_1) <= *(byte *)(param_1 + 3))) {

+    *(ulonglong *)(param_7 + 4) =

+         (((ulonglong)*(uint *)(lVar6 + 4 + param_1) + (ulonglong)*(uint *)(param_1 + 0x24)) -

+         uVar12) + param_1;

+    sVar1 = *(short *)(lVar6 + 8 + param_1) * 2;

+    *param_7 = sVar1;

+    param_7[1] = sVar1;

+  }

+LAB_0:

+  *param_6 = uVar10;

+  return 0;

 }
```

## `vDIBPatBlt`  (modified)

```diff
--- vDIBPatBlt
+++ vDIBPatBlt
@@ -1,232 +1,144 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* void __cdecl vDIBPatBlt(class SURFACE * __ptr64,struct _CLIPOBJ * __ptr64,struct _RECTL *

+   __ptr64,struct _BRUSHOBJ * __ptr64,struct _POINTL * __ptr64,unsigned long) */

 

 void __cdecl

 vDIBPatBlt(SURFACE *param_1,_CLIPOBJ *param_2,_RECTL *param_3,_BRUSHOBJ *param_4,_POINTL *param_5,

           ulong param_6)

 

 {

-  int *piVar1;

-  byte *pbVar2;

-  byte bVar3;

-  uint uVar4;

-  undefined4 uVar5;

-  int iVar6;

-  byte bVar7;

-  uint in_EAX;

-  uint uVar8;

-  longlong lVar9;

+  uint uVar1;

+  int iVar2;

+  int iVar4;

+  code *pcVar5;

+  bool bVar6;

+  bool bVar7;

+  int iVar8;

+  int iVar9;

   int iVar10;

-  char cVar11;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  longlong *unaff_RDI;

-  byte *pbVar12;

-  uint *puVar13;

-  undefined1 *puVar14;

-  int in_R10D;

-  int iVar15;

-  uint uVar16;

-  longlong *in_R11;

-  int unaff_R12D;

-  int unaff_R13D;

-  byte unaff_R14B;

+  longlong lVar11;

+  int *piVar12;

+  ulonglong uVar13;

+  undefined1 auStackY_248 [32];

+  undefined8 local_208;

+  undefined8 local_200;

+  undefined4 local_1f8;

+  undefined4 local_1f4;

+  _RECTL *local_1f0;

+  int local_1e8;

+  int local_1e4;

+  int local_1e0;

+  undefined4 local_1dc;

+  int local_1d8;

+  undefined4 local_1d4;

+  _BRUSHOBJ *local_1d0;

+  _POINTL *local_1c8;

+  code *local_1c0;

+  _CLIPOBJ *local_1b8;

+  undefined8 local_1b0;

+  undefined4 local_1a8;

+  uint local_198;

+  undefined8 local_194;

+  undefined8 uStack_18c;

+  ulonglong local_48;

+  int iVar3;

   

-  *(longlong **)(unaff_RBP + -0x18) = in_R11;

-  piVar1 = (int *)(unaff_RBX + 0x20);

-  iVar15 = *piVar1;

-  puVar14 = (undefined1 *)(((ulonglong)param_4 & 0xfffffffffffffffc) + *in_R11);

-  iVar6 = (int)param_2;

-  iVar10 = unaff_R12D + iVar6 * -4;

-  pbVar12 = (byte *)(((longlong)(int)((in_EAX & 7) + in_R10D) >> 3) + *unaff_RDI);

-  if (unaff_R14B == 0) {

-    if (iVar15 != 0) {

-      lVar9 = (longlong)(unaff_R13D - iVar6);

-      *(longlong *)(unaff_RBP + 0x60) = lVar9;

+  local_48 = __security_cookie ^ (ulonglong)auStackY_248;

+  local_1c8 = param_5;

+  local_1f0 = (_RECTL *)0x0;

+  local_1d4 = 0;

+  local_1d0 = param_4;

+  local_1b8 = param_2;

+  local_1b0 = param_3;

+  memset(&local_198,0,0x144);

+  bVar6 = false;

+  uVar1 = *(uint *)(param_1 + 0x60);

+  iVar8 = Feature_1831571771__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar8 == 0) || (uVar1 - 1 < 6)) {

+    pcVar5 = *(code **)(&DAT_0 + ((ulonglong)uVar1 * 3 + (ulonglong)param_6) * 8);

+    local_1d8 = *(int *)(&DAT_1 + (ulonglong)uVar1 * 4);

+    local_1c0 = pcVar5;

+    iVar8 = Feature_1831571771__private_IsEnabledDeviceUsageNoInline();

+    if ((iVar8 == 0) || (pcVar5 != (code *)0x0)) {

+      bVar7 = false;

+      if (param_2 != (_CLIPOBJ *)0x0) {

+        bVar7 = false;

+        if (param_2[0x14] == (_CLIPOBJ)0x1) {

+          bVar6 = true;

+          local_198 = 1;

+          local_194 = *(undefined8 *)(param_2 + 4);

+          uStack_18c = *(undefined8 *)(param_2 + 0xc);

+        }

+        else if (param_2[0x14] == (_CLIPOBJ)0x3) {

+          bVar6 = true;

+          XCLIPOBJ::cEnumStart((XCLIPOBJ *)param_2,0,0,4,0x14);

+          bVar7 = bVar6;

+        }

+      }

+      local_208 = *(undefined8 *)(param_1 + 0x50);

+      local_1f8 = *(undefined4 *)(param_1 + 0x58);

+      lVar11 = *(longlong *)(local_1d0 + 0x20);

+      local_200 = *(undefined8 *)(lVar11 + 0x20);

+      local_1f4 = *(undefined4 *)(lVar11 + 0x1c);

+      local_1e0 = local_1d8 * *(int *)(lVar11 + 0x14);

+      local_1dc = *(undefined4 *)(lVar11 + 0x18);

+      local_1e8 = local_1d8 * *(int *)local_1c8;

+      local_1e4 = *(int *)(local_1c8 + 4);

+      if (!bVar6) {

+        local_1f0 = param_3;

+        (*pcVar5)(&local_208);

+        return;

+      }

+      iVar8 = 0;

+      if (!bVar7) goto LAB_2;

       do {

-        iVar15 = iVar15 + -1;

-        pbVar2 = pbVar12 + iVar6;

-        if (pbVar12 != pbVar2) {

-          do {

-            bVar7 = *pbVar12;

-            pbVar12 = pbVar12 + 1;

-            *puVar14 = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 6));

-            puVar14[1] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 4 & 3));

-            puVar14[2] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 2 & 3));

-            puVar14[3] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 & 3));

-            puVar14 = puVar14 + 4;

-          } while (pbVar12 != pbVar2);

-          lVar9 = *(longlong *)(unaff_RBP + 0x60);

+        iVar8 = XCLIPOBJ::bEnum((XCLIPOBJ *)param_2,0x144,&local_198,(ulong *)0x0);

+LAB_2:

+        for (uVar13 = 0; (uint)uVar13 < local_198; uVar13 = (ulonglong)((uint)uVar13 + 1)) {

+          lVar11 = uVar13 * 0x10;

+          piVar12 = (int *)(&local_194 + uVar13 * 2);

+          iVar9 = *(int *)param_3;

+          iVar10 = *piVar12;

+          if (*piVar12 < iVar9) {

+            *piVar12 = iVar9;

+            iVar10 = iVar9;

+          }

+          iVar9 = *(int *)(param_3 + 8);

+          iVar3 = *(int *)(&uStack_18c + uVar13 * 2);

+          if (iVar9 < *(int *)(&uStack_18c + uVar13 * 2)) {

+            *(int *)(&uStack_18c + uVar13 * 2) = iVar9;

+            iVar3 = iVar9;

+          }

+          iVar2 = *(int *)((longlong)&local_194 + lVar11 + 4);

+          iVar9 = *(int *)(param_3 + 4);

+          if (iVar2 < iVar9) {

+            *(int *)((longlong)&local_194 + lVar11 + 4) = iVar9;

+            iVar2 = iVar9;

+          }

+          iVar9 = *(int *)((longlong)&uStack_18c + lVar11 + 4);

+          iVar4 = *(int *)(param_3 + 0xc);

+          if (iVar4 < iVar9) {

+            *(int *)((longlong)&uStack_18c + lVar11 + 4) = iVar4;

+            iVar9 = iVar4;

+          }

+          if ((iVar2 < iVar9) && (iVar10 < iVar3)) {

+            local_1f0 = (_RECTL *)piVar12;

+            (*pcVar5)(&local_208);

+          }

         }

-        puVar14 = puVar14 + iVar10;

-        pbVar12 = pbVar12 + lVar9;

-      } while (iVar15 != 0);

-      unaff_RBX = *(longlong *)(unaff_RBP + 0x48);

+      } while (iVar8 != 0);

+      return;

     }

+    local_1b0._4_4_ = 1;

   }

-  else if (iVar15 != 0) {

-    uVar5 = *(undefined4 *)(unaff_RBP + -0x50);

-    lVar9 = (longlong)iVar6;

-    *(longlong *)(unaff_RBP + -0x20) = lVar9;

-    do {

-      pbVar2 = pbVar12 + lVar9;

-      iVar15 = iVar15 + -1;

-      bVar7 = *pbVar12 << (unaff_R14B & 0x1f);

-      if (pbVar12 != pbVar2) {

-        do {

-          pbVar12 = pbVar12 + 1;

-          bVar7 = *pbVar12 >> ((byte)uVar5 & 0x3f) | bVar7;

-          *puVar14 = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 6));

-          puVar14[1] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 4 & 3));

-          puVar14[2] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 2 & 3));

-          puVar14[3] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 & 3));

-          puVar14 = puVar14 + 4;

-          bVar7 = *pbVar12 << (unaff_R14B & 0x1f);

-        } while (pbVar12 != pbVar2);

-        lVar9 = *(longlong *)(unaff_RBP + -0x20);

-      }

-      puVar14 = puVar14 + iVar10;

-      pbVar12 = pbVar12 + (unaff_R13D - iVar6);

-    } while (iVar15 != 0);

-    in_R11 = *(longlong **)(unaff_RBP + -0x18);

-    unaff_RBX = *(longlong *)(unaff_RBP + 0x48);

-    unaff_R12D = *(int *)(unaff_RBP + -0x4c);

-    unaff_R13D = *(int *)(unaff_RBP + -0x48);

-    unaff_R14B = (byte)*(undefined4 *)(unaff_RBP + -0x58);

+  else {

+    local_1b0._4_4_ = 0;

   }

-  cVar11 = *(char *)(unaff_RBP + 0x50);

-  uVar4 = *(uint *)(unaff_RBP + -0x44);

-  if (cVar11 != '\x01' || uVar4 != 0) {

-    uVar16 = *(uint *)(&DAT_0 + (ulonglong)uVar4 * 4);

-    if (cVar11 == '\0') {

-      uVar16 = uVar16 & *(uint *)(&DAT_1 + (ulonglong)(*(uint *)(unaff_RBP + -0x54) & 7) * 4

-                                 );

-    }

-    puVar13 = (uint *)(((longlong)*(int *)(unaff_RBX + 0x38) >> 1 & 0xfffffffffffffffcU) + *in_R11);

-    pbVar12 = (byte *)(((longlong)*(int *)(unaff_RBX + 0x30) >> 3) + *unaff_RDI);

-    iVar15 = *piVar1;

-    if (iVar15 != 0) {

-      if (*(uint *)(unaff_RBP + -0x40) < uVar4) {

-        bVar7 = *(byte *)(unaff_RBP + -0x50);

-        do {

-          bVar3 = *pbVar12 >> (bVar7 & 0x3f);

-          pbVar12 = pbVar12 + unaff_R13D;

-          uVar4 = *puVar13;

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 2 & 3));

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 & 3));

-          uVar8 = *(uint *)(unaff_RBP + 0x60) & uVar16;

-          *(uint *)(unaff_RBP + 0x60) = uVar8;

-          *puVar13 = uVar4 & ~uVar16 | uVar8;

-          puVar13 = (uint *)((longlong)puVar13 + (longlong)unaff_R12D);

-          iVar15 = iVar15 + -1;

-        } while (iVar15 != 0);

-      }

-      else if ((int)(*(int *)(unaff_RBP + -0x3c) + *(uint *)(unaff_RBP + -0x40)) < 9) {

-        do {

-          bVar7 = *pbVar12 << (unaff_R14B & 0x1f);

-          pbVar12 = pbVar12 + unaff_R13D;

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 2 & 3));

-          uVar4 = *puVar13;

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 & 3));

-          uVar8 = *(uint *)(unaff_RBP + 0x60) & uVar16;

-          *(uint *)(unaff_RBP + 0x60) = uVar8;

-          *puVar13 = uVar4 & ~uVar16 | uVar8;

-          puVar13 = (uint *)((longlong)puVar13 + (longlong)unaff_R12D);

-          iVar15 = iVar15 + -1;

-        } while (iVar15 != 0);

-      }

-      else {

-        bVar7 = *(byte *)(unaff_RBP + -0x50);

-        do {

-          bVar3 = *pbVar12;

-          pbVar2 = pbVar12 + 1;

-          pbVar12 = pbVar12 + unaff_R13D;

-          bVar3 = *pbVar2 >> (bVar7 & 0x3f) | bVar3 << (unaff_R14B & 0x1f);

-          uVar4 = *puVar13;

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 2 & 3));

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 & 3));

-          uVar8 = *(uint *)(unaff_RBP + 0x60) & uVar16;

-          *(uint *)(unaff_RBP + 0x60) = uVar8;

-          *puVar13 = uVar4 & ~uVar16 | uVar8;

-          puVar13 = (uint *)((longlong)puVar13 + (longlong)unaff_R12D);

-          iVar15 = iVar15 + -1;

-        } while (iVar15 != 0);

-        unaff_RBX = *(longlong *)(unaff_RBP + 0x48);

-      }

-      cVar11 = *(char *)(unaff_RBP + 0x50);

-      unaff_R14B = (byte)*(undefined4 *)(unaff_RBP + -0x58);

-    }

-  }

-  uVar4 = *(uint *)(unaff_RBP + -0x54);

-  if ((((longlong)(int)uVar4 & 7U) != 0) && (cVar11 != '\0')) {

-    iVar15 = *(int *)(unaff_RBX + 0x20);

-    puVar13 = (uint *)(((longlong)(int)uVar4 >> 1 & 0xfffffffffffffffcU) +

-                      *(longlong *)(unaff_RBX + 0x10));

-    uVar16 = *(uint *)(&DAT_1 + (ulonglong)(uVar4 & 7) * 4);

-    pbVar12 = (byte *)(((longlong)(*(int *)(unaff_RBX + 0x34) + -1) >> 3) +

-                      *(longlong *)(unaff_RBX + 8));

-    if (iVar15 != 0) {

-      if ((*(int *)(unaff_RBP + -0x38) - 1U & 7) < (uVar4 - 1 & 7)) {

-        bVar7 = *(byte *)(unaff_RBP + -0x50);

-        do {

-          pbVar2 = pbVar12 + -1;

-          bVar3 = *pbVar12;

-          pbVar12 = pbVar12 + unaff_R13D;

-          uVar4 = *puVar13;

-          bVar3 = *pbVar2 << (unaff_R14B & 0x1f) | bVar3 >> (bVar7 & 0x3f);

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 >> 2 & 3));

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar3 & 3));

-          uVar8 = *(uint *)(unaff_RBP + 0x60) & uVar16;

-          *(uint *)(unaff_RBP + 0x60) = uVar8;

-          *puVar13 = uVar4 & ~uVar16 | uVar8;

-          puVar13 = (uint *)((longlong)puVar13 + (longlong)unaff_R12D);

-          iVar15 = iVar15 + -1;

-        } while (iVar15 != 0);

-      }

-      else {

-        do {

-          bVar7 = *pbVar12 << (unaff_R14B & 0x1f);

-          pbVar12 = pbVar12 + unaff_R13D;

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 >> 2 & 3));

-          uVar4 = *puVar13;

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar7 & 3));

-          uVar8 = *(uint *)(unaff_RBP + 0x60) & uVar16;

-          *(uint *)(unaff_RBP + 0x60) = uVar8;

-          *puVar13 = uVar4 & ~uVar16 | uVar8;

-          puVar13 = (uint *)((longlong)puVar13 + (longlong)unaff_R12D);

-          iVar15 = iVar15 + -1;

-        } while (iVar15 != 0);

-      }

-    }

-  }

+  local_1b0 = (_RECTL *)CONCAT44(local_1b0._4_4_,0x3b8147b);

+  local_1a8 = 0;

+  RtlLogUnexpectedCodepath(&local_1b0);

   return;

 }
```

## `NtUserfnGETWINDOWDATA`  (modified)

```diff
--- NtUserfnGETWINDOWDATA
+++ NtUserfnGETWINDOWDATA
@@ -1,86 +1,72 @@
 

-ulonglong NtUserfnGETWINDOWDATA(void)

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+

+ulonglong NtUserfnGETWINDOWDATA

+                    (tagWND *param_1,undefined4 param_2,longlong param_3,longlong param_4,

+                    undefined1 *param_5,int param_6)

 

 {

-  byte bVar1;

-  int iVar2;

-  ulong uVar3;

-  undefined8 in_RAX;

-  longlong lVar4;

-  AtomicExecutionCheck AVar5;

-  ulonglong unaff_RBX;

-  void *unaff_RSI;

-  AtomicExecutionCheck unaff_DIL;

-  undefined8 uVar6;

-  longlong in_R11;

-  int unaff_R14D;

-  bool bVar7;

-  AtomicExecutionCheck in_stack_00000040;

-  undefined8 in_stack_00000088;

+  uint uVar1;

+  ulonglong uVar2;

+  bool bVar3;

+  tagTHREADINFO *ptVar4;

+  longlong *plVar5;

+  ulonglong uVar6;

+  longlong lVar7;

+  ulonglong uVar8;

   

-  *(undefined8 *)(in_R11 + -0x48) = in_RAX;

-  iVar2 = ObReferenceObjectByHandle();

-  AVar5 = SUB81(unaff_RBX,0);

-  if (iVar2 < 0) {

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3))

-    {

-      unaff_DIL = AVar5;

+  uVar6 = 0;

+  ptVar4 = PtiCurrent();

+  if ((param_6 == 0x2b1) && (param_4 < 3)) {

+    plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar8 = 0;

+    if (plVar5 != (longlong *)0x0) {

+      uVar8 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

     }

-    bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((unaff_DIL != (AtomicExecutionCheck)0x0) || (bVar7)) {

-      lVar4 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_DIL,bVar7,

-                 *(undefined8 *)(lVar4 + 0x10f98),3);

+    uVar1 = *(uint *)(uVar8 + 0xc);

+    plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar8 = 0;

+    if (plVar5 != (longlong *)0x0) {

+      uVar8 = (ulonglong)plVar5 & -(ulonglong)(*plVar5 != 0);

     }

-    UserSetLastError(0x57);

-    return 0;

-  }

-  EnterCrit(0,0);

-  in_stack_00000040 = AVar5;

-  AtomicExecutionCheck::Arm(&stack0x00000040);

-  bVar1 = PsGetJobUIRestrictionsClass(in_stack_00000088);

-  if (((byte)unaff_DIL & bVar1) == 0) {

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3))

-    {

-      unaff_DIL = AVar5;

+    uVar2 = *(ulonglong *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+    if (uVar2 == uVar8) {

+      if (*(undefined1 **)MmUserProbeAddress_exref <= param_5) {

+        param_5 = *(undefined1 **)MmUserProbeAddress_exref;

+      }

+      *param_5 = 1;

     }

-    bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((unaff_DIL != (AtomicExecutionCheck)0x0) || (bVar7)) {

-      lVar4 = W32GetUserSessionState();

-      uVar6 = *(undefined8 *)(lVar4 + 0x10f98);

-LAB_0:

-      WPP_RECORDER_AND_TRACE_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_DIL,bVar7,uVar6,3)

-      ;

+    else if ((*(ushort *)(*(longlong *)(param_1 + 0x28) + 0x2a) & 0x2fff) == 0) {

+      bVar3 = UIPrivilegeIsolation::CheckAccess

+                        ((tagUIPI_INFO *)

+                         (-(ulonglong)(*(longlong *)(ptVar4 + 0x1d0) != 0) &

+                         *(longlong *)(ptVar4 + 0x1d0) + 0x130U),

+                         (tagUIPI_INFO *)(-(ulonglong)(uVar2 != 0) & uVar2 + 0x130),0);

+      uVar6 = 0;

+      if (bVar3) {

+        KeAttachProcess(**(undefined8 **)(*(longlong *)(param_1 + 0x10) + 0x1d0));

+        uVar6 = GetWindowData(param_1,param_4,(int)param_3,(bool)((byte)(uVar1 >> 7) & 1));

+        KeDetachProcess();

+      }

+    }

+    else {

+      lVar7 = W32GetUserSessionState();

+      uVar6 = (**(code **)(lVar7 + 0x116d0))(param_1,param_2,param_3,param_4,param_5);

+      if ((param_4 == 2) &&

+         ((char)*(undefined4 *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0) + 0xc) < '\0'))

+      {

+        if (((*(byte *)(*(longlong *)(param_1 + 0x28) + 0x12) & 1) == 0) || (param_3 != 0)) {

+          param_3 = param_3 + 4;

+        }

+        else {

+          param_3 = 0x11;

+        }

+        lVar7 = W32GetUserSessionState();

+        lVar7 = (**(code **)(lVar7 + 0x116d0))(param_1,param_2,param_3,2,param_5);

+        uVar6 = uVar6 | lVar7 << 0x20;

+      }

     }

   }

-  else {

-    lVar4 = HMValidateHandleWithDescriptor();

-    if (lVar4 != 0) {

-      uVar3 = KfGetJobIdentity(in_stack_00000088);

-      bVar7 = Win32JobObject::GrantAccessHandle(uVar3,unaff_RSI,unaff_R14D != 0);

-      unaff_RBX = (ulonglong)bVar7;

-      goto LAB_1;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3))

-    {

-      unaff_DIL = AVar5;

-    }

-    bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((unaff_DIL != (AtomicExecutionCheck)0x0) || (bVar7)) {

-      lVar4 = W32GetUserSessionState();

-      uVar6 = *(undefined8 *)(lVar4 + 0x10f98);

-      goto LAB_0;

-    }

-  }

-  UserSetLastError(0x57);

-LAB_1:

-  ObfDereferenceObject(in_stack_00000088);

-  AtomicExecutionCheck::Disarm(&stack0x00000040);

-  UserSessionSwitchLeaveCrit();

-  return unaff_RBX;

+  return uVar6;

 }
```

## `GetDpiDependentMetric`  (modified)

```diff
--- GetDpiDependentMetric
+++ GetDpiDependentMetric
@@ -1,55 +1,31 @@
 

-/* WARNING: Instruction at (ram,0x00014008b5b9) overlaps instruction at (ram,0x00014008b5b3)

-    */

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

-

-ulonglong GetDpiDependentMetric(PDEVOBJ *param_1)

+int GetDpiDependentMetric(int param_1,int param_2)

 

 {

-  char cVar1;

-  int iVar2;

-  uint uVar3;

-  ulonglong in_RAX;

-  char *pcVar4;

-  byte bVar5;

-  HSEMAPHORE__ *unaff_RBX;

-  longlong unaff_RBP;

-  ulonglong unaff_RDI;

-  int unaff_R14D;

-  int *piStack0000000000000038;

+  int iVar1;

+  longlong lVar2;

+  longlong lVar3;

+  bool bVar4;

   

-  piStack0000000000000038 = (int *)(in_RAX & 0xffffffffffffff00);

-  *piStack0000000000000038 = *piStack0000000000000038 + (uint)piStack0000000000000038;

-  pcVar4 = (char *)((longlong)piStack0000000000000038 + -0x77);

-  cVar1 = *pcVar4;

-  bVar5 = (byte)param_1;

-  *pcVar4 = *pcVar4 + bVar5;

-  if (SCARRY1(cVar1,bVar5) == *pcVar4 < '\0') {

-    *(byte *)(unaff_RDI - 0x3ffffffe) =

-         *(byte *)(unaff_RDI - 0x3ffffffe) ^ (byte)((ulonglong)unaff_RBX >> 8);

-    iVar2 = bNeedRenderHint(param_1);

-    if (iVar2 != 0) {

-      DEVLOCKOBJ::DEVLOCKOBJ((DEVLOCKOBJ *)&stack0x00000050,(PDEVOBJ *)&stack0x00000100);

-      uVar3 = (**(code **)(unaff_RBP + 0xd60))

-                        (*(undefined8 *)(unaff_RBP + 0x6f8),0x10007 - (uint)(unaff_R14D != 0),0x18,

-                         &stack0x00000030);

-      unaff_RDI = (ulonglong)uVar3;

-      DEVLOCKOBJ::~DEVLOCKOBJ((DEVLOCKOBJ *)&stack0x00000050);

-    }

-    if (unaff_RBX != (HSEMAPHORE__ *)0x0) {

-      GreReleaseSemaphoreCommon<8,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

-                (GreReleaseSemaphoreExclusiveInternal_exref,unaff_RBX);

+  iVar1 = GetDpiCacheIndex(param_2);

+  bVar4 = iVar1 == -1;

+  if (bVar4) {

+    iVar1 = 1;

+  }

+  lVar2 = W32GetUserSessionState();

+  lVar3 = (longlong)iVar1 * 0x1e + (longlong)param_1;

+  iVar1 = *(int *)(*(longlong *)(lVar2 + 0x4e30) + 0x8ec + lVar3 * 4);

+  if (iVar1 == -1) {

+    _EnsureDpiDepSysMetCacheForPlateau(param_2);

+    lVar2 = W32GetUserSessionState();

+    iVar1 = *(int *)(*(longlong *)(lVar2 + 0x4e30) + 0x8ec + lVar3 * 4);

+    if (iVar1 == -1) {

+      iVar1 = 0;

     }

   }

-  else {

-    *(char *)((longlong)piStack0000000000000038 + -0x75) =

-         *(char *)((longlong)piStack0000000000000038 + -0x75) + bVar5;

-    pcVar4 = (char *)((ulonglong)((uint)piStack0000000000000038 >> (bVar5 & 0x1f) ^ 0x8d4cfff9) &

-                     0xffffffffffffffe0);

-    *pcVar4 = *pcVar4 + (char)pcVar4;

-    unaff_RBX[0x5b8b49c7] = (HSEMAPHORE__)((char)unaff_RBX[0x5b8b49c7] + bVar5);

-    param_1[-0x75] = (PDEVOBJ)((char)param_1[-0x75] - bVar5);

+  if (bVar4) {

+    iVar1 = (iVar1 * param_2 + 0x30) / 0x60;

   }

-  return unaff_RDI & 0xffffffff;

+  return iVar1;

 }
```

## `NtUserSetShellWindowEx`  (modified)

```diff
--- NtUserSetShellWindowEx
+++ NtUserSetShellWindowEx
@@ -1,19 +1,80 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-longlong NtUserSetShellWindowEx(AtomicExecutionCheck *param_1)

+bool NtUserSetShellWindowEx(undefined8 param_1)

 

 {

-  int *piVar1;

-  int in_EAX;

-  int unaff_EDI;

+  bool bVar1;

+  bool bVar2;

+  int iVar3;

+  tagTHREADINFO *ptVar4;

+  tagWND *ptVar5;

+  longlong *plVar6;

+  longlong lVar7;

+  ulonglong uVar8;

+  undefined1 auStack_58 [32];

+  _Win32HMThreadLockItem local_38 [16];

+  uint local_28 [2];

+  ulonglong local_20;

+  ulonglong local_18;

   

-  piVar1 = (int *)((ulonglong)

-                   CONCAT31((int3)((uint)(in_EAX + -0x18000000) >> 8),

-                            (char)(in_EAX + -0x18000000) + -0x22) - 0x73);

-  *piVar1 = *piVar1 + -1;

-  AtomicExecutionCheck::Disarm(param_1);

+                    /* 0x23d000  2018  NtUserSetShellWindowEx */

+  local_18 = __security_cookie ^ (ulonglong)auStack_58;

+  ptVar4 = (tagTHREADINFO *)EnterCrit(0,0);

+  ptVar5 = (tagWND *)ValidateHwnd(param_1);

+  bVar2 = false;

+  if ((ptVar5 == (tagWND *)0x0) ||

+     (((*(ushort *)(*(longlong *)(ptVar5 + 0x28) + 0x2a) & 0xffff2fff) - 0x29d & 0xfffffffd) == 0))

+  goto LAB_0;

+  Win32HM_LockIntoThread<0>(ptVar4,(_HEAD *)ptVar5,local_38);

+  iVar3 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar3 == 0) {

+    local_28[1] = 0xffffffff;

+    local_20 = local_20 & 0xffffffff00000000;

+    local_28[0] = 0x2000;

+    plVar6 = (longlong *)PsGetCurrentProcessWin32Process();

+    if ((plVar6 != (longlong *)0x0) && (*plVar6 != 0)) {

+      plVar6 = (longlong *)PsGetCurrentProcessWin32Process();

+      uVar8 = 0;

+      if (plVar6 != (longlong *)0x0) {

+        uVar8 = (ulonglong)plVar6 & -(ulonglong)(*plVar6 != 0);

+      }

+      bVar1 = UIPrivilegeIsolation::CheckAccess

+                        ((tagUIPI_INFO *)(uVar8 + 0x130),(tagUIPI_INFO *)local_28,0);

+      goto LAB_1;

+    }

+LAB_2:

+    UserSetLastError(5);

+  }

+  else {

+    plVar6 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar8 = 0;

+    if (plVar6 != (longlong *)0x0) {

+      uVar8 = (ulonglong)plVar6 & -(ulonglong)(*plVar6 != 0);

+    }

+    bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                      ((UIPIAccessor *)(-(ulonglong)(uVar8 != 0) & uVar8 + 0x130),0x2000);

+LAB_1:

+    if (bVar1 == false) goto LAB_2;

+    plVar6 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar8 = 0;

+    if (plVar6 != (longlong *)0x0) {

+      uVar8 = (ulonglong)plVar6 & -(ulonglong)(*plVar6 != 0);

+    }

+    if (*(ulonglong *)(*(longlong *)(ptVar5 + 0x10) + 0x1d0) != uVar8) goto LAB_2;

+    lVar7 = W32GetUserSessionState();

+    local_28[0] = local_28[0] & 0xffffff00;

+    local_20 = 0;

+    *(int *)(lVar7 + 0x114d8) = *(int *)(lVar7 + 0x114d8) + 1;

+    AtomicExecutionCheck::Arm((AtomicExecutionCheck *)local_28);

+    bVar2 = RegisterShell(ptVar5);

+    AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)local_28);

+    zzzEndDeferWinEventNotify();

+  }

+  Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+            ((Win32HMThreadLockBase<tagWND,0,0> *)local_38);

+LAB_0:

   UserSessionSwitchLeaveCrit();

-  return (longlong)unaff_EDI;

+  return bVar2;

 }
```

## `xxxCopyAckIn`  (modified)

```diff
--- xxxCopyAckIn
+++ xxxAdviseDataAck
@@ -1,70 +1,10 @@
 

-/* unsigned long __cdecl xxxCopyAckIn(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

-   __ptr64,struct tagINTDDEINFO * __ptr64 * __ptr64) */

+/* WARNING: Control flow encountered bad instruction data */

 

-ulong __cdecl

-xxxCopyAckIn(ulong *param_1,__int64 *param_2,tagDDECONV *param_3,tagINTDDEINFO **param_4)

+ulong __cdecl xxxAdviseDataAck(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

-  longlong lVar1;

-  tagINTDDEINFO *ptVar2;

-  ulong uVar3;

-  int iVar4;

-  tagDDECONV *ptVar5;

-  longlong lVar6;

-  tagXSTATE *ptVar7;

-  bool bVar8;

-  ulong local_res18 [4];

-  

-  lVar1 = *(longlong *)(param_3 + 0x38);

-  local_res18[0] = 0x1001;

-  uVar3 = xxxCopyDdeIn((void *)*param_2,local_res18,(void **)0x0,param_4);

-  iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

-  if (iVar4 == 0) {

-    lVar6 = _HMPheFromObject(param_3);

-    bVar8 = (bool)(~*(byte *)(lVar6 + 0x19) & 1);

-  }

-  else {

-    ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

-    bVar8 = ptVar5 == param_3;

-  }

-  if ((bVar8 == false) || (*(longlong *)(param_3 + 0x38) != lVar1)) {

-    uVar3 = 3;

-    if (*param_4 != (tagINTDDEINFO *)0x0) {

-      Win32FreePool();

-    }

-  }

-  else if (uVar3 == 2) {

-    ptVar2 = *param_4;

-    if (((*(uint *)(*(longlong *)(param_3 + 0x38) + 0x40) & 0x4000) != 0) &&

-       (-1 < *(short *)(ptVar2 + 0x48))) {

-      lVar1 = *(longlong *)(*(longlong *)(param_3 + 0x38) + 0x38);

-      GiveObject((uint)*(ushort *)(lVar1 + 0x4a),*(void **)(lVar1 + 0x30),

-                 *(ulong *)(*(longlong *)

-                             (*(longlong *)(*(longlong *)(param_3 + 0x30) + 0x10) + 0x1d0) + 0x38));

-    }

-    if ((*(uint *)(*(longlong *)(param_3 + 0x38) + 0x40) & 0x2000) != 0) {

-      lVar1 = *(longlong *)(*(longlong *)(param_3 + 0x38) + 0x38);

-      RemovePublicObject((uint)*(ushort *)(lVar1 + 0x4a),*(void **)(lVar1 + 0x30));

-      *(uint *)(*(longlong *)(param_3 + 0x38) + 0x40) =

-           *(uint *)(*(longlong *)(param_3 + 0x38) + 0x40) & 0xffffdfff;

-    }

-    ptVar7 = Createpxs((_func_ulong_ulong_ptr___int64_ptr_tagDDECONV_ptr *)0x0,(void *)0x0,

-                       (void *)0x0,ptVar2,local_res18[0] | 0x200);

-    if (ptVar7 == (tagXSTATE *)0x0) {

-      *param_2 = 0;

-    }

-    else {

-      *(undefined8 *)(ptVar7 + 0x10) = *(undefined8 *)(*(longlong *)(param_3 + 0x30) + 0x10);

-      lVar1 = *(longlong *)ptVar7;

-      *param_2 = lVar1;

-      if (lVar1 != 0) {

-        *param_1 = *param_1 | 0x80000000;

-        return 2;

-      }

-    }

-    uVar3 = 3;

-  }

-  return uVar3;

+                    /* WARNING: Bad instruction - Truncating control flow here */

+  halt_baddata();

 }
```

## `UnlockCaptureWindow`  (modified)

```diff
--- UnlockCaptureWindow
+++ UnlockCaptureWindow
@@ -1,290 +1,18 @@
 

-tagMONITOR * UnlockCaptureWindow(void)

+void UnlockCaptureWindow(longlong param_1)

 

 {

-  uint *puVar1;

-  tagWND *ptVar2;

-  undefined4 uVar3;

-  undefined4 uVar4;

-  bool bVar5;

-  byte bVar6;

-  int iVar7;

-  int iVar8;

-  CloakState CVar9;

-  longlong in_RAX;

-  longlong lVar10;

-  undefined8 uVar11;

-  longlong *plVar12;

-  CHECKPOINT *this;

-  undefined4 *puVar13;

-  tagWND *ptVar14;

-  HWND pHVar15;

-  tagWLDBI *ptVar16;

-  tagMONITOR *ptVar17;

-  ulonglong uVar18;

-  tagWND *unaff_RBX;

-  longlong unaff_RBP;

-  tagWND *unaff_RDI;

-  ulonglong uVar19;

-  tagWND *unaff_R12;

-  undefined8 unaff_R15;

-  undefined4 uVar20;

-  undefined4 extraout_XMM0_Da;

-  undefined4 extraout_XMM0_Da_00;

-  undefined4 extraout_XMM0_Da_01;

+  int *piVar1;

+  longlong lVar2;

   

-  if (((*(longlong *)(*(longlong *)(unaff_RBX + 0x10) + 0x1d0) != *(longlong *)(in_RAX + 0x1d0)) ||

-      (((*(uint *)(*(longlong *)(unaff_RBX + 0x28) + 0x120) ^

-        *(uint *)(*(longlong *)(unaff_RDI + 0x28) + 0x120)) & 0xf) == 0)) ||

-     (bVar5 = IsChildWindowDpiIsolationEnabled(unaff_RBX,unaff_RDI), bVar5)) {

-    if ((*(uint *)(unaff_RBX + 0x180) & 0x10) == 0) {

-      Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>

-                ((Win32HMThreadLockBase<tagWND,1,0> *)(unaff_RBP + -0x31),unaff_RDI);

-      iVar7 = ValidateNewParent();

-      if (iVar7 != 0) {

-        W32GetUserSessionState();

-        iVar7 = xxxShowWindowEx(unaff_RBX,'\0',0);

-        lVar10 = *(longlong *)(unaff_RBX + 0x28);

-        *(int *)(unaff_RBP + -0x59) = iVar7;

-        if ((*(byte *)(lVar10 + 0x1f) & 0x10) == 0) {

-          if ((*(uint *)(lVar10 + 0xe8) & 2) != 0) {

-            DecomposeWindowIfNeeded(unaff_RBX);

-          }

-          iVar8 = ValidateNewParent();

-          if (iVar8 != 0) {

-            lVar10 = W32GetUserSessionState();

-            *(char *)(unaff_RBP + -0x41) = (char)unaff_R15;

-            *(undefined8 *)(unaff_RBP + -0x39) = unaff_R15;

-            *(int *)(lVar10 + 0x114d8) = *(int *)(lVar10 + 0x114d8) + 1;

-            AtomicExecutionCheck::Arm((AtomicExecutionCheck *)(unaff_RBP + -0x41));

-            uVar11 = GetStyleWindow();

-            ptVar2 = *(tagWND **)(unaff_RBX + 0x68);

-            *(undefined8 *)(unaff_RBP + -0x49) = uVar11;

-            Win32HMThreadLockBase<tagMENU,1,1>::ManualLock<void>

-                      ((Win32HMThreadLockBase<tagMENU,1,1> *)(unaff_RBP + -0x69),(tagMENU *)ptVar2);

-            lVar10 = *(longlong *)(unaff_RBX + 0x28);

-            if ((*(byte *)(*(longlong *)(ptVar2 + 0x28) + 0x1a) & 0x40) == 0) {

-              uVar20 = *(undefined4 *)(lVar10 + 0x58);

-            }

-            else {

-              uVar20 = *(undefined4 *)(lVar10 + 0x60);

-            }

-            *(undefined4 *)(unaff_RBP + -0x79) = uVar20;

-            *(undefined4 *)(unaff_RBP + -0x75) = *(undefined4 *)(lVar10 + 0x5c);

-            _ScreenToClient((HWND)ptVar2,(LPPOINT)(unaff_RBP + -0x79));

-            if (*(int *)(lVar10 + 0xec) == 1) {

-LAB_0:

-              if (unaff_RDI != unaff_R12) goto LAB_1;

-              if (ptVar2 != unaff_R12) {

-                bVar5 = IsWindowShellCloakedComponentUIAware(ptVar2,false);

-                if (bVar5) {

-                  zzzUpdateWindowCompositionCloak(unaff_RBX,0,2);

-                }

-                plVar12 = (longlong *)PsGetCurrentProcessWin32Process();

-                uVar18 = 0;

-                if (plVar12 != (longlong *)0x0) {

-                  uVar18 = (ulonglong)plVar12 & -(ulonglong)(*plVar12 != 0);

-                }

-                if (((*(byte *)(uVar18 + 0x330) & 0x30) == 0x10) &&

-                   (CVar9 = _GetWindowCloakState(unaff_RBX), (CVar9 & 1) != 0)) {

-                  zzzUpdateWindowCompositionCloak(unaff_RBX,1,1);

-                }

-                if ((*(uint *)(unaff_RBX + 0x17c) & 0x400) != 0) {

-                  RemoveWindowFullScreen();

-                }

-                WindowMargins::CheckForChanges(unaff_RBX,3);

-                this = CHECKPOINT::Get(unaff_RBX);

-                if (this != (CHECKPOINT *)0x0) {

-                  CHECKPOINT::SendNormalToDwm(this,unaff_RBX);

-                }

-              }

-            }

-            else {

-              if ((unaff_RDI == unaff_R12) || (unaff_RDI == *(tagWND **)(unaff_RBP + -0x51))) {

-                SetOrClrWF(1);

-                goto LAB_0;

-              }

-LAB_1:

-              if (ptVar2 == unaff_R12) {

-                bVar5 = IsWindowShellCloakedComponentUIAware(unaff_RBX,true);

-                if (bVar5) {

-                  zzzUpdateWindowCompositionCloak(unaff_RBX,1,2);

-                }

-                ResetWindowTransform();

-                CRecalcProp::s_OnWindowBecomingChild(unaff_RBX);

-                WindowMargins::CheckForChanges(unaff_RBX,4);

-              }

-            }

-            UnlinkWindow();

-            puVar13 = (undefined4 *)

-                      LockPointer((SharedUserObjPointerFieldspwndParent<tagWND> *)(unaff_RBP + 0x17)

-                                  ,(_HEAD *)(unaff_RBX + 0x68));

-            uVar20 = puVar13[1];

-            uVar3 = puVar13[2];

-            uVar4 = puVar13[3];

-            *(undefined4 *)(unaff_RBP + 7) = *puVar13;

-            *(undefined4 *)(unaff_RBP + 0xb) = uVar20;

-            *(undefined4 *)(unaff_RBP + 0xf) = uVar3;

-            *(undefined4 *)(unaff_RBP + 0x13) = uVar4;

-            uVar20 = HMAssignmentLock(unaff_RBP + 7,0);

-            if ((unaff_RDI == (tagWND *)0x0) ||

-               (uVar11 = 1, (*(uint *)(unaff_RDI + 0x17c) & 0x1000) == 0)) {

-              uVar11 = 0;

-            }

-            SetWindowSubtreeCoreWindowStatus(uVar20,uVar11);

-            if ((((*(byte *)(*(longlong *)(unaff_RBX + 0x28) + 0x1f) & 0x40) != 0) &&

-                (*(longlong *)(unaff_RBX + 0x78) != 0)) &&

-               ((*(byte *)(*(longlong *)(*(longlong *)(unaff_RBX + 0x78) + 0x28) + 0x18) & 8) != 0))

-            {

-              SetOrClrWF(1);

-            }

-            ptVar14 = (tagWND *)_GetDesktopWindow();

-            if ((unaff_RDI == ptVar14) &&

-               ((*(byte *)(*(longlong *)(unaff_RBX + 0x28) + 0x18) & 8) == 0)) {

-              CalcWindowFullScreen();

-              CalcForegroundInsertAfter();

-            }

-            LinkWindow();

-            if ((*(longlong *)(unaff_RBP + 0x6f) == -3) &&

-               (bVar5 = IsWindowShellCloakedComponentUIAware(unaff_RBX,true), !bVar5)) {

-              zzzUpdateWindowCompositionCloak(unaff_RBX,0,2);

-            }

-            lVar10 = GetStyleWindow();

-            if (*(longlong *)(unaff_RBP + -0x49) == 0) {

-              if (lVar10 != 0) {

-                RedirectDCEs();

-              }

-            }

-            else if (lVar10 == 0) {

-              UnredirectDCEs();

-            }

-            else if (*(longlong *)(unaff_RBP + -0x49) != lVar10) {

-              ChangeRedirectionParentInDCEs(extraout_XMM0_Da,1);

-            }

-            ptVar14 = (tagWND *)_GetDesktopWindow();

-            if ((unaff_RDI == ptVar14) &&

-               ((*(byte *)(*(longlong *)(unaff_RBX + 0x28) + 0x1f) & 4) == 0)) {

-              uVar20 = SetOrClrWF(1);

-              zzzLockDisplayAreaAndInvalidateDCCache(uVar20,1,0);

-            }

-            if ((*(byte *)(*(longlong *)(unaff_RBX + 0x28) + 0x1f) & 0xc0) == 0x40) {

-              pHVar15 = _GetDesktopWindow();

-              if (*(HWND *)(unaff_RBX + 0x68) != pHVar15) {

-                if (*(longlong *)(unaff_RBX + 0x10) != *(longlong *)(ptVar2 + 0x10)) {

-                  zzzAttachThreadInput

-                            (*(longlong *)(unaff_RBX + 0x10),*(longlong *)(ptVar2 + 0x10),0);

-                }

-              }

-              ptVar14 = (tagWND *)_GetDesktopWindow();

-              if ((unaff_RDI != ptVar14) &&

-                 (*(longlong *)(unaff_RBX + 0x10) != *(longlong *)(unaff_RDI + 0x10))) {

-                uVar11 = 1;

-                if (*(int *)(unaff_RBP + 0x7f) != 0) {

-                  iVar7 = Feature_UIPIEliminateATIOverride__private_IsEnabledDeviceUsageNoInline();

-                  if (iVar7 != 0) {

-                    *(undefined4 *)(unaff_RBP + 0x6f) = 0x20000;

-                    MicrosoftTelemetryAssertTriggeredArgsKM

-                              ("IXPTelAssert",*(undefined4 *)(unaff_RBP + 0x6f),0x506);

-                  }

-                  uVar11 = 0x8001;

-                }

-                zzzAttachThreadInput

-                          (*(undefined8 *)(unaff_RBX + 0x10),*(undefined8 *)(unaff_RDI + 0x10),

-                           uVar11);

-              }

-            }

-            ptVar14 = *(tagWND **)(unaff_RBP + -0x51);

-            if (((*(uint *)(ptVar2 + 0x17c) >> 0x13 & 1) != 0) ||

-               ((*(uint *)(unaff_RBX + 0x17c) >> 0x13 & 1) != 0)) {

-              bVar6 = (byte)*(undefined4 *)(*(longlong *)(unaff_RBX + 0x28) + 0x120);

-              if (((bVar6 & 0xf) == 2) && ((bVar6 & 0xf0) == 0x10)) {

-                *(uint *)(unaff_RBX + 0x17c) = *(uint *)(unaff_RBX + 0x17c) & 0xfff7ffff;

-              }

-              puVar1 = (uint *)(*(longlong *)(unaff_RBX + 0x28) + 0xe8);

-              *puVar1 = *puVar1 & 0xfffffbff;

-            }

-            uVar19 = 0;

-            uVar18 = uVar19;

-            iVar7 = _IsTopLevelWindow();

-            if ((iVar7 == 0) && (unaff_RDI != (tagWND *)0x0)) {

-              uVar19 = CONCAT71((int7)(uVar19 >> 8),

-                                *(short *)(*(longlong *)(unaff_RDI + 0x28) + 0x11e) != (short)uVar18

-                               );

-            }

-            _SetDeferredDpiStateForWindowAndChildren(extraout_XMM0_Da_00,uVar19 & 0xffffffff,0);

-            AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)(unaff_RBP + -0x41));

-            zzzEndDeferWinEventNotify();

-            lVar10 = GetStyleWindow(*(undefined8 *)(unaff_RBX + 0x68),0xb02);

-            if (lVar10 != 0) {

-              xxxTurnOffCompositing(extraout_XMM0_Da_01,0);

-            }

-            xxxWindowEvent(0x800f);

-            if (((unaff_RDI == (tagWND *)0x0) || (ptVar2 == unaff_R12)) || (unaff_RDI == unaff_R12))

-            {

-              ptVar16 = (tagWLDBI *)0x0;

-            }

-            else if (*(longlong *)(*(longlong *)(ptVar2 + 0x28) + 0x100) ==

-                     *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0x100)) {

-              ptVar16 = *(tagWLDBI **)(unaff_RBP + -0x71);

-            }

-            else {

-              ptVar16 = BuildWindowListWithDpiBoundaryInfo

-                                  (unaff_RBX,ptVar2,(tagBWL *)0x0,(int *)(unaff_RBP + 0x67));

-              if (*(int *)(unaff_RBP + 0x67) != 0) goto LAB_2;

-            }

-            xxxSetWindowPos();

-LAB_2:

-            ptVar2 = *(tagWND **)(unaff_RBX + 0x68);

-            if (((ptVar2 == (tagWND *)0x0) ||

-                (((*(uint *)(*(longlong *)(ptVar2 + 0x28) + 0x120) ^

-                  *(uint *)(*(longlong *)(unaff_RBX + 0x28) + 0x120)) & 0xf) == 0)) ||

-               ((ptVar2 == unaff_R12 ||

-                ((ptVar2 == ptVar14 ||

-                 (bVar5 = IsChildWindowDpiIsolationEnabled(unaff_RBX,ptVar2), bVar5)))))) {

-              xxxInheritWindowMonitor();

-            }

-            else {

-              xxxForceUpdateProcessDpiAwarenessContext

-                        (unaff_RBX,

-                         *(ulong *)(*(longlong *)(*(longlong *)(unaff_RBX + 0x68) + 0x28) + 0x120));

-            }

-            if (ptVar16 != (tagWLDBI *)0x0) {

-              xxxUpdateWindowPositionsForDpiBoundaryChange(ptVar16);

-              FreeListFree((tagFREELIST *)ptVar16);

-            }

-            if (*(int *)(unaff_RBP + -0x59) != 0) {

-              W32GetUserSessionState();

-              xxxShowWindowEx(unaff_RBX,'\x01',0);

-            }

-            ptVar17 = Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

-                                ((Win32HMThreadLockBase<tagMONITOR,1,1> *)(unaff_RBP + -0x69));

-            Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

-                      ((Win32HMThreadLockBase<tagWND,1,0> *)(unaff_RBP + -0x31));

-            CDwmNotifyBatch::~CDwmNotifyBatch((CDwmNotifyBatch *)(unaff_RBP + -0x21));

-            Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

-                      ((Win32HMOptionalThreadLock<tagHOOK> *)(unaff_RBP + -0x69));

-            return ptVar17;

-          }

-          if ((iVar7 != 0) && ((char)unaff_R15 <= *(char *)(*(longlong *)(unaff_RBX + 0x28) + 0x13))

-             ) {

-            W32GetUserSessionState();

-            xxxShowWindowEx(unaff_RBX,'\x01',0);

-          }

-        }

-      }

-      Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

-                ((Win32HMThreadLockBase<tagWND,1,0> *)(unaff_RBP + -0x31));

-      goto LAB_3;

-    }

+                    /* 0x4f490  2238  UnlockCaptureWindow */

+  if (*(longlong *)(param_1 + 0x80) != 0) {

+    lVar2 = W32GetUserSessionState();

+    piVar1 = (int *)(*(longlong *)(lVar2 + 0x4e30) + 0x1b50);

+    *piVar1 = *piVar1 + -1;

+    HMAssignmentUnlock((longlong *)(param_1 + 0x80));

+    EditionUpdateRawMouseMode(param_1);

   }

-  else {

-    TraceChildWindowDpiTelemetry(unaff_RBX,unaff_RDI,1);

-  }

-  UserSetLastError(0x139f);

-LAB_3:

-  CDwmNotifyBatch::~CDwmNotifyBatch((CDwmNotifyBatch *)(unaff_RBP + -0x21));

-  Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

-            ((Win32HMOptionalThreadLock<tagHOOK> *)(unaff_RBP + -0x69));

-  return (tagMONITOR *)0x0;

+  return;

 }
```

## `xxxSetThreadDesktop`  (modified)

```diff
--- xxxSetThreadDesktop
+++ xxxSetThreadDesktop
@@ -1,768 +1,94 @@
 

-undefined8 xxxSetThreadDesktop(undefined8 param_1)

+undefined1 * xxxSetThreadDesktop(longlong param_1,longlong param_2)

 

 {

-  int *piVar1;

-  MAPPER MVar2;

-  short sVar3;

-  wchar_t *_Str1;

-  ulonglong uVar4;

-  uchar uVar5;

-  int iVar6;

-  int iVar7;

-  uint uVar8;

-  longlong lVar9;

-  longlong lVar10;

-  tagPvtData *ptVar11;

-  MAPPER *pMVar12;

-  SESSION_GLOBALS *pSVar13;

-  _LIST_ENTRY *p_Var14;

-  void *pvVar15;

-  byte bVar16;

-  ulonglong uVar17;

-  undefined8 *puVar18;

-  byte bVar19;

-  uint uVar20;

-  MAPPER *unaff_RBX;

-  int unaff_EBP;

-  int iVar21;

-  longlong unaff_RSI;

-  undefined8 *puVar22;

-  MAPPER MVar23;

-  MAPPER MVar24;

-  wchar_t *pwVar25;

-  wchar_t *_Str2;

-  uint uVar26;

-  MAPPER *pMVar27;

-  int iVar28;

-  char cVar29;

-  wchar_t wVar30;

-  ulonglong unaff_R12;

-  MAPPER *unaff_R13;

-  PFEOBJ *unaff_R14;

-  longlong unaff_R15;

-  longlong local_res20;

-  PFE *in_stack_00000070;

-  wchar_t *in_stack_00000078;

-  int in_stack_00000088;

+  undefined8 *puVar1;

+  bool bVar2;

+  int iVar3;

+  tagTHREADINFO *ptVar4;

+  undefined1 *puVar5;

+  longlong lVar6;

+  longlong lVar7;

+  tagQ *this;

+  undefined8 local_48;

+  undefined8 local_40;

+  undefined8 local_38;

+  undefined8 local_30;

+  longlong local_28;

+  undefined4 local_20;

+  undefined4 local_1c;

   

-  *(undefined8 *)(unaff_RBX + 0xf8) = param_1;

-  if ((*(uint *)((longlong)*(longlong **)unaff_R14 + 0xc) & 2) != 0) goto LAB_0;

-  lVar10 = **(longlong **)unaff_R14;

-  local_res20 = lVar10;

-  lVar9 = W32GetSessionState();

-  if (((*(longlong *)(lVar10 + 0x88) == *(longlong *)(*(longlong *)(lVar9 + 0x60) + 0x4fb8)) &&

-      (ptVar11 = PFFOBJ::pPvtDataMatch((PFFOBJ *)&local_res20,(ulong *)0x0),

-      ptVar11 == (tagPvtData *)0x0)) || ((*(uint *)(*(longlong *)unaff_R14 + 0xc) & 0x20) != 0))

-  goto LAB_0;

-  lVar10 = W32GetSessionState();

-  cVar29 = (char)unaff_R12;

-  if (((*(longlong *)(**(longlong **)unaff_R14 + 0x88) ==

-        *(longlong *)(*(longlong *)(lVar10 + 0x60) + 0x4fb8)) &&

-      (local_res20 = **(longlong **)unaff_R14,

-      ptVar11 = PFFOBJ::pPvtDataMatch((PFFOBJ *)&local_res20,(ulong *)0x0),

-      ptVar11 != (tagPvtData *)0x0)) &&

-     (((*(uint *)(ptVar11 + 8) & 0xc) != 0 &&

-      (cVar29 <= *(char *)(*(longlong *)(unaff_RBX + 8) + 0x19))))) goto LAB_0;

-  *(ulonglong *)(unaff_RBX + 0xb8) = unaff_R12;

-  *(undefined4 *)(unaff_RBX + 0xc0) = 1;

-  *(undefined4 *)(unaff_RBX + 0xc4) = 1;

-  if ((((int)*(uint *)(unaff_RBX + 0xf4) < 0) &&

-      ((*(uint *)(*(longlong *)(*(longlong *)unaff_R14 + 0x20) + 0x30) & 0x4000) == 0)) ||

-     ((*(char *)(*(longlong *)unaff_RBX + 0x56) != cVar29 &&

-      (*(ulonglong *)(unaff_RSI + 0x48) == unaff_R12)))) goto LAB_0;

-  uVar26 = (uint)unaff_R12;

-  bVar16 = *(byte *)(*(longlong *)(unaff_RBX + 0xf8) + 0x2d);

-  bVar19 = *(byte *)(*(longlong *)(unaff_RBX + 8) + 0x1b) & 3;

-  uVar8 = uVar26;

-  if (bVar19 == 0) {

-    if ((bVar16 & 1) == 0) goto LAB_1;

-    uVar8 = 1;

-LAB_2:

-    *(uint *)(unaff_RBX + 0xb8) = uVar8;

-    if (*(uint *)(unaff_RBX + 0xb4) <= uVar8) {

-      if (uVar8 != *(uint *)(unaff_RBX + 0xb4)) {

-        return 0;

-      }

-      if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-        return 0;

-      }

-      if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(unaff_RSI + 0x50)) {

-        return 0;

-      }

+  ptVar4 = PtiCurrent();

+  puVar1 = *(undefined8 **)(ptVar4 + 0x1d0);

+  if (param_2 != 0) {

+    local_30 = *puVar1;

+    local_48 = 0;

+    local_40 = 0;

+    local_38 = 1;

+    local_20 = 0;

+    local_1c = 1;

+    local_28 = param_2;

+    puVar5 = (undefined1 *)MapDesktop(&local_48);

+    if ((int)puVar5 < 0) {

+      return puVar5;

     }

   }

-  else {

-    bVar16 = bVar16 & 2;

-    if (bVar19 == 1) {

-      uVar8 = -(uint)(bVar16 != 0) & 15000;

+  lVar6 = W32GetUserGdiSessionState();

+  lVar6 = *(longlong *)(lVar6 + 0x28);

+  lVar7 = PsGetCurrentProcess();

+  if (lVar7 != lVar6) {

+    if (((*(int *)(ptVar4 + 0x3b0) != 0) || (*(int *)(ptVar4 + 0x2d0) != 0)) ||

+       ((*(longlong *)(ptVar4 + 0x1f0) != 0 &&

+        ((lVar6 = *(longlong *)(*(longlong *)(ptVar4 + 0x1f0) + 0xe0), lVar6 != 0 &&

+         (*(tagTHREADINFO **)(lVar6 + 0x20) == ptVar4)))))) {

+      UserSetLastError(0xaa);

+      return (undefined1 *)0x80000011;

     }

-    else if (bVar16 == 0) {

-      uVar8 = 0x15e;

-    }

-LAB_1:

-    if (uVar8 != 0) goto LAB_2;

-  }

-  bVar19 = *(byte *)(*(longlong *)(unaff_RBX + 0xf8) + 0x2d) & 0x70;

-  bVar16 = *(byte *)(*(longlong *)(unaff_RBX + 8) + 0x1b) & 0x70;

-  uVar17 = (ulonglong)bVar16;

-  if (((bVar16 == 0) && (uVar17 = (ulonglong)bVar19, unaff_RBX[0x114] != (MAPPER)0x2)) &&

-     (uVar17 = (ulonglong)bVar16, bVar19 != 0)) {

-    uVar17 = 0x20;

-    if ((*(uint *)(unaff_RBX + 0xf4) & 0x800000) != 0) {

-      uVar17 = 0x10;

-    }

-LAB_3:

-    in_stack_00000078 = *(wchar_t **)(unaff_R15 + 0x4d20 + (uVar17 >> 4) * 8);

-  }

-  else if ((byte)uVar17 < 0x60) goto LAB_3;

-  if ((byte)uVar17 != bVar19) {

-    if (bVar19 == 0) {

-      iVar6 = 8000;

-    }

-    else {

-      uVar8 = uVar26;

-      if ((byte)uVar17 < 0x31) {

-        if (0x30 < bVar19) {

-LAB_4:

-          uVar8 = 0x32;

-        }

-      }

-      else if (bVar19 < 0x31) goto LAB_4;

-      iVar6 = uVar8 + 9000;

-    }

-    uVar8 = *(int *)(unaff_RBX + 0xb8) + iVar6;

-    *(uint *)(unaff_RBX + 0xb8) = uVar8;

-    if (*(uint *)(unaff_RBX + 0xb4) <= uVar8) {

-      if (uVar8 != *(uint *)(unaff_RBX + 0xb4)) {

-        return 0;

-      }

-      if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-        return 0;

-      }

-      if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(unaff_RSI + 0x50)) {

-        return 0;

-      }

+    if ((puVar1[0x2d] == 0) && (param_1 != 0)) {

+      LockObjectAssignment(puVar1 + 0x2d,param_2);

+      puVar1[0x32] = param_1;

     }

   }

-  MVar23 = unaff_RBX[0x114];

-  if ((MVar23 == (MAPPER)0x1) || ((*(uint *)(unaff_RBX + 0xf4) & 0x8000000) != 0)) {

-    lVar10 = *(longlong *)(*(longlong *)unaff_R14 + 0x20);

-    if (*(uint *)(lVar10 + 0x28) == uVar26) {

-      MVar24 = *(MAPPER *)(lVar10 + 0x2c);

+  if (*(longlong *)(ptVar4 + 0x1f0) != param_2) {

+    if (((byte)ptVar4[0x550] & 8) != 0) {

+      lVar6 = W32GetUserSessionState();

+      MagContextThreadCallout(lVar6 + 0x10280,ptVar4);

     }

-    else {

-      if (MVar23 == (MAPPER)0x1) {

-        lVar9 = W32GetSessionState();

-        MVar23 = *(MAPPER *)(*(longlong *)(lVar9 + 0x60) + 0x4d18);

-      }

-      if (MVar23 == (MAPPER)0xfe) {

-        MVar24 = (MAPPER)0xfe;

+    if (*(longlong *)(ptVar4 + 0x1f0) != param_2) {

+      bVar2 = tagQ::AreMultipleThreadsAttached(*(tagQ **)(ptVar4 + 0x1d8));

+      if (bVar2) {

+        iVar3 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+        if (iVar3 == 0) {

+          this = (tagQ *)AllocQueue(0,0);

+        }

+        else {

+          this = tagQ::Alloc(ptVar4);

+        }

+        if (this == (tagQ *)0x0) {

+          UserSetLastError(8);

+          return &DAT_0;

+        }

+        tagQ::zzzAttachToQueue(this,ptVar4,(tagQ *)0x0,false);

       }

       else {

-        pMVar12 = (MAPPER *)(*(int *)(lVar10 + 0x28) + lVar10);

-        MVar2 = *pMVar12;

-        pMVar27 = pMVar12 + 0x10;

-        for (; pMVar12 < pMVar27; pMVar12 = pMVar12 + 1) {

-          MVar24 = MVar23;

-          unaff_EBP = in_stack_00000088;

-          if (*pMVar12 == MVar23) goto LAB_5;

-          if (*pMVar12 == (MAPPER)0x1) break;

+        lVar6 = W32GetUserSessionState();

+        if (*(longlong *)(ptVar4 + 0x1d8) == *(longlong *)(lVar6 + 0x4a50)) {

+          if ((*(int *)gbIgnoreStressedOutStuff_exref == 0) &&

+             (*(longlong *)(*(longlong *)(ptVar4 + 0x1d8) + 0x98) != 0)) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+          }

+          xxxSetForegroundWindow2((tagWND *)0x0,ptVar4,0);

         }

-        MVar24 = MVar2;

-        unaff_EBP = in_stack_00000088;

-        if (*(longlong *)(*(longlong *)unaff_R14 + 0x78) != 0) {

-          puVar22 = *(undefined8 **)(*(longlong *)(*(longlong *)unaff_R14 + 0x78) + 0x10);

-          while( true ) {

-            if (*(longlong *)(*(longlong *)unaff_R14 + 0x78) == 0) {

-              lVar10 = W32GetSessionState();

-              puVar18 = (undefined8 *)(*(longlong *)(lVar10 + 0x60) + 0x3738);

-            }

-            else {

-              puVar18 = (undefined8 *)(*(longlong *)(*(longlong *)unaff_R14 + 0x78) + 0x10);

-            }

-            MVar24 = MVar2;

-            if (puVar22 == puVar18) break;

-            lVar10 = *(longlong *)(puVar22[4] + 0x20);

-            if (*(int *)(lVar10 + 0x28) == 0) {

-              MVar24 = MVar23;

-              if (*(MAPPER *)(lVar10 + 0x2c) == MVar23) break;

-            }

-            else {

-              pMVar12 = (MAPPER *)(*(int *)(lVar10 + 0x28) + lVar10);

-              pMVar27 = pMVar12 + 0x10;

-              for (; pMVar12 < pMVar27; pMVar12 = pMVar12 + 1) {

-                MVar24 = MVar23;

-                if (*pMVar12 == MVar23) goto LAB_5;

-                if (*pMVar12 == (MAPPER)0x1) break;

-              }

-            }

-            puVar22 = (undefined8 *)*puVar22;

-          }

-        }

-      }

-    }

-LAB_5:

-    MVar23 = unaff_RBX[0x114];

-    *unaff_R13 = MVar24;

-    if (((MVar23 == (MAPPER)0x1) && ((*(uint *)(unaff_RBX + 0xf4) >> 0x1b & 1) == 0)) &&

-       (*(MAPPER *)(unaff_R15 + 0x4d18) != MVar24)) {

-      uVar8 = *(int *)(unaff_RBX + 0xb8) + 2;

-      *(uint *)(unaff_RBX + 0xb8) = uVar8;

-      if (*(uint *)(unaff_RBX + 0xb4) <= uVar8) {

-        if (uVar8 != *(uint *)(unaff_RBX + 0xb4)) {

-          return 0;

-        }

-        if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-          return 0;

-        }

-        if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-          return 0;

+        else if (*(longlong *)(ptVar4 + 0x1f0) == 0) {

+          lVar6 = W32GetUserSessionState();

+          iVar3 = (*(uint *)(lVar6 + 0x10cd0) & 1) - 1;

+          *(int *)(ptVar4 + 0x318) = iVar3;

+          *(int *)(*(longlong *)(ptVar4 + 0x1d8) + 0x210) = iVar3;

         }

       }

     }

   }

-  else {

-    lVar10 = *(longlong *)(*(longlong *)unaff_R14 + 0x20);

-    if (*(int *)(lVar10 + 0x28) == 0) {

-      MVar24 = *(MAPPER *)(lVar10 + 0x2c);

-    }

-    else if (MVar23 == (MAPPER)0xfe) {

-      MVar24 = (MAPPER)0xfe;

-    }

-    else {

-      pMVar12 = (MAPPER *)(*(int *)(lVar10 + 0x28) + lVar10);

-      MVar2 = *pMVar12;

-      pMVar27 = pMVar12 + 0x10;

-      for (; pMVar12 < pMVar27; pMVar12 = pMVar12 + 1) {

-        MVar24 = MVar23;

-        unaff_EBP = in_stack_00000088;

-        if (*pMVar12 == MVar23) goto LAB_6;

-        if (*pMVar12 == (MAPPER)0x1) break;

-      }

-      MVar24 = MVar2;

-      unaff_EBP = in_stack_00000088;

-      if (*(ulonglong *)(*(longlong *)unaff_R14 + 0x78) != unaff_R12) {

-        p_Var14 = PFEOBJ::pGetLinkedFontList(unaff_R14);

-        puVar22 = *(undefined8 **)p_Var14;

-        while( true ) {

-          if (*(longlong *)(*(longlong *)unaff_R14 + 0x78) == 0) {

-            lVar10 = W32GetSessionState();

-            puVar18 = (undefined8 *)(*(longlong *)(lVar10 + 0x60) + 0x3738);

-          }

-          else {

-            puVar18 = (undefined8 *)(*(longlong *)(*(longlong *)unaff_R14 + 0x78) + 0x10);

-          }

-          MVar24 = MVar2;

-          if (puVar22 == puVar18) break;

-          lVar10 = *(longlong *)(puVar22[4] + 0x20);

-          if (*(int *)(lVar10 + 0x28) == 0) {

-            MVar24 = MVar23;

-            if (*(MAPPER *)(lVar10 + 0x2c) == MVar23) break;

-          }

-          else {

-            pMVar12 = (MAPPER *)(*(int *)(lVar10 + 0x28) + lVar10);

-            pMVar27 = pMVar12 + 0x10;

-            for (; pMVar12 < pMVar27; pMVar12 = pMVar12 + 1) {

-              MVar24 = MVar23;

-              if (*pMVar12 == MVar23) goto LAB_6;

-              if (*pMVar12 == (MAPPER)0x1) break;

-            }

-          }

-          puVar22 = (undefined8 *)*puVar22;

-        }

-      }

-    }

-LAB_6:

-    *unaff_R13 = MVar24;

-    if (unaff_RBX[0x114] != MVar24) {

-      if ((*(uint *)(unaff_RBX + 0xf4) >> 0x1a & 1) == 0) goto LAB_0;

-      uVar8 = *(int *)(unaff_RBX + 0xb8) + 65000;

-      *(uint *)(unaff_RBX + 0xb8) = uVar8;

-      if (*(uint *)(unaff_RBX + 0xb4) <= uVar8) {

-        if (uVar8 != *(uint *)(unaff_RBX + 0xb4)) {

-          return 0;

-        }

-        if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-          return 0;

-        }

-        if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-          return 0;

-        }

-      }

-    }

-  }

-  if (unaff_EBP != 0) {

-    _Str1 = *(wchar_t **)(unaff_RBX + 0x10);

-    pwVar25 = (wchar_t *)

-              ((longlong)*(int *)(*(longlong *)(*(longlong *)unaff_R14 + 0x20) + 8) +

-              *(longlong *)(*(longlong *)unaff_R14 + 0x20));

-    iVar6 = _wcsicmp(_Str1,pwVar25);

-    if (iVar6 != 0) {

-      if ((*(uint *)(*(longlong *)(*(longlong *)unaff_R14 + 0x20) + 0x30) & 0x8000000) != 0) {

-        lVar10 = -1;

-        do {

-          lVar9 = lVar10 + 1;

-          wVar30 = (wchar_t)unaff_R12;

-          lVar10 = lVar10 + 1;

-        } while (pwVar25[lVar9] != wVar30);

-        pwVar25 = pwVar25 + lVar10;

-        uVar17 = unaff_R12;

-        do {

-          iVar6 = (int)uVar17;

-          _Str2 = pwVar25 + 1;

-          if (*_Str2 == wVar30) break;

-          iVar7 = _wcsicmp(_Str1,_Str2);

-          lVar10 = -1;

-          do {

-            lVar9 = lVar10 + 2;

-            lVar10 = lVar10 + 1;

-          } while (pwVar25[lVar9] != wVar30);

-          pwVar25 = _Str2 + lVar10;

-          uVar17 = CONCAT71((int7)(unaff_R12 >> 8),iVar7 == 0);

-          iVar6 = (int)uVar17;

-        } while (iVar7 != 0);

-        if (iVar6 != 0) {

-          *(int *)(unaff_RBX + 0xb8) = *(int *)(unaff_RBX + 0xb8) + 1;

-          goto LAB_7;

-        }

-      }

-      if ((in_stack_00000078 == (wchar_t *)0x0) ||

-         (iVar6 = _wcsicmp((wchar_t *)

-                           ((longlong)*(int *)(*(longlong *)(*(longlong *)unaff_R14 + 0x20) + 8) +

-                           *(longlong *)(*(longlong *)unaff_R14 + 0x20)),in_stack_00000078),

-         iVar6 != 0)) {

-        *(int *)(unaff_RBX + 0xb8) = *(int *)(unaff_RBX + 0xb8) + 10000;

-      }

-      else {

-        *(int *)(unaff_RBX + 0xb8) = *(int *)(unaff_RBX + 0xb8) + 9000;

-      }

-    }

-LAB_7:

-    if (*(uint *)(unaff_RBX + 0xb4) <= *(uint *)(unaff_RBX + 0xb8)) {

-      if (*(uint *)(unaff_RBX + 0xb8) != *(uint *)(unaff_RBX + 0xb4)) {

-        return 0;

-      }

-      if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-        return 0;

-      }

-      if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-        return 0;

-      }

-    }

-  }

-  lVar10 = *(longlong *)(unaff_RBX + 0xf8);

-  if ((*(uint *)(unaff_RBX + 0xf4) >> 0x19 & 1) == 0) {

-    if (*(short *)(*(int *)(lVar10 + 8) + lVar10) == 0x40) goto LAB_0;

-  }

-  else if (*(short *)(*(int *)(lVar10 + 8) + lVar10) != 0x40) goto LAB_0;

-  if ((*(uint *)(lVar10 + 0x30) & 0x3000010) == 0) {

-    if (((*(uint *)(unaff_RBX + 0xf4) & 4) == 0) &&

-       (iVar6 = MAPPER::bCalculateWishCell(unaff_RBX), iVar6 == 0)) goto LAB_0;

-    lVar10 = *(longlong *)(unaff_RBX + 0xf8);

-    if ((*(uint *)(unaff_RBX + 0xf4) & 2) == 0) {

-      iVar6 = (int)*(short *)(lVar10 + 0x3e) + (int)*(short *)(lVar10 + 0x3c);

-    }

-    else {

-      iVar6 = (int)*(short *)(lVar10 + 0x38);

-    }

-    iVar7 = *(int *)(unaff_RBX + 0xa4);

-    uVar8 = uVar26;

-    if (((iVar6 < iVar7) &&

-        ((*(uint *)(unaff_RBX + 0xf4) >> 0xf & 1) == 0 && (*(uint *)(lVar10 + 0x30) & 0x100000) != 0

-        )) && ((int)(iVar6 * 7 + (iVar6 * 7 >> 0x1f & 3U)) >> 2 < iVar7)) {

-      iVar7 = ((int)(iVar6 + (iVar6 >> 0x1f & 3U)) >> 2) + iVar7;

-      if (iVar6 == 0) {

-        return 0;

-      }

-      if ((iVar7 == -0x80000000) && (iVar6 == -1)) {

-        return 0;

-      }

-      uVar20 = iVar7 / iVar6;

-      if (8 < uVar20) {

-        uVar20 = 8;

-      }

-      *(uint *)(unaff_RBX + 0xc4) = uVar20;

-      if (1 < (int)uVar20) {

-        if (((*(uint *)(unaff_RBX + 0xf4) & 0x800) == 0) && (iVar6 <= (int)(uVar20 + 2))) {

-          return 0;

-        }

-        iVar6 = iVar6 * uVar20;

-        uVar8 = (uVar20 - 1) * 5 | uVar20 * 0x14;

-      }

-    }

-    else {

-      *(undefined4 *)(unaff_RBX + 0xc4) = 1;

-    }

-    iVar7 = *(int *)(unaff_RBX + 0xa4);

-    if (iVar7 < iVar6) {

-      iVar6 = iVar6 - iVar7;

-      if ((*(uint *)(unaff_RBX + 0xf4) & 0x1080) == 0x1080) {

-        if (1 < iVar6) {

-          uVar8 = uVar8 + (iVar6 + 0x14) * 0x96;

-        }

-      }

-      else {

-        uVar8 = uVar8 + (iVar6 + 4) * 0x96;

-      }

-    }

-    else {

-      uVar8 = uVar8 + (iVar7 - iVar6) * 0x96;

-    }

-    if (uVar8 != 0) {

-      uVar20 = *(int *)(unaff_RBX + 0xb8) + uVar8;

-      *(uint *)(unaff_RBX + 0xb8) = uVar20;

-      if (*(uint *)(unaff_RBX + 0xb4) <= uVar20) {

-        if (uVar20 != *(uint *)(unaff_RBX + 0xb4)) {

-          return 0;

-        }

-        if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-          return 0;

-        }

-        if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-          return 0;

-        }

-      }

-      if ((9999 < uVar8) && ((*(uint *)(unaff_RBX + 0xf4) & 0x4800) == 0)) {

-        return 0;

-      }

-    }

-  }

-  lVar10 = *(longlong *)unaff_RBX;

-  if (((*(char *)(lVar10 + 0x47) != cVar29) &&

-      (uVar5 = IFIOBJ::lfOutPrecision((IFIOBJ *)(unaff_RBX + 0xf8)), uVar5 == '\x06')) &&

-     ((*(uint *)(unaff_RBX + 0xf4) & 0x4000) == 0)) {

-    iVar6 = *(int *)(*(longlong *)(unaff_RBX + 0xf8) + 0x80);

-    piVar1 = (int *)(*(longlong *)(unaff_RBX + 0xf8) + 0x84);

-    if (((*(int *)(lVar10 + 0x34) != iVar6) || (*(int *)(lVar10 + 0x38) != *piVar1)) &&

-       (*(int *)(lVar10 + 0x34) * *piVar1 != iVar6 * *(int *)(lVar10 + 0x38))) goto LAB_0;

-  }

-  if (*(char *)(*(longlong *)(unaff_RBX + 8) + 0x14) == cVar29) {

-    if ((*(ushort *)(*(longlong *)(unaff_RBX + 0xf8) + 0x34) & 1) != 0) {

-      uVar8 = *(int *)(unaff_RBX + 0xb8) + 4;

-      *(uint *)(unaff_RBX + 0xb8) = uVar8;

-      if (*(uint *)(unaff_RBX + 0xb4) <= uVar8) {

-        if (uVar8 != *(uint *)(unaff_RBX + 0xb4)) {

-          return 0;

-        }

-        if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-          return 0;

-        }

-        if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-          return 0;

-        }

-      }

-    }

-  }

-  else if ((*(ushort *)(*(longlong *)(unaff_RBX + 0xf8) + 0x34) & 1) == 0) {

-    iVar6 = IFIOBJ::bSimItalic((IFIOBJ *)(unaff_RBX + 0xf8));

-    if (iVar6 == 0) {

-      iVar6 = 4;

-    }

-    else {

-      *(uint *)(unaff_RBX + 0xbc) = *(uint *)(unaff_RBX + 0xbc) | 0x4000;

-      iVar6 = 1;

-    }

-    uVar8 = iVar6 + *(int *)(unaff_RBX + 0xb8);

-    *(uint *)(unaff_RBX + 0xb8) = uVar8;

-    if (*(uint *)(unaff_RBX + 0xb4) <= uVar8) {

-      if (uVar8 != *(uint *)(unaff_RBX + 0xb4)) {

-        return 0;

-      }

-      if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-        return 0;

-      }

-      if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-        return 0;

-      }

-    }

-  }

-  uVar8 = *(uint *)(unaff_RBX + 0xf4);

-  iVar6 = (uint)*(ushort *)(*(longlong *)(unaff_RBX + 0xf8) + 0x2e) - *(int *)(unaff_RBX + 0xac);

-  if ((uVar8 >> 0x15 & 1) == 0) {

-    if (iVar6 != 0) {

-      if (((iVar6 < 0) && (iVar6 = -iVar6, 0x96 < iVar6)) &&

-         (pvVar15 = IFIOBJ::pvSimBold((IFIOBJ *)(unaff_RBX + 0xf8)), pvVar15 != (void *)0x0)) {

-        *(uint *)(unaff_RBX + 0xbc) = *(uint *)(unaff_RBX + 0xbc) | 0x2000;

-        iVar6 = iVar6 + -0x78;

-      }

-      uVar20 = (iVar6 * 0x49 >> 8) + *(int *)(unaff_RBX + 0xb8);

-      *(uint *)(unaff_RBX + 0xb8) = uVar20;

-      if (*(uint *)(unaff_RBX + 0xb4) <= uVar20) {

-        if (uVar20 != *(uint *)(unaff_RBX + 0xb4)) {

-          return 0;

-        }

-        if ((uVar8 & 0x1000080) != 0) {

-          return 0;

-        }

-        if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-          return 0;

-        }

-      }

-    }

-  }

-  else {

-    iVar7 = -iVar6;

-    if (-iVar6 < 0) {

-      iVar7 = iVar6;

-    }

-    uVar20 = (iVar7 * 0x13 >> 7) + *(int *)(unaff_RBX + 0xb8);

-    *(uint *)(unaff_RBX + 0xb8) = uVar20;

-    if (*(uint *)(unaff_RBX + 0xb4) <= uVar20) {

-      if (uVar20 != *(uint *)(unaff_RBX + 0xb4)) {

-        return 0;

-      }

-      if ((uVar8 & 0x1000080) != 0) {

-        return 0;

-      }

-      if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-        return 0;

-      }

-    }

-  }

-  if ((char)uVar8 < '\0') {

-LAB_8:

-    if (*(char *)(*(longlong *)(unaff_RBX + 8) + 0x18) != '\t') goto LAB_9;

-LAB_10:

-    if (((char)*(uint *)(unaff_RBX + 0xf4) < '\0') ||

-       ((uVar8 = *(uint *)(*(longlong *)(unaff_RBX + 0xf8) + 0x30), (uVar8 & 1) == 0 &&

-        ((((uVar8 & 2) != 0 || ((uVar8 & 4) != 0)) || ((uVar8 & 8) == 0)))))) {

-      uVar8 = *(int *)(unaff_RBX + 0xb8) + 2;

-      *(uint *)(unaff_RBX + 0xb8) = uVar8;

-      if (*(uint *)(unaff_RBX + 0xb4) <= uVar8) {

-        if (uVar8 != *(uint *)(unaff_RBX + 0xb4)) {

-          return 0;

-        }

-        if ((*(uint *)(unaff_RBX + 0xf4) & 0x1000080) != 0) {

-          return 0;

-        }

-        if (*(uint *)(unaff_RBX + 0xd0) <= *(uint *)(in_stack_00000070 + 0x50)) {

-          return 0;

-        }

-      }

-    }

-  }

-  else {

-    uVar20 = *(uint *)(*(longlong *)(unaff_RBX + 0xf8) + 0x30);

-    if ((((uVar20 & 1) == 0) && ((uVar20 & 2) != 0)) &&

-       ((((uVar8 >> 0x10 & 1) != 0 ||

-         (lVar10 = *(longlong *)unaff_RBX, *(char *)(lVar10 + 0x46) != cVar29)) ||

-        ((((uVar8 >> 8 & 1) == 0 || (*(int *)(lVar10 + 0x34) != *(int *)(lVar10 + 0x38))) &&

-         ((uVar20 >> 0x1e & 1) == 0)))))) goto LAB_0;

-    if (*(char *)(*(longlong *)(unaff_RBX + 8) + 0x18) == '\a') {

-      uVar5 = IFIOBJ::lfOutPrecision((IFIOBJ *)(unaff_RBX + 0xf8));

-      if (uVar5 != '\b') goto LAB_0;

-    }

-    else {

-      if (*(char *)(*(longlong *)(unaff_RBX + 8) + 0x18) != '\n') goto LAB_8;

-      if ((int)uVar26 <= *(int *)(*(longlong *)(unaff_RBX + 0xf8) + 0x30)) goto LAB_0;

-    }

-LAB_9:

-    pSVar13 = Gre::Base::Globals();

-    if (((*(uint *)(*(longlong *)(pSVar13 + 0x6e8) + 0x180094) != uVar26) &&

-        (((*(char *)(*(longlong *)(unaff_RBX + 8) + 0x18) - 5U & 0xfa) != 0 ||

-         (*(char *)(*(longlong *)(unaff_RBX + 8) + 0x18) == '\t')))) ||

-       (*(char *)(*(longlong *)unaff_RBX + 0x45) != cVar29)) goto LAB_10;

-  }

-  lVar10 = *(longlong *)(unaff_RBX + 0xf8);

-  if ((*(uint *)(lVar10 + 0x30) & 0x2000010) == 0) {

-    sVar3 = *(short *)(lVar10 + 0x4c);

-    iVar6 = (int)sVar3;

-    *(undefined4 *)(unaff_RBX + 0xc0) = 1;

-    if (*(uint *)(*(longlong *)(unaff_RBX + 8) + 4) == uVar26) {

-      if ((*(uint *)(lVar10 + 0x30) & 0x100000) == 0 || (*(uint *)(unaff_RBX + 0xf4) & 0x8000) != 0)

-      goto LAB_11;

-      uVar8 = *(uint *)(*(longlong *)unaff_RBX + 0x34);

-      if (uVar8 == 0) {

-        return 0;

-      }

-      uVar17 = (ulonglong)(uint)(*(int *)(*(longlong *)unaff_RBX + 0x38) * 100) / (ulonglong)uVar8;

-      iVar6 = *(int *)(lVar10 + 0x84);

-      iVar7 = *(int *)(lVar10 + 0x80) * 100;

-      if (iVar6 == 0) {

-        return 0;

-      }

-      if ((iVar7 == -0x80000000) && (iVar6 == -1)) {

-        return 0;

-      }

-      uVar8 = *(uint *)(unaff_RBX + 0xc4);

-      uVar4 = (longlong)iVar7 / (longlong)iVar6;

-      iVar7 = (int)uVar4;

-      if (uVar8 == 0) {

-        return 0;

-      }

-      if ((iVar7 == -0x80000000) && (uVar8 == 0xffffffff)) {

-        return 0;

-      }

-      uVar4 = (longlong)((ulonglong)(uint)(iVar7 >> 0x1f) << 0x20 | uVar4 & 0xffffffff) /

-              (longlong)(int)uVar8;

-      uVar20 = (uint)uVar17;

-      if ((*(int *)(lVar10 + 0x80) == iVar6) &&

-         (*(int *)(*(longlong *)unaff_RBX + 0x34) == *(int *)(*(longlong *)unaff_RBX + 0x38))) {

-        uVar26 = 1;

-        if (uVar8 == 1) goto LAB_11;

-LAB_12:

-        if (5 < uVar8) {

-          uVar8 = 5;

-        }

-        *(uint *)(unaff_RBX + 0xc0) = uVar8;

-        unaff_R12 = (ulonglong)(uVar8 * 0x14);

-      }

-      else {

-        iVar6 = (int)uVar4;

-        if ((uint)(iVar6 * 3) >> 1 < uVar20) {

-          if (iVar6 == 0) goto LAB_0;

-          uVar8 = (uint)(uVar17 / (uVar4 & 0xffffffff));

-          goto LAB_12;

-        }

-      }

-      iVar6 = (int)unaff_R12;

-      if ((uVar26 == 0) || (*(int *)(unaff_RBX + 0xc0) != *(int *)(unaff_RBX + 0xc4))) {

-        if (*(uint *)(unaff_RBX + 0xc4) == 0) goto LAB_0;

-        iVar21 = uVar20 - (uint)(iVar7 * *(int *)(unaff_RBX + 0xc0)) / *(uint *)(unaff_RBX + 0xc4);

-        iVar7 = -iVar21;

-        if (iVar7 < 0) {

-          iVar7 = iVar21;

-        }

-        iVar6 = iVar6 + iVar7 * 0x1e;

-      }

-    }

-    else {

-      if (((*(uint *)(unaff_RBX + 0xf4) & 4) == 0) &&

-         (iVar7 = MAPPER::bCalculateWishCell(unaff_RBX), iVar7 == 0)) goto LAB_0;

-      lVar10 = *(longlong *)(unaff_RBX + 0xf8);

-      if (((*(uint *)(lVar10 + 0x30) >> 0x14 & 1) == 0 ||

-           (*(uint *)(unaff_RBX + 0xf4) & 0x8000) != 0) || (*(int *)(unaff_RBX + 0xa8) <= iVar6)) {

-        if ((*(uint *)(lVar10 + 0x30) >> 0x18 & 1) != 0) {

-          iVar7 = (int)*(short *)(lVar10 + 0x3e) + (int)*(short *)(lVar10 + 0x3c);

-          if (iVar7 == 0) {

-            return 0;

-          }

-          if ((iVar6 * *(int *)(unaff_RBX + 0xa4) == -0x80000000) && (iVar7 == -1)) {

-            return 0;

-          }

-          iVar6 = (iVar6 * *(int *)(unaff_RBX + 0xa4)) / iVar7;

-        }

-      }

-      else {

-        iVar7 = *(int *)(unaff_RBX + 0xa8) - (iVar6 + 1) / 2;

-        if (sVar3 == 0) {

-          return 0;

-        }

-        if ((iVar7 == -0x80000000) && (iVar6 == -1)) {

-          return 0;

-        }

-        uVar8 = iVar7 / iVar6 + 1;

-        if (5 < uVar8) {

-          uVar8 = 5;

-        }

-        *(uint *)(unaff_RBX + 0xc0) = uVar8;

-      }

-      iVar7 = *(int *)(unaff_RBX + 0xc0);

-      if (1 < iVar7) {

-        iVar6 = iVar6 * iVar7;

-        unaff_R12 = (ulonglong)(iVar7 * 0x14 | iVar7 - 1U);

-      }

-      iVar7 = *(int *)(unaff_RBX + 0xa8) - iVar6;

-      iVar6 = iVar6 - *(int *)(unaff_RBX + 0xa8);

-      if (-1 < iVar7) {

-        iVar6 = iVar7;

-      }

-      iVar6 = (int)unaff_R12 + iVar6 * 0x32;

-    }

-    if (iVar6 != 0) {

-      *(int *)(unaff_RBX + 0xb8) = *(int *)(unaff_RBX + 0xb8) + iVar6;

-      iVar6 = MAPPER::bNoMatch(unaff_RBX,in_stack_00000070);

-      if (iVar6 != 0) {

-        return 0;

-      }

-    }

-  }

-LAB_11:

-  iVar6 = *(int *)(unaff_RBX + 0xc0);

-  if ((1 < iVar6) || (1 < *(int *)(unaff_RBX + 0xc4))) {

-    iVar7 = *(int *)(unaff_RBX + 0xb8);

-    iVar21 = *(int *)(unaff_RBX + 0xc4);

-    *(int *)(unaff_RBX + 0xb8) = iVar7 + 0x32;

-    if (iVar21 < iVar6) {

-      if (iVar21 == 0) goto LAB_0;

-      iVar28 = iVar6 * 100;

-      if (iVar21 != 1) {

-        iVar28 = (iVar21 / 2 + iVar28) / iVar21;

-      }

-LAB_13:

-      *(int *)(unaff_RBX + 0xb8) = iVar7 + 0x32 + iVar28 * 4;

-    }

-    else if (iVar6 < iVar21) {

-      if (iVar6 == 0) goto LAB_0;

-      iVar28 = iVar21 * 100;

-      if (iVar6 != 1) {

-        iVar28 = (iVar6 / 2 + iVar28) / iVar6;

-      }

-      goto LAB_13;

-    }

-    iVar6 = MAPPER::bNoMatch(unaff_RBX,in_stack_00000070);

-    if (iVar6 != 0) {

-      return 0;

-    }

-  }

-  if (((*(uint *)(*(longlong *)(unaff_RBX + 0xf8) + 0x30) & 0x10) == 0) &&

-     ((*(uint *)(unaff_RBX + 0xf4) & 0x41000) != 0x41000)) {

-    if (((*(uint *)(unaff_RBX + 0xf4) >> 0x13 & 1) == 0) &&

-       (iVar6 = MAPPER::bCalcOrientation(unaff_RBX), iVar6 == 0)) goto LAB_0;

-    uVar8 = *(uint *)(unaff_RBX + 0xb0);

-    uVar26 = uVar8 - *(int *)(*(longlong *)unaff_R14 + 0x44);

-    if (uVar26 != 0) {

-      if ((*(uint *)(unaff_RBX + 0xf4) & 0x480) == 0x480) {

-        if (uVar8 < uVar26) {

-          uVar26 = -uVar26;

-        }

-        uVar26 = uVar26 % 900;

-        if (uVar26 == 0) goto LAB_14;

-      }

-      if ((*(uint *)(*(longlong *)(unaff_RBX + 0xf8) + 0x30) & 0x200000) == 0) goto LAB_0;

-      uVar20 = -uVar26;

-      if (uVar26 <= uVar8) {

-        uVar20 = uVar26;

-      }

-      if (uVar20 != (uVar20 / 900) * 900) goto LAB_0;

-    }

-  }

-LAB_14:

-  uVar8 = *(uint *)(unaff_RBX + 0xf4);

-  if ((uVar8 >> 0x16 & 1) != 0) {

-    *(int *)(unaff_RBX + 0xb8) = *(int *)(unaff_RBX + 0xb8) + 1;

-    iVar6 = MAPPER::bNoMatch(unaff_RBX,in_stack_00000070);

-    if (iVar6 != 0) {

-      return 0;

-    }

-  }

-  if ((int)uVar8 < 0) {

-    pMVar27 = unaff_RBX + 100;

-    pMVar12 = unaff_RBX + 0x60;

-  }

-  else {

-    pMVar27 = (MAPPER *)(*(longlong *)(unaff_RBX + 8) + 0x164);

-    pMVar12 = (MAPPER *)(*(longlong *)(unaff_RBX + 8) + 0x160);

-  }

-  if (*(uint *)pMVar12 == 0) {

-    return 1;

-  }

-  lVar10 = *(longlong *)(unaff_RBX + 0xf8);

-  if (((0xf < *(uint *)(lVar10 + 4)) && (*(int *)(lVar10 + 0xcc) != 0)) &&

-     (lVar10 = *(int *)(lVar10 + 0xcc) + lVar10, lVar10 != 0)) {

-    if (((*(uint *)(lVar10 + 4) != 0) && (*(uint *)pMVar12 == *(uint *)(lVar10 + 4))) &&

-       (*(uint *)(unaff_RBX + 0xb8) < 0x88b9)) {

-      *(PFE **)(unaff_RBX + 0x118) = in_stack_00000070;

-    }

-    if ((*(uint *)pMVar12 == *(uint *)(lVar10 + 4)) &&

-       (iVar6 = memcmp(pMVar27,(void *)(lVar10 + 8),(ulonglong)*(uint *)(lVar10 + 4) << 2),

-       iVar6 == 0)) {

-      return 1;

-    }

-  }

-LAB_0:

-  *(undefined4 *)(unaff_RBX + 0xb8) = 0xfffffffe;

-  return 0;

+  puVar5 = (undefined1 *)zzzSetDesktop(ptVar4,param_2,param_1);

+  return puVar5;

 }
```

## `zzzRecalcThreadAttachment`  (modified)

```diff
--- zzzRecalcThreadAttachment
+++ zzzRecalcThreadAttachment
@@ -1,10 +1,42 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* void __cdecl zzzRecalcThreadAttachment(void) */

 

 void __cdecl zzzRecalcThreadAttachment(void)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  _LIST_ENTRY *p_Var1;

+  bool bVar2;

+  int iVar3;

+  _LIST_ENTRY *p_Var4;

+  tagTHREADINFO *this;

+  tagQ *this_00;

+  

+  p_Var4 = GetRecalcHeadPtiListEntry();

+  p_Var1 = *(_LIST_ENTRY **)p_Var4;

+  do {

+    if (p_Var1 == p_Var4) {

+      return;

+    }

+    this = GetRecalcPtiFromListEntry(p_Var1);

+    if ((this != (tagTHREADINFO *)0x0) && (*(longlong *)(this + 0x2b8) == 0)) {

+      this_00 = *(tagQ **)(this + 0x1d8);

+      bVar2 = tagQ::AreMultipleThreadsAttached(this_00);

+      if (bVar2) {

+        iVar3 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+        if (iVar3 == 0) {

+          this_00 = (tagQ *)AllocQueue(0,0);

+        }

+        else {

+          this_00 = tagQ::Alloc(this);

+        }

+        if (this_00 == (tagQ *)0x0) {

+          return;

+        }

+      }

+      tagTHREADINFO::AssignAttachQueue(this,this_00);

+      zzzRecalc2(*(tagQ **)(this + 0x2b8));

+    }

+    p_Var1 = *(_LIST_ENTRY **)p_Var1;

+  } while( true );

 }
```

## `xxxDrawMenuBarUnderlines`  (modified)

```diff
--- xxxDrawMenuBarUnderlines
+++ xxxDrawMenuBarUnderlines
@@ -1,11 +1,271 @@
 

-void xxxDrawMenuBarUnderlines(void)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+

+void xxxDrawMenuBarUnderlines(undefined8 param_1,int param_2)

 

 {

-  code *pcVar1;

+  uint *puVar1;

+  __uint64 _Var2;

+  bool bVar3;

+  char cVar4;

+  ushort uVar5;

+  int iVar6;

+  int iVar7;

+  undefined4 uVar8;

+  tagITEM *hDC;

+  longlong lVar9;

+  ulonglong uVar10;

+  HWND hWnd;

+  HDC hWnd_00;

+  ushort *puVar11;

+  tagITEM *ptVar12;

+  tagMENU *ptVar13;

+  undefined4 uVar14;

+  uint uVar15;

+  undefined8 uVar16;

+  tagTHREADINFO *ptVar17;

+  tagMENU *ptVar18;

+  int iVar19;

+  uint uVar20;

+  undefined1 auStackY_308 [32];

+  longlong *local_2c8 [2];

+  tagMENU *local_2b8;

+  int local_2b0;

+  uint local_2ac;

+  tagTHREADINFO *local_2a8;

+  undefined8 local_2a0;

+  HWND local_298;

+  undefined8 local_290;

+  undefined8 local_288;

+  undefined8 uStack_280;

+  longlong local_278;

+  tagTHREADINFO *local_270;

+  Win32HMThreadLockAlwaysMenuNoModify local_268 [32];

+  undefined8 local_248;

+  ushort local_238 [256];

+  ulonglong local_38;

   

-  pcVar1 = (code *)swi(3);

-  (*pcVar1)();

+  local_38 = __security_cookie ^ (ulonglong)auStackY_308;

+  local_2b0 = param_2;

+  SmartObjStackRef<tagMENU>::SmartObjStackRef<tagMENU>((SmartObjStackRef<tagMENU> *)local_2c8);

+  hDC = (tagITEM *)PtiCurrent();

+  local_290 = 0;

+  local_270 = (tagTHREADINFO *)hDC;

+  lVar9 = W32GetUserSessionState();

+  if ((((((*(uint *)(lVar9 + 0x10650) & 0x20000) == 0) &&

+        (lVar9 = W32GetUserSessionState(), (*(uint *)(lVar9 + 0x10654) & 0x20) == 0)) &&

+       (lVar9 = W32GetUserSessionState(), *(int *)(lVar9 + 0x10654) < 0)) &&

+      ((uVar10 = GetAppCompatFlags2(0x400), (uVar10 & 2) == 0 &&

+       (hWnd = (HWND)GetNonChildAncestor(param_1), local_298 = hWnd, hWnd != (HWND)0x0)))) &&

+     ((*(byte *)(*(longlong *)(hWnd + 10) + 0x10) & 1) != 0)) {

+    ptVar13 = *(tagMENU **)(hWnd + 0x2a);

+    local_2b8 = (tagMENU *)0x0;

+    SmartObjStackRefBase<tagMENU>::operator=((SmartObjStackRefBase<tagMENU> *)local_2c8,ptVar13);

+    bVar3 = SmartObjStackRef<tagMENU>::operator==

+                      ((SmartObjStackRef<tagMENU> *)local_2c8,(int)ptVar13);

+    if (!bVar3) {

+      iVar6 = MNIsFlatMenu();

+      if (iVar6 == 0) {

+        uVar20 = 0;

+      }

+      else {

+        uVar20 = ~*(uint *)(*(longlong *)(*local_2c8[0] + 0x28) + 0x28) & 1;

+      }

+      uVar15 = *(uint *)(*(longlong *)(*local_2c8[0] + 0x28) + 0x28);

+      if (param_2 == 0) {

+        if ((uVar15 & 4) == 0) goto LAB_0;

+        if (*(longlong *)(*(longlong *)(*local_2c8[0] + 0x28) + 0x18) == 0) {

+          lVar9 = W32GetUserSessionState();

+          if (uVar20 == 0) {

+            uVar16 = *(undefined8 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1278);

+          }

+          else {

+            uVar16 = *(undefined8 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1348);

+          }

+        }

+        else {

+          uVar16 = *(undefined8 *)(*(longlong *)(*local_2c8[0] + 0x28) + 0x18);

+        }

+        puVar1 = (uint *)(*(longlong *)(*local_2c8[0] + 0x28) + 0x28);

+        *puVar1 = *puVar1 & 0xfffffffb;

+      }

+      else {

+        if ((uVar15 & 4) != 0) goto LAB_0;

+        lVar9 = W32GetUserSessionState();

+        uVar16 = *(undefined8 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1290);

+        puVar1 = (uint *)(*(longlong *)(*local_2c8[0] + 0x28) + 0x28);

+        *puVar1 = *puVar1 | 4;

+      }

+      ptVar12 = *(tagITEM **)(*local_2c8[0] + 0x58);

+      local_2a0 = uVar16;

+      hWnd_00 = _GetDCEx(hWnd,(HRGN)0x0,0x10003);

+      ptVar13 = local_2b8;

+      if (local_2b8 == (tagMENU *)0x0) {

+        ptVar13 = (tagMENU *)*local_2c8[0];

+      }

+      Win32HMThreadLockAlwaysMenuNoModify::Win32HMThreadLockAlwaysMenuNoModify

+                (local_268,(tagTHREADINFO *)hDC,ptVar13);

+      local_2ac = 0;

+      if (*(int *)(*(longlong *)(*local_2c8[0] + 0x28) + 0x2c) != 0) {

+        do {

+          ptVar13 = local_2b8;

+          if (local_2b8 == (tagMENU *)0x0) {

+            ptVar13 = (tagMENU *)*local_2c8[0];

+          }

+          hDC = ptVar12;

+          ptVar18 = local_2b8;

+          cVar4 = MNIspItemValid(ptVar13);

+          if (cVar4 == '\0') break;

+          if (ptVar18 == (tagMENU *)0x0) {

+            ptVar18 = (tagMENU *)*local_2c8[0];

+          }

+          iVar6 = MNIsOwnerDrawItem(ptVar18,ptVar12);

+          _Var2 = *(__uint64 *)(ptVar12 + 0x58);

+          local_2a8 = *(tagTHREADINFO **)(ptVar12 + 0x18);

+          if ((local_2a8 != (tagTHREADINFO *)0x0) || (iVar6 != 0)) {

+            if (iVar6 == 0) {

+              lVar9 = GetDpiMetricsForCurrentThread();

+              GreSelectFont(hWnd_00,*(undefined8 *)(lVar9 + 8));

+              uVar8 = *(undefined4 *)(*(longlong *)ptVar12 + 0x44);

+              uVar14 = *(undefined4 *)(*(longlong *)ptVar12 + 0x40);

+            }

+            else {

+              lVar9 = GetDpiMetricsForWindow(hWnd);

+              GreSelectFont(hWnd_00,*(undefined8 *)(lVar9 + 8));

+              uVar8 = 0;

+              uVar14 = 0;

+            }

+            GreSetViewportOrg(hWnd_00,uVar14,uVar8);

+            if ((local_2b0 != 0) && ((*(uint *)(*(longlong *)ptVar12 + 4) & 0x100) != 0)) {

+              lVar9 = W32GetUserSessionState();

+              uVar16 = *(undefined8 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1328);

+            }

+            GreSelectBrush(hWnd_00,uVar16);

+            if (iVar6 == 0) {

+              lVar9 = GetDpiMetricsForCurrentThread();

+              ptVar17 = local_2a8;

+              puVar1 = *(uint **)ptVar12;

+              iVar6 = *(int *)(lVar9 + 0x1c);

+              uVar15 = ((puVar1[0x13] - *(int *)(lVar9 + 0x14)) - iVar6) - 1;

+              if (uVar15 != 0) {

+                iVar6 = iVar6 + (uVar15 >> 1);

+              }

+              iVar19 = *(int *)(lVar9 + 0x10);

+              if ((*puVar1 & 0x2000) != 0) {

+                xxxPSMGetTextExtent(hWnd_00,local_2a8,puVar1[0xc],&local_290);

+                ptVar13 = local_2b8;

+                if (local_2b8 == (tagMENU *)0x0) {

+                  ptVar13 = (tagMENU *)*local_2c8[0];

+                }

+                hDC = ptVar12;

+                cVar4 = MNIspItemValid(ptVar13);

+                if (cVar4 == '\0') break;

+                iVar7 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+                if (iVar7 == 0) {

+                  if (_Var2 != *(__uint64 *)(ptVar12 + 0x58)) break;

+                }

+                else {

+                  bVar3 = MNIspItemStringUnchanged(ptVar12,(ushort *)ptVar17,_Var2);

+                  hDC = (tagITEM *)ptVar17;

+                  if (!bVar3) break;

+                }

+                iVar7 = *(int *)(*(longlong *)ptVar12 + 0x48);

+                lVar9 = GetOemBitmapInfoForCurrentThread(0x3f);

+                iVar19 = iVar19 + -2 + ((iVar7 - *(short *)(lVar9 + 4)) - (int)local_290);

+              }

+              iVar7 = CALL_LPK(local_270);

+              if (iVar7 == 0) {

+                local_248 = 0;

+                local_288 = 0;

+                uStack_280 = 0;

+                local_278 = -1;

+                if (*(uint *)(*(longlong *)ptVar12 + 0x30) < 0xff) {

+                  puVar11 = local_238;

+                }

+                else {

+                  hDC = (tagITEM *)0x74727355;

+                  puVar11 = (ushort *)

+                            Win32AllocPoolZInit((ulonglong)

+                                                (*(uint *)(*(longlong *)ptVar12 + 0x30) + 1) * 2);

+                  if (puVar11 == (ushort *)0x0) {

+                    if (local_278 != -1) {

+                      PopAndFreeW32ThreadLock(&local_288);

+                    }

+                    break;

+                  }

+                  Win32RawLockedItemBase<void,0,0,1,1>::ManualLock<void>

+                            ((Win32RawLockedItemBase<void,0,0,1,1> *)&local_288,puVar11,

+                             Win32FreePool_exref);

+                }

+                uVar5 = GetPrefixCount(local_2a8,*(undefined4 *)(*(longlong *)ptVar12 + 0x30),

+                                       puVar11,*(undefined4 *)(*(longlong *)ptVar12 + 0x30));

+                xxxDrawItemUnderline

+                          ((SmartObjStackRef<tagMENU> *)local_2c8,ptVar12,hWnd_00,iVar19,iVar6,

+                           puVar11,(uint)uVar5);

+                hWnd = local_298;

+                if (local_278 != -1) {

+                  PopAndFreeW32ThreadLock(&local_288);

+                  hWnd = local_298;

+                }

+              }

+              else {

+                lVar9 = W32GetUserSessionState();

+                lVar9 = *(longlong *)(lVar9 + 0x4e30);

+                if (local_2b0 == 0) {

+                  if (uVar20 == 0) {

+                    uVar8 = *(undefined4 *)(lVar9 + 0x11e8);

+                  }

+                  else {

+                    uVar8 = *(undefined4 *)(lVar9 + 0x1250);

+                  }

+                }

+                else {

+                  uVar8 = *(undefined4 *)(lVar9 + 0x11f4);

+                }

+                uVar8 = GreSetTextColor(hWnd_00,uVar8);

+                xxxPSMTextOut(hWnd_00,iVar19,iVar6,local_2a8);

+                ptVar13 = local_2b8;

+                if (local_2b8 == (tagMENU *)0x0) {

+                  ptVar13 = (tagMENU *)*local_2c8[0];

+                }

+                hDC = ptVar12;

+                cVar4 = MNIspItemValid(ptVar13);

+                if (cVar4 == '\0') break;

+                iVar6 = Feature_2699007288__private_IsEnabledDeviceUsageNoInline();

+                if (iVar6 == 0) {

+                  if (_Var2 != *(__uint64 *)(ptVar12 + 0x58)) break;

+                }

+                else {

+                  hDC = (tagITEM *)local_2a8;

+                  bVar3 = MNIspItemStringUnchanged(ptVar12,(ushort *)local_2a8,_Var2);

+                  if (!bVar3) break;

+                }

+                GreSetTextColor(hWnd_00,uVar8);

+                hWnd = local_298;

+              }

+            }

+            else {

+              xxxSendMenuDrawItemMessage

+                        (hWnd_00,1,(SmartObjStackRef<tagMENU> *)local_2c8,ptVar12,0,0,(tagWND *)0x0)

+              ;

+            }

+          }

+          local_2ac = local_2ac + 1;

+          hDC = (tagITEM *)(ulonglong)local_2ac;

+          ptVar13 = local_2b8;

+          if (local_2b8 == (tagMENU *)0x0) {

+            ptVar13 = (tagMENU *)*local_2c8[0];

+          }

+          ptVar12 = (tagITEM *)MNGetpItemFromIndex(ptVar13);

+          uVar16 = local_2a0;

+        } while ((uint)hDC < *(uint *)(*(longlong *)(*local_2c8[0] + 0x28) + 0x2c));

+      }

+      _ReleaseDC((HWND)hWnd_00,(HDC)hDC);

+      Win32HMThreadLockAlwaysMenuNoModify::~Win32HMThreadLockAlwaysMenuNoModify(local_268);

+    }

+  }

+LAB_0:

+  SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>((SmartObjStackRef<tagMENU> *)local_2c8);

   return;

 }
```

## `xxxBroadcastMessageEx`  (modified)

```diff
--- xxxBroadcastMessageEx
+++ xxxBroadcastMessageEx
@@ -1,218 +1,400 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

-

-void xxxBroadcastMessageEx(char *param_1)

+undefined8

+xxxBroadcastMessageEx

+          (tagWND *param_1,uint param_2,_LARGE_STRING *param_3,_LARGE_STRING *param_4,uint param_5,

+          tagBROADCASTMSG *param_6,int param_7,uint param_8)

 

 {

-  int iVar1;

-  int iVar2;

-  char *in_RAX;

-  SESSION_GLOBALS *pSVar3;

+  uint *puVar1;

+  tagWND *ptVar2;

+  int iVar3;

   uint uVar4;

   uint uVar5;

-  uint uVar6;

-  longlong unaff_RBX;

+  undefined4 uVar6;

   int iVar7;

-  XLATE *unaff_RDI;

-  uint uVar8;

-  SURFACE *pSVar9;

-  uint uVar10;

-  undefined4 unaff_R12D;

-  code *pcVar11;

-  uint uVar12;

-  uint unaff_R14D;

-  uint *unaff_R15;

-  uint *puVar13;

-  int in_stack_00000060;

-  uint uStack000000000000006c;

-  undefined8 in_stack_00000070;

-  SURFACE *in_stack_00000078;

-  longlong in_stack_00000080;

-  uint *in_stack_00000088;

-  int iStack0000000000000090;

-  uint uStack00000000000000b0;

-  int iStack00000000000000c8;

-  uint uStack00000000000000cc;

-  code *in_stack_000000d0;

-  uint *in_stack_000000d8;

-  _POINTL *in_stack_000000e8;

-  _BRUSHOBJ *in_stack_000000f0;

-  char *pcStack00000000000000f8;

-  undefined8 in_stack_00000100;

-  code *in_stack_00000108;

-  code *in_stack_00000110;

-  uint uStack0000000000000118;

-  uint uStack000000000000011c;

-  uint uStack0000000000000120;

-  uint uStack0000000000000124;

-  int iStack00000000000001b8;

-  int iStack00000000000001bc;

-  longlong in_stack_000001d0;

-  int in_stack_000001d8;

-  undefined4 uStack00000000000001e0;

-  undefined2 uStack00000000000001e4;

-  int in_stack_000004d8;

-  int in_stack_000004e0;

+  longlong lVar8;

+  longlong lVar9;

+  undefined8 *puVar10;

+  longlong *plVar11;

+  tagTHREADINFO *ptVar12;

+  _LARGE_STRING *p_Var13;

+  char cVar14;

+  uint uVar15;

+  undefined7 uVar16;

+  ulonglong uVar17;

+  char cVar18;

+  ushort uVar19;

+  undefined8 uVar20;

+  _LARGE_STRING *in_stack_ffffffffffffff08;

+  undefined8 uVar21;

+  _LARGE_STRING *in_stack_ffffffffffffff10;

+  uint uVar22;

+  undefined4 uVar23;

+  undefined8 in_stack_ffffffffffffff30;

+  undefined4 uVar24;

+  longlong *local_b0;

+  ulonglong *local_a0;

+  undefined8 local_98;

+  undefined8 uStack_90;

+  longlong local_88;

+  tagTHREADINFO *local_80;

+  longlong local_78;

+  undefined8 local_70;

+  void *pvStack_68;

+  short local_60 [8];

+  undefined8 local_50;

+  tagWND *local_48;

+  undefined8 local_30;

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  pcStack00000000000000f8 = in_RAX;

-  if (param_1 != (char *)0x0) {

-    pcStack00000000000000f8 = param_1;

+  local_80 = PtiCurrent();

+  if (param_2 - 0x400 < 0xbc00) {

+    UserSetLastError(0x57);

+    return 1;

   }

-  uStack000000000000006c = unaff_R14D & 0x20;

-  if ((unaff_R14D & 8) == 0) {

-    uStack00000000000000b0 = 0x1f;

+  if ((param_7 == 0) &&

+     ((((((param_2 == 0x15 || (param_2 == 0x1a)) || (param_2 == 0x1d)) ||

+        ((param_2 == 0x127 || (param_2 == 0x31a)))) || (param_2 == 0x324)) || (param_2 == 0x325))))

+  {

+    param_7 = 1;

   }

-  else {

-    uStack00000000000000b0 = (-(uint)(uStack000000000000006c != 0) & 0xfffffffc) + 7;

+  if (param_1 == (tagWND *)0x0) {

+    local_70 = 0;

+    pvStack_68 = (void *)0x0;

+    if ((param_2 == 0x1a) || (param_2 == 0x1b)) {

+      local_30 = 0;

+      local_98 = 0;

+      uStack_90 = 0;

+      local_88 = -1;

+      puVar10 = (undefined8 *)0x0;

+      if (param_4 != (_LARGE_STRING *)0x0) {

+        iVar3 = CaptureBroadcastString((_LARGE_UNICODE_STRING *)&local_70,param_4);

+        if (iVar3 == 0) {

+          if (local_88 == -1) {

+            return 0;

+          }

+          PopAndFreeW32ThreadLock(&local_98);

+          return 0;

+        }

+        Win32RawLockedItemBase<void,0,0,1,1>::ManualLock<void>

+                  ((Win32RawLockedItemBase<void,0,0,1,1> *)&local_98,pvStack_68,Win32FreePool_exref)

+        ;

+        puVar10 = &local_70;

+      }

+      xxxSystemBroadcastMessage

+                (param_2,(__uint64)param_3,(__int64)puVar10,param_5,param_6,param_7,param_8);

+      if (local_88 == -1) {

+        return 1;

+      }

+      PopAndFreeW32ThreadLock(&local_98);

+      return 1;

+    }

+    if (param_2 == 0x1e) {

+      LOCK();

+      uVar4 = *(uint *)(local_80 + 0x210);

+      if (uVar4 == 0) {

+        *(uint *)(local_80 + 0x210) = 0;

+        uVar4 = 0;

+      }

+      UNLOCK();

+      if ((uVar4 & 4) == 0) {

+        return 0;

+      }

+    }

+    else {

+      if (param_2 == 0x2a) {

+        param_2 = 0x2a;

+LAB_0:

+        xxxSystemBroadcastMessage

+                  (param_2,(__uint64)param_3,(__int64)param_4,param_5,param_6,param_7,param_8);

+        return 1;

+      }

+      if ((param_2 == 0x2c8) || (param_2 == 0x2c9)) goto LAB_0;

+    }

+    param_1 = *(tagWND **)(*(longlong *)(*(longlong *)(local_80 + 0x1f0) + 8) + 0x18);

+    if (param_1 == (tagWND *)0x0) {

+      UserSetLastError(5);

+      return 0;

+    }

   }

-  uStack00000000000000b0 = *in_stack_00000088 & uStack00000000000000b0;

-  iVar7 = *in_stack_00000088 - uStack00000000000000b0;

-  iStack0000000000000090 = iVar7;

-  if (uStack000000000000006c == 0) {

-    (*(code *)(&PTR_draw_nf_ntb_o_to_temp_start_14034b790)[(ulonglong)unaff_R14D & 0xffffff4f])

-              (in_stack_00000070,unaff_R12D,in_stack_00000080,iVar7,in_stack_00000060);

+  lVar8 = BuildHwndList(*(undefined8 *)(param_1 + 0x70),2,0,1);

+  if (lVar8 == 0) {

+    return 0;

   }

-  else {

-    in_stack_00000100 = 0x140105ec0;

-    in_stack_00000108 = draw_clrt_f_ntb_o_to_temp_start;

-    in_stack_00000110 = (code *)(&stack0x00000100)[unaff_R14D & 1];

-    if (in_stack_00000110 == (code *)0x140105ec0) {

-      func_0x000140105ec0(in_stack_00000070,unaff_R12D,in_stack_00000080,iVar7,in_stack_00000060);

-    }

-    else {

-      (*in_stack_00000110)(in_stack_00000070,unaff_R12D,in_stack_00000080,iVar7,in_stack_00000060);

-    }

+  local_78 = lVar8;

+  TraceLoggingBroadcastMessage(param_1,param_2,(__uint64)param_3,param_5);

+  local_b0 = (longlong *)PsGetCurrentProcessWin32Process();

+  if (local_b0 != (longlong *)0x0) {

+    local_b0 = (longlong *)(-(ulonglong)(*local_b0 != 0) & (ulonglong)local_b0);

   }

-  if (unaff_R15 != (uint *)0x0) {

-    if ((unaff_R14D & 8) == (uint)unaff_RDI) {

-      pcVar11 = vRectBlt;

-    }

-    else {

-      pcVar11 = stretch::vStrMirrorError;

-    }

-    while( true ) {

-      uVar4 = *unaff_R15;

-      uVar10 = unaff_R15[2];

-      if (uVar4 == uVar10) break;

-      if ((int)uVar4 <= (int)*in_stack_00000088) {

-        uVar4 = *in_stack_00000088;

-      }

-      if ((int)in_stack_00000088[2] <= (int)uVar10) {

-        uVar10 = in_stack_00000088[2];

-      }

-      uVar5 = *(uint *)in_stack_000000d0;

-      uVar8 = unaff_R15[1];

-      if ((int)unaff_R15[1] <= (int)uVar5) {

-        uVar8 = uVar5;

-      }

-      uVar6 = unaff_R15[3];

-      if ((int)in_stack_00000088[3] <= (int)unaff_R15[3]) {

-        uVar6 = in_stack_00000088[3];

-      }

-      if (((int)(uVar4 - iVar7) < (int)(uVar10 - iVar7)) &&

-         ((int)(uVar8 - uVar5) < (int)(uVar6 - uVar5))) {

-        (*pcVar11)(in_stack_00000080,in_stack_00000060,uVar4 - iVar7,uVar8 - uVar5,uVar10 - iVar7);

-      }

-      unaff_R15 = unaff_R15 + 4;

-    }

-  }

-  if ((*(uint *)(in_stack_00000078 + 0x60) < 7) || (iVar1 = func_0x000140106048(), iVar1 == 0)) {

-    iVar1 = *(int *)(in_stack_00000078 + 0x60);

-    if (in_stack_000004e0 == -1) {

-      iVar1 = iVar1 + 8;

-    }

-    if ((char)unaff_R14D < '\0') {

-      pcVar11 = vSrcAlphaCopyS8D32;

-      if ((unaff_R14D & 0x20) == 0) {

-        pcVar11 = vSrcAlphaCopyS4D32;

-      }

-    }

-    else {

-      iVar2 = iVar1;

-      if (((unaff_R14D & 8) != 0) && (iVar2 = iVar1 + 0x10, (unaff_R14D & 0x20) != 0)) {

-        iVar2 = iVar1 + 0x20;

-      }

-      pcVar11 = (code *)(&PTR_vStrMirrorError_14034b610)[iVar2];

-    }

-    in_stack_000000d0 = pcVar11;

-    for (puVar13 = (uint *)CONCAT44(uStack00000000000000cc,iStack00000000000000c8);

-        uVar4 = puVar13[3], in_stack_000000d8 = puVar13, uVar4 != 0; puVar13 = puVar13 + 4) {

-      uVar10 = *in_stack_00000088;

-      uVar5 = uVar10;

-      if ((int)uVar10 <= (int)*puVar13) {

-        uVar5 = *puVar13;

-      }

-      uVar8 = in_stack_00000088[2];

-      if ((int)puVar13[2] <= (int)in_stack_00000088[2]) {

-        uVar8 = puVar13[2];

-      }

-      uVar6 = in_stack_00000088[1];

-      uStack000000000000006c = uVar6;

-      if ((int)uVar6 <= (int)puVar13[1]) {

-        uStack000000000000006c = puVar13[1];

-      }

-      uVar12 = in_stack_00000088[3];

-      if ((int)uVar4 <= (int)in_stack_00000088[3]) {

-        uVar12 = uVar4;

-      }

-      iVar1 = uVar5 - uVar10;

-      uVar4 = uStack000000000000006c - uVar6;

-      if ((unaff_R14D & 0x10) == 0) {

-        pSVar9 = in_stack_00000078;

-        PUBLIC_PFTOBJ::PUBLIC_PFTOBJ

-                  ((PUBLIC_PFTOBJ *)&stack0x000000e0,*(PFT **)(in_stack_00000078 + 0x30));

-        PDEVOBJ::vSync((PDEVOBJ *)&stack0x000000e0,(_SURFOBJ *)(pSVar9 + 0x18),(_RECTL *)0x0,0);

-      }

-      else {

-        uVar5 = uVar5 - iVar7;

-        uVar8 = uVar8 - iVar7;

-        uVar12 = uVar12 - uVar6;

-        uStack000000000000006c = uVar4;

-      }

-      if (((int)uVar5 < (int)uVar8) && ((int)uStack000000000000006c < (int)uVar12)) {

-        if (in_stack_000004d8 == -1) {

-          uStack00000000000001e0 = 1;

-          uStack00000000000001e4 = SUB82(unaff_RDI,0);

-          in_stack_000001d0 = in_stack_00000080;

-          in_stack_000001d8 = in_stack_00000060;

-          iStack00000000000001b8 = in_stack_00000060 * 8;

-          iStack00000000000001bc = in_stack_00000088[3] - in_stack_00000088[1];

-          iStack00000000000000c8 = iVar1 + uStack00000000000000b0;

-          uStack00000000000000cc = uVar4;

-          uStack0000000000000118 = uVar5;

-          uStack000000000000011c = uStack000000000000006c;

-          uStack0000000000000120 = uVar8;

-          uStack0000000000000124 = uVar12;

-          BltLnk(in_stack_00000078,(SURFACE *)0x0,(SURFACE *)&stack0x00000180,(ECLIPOBJ *)0x0,

-                 unaff_RDI,(_RECTL *)&stack0x00000118,(_POINTL *)unaff_RDI,

-                 (_POINTL *)&stack0x000000c8,in_stack_000000f0,in_stack_000000e8,0xaaf0);

+  local_a0 = (ulonglong *)(lVar8 + 0x20);

+  uVar17 = *local_a0;

+  do {

+    if (uVar17 == 1) {

+      FreeHwndList(local_78);

+      return 1;

+    }

+    W32GetCurrentThreadNonPaged();

+    lVar8 = W32GetUserSessionState();

+    if ((uVar17 & 0xffff) < *(ulonglong *)(*(longlong *)(lVar8 + 0x4e30) + 8)) {

+      lVar8 = W32GetUserSessionState();

+      lVar9 = W32GetUserSessionState();

+      lVar8 = *(longlong *)(lVar8 + 0x4e40) +

+              (ulonglong)(uint)((int)(uVar17 & 0xffff) * *(int *)(lVar9 + 0x4e48));

+      puVar10 = (undefined8 *)HMPkheFromPhe(lVar8);

+      uVar19 = (ushort)(uVar17 >> 0x10) & 0x7fff;

+      if ((((uVar19 == *(ushort *)(lVar8 + 0x1a)) || (uVar19 == 0x7fff)) ||

+          (((uVar17 & 0x7fff0000) == 0 && (lVar9 = PsGetCurrentProcessWow64Process(), lVar9 != 0))))

+         && ((((cVar18 = '\x01', (*(byte *)(lVar8 + 0x19) & 1) == 0 &&

+               (*(char *)(lVar8 + 0x18) == '\x01')) &&

+              (ptVar2 = (tagWND *)*puVar10, ptVar2 != (tagWND *)0x0)) &&

+             (((*(ushort *)(*(longlong *)(ptVar2 + 0x28) + 0x2a) & 0x2fff) != 0x29c &&

+              (lVar8 = W32GetUserSessionState(),

+              *(short *)(lVar8 + 0xa212) != **(short **)(*(longlong *)(ptVar2 + 0x88) + 8))))))) {

+        if ((param_2 == 0x310 || param_2 == 0x311) &&

+           ((*(byte *)(*(longlong *)(ptVar2 + 0x28) + 0x1f) & 0x10) == 0)) {

+          LOCK();

+          uVar4 = *(uint *)(*(longlong *)(ptVar2 + 0x10) + 0x210);

+          if (uVar4 == 0) {

+            *(uint *)(*(longlong *)(ptVar2 + 0x10) + 0x210) = 0;

+            uVar4 = 0;

+          }

+          UNLOCK();

+          if ((uVar4 >> 0xb & 1) == 0) goto LAB_1;

         }

-        else {

-          (*pcVar11)((ulonglong)(uVar4 * in_stack_00000060) + in_stack_00000080,

-                     iVar1 + uStack00000000000000b0,in_stack_00000060,

-                     (longlong)(int)(*(int *)(in_stack_00000078 + 0x58) * uStack000000000000006c) +

-                     *(longlong *)(in_stack_00000078 + 0x50),uVar5);

+        if (param_8 == 1) {

+          if (*(int *)(*(longlong *)(ptVar2 + 0x28) + 0xec) == 1) goto LAB_2;

         }

-      }

-    }

-  }

-  func_0x000140105e58(&stack0x00000130);

-  if (unaff_RBX != 0) {

-    if (*(int *)(unaff_RBX + 0x24) < 0) {

-      if (*(int *)(unaff_RBX + 0x24) == -1) {

-        FreeThreadBufferWithTag();

-      }

-    }

-    else {

-      pSVar3 = Gre::Base::Globals();

-      LOCK();

-      *(int *)(pSVar3 + ((longlong)*(int *)(unaff_RBX + 0x24) + 0x86) * 0x20) =

-           *(int *)(pSVar3 + ((longlong)*(int *)(unaff_RBX + 0x24) + 0x86) * 0x20) + -1;

-      UNLOCK();

-    }

-  }

-  return;

+        else if (((param_8 != 2) || (*(int *)(*(longlong *)(ptVar2 + 0x28) + 0xec) != 1)) ||

+                ((*(byte *)(*(longlong *)(ptVar2 + 0x28) + 0xe8) & 0x40) != 0)) {

+LAB_2:

+          if (((*(uint *)(ptVar2 + 0x17c) & 0x10) == 0) ||

+             (((param_2 != 0x7e || (param_4 != (_LARGE_STRING *)0x1)) &&

+              ((param_2 != 0x1a || (param_3 != (_LARGE_STRING *)0x2f)))))) {

+            local_50 = *(undefined8 *)(local_80 + 0x1c8);

+            *(undefined8 **)(local_80 + 0x1c8) = &local_50;

+            local_48 = ptVar2;

+            HMLockObject();

+            uVar22 = (uint)((ulonglong)in_stack_ffffffffffffff10 >> 0x20);

+            uVar4 = (uint)((ulonglong)in_stack_ffffffffffffff08 >> 0x20);

+            iVar3 = param_7;

+            if (param_5 == 0) {

+LAB_3:

+              in_stack_ffffffffffffff10 = (_LARGE_STRING *)((ulonglong)uVar22 << 0x20);

+              in_stack_ffffffffffffff08 = (_LARGE_STRING *)((ulonglong)uVar4 << 0x20);

+              xxxSendTransformableMessageTimeout

+                        (ptVar2,param_2,param_3,param_4,in_stack_ffffffffffffff08,

+                         in_stack_ffffffffffffff10,0,iVar3,1);

+              goto LAB_4;

+            }

+            p_Var13 = param_4;

+            uVar15 = param_2;

+            if (param_5 == 1) {

+LAB_5:

+              uVar4 = (uint)((ulonglong)in_stack_ffffffffffffff08 >> 0x20);

+              uVar17 = 0;

+              if ((param_2 == 0x1a) || (param_2 == 0x1b)) {

+                if (param_4 != (_LARGE_STRING *)0x0) {

+                  if (**(short **)(param_4 + 8) == 0) {

+                    uVar17 = 0xffffffffffffffff;

+                  }

+                  else {

+                    uVar19 = UserAddAtomEx(*(short **)(param_4 + 8),0);

+                    uVar4 = (uint)((ulonglong)in_stack_ffffffffffffff08 >> 0x20);

+                    uVar17 = (ulonglong)uVar19;

+                    if (uVar17 == 0) goto LAB_4;

+                  }

+                }

+                in_stack_ffffffffffffff08 = (_LARGE_STRING *)CONCAT44(uVar4,param_2);

+                in_stack_ffffffffffffff10 = param_3;

+                iVar3 = PostEventMessageEx(*(tagTHREADINFO **)(ptVar2 + 0x10),

+                                           *(tagQ **)(*(tagTHREADINFO **)(ptVar2 + 0x10) + 0x1d8),9,

+                                           ptVar2,param_2,(__uint64)param_3,uVar17,

+                                           (tagINPUT_MESSAGE_SOURCE *)0x0);

+                if ((iVar3 == 0) && (uVar17 != 0xffffffffffffffff && uVar17 != 0)) {

+                  UserDeleteAtom(uVar17 & 0xffff);

+                }

+              }

+              else {

+                if (param_2 == 0x7e) {

+                  lVar8 = GetDispInfo();

+                  uVar20 = *(undefined8 *)(lVar8 + 0x68);

+                  GetWindowCompositedDpiContext(ptVar2);

+                  GetMonitorRectForDpi(local_60,uVar20);

+                  uVar4 = (uint)((ulonglong)in_stack_ffffffffffffff08 >> 0x20);

+                  uVar23 = (undefined4)((ulonglong)in_stack_ffffffffffffff10 >> 0x20);

+                  uVar24 = (undefined4)((ulonglong)in_stack_ffffffffffffff30 >> 0x20);

+                  uVar19 = (short)local_60._8_8_ - local_60[0];

+                  p_Var13 = (_LARGE_STRING *)

+                            ((longlong)

+                             (SUB84(local_60._8_8_,4) * 0x10000 + SUB64(local_60._2_6_,2) * -0x10000

+                             ) | (ulonglong)uVar19);

+                  uVar16 = (undefined7)(CONCAT62(SUB86(local_60._8_8_,2),uVar19) >> 8);

+                  if (param_4 != (_LARGE_STRING *)0x0) {

+                    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+                       (cVar14 = cVar18, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+                      cVar14 = '\0';

+                    }

+                    if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+                       (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+                      cVar18 = '\0';

+                    }

+                    if ((cVar14 != '\0') || (cVar18 != '\0')) {

+                      uVar6 = PsGetThreadId(**(undefined8 **)(ptVar2 + 0x10));

+                      uVar20 = *(undefined8 *)ptVar2;

+                      lVar8 = W32GetUserSessionState();

+                      in_stack_ffffffffffffff30 = CONCAT44(uVar24,uVar6);

+                      uVar21 = CONCAT71((int7)((ulonglong)in_stack_ffffffffffffff08 >> 8),5);

+                      WPP_RECORDER_AND_TRACE_SF_qd

+                                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),CONCAT71(uVar16,cVar14),

+                                 cVar18,*(undefined8 *)(lVar8 + 0x10f98),uVar21,CONCAT44(uVar23,7),

+                                 0xf,&WPP_8698d3ee995231e91f0eb6b56c9d7f80_Traceguids,uVar20,

+                                 in_stack_ffffffffffffff30);

+                      uVar4 = (uint)((ulonglong)uVar21 >> 0x20);

+                    }

+                    in_stack_ffffffffffffff08 = (_LARGE_STRING *)CONCAT44(uVar4,0x7e);

+                    in_stack_ffffffffffffff10 = param_3;

+                    PostEventMessageEx(*(tagTHREADINFO **)(ptVar2 + 0x10),

+                                       *(tagQ **)(*(tagTHREADINFO **)(ptVar2 + 0x10) + 0x1d8),9,

+                                       ptVar2,0x7e,(__uint64)param_3,(__int64)p_Var13,

+                                       (tagINPUT_MESSAGE_SOURCE *)0x0);

+                    goto LAB_4;

+                  }

+                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+                     (cVar14 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+                    cVar14 = '\0';

+                  }

+                  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+                     (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+                    cVar18 = '\0';

+                  }

+                  if ((cVar14 != '\0') || (cVar18 != '\0')) {

+                    uVar6 = PsGetThreadId(**(undefined8 **)(ptVar2 + 0x10));

+                    uVar20 = *(undefined8 *)ptVar2;

+                    lVar8 = W32GetUserSessionState();

+                    in_stack_ffffffffffffff30 = CONCAT44(uVar24,uVar6);

+                    in_stack_ffffffffffffff10 = (_LARGE_STRING *)CONCAT44(uVar23,7);

+                    uVar21 = CONCAT71((int7)((ulonglong)in_stack_ffffffffffffff08 >> 8),5);

+                    WPP_RECORDER_AND_TRACE_SF_qd

+                              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,cVar18,

+                               *(undefined8 *)(lVar8 + 0x10f98),uVar21,in_stack_ffffffffffffff10,0xe

+                               ,&WPP_8698d3ee995231e91f0eb6b56c9d7f80_Traceguids,uVar20,

+                               in_stack_ffffffffffffff30);

+                    uVar4 = (uint)((ulonglong)uVar21 >> 0x20);

+                  }

+                  uVar15 = 0x7e;

+                }

+LAB_6:

+                in_stack_ffffffffffffff08 = (_LARGE_STRING *)CONCAT44(uVar4,param_7);

+                xxxSendNotifyMessage(ptVar2,uVar15,param_3,p_Var13,in_stack_ffffffffffffff08);

+              }

+            }

+            else if (param_5 == 2) {

+              if (*(longlong *)(ptVar2 + 0x78) == 0) {

+                if ((param_2 - 0x3e0 < 9) &&

+                   (iVar7 = ValidateDDEConvPair(param_3,ptVar2), iVar7 != 0)) {

+                  iVar3 = 1;

+                }

+                if ((param_2 == 0x112) && (param_3 == (_LARGE_STRING *)0xf030)) {

+                  ptVar12 = PtiCurrent();

+                  iVar7 = IAMThreadAccessGranted(ptVar12);

+                  if (iVar7 != 0) {

+                    iVar3 = 1;

+                  }

+                }

+                if ((ptVar2 != (tagWND *)0xffffffffffffffff) && (iVar3 == 0)) {

+                  uVar20 = *(undefined8 *)(*(longlong *)(ptVar2 + 0x10) + 0x1d0);

+                  plVar11 = (longlong *)PsGetCurrentProcessWin32Process();

+                  uVar17 = 0;

+                  if (plVar11 != (longlong *)0x0) {

+                    uVar17 = (ulonglong)plVar11 & -(ulonglong)(*plVar11 != 0);

+                  }

+                  in_stack_ffffffffffffff08 = param_3;

+                  in_stack_ffffffffffffff10 = param_4;

+                  iVar3 = CheckForMessageAccessCrossIL(uVar17,uVar20,ptVar2,param_2,param_3,param_4)

+                  ;

+                  uVar22 = (uint)((ulonglong)in_stack_ffffffffffffff10 >> 0x20);

+                  if (iVar3 == 0) goto LAB_4;

+                }

+                in_stack_ffffffffffffff10 = (_LARGE_STRING *)CONCAT44(uVar22,1);

+                in_stack_ffffffffffffff08 = (_LARGE_STRING *)0x0;

+                _PostTransformableMessageExtended

+                          (ptVar2,param_2,(__uint64)param_3,(__int64)param_4,

+                           (tagINPUT_MESSAGE_SOURCE *)0x0,1);

+              }

+            }

+            else if (param_5 == 3) {

+              in_stack_ffffffffffffff10 = *(_LARGE_STRING **)(param_6 + 8);

+              in_stack_ffffffffffffff08 = *(_LARGE_STRING **)param_6;

+              xxxSendMessageCallback

+                        (ptVar2,param_2,param_3,param_4,in_stack_ffffffffffffff08,

+                         in_stack_ffffffffffffff10,*(undefined4 *)(param_6 + 0x10),param_7,1);

+            }

+            else {

+              if (param_5 != 4) {

+                if (param_5 != 5) {

+                  if (param_5 != 6) goto LAB_4;

+                  goto LAB_7;

+                }

+                if (*(longlong **)(*(longlong *)(ptVar2 + 0x10) + 0x1d0) == local_b0) {

+                  puVar1 = (uint *)(*(longlong *)(ptVar2 + 0x10) + 0x210);

+                  LOCK();

+                  uVar5 = *puVar1;

+                  if (uVar5 == 0) {

+                    *puVar1 = 0;

+                    uVar5 = 0;

+                  }

+                  UNLOCK();

+                  if ((uVar5 & 8) == 0) {

+                    iVar3 = 1;

+                    goto LAB_3;

+                  }

+                }

+                goto LAB_6;

+              }

+LAB_7:

+              in_stack_ffffffffffffff10 =

+                   (_LARGE_STRING *)CONCAT44(uVar22,*(undefined4 *)(param_6 + 4));

+              in_stack_ffffffffffffff08 = (_LARGE_STRING *)CONCAT44(uVar4,*(undefined4 *)param_6);

+              lVar8 = xxxSendTransformableMessageTimeout

+                                (ptVar2,param_2,param_3,param_4,in_stack_ffffffffffffff08,

+                                 in_stack_ffffffffffffff10,*(undefined8 *)(param_6 + 8),param_7,1);

+              if ((lVar8 == 0) && (param_5 == 6)) goto LAB_5;

+            }

+LAB_4:

+            ptVar12 = (tagTHREADINFO *)0x0;

+            puVar10 = (undefined8 *)W32GetCurrentThreadNonPaged();

+            if (puVar10 != (undefined8 *)0x0) {

+              ptVar12 = (tagTHREADINFO *)*puVar10;

+            }

+            Win32HM_UnlockFromThread<0>(ptVar12,(_Win32HMThreadLockItem *)&local_50);

+          }

+          else {

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+               (cVar14 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+              cVar14 = '\0';

+            }

+            if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+               (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+              cVar18 = '\0';

+            }

+            if ((cVar14 != '\0') || (cVar18 != '\0')) {

+              PsGetThreadId(**(undefined8 **)(ptVar2 + 0x10));

+              in_stack_ffffffffffffff30 = *(undefined8 *)ptVar2;

+              lVar8 = W32GetUserSessionState();

+              WPP_RECORDER_AND_TRACE_SF_sqd

+                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,cVar18,

+                         *(undefined8 *)(lVar8 + 0x10f98));

+            }

+          }

+        }

+      }

+    }

+LAB_1:

+    local_a0 = local_a0 + 1;

+    uVar17 = *local_a0;

+  } while( true );

 }
```

## `TrySmuggleHidData`  (modified)

```diff
--- TrySmuggleHidData
+++ TrySmuggleHidData
@@ -1,13 +1,54 @@
+

+/* void __cdecl TrySmuggleHidData(struct tagTHREADINFO * __ptr64,struct tagTHREADINFO *

+   __ptr64,struct tagHIDDATA * __ptr64,bool) */

 

 void __cdecl

 TrySmuggleHidData(tagTHREADINFO *param_1,tagTHREADINFO *param_2,tagHIDDATA *param_3,bool param_4)

 

 {

-  char in_AL;

-  undefined7 in_register_00000001;

+  tagTHREADINFO *ptVar1;

+  ulong uVar2;

+  ulong uVar3;

+  int iVar4;

+  bool bVar5;

+  undefined1 in_stack_ffffffffffffffd0;

   

-  *(char *)CONCAT71(in_register_00000001,in_AL) =

-       *(char *)CONCAT71(in_register_00000001,in_AL) + in_AL;

+  ptVar1 = *(tagTHREADINFO **)(param_3 + 0x10);

+  bVar5 = false;

+  uVar3 = 0;

+  uVar2 = uVar3;

+  if (ptVar1 != (tagTHREADINFO *)0x0) {

+    uVar2 = PsGetThreadId(*(undefined8 *)ptVar1);

+  }

+  if (param_2 != (tagTHREADINFO *)0x0) {

+    uVar3 = PsGetThreadId(*(undefined8 *)param_2);

+  }

+  if (param_2 != ptVar1) {

+    if (((*(uint *)(param_3 + 0x30) & 1) == 0) && (param_1 == ptVar1)) {

+      FlushPostedRawInput(param_1);

+      param_3 = UnlinkHidData(param_1,param_3,(tagHIDDATA ***)0x0);

+    }

+    if ((param_3 == (tagHIDDATA *)0x0) || ((*(uint *)(param_3 + 0x30) & 1) == 0)) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0xb64);

+    }

+    else {

+      HMChangeOwnerThread(param_3,param_2);

+      *(uint *)(param_3 + 0x30) = *(uint *)(param_3 + 0x30) & 0xfffffffe | 2;

+      ExpInterlockedPushEntrySList(param_2 + 0x480,param_3 + 0x20);

+      iVar4 = Feature_1259579706__private_IsEnabledDeviceUsageNoInline();

+      if (iVar4 == 0) {

+        if (*(tagHIDDATA **)(param_1 + 0x478) == param_3) {

+          *(undefined8 *)(param_1 + 0x478) = 0;

+        }

+      }

+      else if (*(tagHIDDATA **)(ptVar1 + 0x478) == param_3) {

+        *(undefined8 *)(ptVar1 + 0x478) = 0;

+      }

+      bVar5 = true;

+    }

+  }

+  InputTraceLogging::RawInput::SmuggleHidData

+            (param_3,param_2 == ptVar1,uVar2,uVar3,bVar5,(bool)in_stack_ffffffffffffffd0);

   return;

 }
```

## `zzzAttachThreadInput`  (modified)

```diff
--- zzzAttachThreadInput
+++ zzzAttachThreadInput
@@ -1,145 +1,207 @@
 

-void zzzAttachThreadInput(longlong param_1,undefined8 param_2,char param_3)

+undefined1 * zzzAttachThreadInput(tagTHREADINFO *param_1,tagTHREADINFO *param_2,ulonglong param_3)

 

 {

-  byte bVar1;

-  int iVar2;

-  int iVar3;

-  int iVar4;

-  BOOL BVar5;

-  char *in_RAX;

-  longlong lVar6;

-  longlong lVar7;

-  longlong lVar8;

-  int *piVar9;

-  int iVar10;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  longlong unaff_R12;

-  int unaff_R13D;

-  int iVar11;

-  int iVar12;

-  int iVar13;

+  longlong lVar1;

+  longlong *plVar2;

+  longlong *plVar3;

+  bool bVar4;

+  int iVar5;

+  tagTHREADINFO *ptVar6;

+  undefined1 *puVar7;

+  int *piVar8;

+  longlong lVar9;

+  undefined8 *puVar10;

+  char cVar11;

+  uint uVar12;

+  bool bVar13;

+  undefined8 local_58;

+  undefined4 local_50;

   

-  in_RAX[-0x75] = in_RAX[-0x75] + (char)param_1;

-  *in_RAX = (char)((ulonglong)param_2 >> 8);

-  *in_RAX = *in_RAX + param_3;

-  if ((byte)((byte)unaff_R12 & (byte)*(undefined4 *)(param_1 + 0x848)) == 0) {

-    lVar6 = W32GetUserSessionState();

-    lVar6 = *(longlong *)(lVar6 + 0x4e30);

-    lVar7 = W32GetUserSessionState();

-    iVar11 = *(int *)(lVar6 + 0x824);

-    *(int *)(unaff_RBP + 0x7f) = unaff_ESI;

-    iVar11 = (iVar11 - *(int *)(*(longlong *)(lVar7 + 0x4e30) + 0x84c)) +

-             *(int *)(unaff_RBP + -0x31);

+  ptVar6 = PtiCurrent();

+  cVar11 = '\x01';

+  if ((((uint)param_3 >> 0xe & 1) == 0) || (bVar13 = true, (param_3 & 1) != 0)) {

+    bVar13 = false;

+  }

+  iVar5 = Feature_UIPIEliminateATIOverride__private_IsEnabledDeviceUsageNoInline();

+  if (iVar5 == 0) {

+    uVar12 = ~((uint)(param_3 >> 0xf) & 0x1ffff) & 1;

+  }

+  else if (((param_1 != ptVar6) || ((*(uint *)(param_1 + 0x550) >> 0x14 & 1) == 0)) ||

+          (uVar12 = 0, (*(uint *)(param_2 + 0x550) >> 0x12 & 1) == 0)) {

+    uVar12 = 1;

+  }

+  if (param_1 == param_2) {

+LAB_0:

+    puVar7 = (undefined1 *)0xc000000d;

   }

   else {

-    iVar11 = *(int *)(unaff_RBP + -0x29) - unaff_ESI;

-    *(int *)(unaff_RBP + 0x7f) = -unaff_ESI;

-  }

-  *(int *)(unaff_RBP + -0x21) = iVar11;

-  *(int *)(unaff_RBP + -0xd) = iVar11;

-  lVar6 = W32GetUserSessionState();

-  if ((*(uint *)(*(longlong *)(lVar6 + 0x4e30) + 0x848) & 2) == 0) {

-    iVar12 = *(int *)(unaff_RBP + -0x25) - unaff_R13D;

-    *(int *)(unaff_RBP + -0x39) = -unaff_R13D;

-    unaff_R12 = 1;

-  }

-  else {

-    lVar6 = W32GetUserSessionState();

-    lVar6 = *(longlong *)(lVar6 + 0x4e30);

-    lVar7 = W32GetUserSessionState();

-    iVar12 = *(int *)(lVar6 + 0x828);

-    *(int *)(unaff_RBP + -0x39) = unaff_R13D;

-    iVar12 = (iVar12 - *(int *)(*(longlong *)(lVar7 + 0x4e30) + 0x850)) +

-             *(int *)(unaff_RBP + -0x2d);

-  }

-  *(int *)(unaff_RBP + -9) = iVar12;

-  *(int *)(unaff_RBP + -0x1d) = iVar12;

-  lVar6 = W32GetUserSessionState();

-  iVar10 = (int)unaff_R12;

-  if ((*(uint *)(*(longlong *)(lVar6 + 0x4e30) + 0x848) & 4) == 0) {

-    *(longlong *)(unaff_RBP + 7) = unaff_R12;

-    iVar4 = *(int *)(unaff_RBP + -0x29) / unaff_ESI;

-    if (iVar4 < iVar10) {

-      iVar4 = iVar10;

-    }

-  }

-  else {

-    lVar6 = (longlong)*(int *)(unaff_RBP + -0x25) / (longlong)unaff_R13D;

-    if ((int)lVar6 < iVar10) {

-      lVar6 = unaff_R12;

-    }

-    iVar4 = (int)lVar6;

-    *(undefined8 *)(unaff_RBP + 7) = 0;

-  }

-  *(int *)(unaff_RBP + -5) = iVar4;

-  *(undefined4 *)(unaff_RBP + -0x35) = 0;

-  *(int *)(unaff_RBP + 0x77) = iVar4;

-  do {

-    *(int *)(unaff_RBP + -0x19) = iVar11 + unaff_ESI;

-    *(int *)(unaff_RBP + -0x15) = *(int *)(unaff_RBP + -0x11) + iVar12;

-    lVar6 = *(longlong *)(*(longlong *)(unaff_RBP + 0xf) + 0x70);

-    if (lVar6 == 0) break;

-    iVar10 = *(int *)(unaff_RBP + -1);

-    iVar4 = *(int *)(unaff_RBP + -0x11);

-    iVar13 = *(int *)(unaff_RBP + -0x35);

-    lVar7 = *(longlong *)(unaff_RBP + 0x67);

-    do {

-      bVar1 = *(byte *)(*(longlong *)(lVar6 + 0x28) + 0x1f);

-      if (((bVar1 & 0x10) != 0) && (lVar6 != lVar7)) {

-        if ((bVar1 & 0x20) == 0) {

-          lVar8 = W32GetUserSessionState();

-          piVar9 = (int *)_GetProp(lVar6,*(undefined2 *)(lVar8 + 0xa216),1);

-          if ((piVar9 == (int *)0x0) || (((byte)piVar9[4] & 0x11) != 0x11)) goto LAB_0;

-          iVar2 = *piVar9;

-          iVar3 = piVar9[1];

-          *(int *)(unaff_RBP + -0x31) = iVar2;

-          *(int *)(unaff_RBP + -0x2d) = iVar3;

-          *(int *)(unaff_RBP + -0x25) = iVar3 + iVar4;

-          *(int *)(unaff_RBP + -0x29) = iVar2 + iVar10;

+    if ((uVar12 == 0) ||

+       ((*(longlong *)(param_2 + 0x1d0) == *(longlong *)(param_1 + 0x1d0) &&

+        (*(longlong *)(ptVar6 + 0x1d0) == *(longlong *)(param_2 + 0x1d0))))) {

+LAB_1:

+      LOCK();

+      uVar12 = *(uint *)(param_2 + 0x210);

+      if (uVar12 == 0) {

+        *(uint *)(param_2 + 0x210) = 0;

+        uVar12 = 0;

+      }

+      UNLOCK();

+      if ((uVar12 & 0x40) == 0) {

+        LOCK();

+        uVar12 = *(uint *)(param_1 + 0x210);

+        if (uVar12 == 0) {

+          *(uint *)(param_1 + 0x210) = 0;

+          uVar12 = 0;

         }

-        else {

-          GetRect(lVar6,unaff_RBP + -0x31,0x42);

+        UNLOCK();

+        if (((uVar12 & 0x40) == 0) &&

+           (*(longlong *)(param_2 + 0x1f0) == *(longlong *)(param_1 + 0x1f0))) {

+          lVar9 = W32GetUserSessionState();

+          if ((param_3 & 1) != 0) {

+            for (puVar10 = *(undefined8 **)(lVar9 + 0x4208); puVar10 != (undefined8 *)0x0;

+                puVar10 = (undefined8 *)*puVar10) {

+              if ((((tagTHREADINFO *)puVar10[2] == param_2) &&

+                  ((tagTHREADINFO *)puVar10[1] == param_1)) ||

+                 (((tagTHREADINFO *)puVar10[2] == param_1 &&

+                  ((tagTHREADINFO *)puVar10[1] == param_2)))) {

+                if (*(int *)(puVar10 + 3) != -1) {

+                  *(int *)(puVar10 + 3) = *(int *)(puVar10 + 3) + 1;

+                  return (undefined1 *)0x0;

+                }

+                goto LAB_0;

+              }

+            }

+            puVar10 = (undefined8 *)Win32AllocPoolZInit(0x20,0x69617355);

+            if (puVar10 == (undefined8 *)0x0) {

+              return &DAT_2;

+            }

+            puVar10[1] = param_1;

+            puVar10[2] = param_2;

+            *(undefined4 *)(puVar10 + 3) = 1;

+            lVar9 = W32GetUserSessionState();

+            *puVar10 = *(undefined8 *)(lVar9 + 0x4208);

+            lVar9 = W32GetUserSessionState();

+            *(undefined8 **)(lVar9 + 0x4208) = puVar10;

+LAB_3:

+            *(ulonglong *)(param_2 + 0x550) = *(ulonglong *)(param_2 + 0x550) | 0x200;

+            *(ulonglong *)(param_1 + 0x550) = *(ulonglong *)(param_1 + 0x550) | 0x200;

+            if ((*(ulonglong *)(param_1 + 0x550) >> 10 & 1) != 0) {

+              KeSetEvent(*(undefined8 *)(param_1 + 0x300),1,0);

+            }

+            if ((*(uint *)(param_2 + 0x550) >> 10 & 1) != 0) {

+              KeSetEvent(*(undefined8 *)(param_2 + 0x300),1,0);

+            }

+            zzzReattachThreads(0,param_1,param_2);

+            return (undefined1 *)0x0;

+          }

+          plVar2 = (longlong *)(lVar9 + 0x4208);

+          for (plVar3 = *(longlong **)(lVar9 + 0x4208); plVar3 != (longlong *)0x0;

+              plVar3 = (longlong *)*plVar3) {

+            if ((((tagTHREADINFO *)plVar3[2] == param_2) && ((tagTHREADINFO *)plVar3[1] == param_1))

+               || (((tagTHREADINFO *)plVar3[2] == param_1 && ((tagTHREADINFO *)plVar3[1] == param_2)

+                   ))) {

+              *(int *)(plVar3 + 3) = (int)plVar3[3] + -1;

+              if ((*(int *)((longlong *)*plVar2 + 3) != 0) && (!bVar13)) {

+                return (undefined1 *)0x0;

+              }

+              *plVar2 = *(longlong *)*plVar2;

+              Win32FreePool();

+              goto LAB_3;

+            }

+            plVar2 = plVar3;

+          }

+          goto LAB_0;

         }

-        iVar13 = iVar13 + 1;

-        BVar5 = IntersectRect((LPRECT)(unaff_RBP + -0x31),(RECT *)(unaff_RBP + -0x31),

-                              (RECT *)(unaff_RBP + -0x21));

-        if (BVar5 != 0) break;

-      }

-LAB_0:

-      lVar6 = *(longlong *)(lVar6 + 0x58);

-    } while (lVar6 != 0);

-    *(int *)(unaff_RBP + -0x35) = iVar13;

-    iVar10 = *(int *)(unaff_RBP + -9);

-    if (lVar6 == 0) break;

-    piVar9 = (int *)(unaff_RBP + 0x77);

-    *piVar9 = *piVar9 + -1;

-    if (*piVar9 == 0) {

-      *(undefined4 *)(unaff_RBP + 0x77) = *(undefined4 *)(unaff_RBP + -5);

-      if (*(longlong *)(unaff_RBP + 7) == 0) {

-        iVar11 = iVar11 + *(int *)(unaff_RBP + 0x7f);

-        *(int *)(unaff_RBP + -0x21) = iVar11;

-      }

-      else {

-        *(int *)(unaff_RBP + -0x21) = *(int *)(unaff_RBP + -0xd);

-        iVar11 = *(int *)(unaff_RBP + -0xd);

-LAB_1:

-        iVar10 = iVar12 + *(int *)(unaff_RBP + -0x39);

-      }

-      *(int *)(unaff_RBP + -0x1d) = iVar10;

-      iVar12 = iVar10;

+      }

     }

     else {

-      if (*(longlong *)(unaff_RBP + 7) == 0) goto LAB_1;

-      iVar11 = iVar11 + *(int *)(unaff_RBP + 0x7f);

-      *(int *)(unaff_RBP + -0x21) = iVar11;

+      bVar4 = UIPrivilegeIsolation::CheckAccess

+                        ((tagUIPI_INFO *)

+                         (-(ulonglong)(*(longlong *)(ptVar6 + 0x1d0) != 0) &

+                         *(longlong *)(ptVar6 + 0x1d0) + 0x130U),*(tagUIPI_INFO **)(param_2 + 0x1d8)

+                         ,0);

+      if ((bVar4) || (*(int *)(*(longlong *)(ptVar6 + 0x1d0) + 0xc) < 0)) {

+        bVar4 = UIPrivilegeIsolation::CheckAccess

+                          ((tagUIPI_INFO *)

+                           (-(ulonglong)(*(longlong *)(ptVar6 + 0x1d0) != 0) &

+                           *(longlong *)(ptVar6 + 0x1d0) + 0x130U),

+                           *(tagUIPI_INFO **)(param_1 + 0x1d8),0);

+        if ((bVar4) || (*(int *)(*(longlong *)(ptVar6 + 0x1d0) + 0xc) < 0)) {

+          iVar5 = Feature_UIPIBlockCrossACAttach__private_IsEnabledDeviceUsageNoInline();

+          if (iVar5 != 0) {

+            lVar9 = *(longlong *)(param_1 + 0x1d0);

+            piVar8 = (int *)(lVar9 + 0x134);

+            if (lVar9 == 0) {

+              piVar8 = (int *)&DAT_4;

+            }

+            if (*piVar8 == 0) goto LAB_5;

+            lVar1 = *(longlong *)(param_2 + 0x1d0);

+            piVar8 = (int *)(lVar1 + 0x134);

+            if (lVar1 == 0) {

+              piVar8 = (int *)&DAT_4;

+            }

+            if ((*piVar8 == 0) ||

+               (bVar4 = UIPrivilegeIsolation::IsSameAppContainer

+                                  ((UIPIAccessor *)(-(ulonglong)(lVar9 != 0) & lVar9 + 0x130U),

+                                   (UIPIAccessor *)(-(ulonglong)(lVar1 != 0) & lVar1 + 0x130U),0),

+               bVar4)) goto LAB_5;

+            iVar5 = IsShellProcess(*(undefined8 *)(ptVar6 + 0x1d0));

+            if ((iVar5 != 0) && (iVar5 = IAMThreadAccessGranted(ptVar6), iVar5 != 0)) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x8000) == 0)) ||

+                 (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 3)) {

+                cVar11 = '\0';

+              }

+              bVar4 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+              if ((cVar11 != '\0') || (bVar4)) {

+                tagPROCESSINFO::GetPID(*(tagPROCESSINFO **)(param_2 + 0x1d0));

+                tagPROCESSINFO::GetPID(*(tagPROCESSINFO **)(param_1 + 0x1d0));

+                lVar9 = W32GetUserSessionState();

+                WPP_RECORDER_AND_TRACE_SF_DLDL

+                          (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar4,

+                           *(undefined8 *)(lVar9 + 0x10f98));

+              }

+              goto LAB_5;

+            }

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x8000) == 0)) ||

+               ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+              cVar11 = '\0';

+            }

+            bVar13 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+            if ((cVar11 != '\0') || (bVar13)) {

+              tagPROCESSINFO::GetPID(*(tagPROCESSINFO **)(param_2 + 0x1d0));

+              tagPROCESSINFO::GetPID(*(tagPROCESSINFO **)(param_1 + 0x1d0));

+              lVar9 = W32GetUserSessionState();

+              WPP_RECORDER_AND_TRACE_SF_DLDL

+                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar13,

+                         *(undefined8 *)(lVar9 + 0x10f98));

+            }

+            goto LAB_6;

+          }

+LAB_5:

+          iVar5 = IsDesktopApp(*(undefined8 *)(ptVar6 + 0x1d0));

+          if ((iVar5 == 0) ||

+             ((((iVar5 = IsImmersiveAppRestricted(*(undefined8 *)(param_2 + 0x1d0)), iVar5 == 0 &&

+                (iVar5 = IsImmersiveAppRestricted(*(undefined8 *)(param_1 + 0x1d0)), iVar5 == 0)) ||

+               (iVar5 = ExemptedFromImmersiveRestrictions(ptVar6), iVar5 != 0)) ||

+              ((*(uint *)(*(longlong *)(ptVar6 + 0x1d0) + 0x330) >> 8 & 1) != 0))))

+          goto LAB_1;

+        }

+        puVar10 = *(undefined8 **)(param_1 + 0x1d8);

+      }

+      else {

+        puVar10 = *(undefined8 **)(param_2 + 0x1d8);

+        param_1 = param_2;

+      }

+      local_58 = *puVar10;

+      local_50 = *(undefined4 *)(puVar10 + 1);

+      EtwTraceUIPIInputError(ptVar6,param_1,puVar10,&local_58,2);

     }

-    unaff_ESI = *(int *)(unaff_RBP + -1);

-  } while (*(int *)(unaff_RBP + -0x35) < 5000);

-  piVar9 = *(int **)(unaff_RBP + 0x6f);

-  *piVar9 = iVar11;

-  piVar9[1] = iVar12;

-  return;

+LAB_6:

+    puVar7 = (undefined1 *)0xc0000022;

+  }

+  return puVar7;

 }
```

## `_BlockInput`  (modified)

```diff
--- _BlockInput
+++ _BlockInput
@@ -1,90 +1,105 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 BOOL __stdcall _BlockInput(BOOL fBlockIt)

 

 {

   tagUIPI_INFO *ptVar1;

   char cVar2;

   bool bVar3;

   int iVar4;

   uint uVar5;

-  longlong in_RAX;

-  longlong lVar6;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  longlong unaff_RDI;

-  undefined4 in_stack_00000040;

-  undefined4 in_stack_00000044;

-  undefined4 in_stack_00000048;

+  tagTHREADINFO *ptVar6;

+  longlong lVar7;

+  longlong lVar8;

+  undefined1 auStack_68 [32];

+  undefined1 local_48;

+  undefined4 local_40;

+  undefined2 local_38;

+  undefined *local_30;

+  undefined4 local_28;

+  undefined4 local_24;

+  undefined4 local_20;

+  ulonglong local_18;

   

-  if (*(longlong *)(unaff_RDI + 0x1f0) == *(longlong *)(in_RAX + 0x4b58)) {

-    cVar2 = RtlAreAllAccessesGranted(*(undefined4 *)(unaff_RDI + 0x3a8),(uint)unaff_RBP + 0x20);

-    if (cVar2 != '\0') {

-      iVar4 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

-      ptVar1 = (tagUIPI_INFO *)(*(longlong *)(unaff_RDI + 0x1d0) + 0x130);

-      if (iVar4 == 0) {

-        in_stack_00000044 = 0xffffffff;

-        in_stack_00000040 = 0x3000;

-        in_stack_00000048 = 0;

-        bVar3 = UIPrivilegeIsolation::CheckAccess(ptVar1,(tagUIPI_INFO *)&stack0x00000040,0);

-        if (bVar3) goto LAB_0;

-        SetLastNtError(0xc0000022);

-      }

-      else {

-        bVar3 = UIPrivilegeIsolation::MeetsUIPIThreshold

-                          ((UIPIAccessor *)

-                           (-(ulonglong)(*(longlong *)(unaff_RDI + 0x1d0) != 0) & (ulonglong)ptVar1)

-                           ,0x3000);

-        if (bVar3) {

-LAB_0:

-          lVar6 = W32GetUserSessionState();

-          if (unaff_ESI == 0) {

-            if (*(longlong *)(lVar6 + 0x4a88) != unaff_RDI) {

-              return 0;

-            }

-            lVar6 = W32GetUserSessionState();

-            *(longlong *)(lVar6 + 0x4a88) = unaff_RBP;

-            return 1;

-          }

-          if (*(longlong *)(lVar6 + 0x4a88) != unaff_RBP) {

-            return 0;

-          }

-          LOCK();

-          uVar5 = *(uint *)(unaff_RDI + 0x210);

-          if (uVar5 == 0) {

-            *(uint *)(unaff_RDI + 0x210) = (uint)unaff_RBP;

-            uVar5 = 0;

-          }

-          UNLOCK();

-          if ((uVar5 & 1) != 0) {

-            return 0;

-          }

-          lVar6 = W32GetUserSessionState();

-          *(longlong *)(lVar6 + 0x4a88) = unaff_RDI;

-          return 1;

-        }

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

-          cVar2 = (char)unaff_RBP;

-        }

-        else {

-          cVar2 = '\x01';

-        }

-        bVar3 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-        if ((cVar2 != '\0') || (bVar3)) {

-          lVar6 = W32GetUserSessionState();

-          WPP_RECORDER_AND_TRACE_SF_

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar2,bVar3,

-                     *(undefined8 *)(lVar6 + 0x10f98),3);

-        }

-      }

-      EtwTraceUIPISystemError(*(undefined8 *)(unaff_RDI + 0x1d0),0,2);

+  local_18 = __security_cookie ^ (ulonglong)auStack_68;

+  ptVar6 = PtiCurrent();

+  if (fBlockIt != 0) {

+    lVar7 = W32GetUserGdiSessionState();

+    lVar7 = *(longlong *)(lVar7 + 0x28);

+    lVar8 = PsGetCurrentProcess();

+    if ((lVar8 != lVar7) &&

+       ((lVar7 = W32GetUserSessionState(),

+        *(longlong *)(ptVar6 + 0x1f0) != *(longlong *)(lVar7 + 0x4b58) ||

+        (cVar2 = RtlAreAllAccessesGranted(*(undefined4 *)(ptVar6 + 0x3a8),0x20), cVar2 == '\0')))) {

+      SetLastNtError(0xc0000022);

       return 0;

     }

   }

-  SetLastNtError(0xc0000022);

+  iVar4 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  ptVar1 = (tagUIPI_INFO *)(*(longlong *)(ptVar6 + 0x1d0) + 0x130);

+  if (iVar4 == 0) {

+    local_24 = 0xffffffff;

+    local_28 = 0x3000;

+    local_20 = 0;

+    bVar3 = UIPrivilegeIsolation::CheckAccess(ptVar1,(tagUIPI_INFO *)&local_28,0);

+    if (!bVar3) {

+      SetLastNtError(0xc0000022);

+      goto LAB_0;

+    }

+  }

+  else {

+    bVar3 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                      ((UIPIAccessor *)

+                       (-(ulonglong)(*(longlong *)(ptVar6 + 0x1d0) != 0) & (ulonglong)ptVar1),0x3000

+                      );

+    if (!bVar3) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0)) ||

+         ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

+        cVar2 = '\0';

+      }

+      else {

+        cVar2 = '\x01';

+      }

+      bVar3 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar2 != '\0') || (bVar3)) {

+        lVar7 = W32GetUserSessionState();

+        local_30 = &WPP_3e7d817159a4344984659a3bce4a049a_Traceguids;

+        local_38 = 0x18;

+        local_40 = 0x14;

+        local_48 = 3;

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar2,bVar3,

+                   *(undefined8 *)(lVar7 + 0x10f98));

+      }

+LAB_0:

+      EtwTraceUIPISystemError(*(undefined8 *)(ptVar6 + 0x1d0),0,2);

+      return 0;

+    }

+  }

+  lVar7 = W32GetUserSessionState();

+  if (fBlockIt == 0) {

+    if (*(tagTHREADINFO **)(lVar7 + 0x4a88) == ptVar6) {

+      lVar7 = W32GetUserSessionState();

+      *(undefined8 *)(lVar7 + 0x4a88) = 0;

+      return 1;

+    }

+  }

+  else if (*(longlong *)(lVar7 + 0x4a88) == 0) {

+    LOCK();

+    uVar5 = *(uint *)(ptVar6 + 0x210);

+    if (uVar5 == 0) {

+      *(uint *)(ptVar6 + 0x210) = 0;

+      uVar5 = 0;

+    }

+    UNLOCK();

+    if ((uVar5 & 1) == 0) {

+      lVar7 = W32GetUserSessionState();

+      *(tagTHREADINFO **)(lVar7 + 0x4a88) = ptVar6;

+      return 1;

+    }

+  }

   return 0;

 }
```

## `CheckProcessIdentity`  (modified)

```diff
--- CheckProcessIdentity
+++ CheckProcessIdentity
@@ -1,10 +1,30 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* int __cdecl CheckProcessIdentity(struct tagWND * __ptr64,unsigned int,unsigned __int64,__int64)

+    */

 

 int __cdecl CheckProcessIdentity(tagWND *param_1,uint param_2,__uint64 param_3,__int64 param_4)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  int iVar1;

+  longlong *plVar2;

+  longlong lVar3;

+  longlong *plVar4;

+  

+  if (param_1 != (tagWND *)0xffffffffffffffff) {

+    plVar2 = (longlong *)PsGetCurrentProcessWin32Process();

+    plVar4 = (longlong *)0x0;

+    if (plVar2 != (longlong *)0x0) {

+      plVar4 = (longlong *)((ulonglong)plVar2 & -(ulonglong)(*plVar2 != 0));

+    }

+    iVar1 = CheckForMessageAccessCrossIL

+                      (plVar4,*(undefined8 *)(*(longlong *)(param_1 + 0x10) + 0x1d0),param_1,param_2

+                       ,param_3,param_4);

+    if ((iVar1 != 0) ||

+       (lVar3 = W32GetUserGdiSessionState(), *plVar4 == *(longlong *)(lVar3 + 0x28))) {

+      return 1;

+    }

+  }

+  UserSetLastError(5);

+  return 0;

 }
```

## `xxxDDETrackWindowDying`  (modified)

```diff
--- xxxDDETrackWindowDying
+++ xxxDDETrackWindowDying
@@ -1,11 +1,144 @@
 

-void xxxDDETrackWindowDying(void)

+void xxxDDETrackWindowDying(undefined8 param_1,_HEAD *param_2)

 

 {

-  code *pcVar1;

+  longlong lVar1;

+  int iVar2;

+  longlong lVar3;

+  tagTHREADINFO *ptVar4;

+  ulonglong uVar5;

+  _HEAD *p_Var6;

+  undefined8 uVar7;

+  tagXSTATE *ptVar8;

+  __uint64 _Var9;

+  bool bVar10;

+  _Win32HMThreadLockItem local_88 [16];

+  _Win32HMThreadLockItem local_78 [16];

+  undefined8 local_68;

+  longlong lStack_60;

+  code *local_58;

+  undefined8 local_50;

+  longlong lStack_48;

+  code *local_40;

   

-  pcVar1 = (code *)swi(3);

-  (*pcVar1)();

-  return;

+  do {

+    if (param_2 == (_HEAD *)0x0) {

+      return;

+    }

+    iVar2 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+    if (iVar2 != 0) {

+      iVar2 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+      if (iVar2 == 0) {

+        lVar3 = _HMPheFromObject(param_2);

+        bVar10 = (*(byte *)(lVar3 + 0x19) & 1) == 0;

+      }

+      else {

+        p_Var6 = (_HEAD *)HMValidateHandleNoSecure(*(undefined8 *)param_2,10);

+        bVar10 = p_Var6 == param_2;

+      }

+      if (!bVar10) {

+        return;

+      }

+    }

+    p_Var6 = *(_HEAD **)(param_2 + 0x18);

+    lVar3 = 0;

+    ptVar4 = PtiCurrent();

+    Win32HM_LockIntoThread<1>(ptVar4,p_Var6,local_78);

+    ptVar4 = PtiCurrent();

+    Win32HM_LockIntoThread<0>(ptVar4,param_2,local_88);

+    if (((*(uint *)(param_2 + 0x50) & 2) == 0) &&

+       ((((uVar5 = GetAppCompatFlags2(0x400), (uVar5 & 0x20) == 0 ||

+          (*(longlong *)(param_2 + 0x30) == 0)) ||

+         (lVar1 = *(longlong *)(*(longlong *)(param_2 + 0x30) + 0x10),

+         0x400 < *(uint *)(lVar1 + 0x2a0))) || ((*(uint *)(lVar1 + 0x2b0) & 0x20) == 0)))) {

+      iVar2 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

+      if (iVar2 != 0) {

+        *(uint *)(param_2 + 0x50) = *(uint *)(param_2 + 0x50) | 2;

+      }

+      if (*(__uint64 **)(param_2 + 0x28) == (__uint64 *)0x0) {

+        _Var9 = 0;

+      }

+      else {

+        _Var9 = **(__uint64 **)(param_2 + 0x28);

+      }

+      _PostTransformableMessageExtended

+                (*(tagWND **)(param_2 + 0x30),0x3e1,_Var9,0,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

+    }

+    lVar1 = *(longlong *)(param_2 + 0x20);

+    if (lVar1 == 0) {

+      bVar10 = true;

+    }

+    else {

+      bVar10 = (*(uint *)(lVar1 + 0x50) & 10) != 0;

+      if (bVar10) {

+        lVar3 = *(longlong *)(lVar1 + 0x48);

+        *(undefined8 *)(lVar1 + 0x48) = 0;

+      }

+      *(uint *)(*(longlong *)(param_2 + 0x20) + 0x50) =

+           *(uint *)(*(longlong *)(param_2 + 0x20) + 0x50) | 6;

+    }

+    lVar1 = *(longlong *)(param_2 + 0x48);

+    *(undefined8 *)(param_2 + 0x48) = 0;

+    local_40 = (code *)0xffffffffffffffff;

+    local_50 = 0;

+    lStack_48 = 0;

+    if (lVar1 != 0) {

+      ptVar4 = PtiCurrent();

+      local_50 = *(undefined8 *)(ptVar4 + 0x180);

+      *(undefined8 **)(ptVar4 + 0x180) = &local_50;

+      local_40 = xxxFreeListFree;

+      lStack_48 = lVar1;

+    }

+    local_58 = (code *)0xffffffffffffffff;

+    local_68 = 0;

+    lStack_60 = 0;

+    if (lVar3 != 0) {

+      ptVar4 = PtiCurrent();

+      local_68 = *(undefined8 *)(ptVar4 + 0x180);

+      *(undefined8 **)(ptVar4 + 0x180) = &local_68;

+      local_58 = xxxFreeListFree;

+      lStack_60 = lVar3;

+    }

+    if ((((*(uint *)(param_2 + 0x50) & 2) != 0) && (bVar10)) ||

+       ((*(uint *)(param_2 + 0x50) & 4) != 0)) {

+      iVar2 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+      if (iVar2 == 0) {

+        lVar3 = _HMPheFromObject(param_2);

+        bVar10 = (*(byte *)(lVar3 + 0x19) & 1) == 0;

+      }

+      else {

+        p_Var6 = (_HEAD *)HMValidateHandleNoSecure(*(undefined8 *)param_2,10);

+        bVar10 = p_Var6 == param_2;

+      }

+      if (bVar10) {

+        uVar7 = xxxFreeDdeConv(*(undefined8 *)(param_2 + 0x20));

+        *(undefined8 *)(param_2 + 0x20) = uVar7;

+      }

+      ptVar8 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                         ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_88);

+      if (ptVar8 != (tagXSTATE *)0x0) {

+        xxxFreeDdeConv(ptVar8);

+      }

+    }

+    else {

+      UnlinkConv((tagDDECONV *)param_2);

+      Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_88);

+    }

+    param_2 = (_HEAD *)Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

+                                 ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_78);

+    if (local_58 != (code *)0xffffffffffffffff) {

+      PopAndFreeW32ThreadLock(&local_68);

+      local_58 = (code *)0xffffffffffffffff;

+    }

+    if (local_40 != (code *)0xffffffffffffffff) {

+      PopAndFreeW32ThreadLock(&local_50);

+      local_40 = (code *)0xffffffffffffffff;

+    }

+    Win32HMThreadLockBase<tagDDECONV,0,1>::~Win32HMThreadLockBase<tagDDECONV,0,1>

+              ((Win32HMThreadLockBase<tagDDECONV,0,1> *)local_88);

+    Win32HMThreadLockBase<tagMONITOR,1,1>::~Win32HMThreadLockBase<tagMONITOR,1,1>

+              ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_78);

+  } while( true );

 }
```

## `xxxUnadviseAck`  (modified)

```diff
--- xxxUnadviseAck
+++ xxxRequestAck
@@ -1,41 +1,10 @@
 

-ulong __cdecl xxxUnadviseAck(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

+/* WARNING: Control flow encountered bad instruction data */

+

+ulong __cdecl xxxRequestAck(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

 

 {

-  uint *puVar1;

-  uint uVar2;

-  undefined4 uVar3;

-  longlong lVar4;

-  ulong uVar5;

-  ulonglong uVar6;

-  ulonglong uVar7;

-  longlong unaff_RDI;

-  char in_CF;

-  

-  *(char *)(unaff_RDI + 0x48) = *(char *)(unaff_RDI + 0x48) + (char)param_2 + in_CF;

-  uVar7 = (ulonglong)((int)&stack0x00000000 - 0x20);

-  if (*(int *)(*(longlong *)(param_1 + 2) + 0x6c0) < 1) {

-    *(undefined4 *)(uVar7 + 0x30) = 0x20000;

-    uVar3 = *(undefined4 *)(uVar7 + 0x30);

-    *(undefined8 *)(uVar7 - 8) = 0x1402abce7;

-    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",uVar3,0x307);

-  }

-  lVar4 = *(longlong *)(param_1 + 2);

-  LOCK();

-  puVar1 = (uint *)(lVar4 + 0x6c0);

-  uVar2 = *puVar1;

-  uVar6 = (ulonglong)uVar2;

-  *puVar1 = *puVar1 - 1;

-  UNLOCK();

-  if (uVar2 == 1) {

-    uVar5 = *param_1;

-    *(undefined8 *)(uVar7 - 8) = 0x1402abd04;

-    KeSetKernelStackSwapEnable(CONCAT71((int7)((ulonglong)lVar4 >> 8),(char)uVar5));

-    uVar6 = *(ulonglong *)(param_1 + 2);

-    *(ulonglong *)(uVar6 + 0x550) = *(ulonglong *)(uVar6 + 0x550) & 0xffffffffbfffffff;

-  }

-  param_1[2] = 0;

-  param_1[3] = 0;

-  return (ulong)uVar6;

+                    /* WARNING: Bad instruction - Truncating control flow here */

+  halt_baddata();

 }
```

## `GetPFFFromId`  (modified)

```diff
--- GetPFFFromId
+++ GetPFFFromId
@@ -1,28 +1,48 @@
+

+/* class PFF * __ptr64 __cdecl GetPFFFromId(class PFT * __ptr64,unsigned int,class PFF * __ptr64 *

+   __ptr64 * __ptr64) */

 

 PFF * __cdecl GetPFFFromId(PFT *param_1,uint param_2,PFF ***param_3)

 

 {

-  PFF *pPVar1;

-  longlong unaff_RBP;

-  undefined8 in_R9;

-  longlong lStack0000000000000028;

-  undefined8 uStack0000000000000030;

-  longlong lStack0000000000000038;

-  longlong lStack0000000000000058;

-  longlong lStack0000000000000068;

-  longlong lStack0000000000000078;

-  longlong lStack0000000000000088;

-  longlong lStack0000000000000098;

+  longlong lVar1;

+  longlong lVar2;

+  PFF *pPVar3;

+  tagPvtData *ptVar4;

+  ulonglong uVar5;

+  uint uVar6;

+  PFF *local_18 [2];

+  ulonglong uVar7;

   

-  lStack0000000000000098 = unaff_RBP + 0x9f;

-  lStack0000000000000088 = unaff_RBP + 0x97;

-  lStack0000000000000078 = unaff_RBP + 0x8f;

-  lStack0000000000000068 = unaff_RBP + 0x87;

-  lStack0000000000000058 = unaff_RBP + 0x7f;

-  lStack0000000000000038 = unaff_RBP + 0x6f;

-  lStack0000000000000028 = unaff_RBP + 0x67;

-  uStack0000000000000030 = 8;

-  pPVar1 = (PFF *)WppAutoLogTrace(param_1,param_2,7,in_R9,(short)param_3);

-  return pPVar1;

+  lVar2 = W32GetSessionState();

+  uVar5 = (ulonglong)*(uint *)(param_1 + 0x18);

+  uVar6 = param_2 >> 0x18;

+  lVar2 = *(longlong *)(lVar2 + 0x60);

+  if (uVar6 < *(uint *)(param_1 + 0x18)) {

+    do {

+      uVar7 = (ulonglong)uVar6;

+      pPVar3 = *(PFF **)(param_1 + uVar7 * 8 + 0x28);

+      lVar1 = uVar7 * 8;

+      while ((pPVar3 = SkipInvalidPff(pPVar3), pPVar3 != (PFF *)0x0 &&

+             (*(uint *)(pPVar3 + 0x94) != param_2))) {

+        pPVar3 = *(PFF **)(pPVar3 + 8);

+      }

+      uVar6 = (int)uVar7 + 0x100;

+    } while (uVar6 < (uint)uVar5);

+    if (pPVar3 != (PFF *)0x0) {

+      if ((param_1 == *(PFT **)(lVar2 + 0x4fb8)) &&

+         (local_18[0] = pPVar3, ptVar4 = PFFOBJ::pPvtDataMatch((PFFOBJ *)local_18,(ulong *)0x0),

+         ptVar4 == (tagPvtData *)0x0)) {

+        pPVar3 = (PFF *)0x0;

+      }

+      else if (param_3 != (PFF ***)0x0) {

+        *param_3 = (PFF **)(param_1 + lVar1 + 0x28);

+      }

+    }

+  }

+  else {

+    pPVar3 = (PFF *)0x0;

+  }

+  return pPVar3;

 }
```

## `_BlockInput`  (modified)

```diff
--- _BlockInput
+++ xxxQueryLegacyActivation
@@ -1,105 +1,56 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* __int64 __cdecl xxxQueryLegacyActivation(struct tagWND * __ptr64,struct tagWND *

+   __ptr64,short,struct tagPOINTEREVENTINT const * __ptr64) */

 

-BOOL __stdcall _BlockInput(BOOL fBlockIt)

+__int64 __cdecl

+xxxQueryLegacyActivation(tagWND *param_1,tagWND *param_2,short param_3,tagPOINTEREVENTINT *param_4)

 

 {

-  tagUIPI_INFO *ptVar1;

-  char cVar2;

-  bool bVar3;

-  int iVar4;

-  uint uVar5;

-  tagTHREADINFO *ptVar6;

-  longlong lVar7;

-  longlong lVar8;

-  undefined1 auStack_68 [32];

-  undefined1 local_48;

-  undefined4 local_40;

-  undefined2 local_38;

-  undefined *local_30;

-  undefined4 local_28;

-  undefined4 local_24;

-  undefined4 local_20;

-  ulonglong local_18;

+  undefined4 uVar1;

+  undefined8 uVar2;

+  undefined8 uVar3;

+  tagTHREADINFO *ptVar4;

+  longlong lVar5;

+  undefined8 uVar6;

+  __int64 _Var7;

+  undefined8 local_48;

+  undefined8 local_40;

+  undefined8 local_38;

   

-  local_18 = __security_cookie ^ (ulonglong)auStack_68;

-  ptVar6 = PtiCurrent();

-  if (fBlockIt != 0) {

-    lVar7 = W32GetUserGdiSessionState();

-    lVar7 = *(longlong *)(lVar7 + 0x28);

-    lVar8 = PsGetCurrentProcess();

-    if ((lVar8 != lVar7) &&

-       ((lVar7 = W32GetUserSessionState(),

-        *(longlong *)(ptVar6 + 0x1f0) != *(longlong *)(lVar7 + 0x4b58) ||

-        (cVar2 = RtlAreAllAccessesGranted(*(undefined4 *)(ptVar6 + 0x3a8),0x20), cVar2 == '\0')))) {

-      SetLastNtError(0xc0000022);

-      return 0;

+  uVar6 = 0;

+  local_48 = 0;

+  _Var7 = 3;

+  if (*(longlong *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d8) + 0x80) == 0) {

+    ptVar4 = PtiCurrent();

+    uVar2 = *(undefined8 *)(ptVar4 + 0x328);

+    ptVar4 = PtiCurrent();

+    uVar3 = *(undefined8 *)(param_4 + 0x28);

+    local_38 = *(undefined8 *)(ptVar4 + 0x31c);

+    uVar1 = *(undefined4 *)(ptVar4 + 0x324);

+    ptVar4 = PtiCurrent();

+    *(undefined8 *)(ptVar4 + 0x328) = uVar3;

+    local_48 = *(undefined8 *)(param_4 + 0x28);

+    if (((byte)*(undefined4 *)(*(longlong *)(param_1 + 0x28) + 0x120) & 0xf) != 2) {

+      local_40 = GetDPITransformationMonitor(local_48,param_1);

+      PhysicalToLogicalDPIPoint(&local_48,&local_48,0,&local_40);

+    }

+    ptVar4 = PtiCurrent();

+    *(undefined4 *)(ptVar4 + 0x31c) = (undefined4)local_48;

+    ptVar4 = PtiCurrent();

+    *(undefined4 *)(ptVar4 + 800) = local_48._4_4_;

+    if (param_2 != (tagWND *)0x0) {

+      uVar6 = *(undefined8 *)param_2;

+    }

+    lVar5 = xxxSendMessage(param_1,0x21,uVar6,(ulonglong)(ushort)param_3 | 0x2460000);

+    ptVar4 = PtiCurrent();

+    *(undefined8 *)(ptVar4 + 0x328) = uVar2;

+    ptVar4 = PtiCurrent();

+    *(undefined8 *)(ptVar4 + 0x31c) = local_38;

+    *(undefined4 *)(ptVar4 + 0x324) = uVar1;

+    if ((lVar5 != 3) && (lVar5 != 4)) {

+      _Var7 = 1;

     }

   }

-  iVar4 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

-  ptVar1 = (tagUIPI_INFO *)(*(longlong *)(ptVar6 + 0x1d0) + 0x130);

-  if (iVar4 == 0) {

-    local_24 = 0xffffffff;

-    local_28 = 0x3000;

-    local_20 = 0;

-    bVar3 = UIPrivilegeIsolation::CheckAccess(ptVar1,(tagUIPI_INFO *)&local_28,0);

-    if (!bVar3) {

-      SetLastNtError(0xc0000022);

-      goto LAB_0;

-    }

-  }

-  else {

-    bVar3 = UIPrivilegeIsolation::MeetsUIPIThreshold

-                      ((UIPIAccessor *)

-                       (-(ulonglong)(*(longlong *)(ptVar6 + 0x1d0) != 0) & (ulonglong)ptVar1),0x3000

-                      );

-    if (!bVar3) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x80000) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

-        cVar2 = '\0';

-      }

-      else {

-        cVar2 = '\x01';

-      }

-      bVar3 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar2 != '\0') || (bVar3)) {

-        lVar7 = W32GetUserSessionState();

-        local_30 = &WPP_3e7d817159a4344984659a3bce4a049a_Traceguids;

-        local_38 = 0x18;

-        local_40 = 0x14;

-        local_48 = 3;

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar2,bVar3,

-                   *(undefined8 *)(lVar7 + 0x10f98));

-      }

-LAB_0:

-      EtwTraceUIPISystemError(*(undefined8 *)(ptVar6 + 0x1d0),0,2);

-      return 0;

-    }

-  }

-  lVar7 = W32GetUserSessionState();

-  if (fBlockIt == 0) {

-    if (*(tagTHREADINFO **)(lVar7 + 0x4a88) == ptVar6) {

-      lVar7 = W32GetUserSessionState();

-      *(undefined8 *)(lVar7 + 0x4a88) = 0;

-      return 1;

-    }

-  }

-  else if (*(longlong *)(lVar7 + 0x4a88) == 0) {

-    LOCK();

-    uVar5 = *(uint *)(ptVar6 + 0x210);

-    if (uVar5 == 0) {

-      *(uint *)(ptVar6 + 0x210) = 0;

-      uVar5 = 0;

-    }

-    UNLOCK();

-    if ((uVar5 & 1) == 0) {

-      lVar7 = W32GetUserSessionState();

-      *(tagTHREADINFO **)(lVar7 + 0x4a88) = ptVar6;

-      return 1;

-    }

-  }

-  return 0;

+  return _Var7;

 }
```

## `xxxCreateWindowEx`  (modified)

```diff
--- xxxCreateWindowEx
+++ xxxCreateWindowEx
@@ -1,15 +1,1792 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

 

-void xxxCreateWindowEx(void)

+tagWND * xxxCreateWindowEx(uint param_1,tagMONITOR *param_2,ulonglong param_3,tagMONITOR *param_4,

+                          uint param_5,MinMaxOptions param_6,MinMaxOptions param_7,

+                          MinMaxOptions param_8,MinMaxOptions param_9,tagWND *param_10,

+                          SmartObjStackRef<struct_tagMENU> *param_11,tagTHREADINFO *param_12,

+                          longlong param_13,ZBID param_14,ushort param_15,uint param_16,

+                          undefined8 param_17)

 

 {

-  byte *pbVar1;

-  longlong in_RAX;

+  int *piVar1;

+  undefined1 auVar2 [16];

+  undefined1 auVar3 [16];

+  undefined1 auVar4 [16];

+  int iVar5;

+  long lVar6;

+  undefined4 uVar7;

+  uint uVar8;

+  MinMaxOptions MVar9;

+  MinMaxOptions MVar10;

+  int iVar11;

+  tagTHREADINFO *ptVar12;

+  longlong lVar13;

+  undefined8 *puVar14;

+  tagWND *ptVar15;

+  tagObjLock *this;

+  tagWND *ptVar16;

+  tagTHREADINFO *ptVar17;

+  tagMONITOR *ptVar18;

+  undefined4 *puVar19;

+  longlong lVar20;

+  longlong *plVar21;

+  tagMENU *ptVar22;

+  tagWND *ptVar23;

+  _LARGE_UNICODE_STRING *p_Var24;

+  tagXSTATE *ptVar25;

+  undefined8 uVar26;

+  _HEAD *p_Var27;

+  undefined8 uVar28;

+  HMENU pHVar29;

+  ulonglong uVar30;

+  __uint64 _Var31;

+  MinMaxOptions MVar32;

+  tagWND *ptVar33;

+  byte bVar34;

+  short sVar35;

+  ZBID ZVar36;

+  MinMaxOptions MVar37;

+  ushort *puVar38;

+  byte bVar39;

+  uint uVar40;

+  ushort uVar41;

+  bool bVar43;

+  undefined1 auStack_458 [32];

+  undefined4 local_438;

+  ulonglong local_430;

+  undefined8 local_428;

+  undefined4 local_420;

+  undefined4 local_418;

+  uint local_408;

+  MinMaxOptions local_404;

+  undefined4 local_400;

+  ushort local_3fc;

+  MinMaxOptions local_3f8;

+  MinMaxOptions local_3f4;

+  uint local_3f0;

+  longlong *local_3e8 [2];

+  MinMaxOptions local_3d8;

+  uint local_3d4;

+  undefined4 local_3d0;

+  uint local_3c8;

+  uint local_3c0;

+  tagMONITOR *local_3b8;

+  CloakState local_3b0;

+  undefined4 local_3ac;

+  int local_3a8;

+  MinMaxOptions local_3a4;

+  undefined8 *local_3a0 [2];

+  HMENU local_390;

+  int local_388;

+  undefined4 local_384;

+  int local_380;

+  uint local_37c;

+  tagWND *local_378;

+  tagTHREADINFO *local_370 [2];

+  Win32HMOptionalThreadLockAlways<tagMENU> local_360 [16];

+  undefined4 local_350;

+  undefined4 local_348;

+  tagMONITOR *local_340;

+  tagTHREADINFO *local_338;

+  tagWND *local_330;

+  longlong local_328;

+  tagWND *local_320;

+  tagMONITOR *local_318;

+  undefined8 local_310;

+  undefined8 uStack_308;

+  uint local_300;

+  uint local_2e0;

+  longlong local_2d8;

+  undefined4 uStack_2d0;

+  undefined4 uStack_2cc;

+  tagMONITOR *local_2c8;

+  AtomicExecutionCheck local_2c0 [16];

+  longlong *local_2b0;

+  tagWND *local_2a8;

+  tagMONITOR *local_2a0;

+  longlong lStack_298;

+  Win32HMThreadLockAlways<tagHOOK> local_290 [16];

+  tagMONITOR *local_280;

+  longlong local_278;

+  tagTHREADINFO *local_270;

+  HMENU local_268;

+  undefined8 local_260;

+  MinMaxOptions local_258;

+  MinMaxOptions local_254;

+  MinMaxOptions local_250;

+  MinMaxOptions local_24c;

+  uint local_248;

+  undefined8 local_240;

+  tagMONITOR *local_238;

+  uint local_230;

+  undefined8 local_228;

+  longlong lStack_220;

+  undefined8 local_218;

+  undefined8 uStack_210;

+  uint local_204;

+  undefined8 local_1f0;

+  undefined8 uStack_1e8;

+  undefined8 local_1e0;

+  undefined8 local_1d8;

+  undefined8 uStack_1d0;

+  tagWND *local_1c8;

+  undefined8 local_1c0;

+  Win32HMThreadLockBase<tagWND,1,0> local_1b8 [16];

+  tagTHREADINFO *local_1a8;

+  tagWND *local_1a0;

+  AtomicExecutionCheck local_180 [24];

+  undefined4 local_168;

+  undefined4 uStack_164;

+  undefined4 uStack_160;

+  undefined4 uStack_15c;

+  undefined4 local_158;

+  undefined4 uStack_154;

+  undefined4 uStack_150;

+  undefined4 uStack_14c;

+  undefined4 local_148;

+  undefined4 uStack_144;

+  undefined4 uStack_140;

+  undefined4 uStack_13c;

+  AtomicExecutionCheck local_138 [16];

+  Win32HMThreadLock<tagMENU> local_128 [16];

+  undefined8 local_118;

+  undefined8 uStack_110;

+  Win32HMThreadLockAlways<tagHOOK> local_100 [16];

+  SharedUserObjPointerFieldspwndParent<tagWND> local_f0 [16];

+  undefined1 local_e0 [16];

+  SharedUserObjPointerFieldspwndLastActive<tagWND> local_d0 [16];

+  SharedUserObjPointerFieldspwndOwner<tagWND> local_c0 [16];

+  SharedUserObjPointerFieldspwndParent<tagWND> local_b0 [16];

+  CDwmWindowNotifyBatch local_a0 [40];

+  MinMaxOptions local_78;

+  MinMaxOptions MStack_74;

+  undefined8 uStack_70;

+  undefined8 local_68;

+  int iStack_60;

+  int iStack_5c;

+  RECT local_58;

+  ulonglong local_48;

+  ushort uVar42;

   

-  pbVar1 = (byte *)(in_RAX + -0x75);

-  *pbVar1 = *pbVar1 >> 1 | *pbVar1 << 7;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  local_48 = __security_cookie ^ (ulonglong)auStack_458;

+  local_378 = param_10;

+  local_338 = param_12;

+  local_2d8 = param_13;

+  ptVar33 = (tagWND *)0x0;

+  local_384 = 0;

+  local_350 = 0;

+  local_388 = 0;

+  local_3a8 = 0;

+  local_408 = param_1;

+  local_3c8 = param_1;

+  local_3c0 = param_1;

+  local_3b8 = param_2;

+  local_340 = param_4;

+  local_318 = param_4;

+  local_2e0 = param_1;

+  local_280 = param_2;

+  SmartObjStackRef<tagCLS>::SmartObjStackRef<tagCLS>((SmartObjStackRef<tagCLS> *)local_3e8);

+  local_68 = 0;

+  iStack_60 = 0;

+  iStack_5c = 0;

+  local_78 = 0;

+  MStack_74 = 0;

+  uStack_70 = 0;

+  local_3a4 = 5;

+  local_348 = 5;

+  local_328 = 0;

+  memset(&local_278,0,0x70);

+  ptVar12 = PtiCurrent();

+  local_370[0] = ptVar12;

+  Win32HMOptionalThreadLockAlways<tagMENU>::Win32HMOptionalThreadLockAlways<tagMENU>(local_360);

+  local_1f0 = 0;

+  uStack_1e8 = 0;

+  local_1e0 = 0;

+  local_380 = 0;

+  local_37c = *(uint *)(*(longlong *)(ptVar12 + 0x1d0) + 0xc) & 0x2000;

+  local_3b0 = 0;

+  local_404 = 0;

+  local_310 = 0;

+  uStack_308 = 0;

+  SmartObjStackRef<tagMENU>::SmartObjStackRef<tagMENU>

+            ((SmartObjStackRef<tagMENU> *)local_3a0,param_11);

+  local_3f0 = 0;

+  AtomicExecutionCheck::AtomicExecutionCheck(local_2c0);

+  if (((*(uint *)(*(longlong *)(ptVar12 + 0x1d0) + 0xc) & 0x10000000) != 0) ||

+     (iVar5 = RegisterIconTitleClass(), iVar5 != 0)) {

+    if ((int)param_1 < 0) {

+      local_408 = param_1 & 0x7fffffff;

+      local_3c8 = local_408;

+    }

+    local_3ac = 800;

+    if (-1 < (int)param_1) {

+      local_3ac = 0;

+    }

+    local_3f8 = CONCAT22(local_3f8._2_2_,(short)local_3ac);

+    ptVar18 = *(tagMONITOR **)(ptVar12 + 0x1f0);

+    local_2c8 = ptVar18;

+    local_2a0 = ptVar18;

+    if ((param_10 == (tagWND *)0x0) || (*(tagMONITOR **)(param_10 + 0x18) == ptVar18)) {

+      MVar9 = 0;

+      if ((param_16 & 1) == 0) {

+LAB_0:

+        if (((param_16 & 2) == 0) ||

+           (iVar5 = IsImmersiveBroker(*(undefined8 *)(ptVar12 + 0x1d0)), iVar5 != 0)) {

+          if ((param_14 == 0) ||

+             (((iVar5 = IsValidBand(param_14), iVar5 != 0 && (param_14 != 0xf)) &&

+              ((((byte)*(ulonglong *)(*(longlong *)(ptVar12 + 0x1d0) + 0x330) & 0x30) != 0x10 ||

+               (((((*(ulonglong *)(*(longlong *)(ptVar12 + 0x1d0) + 0x330) >> 9 & 1) != 0 ||

+                  (param_14 != 1)) || (MVar9 != 0)) ||

+                (iVar5 = HasMessageRootWindow(param_10), iVar5 != 0)))))))) {

+            uVar42 = (ushort)(param_5 >> 0x10);

+            uVar41 = uVar42 & 0xc000;

+            local_3d4 = (uint)uVar41;

+            local_400 = CONCAT22(local_400._2_2_,uVar42) & 0xffffc000;

+            local_300 = (uint)(uVar41 == 0x4000);

+            if ((uVar41 != 0x4000) &&

+               (iVar5 = ShouldSetNoOwner(*(undefined8 *)(ptVar12 + 0x1d0),param_10),

+               local_378 = param_10, iVar5 != 0)) {

+              param_10 = ptVar33;

+              local_378 = ptVar33;

+            }

+            if ((param_10 == (tagWND *)0x0) || (iVar5 = IsDesktopWindow(param_10), iVar5 != 0)) {

+              ZVar36 = param_14;

+              if (param_14 == 0) {

+                lVar13 = *(longlong *)(ptVar12 + 0x1d0);

+                iVar5 = IsImmersiveAppIORestricted();

+                if (iVar5 == 0) {

+                  ZVar36 = 2;

+                  if (((*(byte *)(lVar13 + 0x330) & 2) == 0) || ((local_408 & 8) == 0)) {

+                    ZVar36 = 1;

+                  }

+                }

+                else {

+                  local_404 = 1;

+                  ZVar36 = 0xf;

+                }

+              }

+            }

+            else {

+              local_404 = *(byte *)(*(longlong *)(param_10 + 0x28) + 0xe8) & 0x40;

+              ZVar36 = *(ZBID *)(*(longlong *)(param_10 + 0x28) + 0xec);

+              if ((param_14 != 0) && (bVar43 = param_14 != ZVar36, ZVar36 = param_14, bVar43))

+              goto LAB_1;

+            }

+            local_3f4 = local_404;

+            bVar43 = IsValidBandForProcess(*(tagPROCESSINFO **)(ptVar12 + 0x1d0),ZVar36,param_10);

+            if (!bVar43) goto LAB_2;

+            if ((local_408 & 0x400000) == 0) {

+              if (param_10 == (tagWND *)0x0) {

+                if ((((ulonglong)local_3b8 & 0xffffffffffff0000) != 0) ||

+                   ((short)local_3b8 != -0x7ffe)) {

+                  plVar21 = (longlong *)PsGetCurrentProcessWin32Process();

+                  uVar30 = 0;

+                  if (plVar21 != (longlong *)0x0) {

+                    uVar30 = (ulonglong)plVar21 & -(ulonglong)(*plVar21 != 0);

+                  }

+                  if ((*(uint *)(uVar30 + 0x338) & 1) != 0) goto LAB_3;

+                }

+              }

+              else if ((uVar41 == 0x4000) &&

+                      ((*(byte *)(*(longlong *)(param_10 + 0x28) + 0x1a) & 0x50) == 0x40)) {

+LAB_3:

+                local_408 = local_408 | 0x400000;

+                local_3c8 = local_408;

+              }

+            }

+            if ((local_408 & 0x2200000) != 0x2200000) {

+              if ((*(longlong *)(ptVar12 + 0x278) != 0) &&

+                 (iVar5 = CheckGrantedAccess(*(undefined4 *)(ptVar12 + 0x3a8),2), iVar5 == 0))

+              goto LAB_4;

+              if (uVar41 != 0x4000) {

+LAB_5:

+                do {

+                  if ((param_3 & 0xffffffffffff0000) == 0) {

+                    uVar41 = (ushort)param_3;

+                    local_3fc = uVar41;

+                  }

+                  else {

+                    AtomicExecutionCheck::AtomicExecutionCheck(local_180);

+                    lVar13 = W32GetUserSessionState();

+                    puVar38 = (ushort *)(lVar13 + 0xa394);

+                    lVar6 = RtlStringCchCopyW(puVar38,0x100,*(ushort **)(param_3 + 8));

+                    if (lVar6 < 0) {

+                      local_3fc = 0;

+                      local_37c = 1;

+                      ptVar15 = ptVar33;

+                    }

+                    else {

+                      local_3fc = UserFindAtom(puVar38);

+                      ptVar15 = (tagWND *)(ulonglong)local_3fc;

+                    }

+                    uVar41 = (ushort)ptVar15;

+                    AtomicExecutionCheck::Disarm(local_180);

+                  }

+                  if ((uVar41 != 0) &&

+                     (puVar14 = (undefined8 *)

+                                GetClassPtr(uVar41,*(undefined8 *)(ptVar12 + 0x1d0),local_338),

+                     puVar14 != (undefined8 *)0x0)) {

+                    SmartObjStackRefBase<tagCLS>::operator=

+                              ((SmartObjStackRefBase<tagCLS> *)local_3e8,(tagCLS *)*puVar14);

+                    if (((*(ushort *)(*(longlong *)(*local_3e8[0] + 8) + 6) & 1) != 0) &&

+                       (iVar5 = PsGetWin32KFilterSet(), iVar5 == 5)) goto LAB_4;

+                    iVar5 = NeedsWindowEdge(param_5,local_408,0x3ff < param_15);

+                    if (iVar5 == 0) {

+                      local_408 = local_408 & 0xfffffeff;

+                    }

+                    else {

+                      local_408 = local_408 | 0x100;

+                    }

+                    LOCK();

+                    uVar40 = *(uint *)(ptVar12 + 0x210);

+                    if (uVar40 == 0) {

+                      *(uint *)(ptVar12 + 0x210) = 0;

+                      uVar40 = 0;

+                    }

+                    UNLOCK();

+                    local_3c8 = local_408;

+                    if ((uVar40 & 1) != 0) {

+                      local_3d8 = 0x20000;

+                      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x355);

+                    }

+                    ptVar15 = (tagWND *)HMAllocObject(ptVar12,ptVar18,1,0x1a0);

+                    local_320 = ptVar15;

+                    if (ptVar15 == (tagWND *)0x0) {

+                      iVar5 = UserGetLastError();

+                      if (iVar5 == 8) {

+                        auVar2._8_8_ = 0;

+                        auVar2._0_8_ = _DAT_6 << 8;

+                        TraceLoggingCreateWindowFailed

+                                  (1,SUB168(auVar2 * (ZEXT416(_DAT_7) << 0x20),8));

+                      }

+                      goto LAB_4;

+                    }

+                    tagObjLock::LockInitialize((tagObjLock *)(ptVar15 + 0x38));

+                    uVar7 = PsGetThreadId(*(undefined8 *)ptVar12);

+                    *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0x148) = uVar7;

+                    *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0x14c) =

+                         *(undefined4 *)(*(longlong *)(ptVar12 + 0x1d0) + 0x38);

+                    ptVar16 = ptVar15 + 0x140;

+                    *(tagWND **)(ptVar15 + 0x148) = ptVar16;

+                    *(tagWND **)ptVar16 = ptVar16;

+                    ptVar16 = ptVar15 + 0x150;

+                    *(tagWND **)(ptVar15 + 0x158) = ptVar16;

+                    *(tagWND **)ptVar16 = ptVar16;

+                    ptVar16 = ptVar15 + 0x160;

+                    *(tagWND **)(ptVar15 + 0x168) = ptVar16;

+                    *(tagWND **)ptVar16 = ptVar16;

+                    ptVar16 = ptVar15 + 400;

+                    *(tagWND **)(ptVar15 + 0x198) = ptVar16;

+                    *(tagWND **)ptVar16 = ptVar16;

+                    *(undefined4 *)(ptVar15 + 0x18c) = 5;

+                    *(undefined4 *)(ptVar15 + 0x188) = 1;

+                    this = (tagObjLock *)Win32AllocPoolZInit(0x20,0x68707355);

+                    *(tagObjLock **)(ptVar15 + 0x90) = this;

+                    if (this == (tagObjLock *)0x0) {

+                      tagObjLock::LockUnInitializeThreadCreator((tagObjLock *)(ptVar15 + 0x38));

+                      HMFreeObject(ptVar15);

+                      goto LAB_4;

+                    }

+                    tagObjLock::LockInitialize(this);

+                    if ((*(uint *)(*(longlong *)(*(longlong *)(ptVar15 + 0x10) + 0x1d0) + 0x330) >>

+                         0x18 & 1) != 0) {

+                      *(uint *)(ptVar15 + 0x180) = *(uint *)(ptVar15 + 0x180) | 1;

+                    }

+                    *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0x128) = 0;

+                    *(undefined8 *)(ptVar15 + 0x118) = 0;

+                    *(undefined4 *)(ptVar15 + 0xb4) = 0xffffffff;

+                    *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0xa8) = 0;

+                    uVar7 = W32GetCurrentThreadDpiHostingBehavior();

+                    *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0x124) = uVar7;

+                    if ((((short)local_3d4 == 0x4000) && (param_10 != (tagWND *)0x0)) &&

+                       (ptVar16 = (tagWND *)GetThreadDesktopWindow(0), param_10 != ptVar16)) {

+                      ptVar17 = PtiCurrent();

+                      ptVar16 = ptVar33;

+                      if ((ptVar17 != (tagTHREADINFO *)0x0) && (*(longlong *)(ptVar17 + 0x1f0) != 0)

+                         ) {

+                        ptVar16 = *(tagWND **)(*(longlong *)(ptVar17 + 0x1f0) + 0x70);

+                      }

+                      if (((param_10 == ptVar16) ||

+                          (*(longlong *)(ptVar12 + 0x1d0) !=

+                           *(longlong *)(*(longlong *)(param_10 + 0x10) + 0x1d0))) ||

+                         (bVar43 = IsChildWindowDpiIsolationEnabled((tagWND *)0x0,param_10), bVar43)

+                         ) goto LAB_8;

+                      *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0x120) =

+                           *(undefined4 *)(*(longlong *)(param_10 + 0x28) + 0x120);

+                      uVar40 = *(uint *)(*(longlong *)(param_10 + 0x28) + 0x120);

+                      uVar8 = W32GetCurrentThreadDpiAwarenessContext();

+                      if (((uVar8 ^ uVar40) & 0xf) != 0) {

+                        TraceChildWindowDpiTelemetry(ptVar15,param_10,0);

+                      }

+                    }

+                    else {

+LAB_8:

+                      uVar7 = W32GetCurrentThreadDpiAwarenessContext();

+                      *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0x120) = uVar7;

+                      if ((*(uint *)(*(longlong *)(ptVar15 + 0x28) + 0x120) & 0x4000000f) == 0) {

+                        plVar21 = (longlong *)PsGetCurrentProcessWin32Process();

+                        uVar30 = 0;

+                        if (plVar21 != (longlong *)0x0) {

+                          uVar30 = (ulonglong)plVar21 & -(ulonglong)(*plVar21 != 0);

+                        }

+                        if ((*(uint *)(uVar30 + 0xc) & 0x20000000) != 0) {

+                          *(uint *)(*(longlong *)(ptVar15 + 0x28) + 0x120) =

+                               *(uint *)(*(longlong *)(ptVar15 + 0x28) + 0x120) | 0x40000000;

+                        }

+                      }

+                    }

+                    bVar39 = (byte)*(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0x120);

+                    if (((bVar39 & 0xf) == 2) && ((bVar39 & 0xf0) == 0x20)) {

+                      *(uint *)(ptVar15 + 0x17c) = *(uint *)(ptVar15 + 0x17c) | 0x180000;

+                    }

+                    if (((byte)*(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0x120) & 0xf) == 3) {

+                      *(uint *)(ptVar15 + 0x17c) = *(uint *)(ptVar15 + 0x17c) | 0x80000;

+                    }

+                    tagWND::SharedMixedObjectPointerFieldpcls<tagCLS>::operator=

+                              ((SharedMixedObjectPointerFieldpcls<tagCLS> *)(ptVar15 + 0x88),

+                               (tagCLS *)*local_3e8[0]);

+                    *(uint *)(*(longlong *)(ptVar15 + 0x28) + 0x1c) = param_5 & 0xefffffff;

+                    *(uint *)(*(longlong *)(ptVar15 + 0x28) + 0x18) = local_408 & 0xfdf7ffff;

+                    *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 200) =

+                         *(undefined4 *)(*(longlong *)(*local_3e8[0] + 8) + 0x50);

+                    *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0xf8) =

+                         *(undefined4 *)(*(longlong *)(*local_3e8[0] + 8) + 0x54);

+                    iVar5 = ReferenceClass(*local_3e8[0],ptVar15);

+                    if (iVar5 != 0) {

+                      SmartObjStackRefBase<tagCLS>::operator=

+                                ((SmartObjStackRefBase<tagCLS> *)local_3e8,

+                                 *(tagCLS **)(ptVar15 + 0x88));

+                      iVar5 = ClassLock(*local_3e8[0]);

+                      if (iVar5 != 0) {

+                        *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0xe0) = param_17;

+                        sVar35 = *(short *)(*(longlong *)(*local_3e8[0] + 8) + 2);

+                        lVar13 = W32GetUserSessionState();

+                        if (sVar35 == *(short *)(*(longlong *)(lVar13 + 0x4e30) + 0x364)) {

+                          *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0xd0) = 0;

+                        }

+                        else {

+                          ptVar16 = ptVar33;

+                          if (*(undefined8 **)(ptVar12 + 0x340) != (undefined8 *)0x0) {

+                            ptVar16 = (tagWND *)**(undefined8 **)(ptVar12 + 0x340);

+                          }

+                          *(tagWND **)(*(longlong *)(ptVar15 + 0x28) + 0xd0) = ptVar16;

+                        }

+                        *(ZBID *)(*(longlong *)(ptVar15 + 0x28) + 0xec) = ZVar36;

+                        lVar13 = *(longlong *)(ptVar15 + 0x28);

+                        MVar32 = 0;

+                        MVar9 = MVar32;

+                        if (*(int *)(lVar13 + 0xec) != 1) {

+                          MVar9 = IsTopLevelParent(param_10);

+                        }

+                        if (MVar9 != 0) {

+                          *(uint *)(lVar13 + 0x18) = *(uint *)(lVar13 + 0x18) | 8;

+                        }

+                        if (local_404 != 0) {

+                          SetOrClrWF(1,ptVar15,0xd840,0);

+                        }

+                        *(int *)(ptVar12 + 0x3b0) = *(int *)(ptVar12 + 0x3b0) + 1;

+                        memset(&local_278,0,0x70);

+                        local_230 = local_408;

+                        local_270 = local_338;

+                        if (((ulonglong)local_3b8 & 0xffffffffffff0000) == 0) {

+                          local_238 = local_3b8;

+                        }

+                        else if ((int)local_3c0 < 0) {

+                          local_238 = *(tagMONITOR **)(*local_3e8[0] + 0x68);

+                          if (((ulonglong)local_238 & 0xffffffffffff0000) != 0) {

+                            RtlInitLargeAnsiString(&local_218);

+                          }

+                        }

+                        else {

+                          local_238 = *(tagMONITOR **)(local_3b8 + 8);

+                          local_218 = *(undefined8 *)local_280;

+                          uStack_210 = *(undefined8 *)(local_280 + 8);

+                        }

+                        if (local_318 != (tagMONITOR *)0x0) {

+                          local_240 = *(undefined8 *)(local_318 + 8);

+                          local_228 = *(undefined8 *)local_340;

+                          lStack_220 = *(longlong *)(local_340 + 8);

+                        }

+                        local_248 = param_5;

+                        local_3f8 = param_6;

+                        local_24c = param_6;

+                        local_3f4 = param_7;

+                        local_250 = param_7;

+                        local_404 = param_8;

+                        local_254 = param_8;

+                        local_3d8 = param_9;

+                        local_258 = param_9;

+                        if (param_10 == (tagWND *)0x0) {

+                          local_260 = 0;

+                        }

+                        else {

+                          local_260 = *(undefined8 *)param_10;

+                        }

+                        MVar9 = param_6;

+                        if ((short)local_3d4 == 0x4000) {

+                          local_268 = local_390;

+                          if (local_390 == (HMENU)0x0) {

+                            local_268 = (HMENU)*local_3a0[0];

+                          }

+                          *(uint *)(*(longlong *)(ptVar15 + 0x28) + 0x18) =

+                               *(uint *)(*(longlong *)(ptVar15 + 0x28) + 0x18) |

+                               *(uint *)(*(longlong *)(param_10 + 0x28) + 0x18) & 0xc4000000;

+                        }

+                        else {

+                          bVar43 = SmartObjStackRef<tagMENU>::operator==

+                                             ((SmartObjStackRef<tagMENU> *)local_3a0,param_6);

+                          if (bVar43) {

+                            local_268 = (HMENU)0x0;

+                          }

+                          else {

+                            local_268 = *(HMENU *)*local_3a0[0];

+                          }

+                        }

+                        local_278 = local_2d8;

+                        local_58.left = MVar32;

+                        if ((MVar9 != 0x80000000) && (MVar9 != 0x8000)) {

+                          local_58.left = MVar9;

+                        }

+                        if ((param_7 == 0x80000000) || (param_7 == 0x8000)) {

+                          param_7 = MVar32;

+                        }

+                        local_58.top = param_7;

+                        if ((param_8 == 0x80000000) ||

+                           (ptVar16 = (tagWND *)(ulonglong)param_8, param_8 == 0x8000)) {

+                          ptVar16 = ptVar33;

+                        }

+                        local_58.right = local_58.left + (int)ptVar16;

+                        if ((param_9 == 0x80000000) || (param_9 == 0x8000)) {

+                          param_9 = MVar32;

+                        }

+                        local_58.bottom = param_9 + param_7;

+                        ptVar18 = (tagMONITOR *)GetInheritedMonitor(ptVar15);

+                        local_340 = ptVar18;

+                        local_2c8 = ptVar18;

+                        if ((ptVar18 == (tagMONITOR *)0x0) && (param_10 != (tagWND *)0x0)) {

+                          ptVar18 = (tagMONITOR *)

+                                    ValidateHmonitorNoRip

+                                              (*(undefined8 *)

+                                                (*(longlong *)(param_10 + 0x28) + 0x100));

+                        }

+                        if (ptVar18 == (tagMONITOR *)0x0) {

+                          ptVar18 = (tagMONITOR *)_MonitorFromRect(&local_58,2);

+                        }

+                        UpdateWindowMonitorAndDpiInfoHelper(ptVar15,ptVar18);

+                        *(undefined2 *)(*(longlong *)(ptVar15 + 0x28) + 0x11e) = 0;

+                        *(undefined8 *)(ptVar15 + 0x128) = 0;

+                        sVar35 = (short)local_3d4;

+                        if ((sVar35 != 0x4000) ||

+                           (bVar43 = IsDpiBoundaryBetweenWindows(ptVar15,param_10), bVar43)) {

+                          UpdateTopLevelWindowDPITransform(ptVar15,ptVar18);

+                        }

+                        local_3b8 = (tagMONITOR *)0x0;

+                        if ((sVar35 == 0x4000) && (param_10 != (tagWND *)0x0)) {

+                          *(undefined2 *)(*(longlong *)(ptVar15 + 0x28) + 0x11e) =

+                               *(undefined2 *)(*(longlong *)(param_10 + 0x28) + 0x11e);

+                          piVar1 = *(int **)(param_10 + 0x128);

+                          if (piVar1 != (int *)0x0) {

+                            *(int **)(ptVar15 + 0x128) = piVar1;

+                            *piVar1 = *piVar1 + 1;

+                          }

+                        }

+                        if (*(longlong *)(ptVar15 + 0x18) != 0) {

+                          GetMessageWindow(ptVar15);

+                          puVar19 = (undefined4 *)LockPointer(local_f0,(_HEAD *)(ptVar15 + 0x68));

+                          local_168 = *puVar19;

+                          uStack_164 = puVar19[1];

+                          uStack_160 = puVar19[2];

+                          uStack_15c = puVar19[3];

+                          HMAssignmentLock(&local_168,0);

+                        }

+                        iVar5 = IsWindowDesktopComposed(ptVar15);

+                        if (iVar5 != 0) {

+                          ptVar16 = param_10;

+                          if ((sVar35 != 0x4000) &&

+                             ((param_10 == (tagWND *)0x0 ||

+                              (param_10 != *(tagWND **)(*(longlong *)(param_10 + 0x18) + 0x70))))) {

+                            ptVar16 = (tagWND *)GetThreadDesktopWindow(0);

+                          }

+                          DwmWindowCreate(ptVar15,ptVar16,&local_58);

+                        }

+                        *(tagTHREADINFO **)(*(longlong *)(ptVar15 + 0x28) + 0x20) = local_338;

+                        uVar28 = MapClientNeuterToClientPfn(*local_3e8[0],0,(undefined2)local_3ac);

+                        *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0x78) = uVar28;

+                        bVar43 = (*(ushort *)(*(longlong *)(*local_3e8[0] + 8) + 6) & 1) == 0;

+                        if (bVar43) {

+                          uVar28 = 0x204;

+                        }

+                        else {

+                          SetOrClrWF(1,ptVar15,0x204,1);

+                          uVar28 = 0xda04;

+                        }

+                        SetOrClrWF(!bVar43,ptVar15,uVar28,bVar43);

+                        if (((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1e) & 0x30) != 0) &&

+                           ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0xea) & 4) != 0)) {

+                          local_400 = 0x20000;

+                          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x4bc);

+                        }

+                        AtomicExecutionCheck::Disarm(local_2c0);

+                        Win32HMThreadLockAlways<tagHOOK>::Win32HMThreadLockAlways<tagHOOK>

+                                  (local_290,ptVar12,(tagHOOK *)ptVar15);

+                        bVar39 = *(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x12) & 4;

+                        if (*(int *)(*(longlong *)(*local_3e8[0] + 8) + 0x54) == 0) {

+LAB_9:

+                          iVar5 = PsGetWin32KFilterSet();

+                          if (iVar5 == 5) {

+                            if (bVar39 == 0) {

+                              local_400 = 0x20000;

+                              MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x4e3);

+                              goto LAB_10;

+                            }

+                          }

+                          else {

+LAB_10:

+                            if (bVar39 == 0) {

+                              iVar5 = PsGetWin32KFilterSet();

+                              if (iVar5 == 5) {

+                                lVar13 = *(longlong *)(ptVar15 + 0x28);

+                                uVar40 = *(int *)(lVar13 + 200) + 7;

+LAB_11:

+                                *(uint *)(lVar13 + 200) = uVar40 & 0xfffffff8;

+                                *(int *)(*(longlong *)(ptVar15 + 0x28) + 200) =

+                                     *(int *)(*(longlong *)(ptVar15 + 0x28) + 200) + 0x30;

+                              }

+                              else {

+                                iVar5 = Feature_UserModeNonClientScrollBars2__private_IsEnabledDeviceUsageNoInline

+                                                  ();

+                                if ((iVar5 != 0) &&

+                                   (bVar43 = Scrollbar::NonClient::

+                                             UserModeSupportsUserModeScrollBars(), bVar43)) {

+                                  bVar43 = Scrollbar::NonClient::

+                                           UserModeSupportsPartitionedExtraBytes();

+                                  lVar13 = *(longlong *)(ptVar15 + 0x28);

+                                  uVar40 = *(int *)(lVar13 + 200) + 7;

+                                  if (!bVar43) goto LAB_11;

+                                  *(uint *)(lVar13 + 0x150) =

+                                       (uVar40 & 0xfffffff8) - *(int *)(lVar13 + 200);

+                                  *(int *)(*(longlong *)(ptVar15 + 0x28) + 0x150) =

+                                       *(int *)(*(longlong *)(ptVar15 + 0x28) + 0x150) + 0x30;

+                                }

+                              }

+                            }

+                          }

+                          iVar5 = GetClientExtraBytesTotalSize(ptVar15);

+                          if (iVar5 != 0) {

+                            lVar13 = xxxClientAllocWindowClassExtraBytes(iVar5);

+                            if (lVar13 == 0) {

+                              uVar40 = 2;

+                              goto LAB_12;

+                            }

+                            iVar5 = IsWindowBeingDestroyed(ptVar15);

+                            if (((iVar5 == 0) &&

+                                (lVar20 = _HMPheFromObject(ptVar15),

+                                (*(byte *)(lVar20 + 0x19) & 1) == 0)) &&

+                               (*(longlong *)(*(longlong *)(ptVar15 + 0x28) + 0x128) == 0)) {

+                              *(longlong *)(*(longlong *)(ptVar15 + 0x28) + 0x128) = lVar13;

+                              sVar35 = (short)local_3d4;

+                              goto LAB_13;

+                            }

+                            UserSetLastError(0x57);

+                            *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0x78) = 0;

+                            SetOrClrWF(1,ptVar15,0x204,1);

+                            uVar40 = local_3f0;

+                            goto LAB_14;

+                          }

+LAB_13:

+                          iVar5 = PsGetWin32KFilterSet();

+                          uVar40 = local_3c0;

+                          if ((iVar5 == 5) && (bVar39 == 0)) {

+                            puVar14 = (undefined8 *)GETCLIENTWNDINFO(ptVar15);

+                            uVar40 = local_3c0;

+                            local_318 = *(tagMONITOR **)(*(longlong *)(ptVar15 + 0x28) + 0x78);

+                            *puVar14 = local_318;

+                            lVar13 = W32GetUserSessionState();

+                            if ((int)uVar40 < 0) {

+                              uVar28 = *(undefined8 *)(*(longlong *)(lVar13 + 0x4e30) + 0x240);

+                            }

+                            else {

+                              uVar28 = *(undefined8 *)(*(longlong *)(lVar13 + 0x4e30) + 0x300);

+                            }

+                            *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0x78) = uVar28;

+                          }

+                          if (((*(longlong *)(*local_3e8[0] + 0x50) != 0) &&

+                              (*(longlong *)(*local_3e8[0] + 0x70) == 0)) &&

+                             (iVar5 = PsGetWin32KFilterSet(), iVar5 != 5)) {

+                            xxxCreateClassSmIcon(local_3e8);

+                          }

+                          SetOrClrWF(1,ptVar15,(undefined2)local_3ac,1);

+                          if (((*(ushort *)(*(longlong *)(*local_3e8[0] + 8) + 6) & 2) != 0) ||

+                             (((int)uVar40 < 0 &&

+                              (((((((lVar13 = W32GetUserSessionState(), uVar41 = local_3fc,

+                                    local_3fc == *(ushort *)(*(longlong *)(lVar13 + 0x4e30) + 0x364)

+                                    || (lVar13 = W32GetUserSessionState(),

+                                       uVar41 == *(ushort *)(*(longlong *)(lVar13 + 0x4e30) + 0x36e)

+                                       )) || (lVar13 = W32GetUserSessionState(),

+                                             uVar41 == *(ushort *)

+                                                        (*(longlong *)(lVar13 + 0x4e30) + 0x372)))

+                                  || ((lVar13 = W32GetUserSessionState(),

+                                      uVar41 == *(ushort *)(*(longlong *)(lVar13 + 0x4e30) + 0x388)

+                                      || (lVar13 = W32GetUserSessionState(),

+                                         uVar41 == *(ushort *)

+                                                    (*(longlong *)(lVar13 + 0x4e30) + 0x366))))) ||

+                                 (lVar13 = W32GetUserSessionState(),

+                                 uVar41 == *(ushort *)(*(longlong *)(lVar13 + 0x4e30) + 0x36a))) ||

+                                ((lVar13 = W32GetUserSessionState(),

+                                 uVar41 == *(ushort *)(*(longlong *)(lVar13 + 0x4e30) + 0x370) ||

+                                 (lVar13 = W32GetUserSessionState(),

+                                 uVar41 == *(ushort *)(*(longlong *)(lVar13 + 0x4e30) + 0x382)))))

+                               || (lVar13 = W32GetUserSessionState(), uVar40 = local_3c0,

+                                  uVar41 == *(ushort *)(*(longlong *)(lVar13 + 0x4e30) + 0x368))))))

+                             ) {

+                            SetOrClrWF(1,ptVar15,0x208,1);

+                            uVar40 = local_3c0;

+                          }

+                          if (((((*(ushort *)(*(longlong *)(*local_3e8[0] + 8) + 6) & 2) != 0) ||

+                               ((int)uVar40 < 0)) && (sVar35 != 0x4000)) &&

+                             (local_2d8 = PsGetProcessPeb(**(undefined8 **)

+                                                            (*(longlong *)(ptVar15 + 0x10) + 0x1d0))

+                             , local_2d8 != 0)) {

+                            sVar35 = *(short *)(local_2d8 + 0x34c);

+                            if (sVar35 == -0x217) {

+                              local_3ac = 0x20000;

+                              MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x582);

+                            }

+                            if (sVar35 == -0x2968) {

+                              local_3d4 = 0x20000;

+                              MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000,0x583);

+                            }

+                          }

+                          ptVar12 = local_370[0];

+                          uVar40 = local_408;

+                          uVar8 = GetAppCompatFlags(local_370[0]);

+                          if ((uVar8 >> 0x1b & 1) != 0) {

+                            SetOrClrWF(1,ptVar15,0x408,1);

+                            local_408 = uVar40 & 0x3f;

+                            local_230 = local_230 & 0x3f;

+                          }

+                          SetOrClrWF(1,ptVar15,0x501,1);

+                          SetOrClrWF(1,ptVar15,0x502,1);

+                          SetOrClrWF(1,ptVar15,0x504,1);

+                          uVar40 = (uint)param_15;

+                          if (param_15 <= *(ushort *)(ptVar12 + 0x2a4)) {

+                            uVar40 = *(uint *)(ptVar12 + 0x2a4);

+                          }

+                          *(uint *)(ptVar15 + 0x100) = uVar40;

+                          uVar40 = GetAppCompatFlags2(0x9900);

+                          if ((uVar40 & 0x10000000) != 0) {

+                            SetOrClrWF(1,ptVar15,0xa80,1);

+                          }

+                          iVar5 = IsInsideUserApiHook();

+                          if (iVar5 != 0) {

+                            xxxLoadUserApiHook();

+                          }

+                          ptVar16 = ptVar15;

+                          iVar5 = WantImeWindow(param_10,ptVar15);

+                          if (iVar5 != 0) {

+                            if ((*(longlong *)(ptVar12 + 0x338) != 0) &&

+                               ((lVar13 = _HMPheFromObject(), (*(byte *)(lVar13 + 0x19) & 1) != 0 ||

+                                (iVar5 = IsWindowBeingDestroyed(*(undefined8 *)(ptVar12 + 0x338)),

+                                iVar5 != 0)))) {

+                              local_3d0 = 0x20000;

+                              ptVar16 = (tagWND *)0x20000;

+                              MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x5d7);

+                            }

+                            *(uint *)(ptVar15 + 0x17c) = *(uint *)(ptVar15 + 0x17c) | 0x10000000;

+                            *(int *)(ptVar12 + 0x3b8) = *(int *)(ptVar12 + 0x3b8) + 1;

+                          }

+                          if (((*(uint *)(**(longlong **)(ptVar12 + 0x1f8) + 0x10) |

+                               *(uint *)(ptVar12 + 0x2d0)) & 0x40) == 0) {

+                            local_378 = (tagWND *)0x0;

+                          }

+                          else {

+                            local_2b0 = &local_278;

+                            local_2a8 = (tagWND *)0x0;

+                            iVar5 = xxxCallHook(3,*(__uint64 *)ptVar15,(__int64)&local_2b0,5);

+                            if (iVar5 != 0) {

+                              uVar40 = 6;

+                              goto LAB_14;

+                            }

+                            local_3f8 = local_24c;

+                            local_3f4 = local_250;

+                            local_404 = local_254;

+                            local_3d8 = local_258;

+                            local_378 = local_2a8;

+                            ptVar16 = local_2a8;

+                            param_6 = local_24c;

+                          }

+                          MVar9 = (MinMaxOptions)ptVar16;

+                          bVar39 = *(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0;

+                          local_400 = CONCAT31(local_400._1_3_,

+                                               *(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f)) &

+                                      0xffffffc0;

+                          if ((bVar39 == 0x40) && (uVar40 = local_3f0, param_10 == (tagWND *)0x0))

+                          goto LAB_14;

+                          if ((bVar39 == 0x40) != local_300) {

+                            local_390 = (HMENU)0x0;

+                            MVar9 = 0;

+                            SmartObjStackRefBase<tagMENU>::operator=

+                                      ((SmartObjStackRefBase<tagMENU> *)local_3a0,(tagMENU *)0x0);

+                            bVar39 = (byte)local_400;

+                          }

+                          bVar34 = *(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0;

+                          if (bVar34 != 0) {

+                            if ((param_6 == 0x80000000) || (param_6 == 0x8000)) {

+                              local_3f8 = 0;

+                              local_3f4 = 0;

+                              param_6 = 0;

+                            }

+                            if ((local_404 == 0x80000000) || (local_404 == 0x8000)) {

+                              local_404 = 0;

+                              local_3d8 = 0;

+                            }

+                          }

+                          MStack_74 = local_3f4;

+                          uStack_70 = CONCAT44(local_3d8,local_404);

+                          local_78 = param_6;

+                          if (bVar39 == 0x40) {

+                            local_310 = *(undefined8 *)(*(longlong *)(param_10 + 0x28) + 0x68);

+                            uStack_308 = *(undefined8 *)(*(longlong *)(param_10 + 0x28) + 0x70);

+                            ptVar16 = param_10;

+                            MVar10 = local_3f4;

+                            MVar37 = param_6;

+                            bVar43 = IsDpiBoundaryBetweenWindows(ptVar15,param_10);

+                            MVar9 = (MinMaxOptions)ptVar16;

+                            if (bVar43) {

+                              ptVar16 = ptVar15 + 0xe0;

+                              *(undefined4 *)ptVar16 = 0;

+                              *(undefined4 *)(ptVar15 + 0xe4) = 0;

+                              LogicalToPhysicalInPlaceRectWithSubpixel(param_10,&local_310,ptVar16);

+                              puVar14 = &local_310;

+                              PhysicalToLogicalInPlaceRectWithSubpixel(ptVar15,puVar14,ptVar16);

+                              MVar9 = (MinMaxOptions)puVar14;

+                              param_6 = local_3f8;

+                              MVar10 = MStack_74;

+                              MVar37 = local_78;

+                            }

+                            ptVar16 = (tagWND *)_GetDesktopWindow();

+                            if (param_10 != ptVar16) {

+                              local_78 = MVar37 + (int)local_310;

+                              MStack_74 = MVar10 + local_310._4_4_;

+                            }

+                            local_378 = (tagWND *)0x1;

+                          }

+                          if (bVar34 == 0) {

+                            SetOrClrWF(1,ptVar15,0xf04,1);

+                            local_384 = 0xc0;

+                            SetOrClrWF(1,ptVar15,0x901,1);

+                            SetOrClrWF(1,ptVar15,0x10,1);

+                            if ((((param_6 == 0x80000000) || (param_6 == 0x8000)) &&

+                                (MStack_74 != 0x80000000)) && (MStack_74 != 0x8000)) {

+                              local_3a4 = MStack_74;

+                            }

+                            ptVar16 = (tagWND *)local_3b8;

+                            if ((local_340 == (tagMONITOR *)0x0) &&

+                               (((param_6 == 0x80000000 || (param_6 == 0x8000)) ||

+                                ((local_404 == 0x80000000 || (local_404 == 0x8000)))))) {

+                              if (*(longlong *)(*(longlong *)(ptVar12 + 0x1d0) + 0x2c0) == 0) {

+                                if (param_10 != (tagWND *)0x0) {

+                                  ptVar16 = (tagWND *)_MonitorFromWindowInternal(param_10,2,0);

+                                }

+                              }

+                              else {

+                                ptVar16 = (tagWND *)ValidateHmonitor();

+                              }

+                              if (ptVar16 == (tagWND *)0x0) {

+                                lVar13 = GetDispInfo();

+                                ptVar16 = (tagWND *)*(tagMONITOR **)(lVar13 + 0x68);

+                                goto LAB_15;

+                              }

+                            }

+                            else {

+LAB_15:

+                              if ((ptVar16 == (tagWND *)0x0) &&

+                                 (ptVar16 = (tagWND *)

+                                            ValidateHmonitor(*(undefined8 *)

+                                                              (*(longlong *)(ptVar15 + 0x28) + 0x100

+                                                              )), ptVar16 == (tagWND *)0x0)) {

+                                ptVar16 = ptVar33;

+                                if (local_340 != (tagMONITOR *)0x0) {

+                                  ptVar16 = (tagWND *)GetInheritedMonitor(ptVar15);

+                                }

+                                if (ptVar16 == (tagWND *)0x0) {

+                                  ptVar16 = (tagWND *)

+                                            _MonitorFromRect((LPCRECT)(*(longlong *)(ptVar15 + 0x28)

+                                                                      + 0x58),2);

+                                }

+                                UpdateWindowMonitorAndDpiInfoHelper(ptVar15,(tagMONITOR *)ptVar16);

+                                UpdateTopLevelWindowDPITransform(ptVar15,ptVar16);

+                              }

+                            }

+                            SetTiledRect(ptVar15,&local_68,ptVar16);

+                            if ((local_3f8 == 0x80000000) || (local_3f8 == 0x8000)) {

+                              iVar5 = 1;

+                              if ((*(uint *)(*(longlong *)(ptVar12 + 0x1d0) + 0x324) & 4) == 0) {

+                                local_3f8 = (MinMaxOptions)local_68;

+                                local_3f4 = local_68._4_4_;

+                                local_78 = (MinMaxOptions)local_68;

+                                MStack_74 = local_68._4_4_;

+                              }

+                              else {

+                                local_3a8 = 1;

+                                local_3f8 = *(MinMaxOptions *)

+                                             (*(longlong *)(ptVar12 + 0x1d0) + 0x314);

+                                local_3f4 = *(MinMaxOptions *)

+                                             (*(longlong *)(ptVar12 + 0x1d0) + 0x318);

+                                local_78 = local_3f8;

+                                MStack_74 = local_3f4;

+                              }

+                            }

+                            else {

+                              iVar5 = local_388;

+                              if (*(short *)(ptVar16 + 0x4a) != 0) {

+                                *(short *)(ptVar16 + 0x4a) = *(short *)(ptVar16 + 0x4a) + -1;

+                              }

+                            }

+                            MVar9 = local_3f8;

+                            if (((MinMaxOptions)uStack_70 == -0x80000000) ||

+                               ((MinMaxOptions)uStack_70 == 0x8000)) {

+                              if ((*(uint *)(*(longlong *)(ptVar12 + 0x1d0) + 0x324) & 2) == 0) {

+                                uStack_70 = CONCAT44(iStack_5c - local_3f4,iStack_60 - local_3f8);

+                              }

+                              else {

+                                local_3a8 = 1;

+                                uStack_70 = CONCAT44(*(undefined4 *)

+                                                      (*(longlong *)(ptVar12 + 0x1d0) + 800),

+                                                     *(undefined4 *)

+                                                      (*(longlong *)(ptVar12 + 0x1d0) + 0x31c));

+                              }

+                            }

+                            else if (iVar5 != 0) {

+                              plVar21 = (longlong *)GetMonitorRect(local_e0,ptVar16);

+                              local_2a0 = (tagMONITOR *)*plVar21;

+                              lStack_298 = plVar21[1];

+                              MVar9 = ((MinMaxOptions)uStack_70 - (int)plVar21[1]) + local_78;

+                              iVar5 = (uStack_70._4_4_ - (int)((ulonglong)plVar21[1] >> 0x20)) +

+                                      MStack_74;

+                              if (0 < (int)MVar9) {

+                                local_3f8 = local_3f8 - MVar9;

+                                MVar10 = (MinMaxOptions)local_2a0;

+                                local_78 = local_3f8;

+                                if ((int)local_3f8 < (int)MVar10) {

+                                  local_3f8 = MVar10;

+                                  local_78 = MVar10;

+                                }

+                              }

+                              if (0 < iVar5) {

+                                MVar9 = local_3f4 - iVar5;

+                                MVar10 = (MinMaxOptions)((ulonglong)local_2a0 >> 0x20);

+                                local_3f4 = MVar9;

+                                MStack_74 = MVar9;

+                                if ((int)MVar9 < (int)MVar10) {

+                                  local_3f4 = MVar10;

+                                  MStack_74 = MVar10;

+                                }

+                              }

+                            }

+                          }

+                          if (local_3a8 != 0) {

+                            *(uint *)(*(longlong *)(ptVar12 + 0x1d0) + 0x324) =

+                                 *(uint *)(*(longlong *)(ptVar12 + 0x1d0) + 0x324) & 0xfffffff9;

+                          }

+                          if (((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) + 0x80 &

+                              0xbf) == 0) {

+                            ptVar16 = ptVar15;

+                            SetOrClrWF(1,ptVar15,0xf04,1);

+                            MVar9 = (MinMaxOptions)ptVar16;

+                          }

+                          *(ushort *)(*(longlong *)(ptVar15 + 0x28) + 0x1e) =

+                               *(ushort *)(*(longlong *)(ptVar15 + 0x28) + 0x1e) | (ushort)local_384

+                          ;

+                          bVar43 = SmartObjStackRef<tagMENU>::operator==

+                                             ((SmartObjStackRef<tagMENU> *)local_3a0,MVar9);

+                          if (((bVar43) && ((byte)local_400 != '@')) &&

+                             (*(longlong *)(*local_3e8[0] + 0x60) != 0)) {

+                            local_1d8 = 0;

+                            uStack_1d0 = 0;

+                            ptVar16 = ptVar15;

+                            if (*(tagWND **)(ptVar15 + 0x68) != (tagWND *)0x0) {

+                              ptVar16 = *(tagWND **)(ptVar15 + 0x68);

+                            }

+                            zzzLockDisplayAreaAndInvalidateDCCache(ptVar16,0x10);

+                            RtlInitUnicodeStringOrId

+                                      (&local_1d8,*(undefined8 *)(*local_3e8[0] + 0x60));

+                            ptVar22 = (tagMENU *)

+                                      xxxClientLoadMenu(*(undefined8 *)

+                                                         (*(longlong *)(*local_3e8[0] + 8) + 0x40),

+                                                        &local_1d8);

+                            local_390 = (HMENU)0x0;

+                            SmartObjStackRefBase<tagMENU>::operator=

+                                      ((SmartObjStackRefBase<tagMENU> *)local_3a0,ptVar22);

+                            iVar5 = (int)ptVar22;

+                            if (((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) == 0x40)

+                               || (iVar11 = IsWindowBeingDestroyed(ptVar15), iVar11 != 0)) {

+                              pHVar29 = local_390;

+                              if (local_390 == (HMENU)0x0) {

+                                pHVar29 = (HMENU)*local_3a0[0];

+                              }

+                              _DestroyMenu(pHVar29);

+                              local_390 = (HMENU)0x0;

+                              SmartObjStackRefBase<tagMENU>::operator=

+                                        ((SmartObjStackRefBase<tagMENU> *)local_3a0,(tagMENU *)0x0);

+                              uVar40 = local_3f0;

+                              goto LAB_14;

+                            }

+                            bVar43 = SmartObjStackRef<tagMENU>::operator==

+                                               ((SmartObjStackRef<tagMENU> *)local_3a0,iVar5);

+                            if (bVar43) {

+                              local_268 = (HMENU)0x0;

+                            }

+                            else {

+                              local_268 = *(HMENU *)*local_3a0[0];

+                            }

+                          }

+                          if ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) == 0x40) {

+                            pHVar29 = local_390;

+                            if (local_390 == (HMENU)0x0) {

+                              pHVar29 = (HMENU)*local_3a0[0];

+                            }

+                            *(HMENU *)(*(longlong *)(ptVar15 + 0x28) + 0x140) = pHVar29;

+                            *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0x98) = 0;

+                            *(undefined8 *)(ptVar15 + 0xa8) = 0;

+                          }

+                          else {

+                            *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0x140) = 0;

+                            LockWndMenuWorker(ptVar15,false,(SmartObjStackRef<tagMENU> *)local_3a0);

+                          }

+                          if ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) == 0x40) {

+                            uVar40 = local_3f0;

+                            if (param_10 == (tagWND *)0x0) goto LAB_14;

+                            if ((param_16 & 2) != 0) goto LAB_16;

+                          }

+                          else {

+                            if ((param_16 & 4) != 0) {

+                              CoreWindowProp::ChangeRole(ptVar15,1,true);

+                            }

+                            puVar19 = (undefined4 *)LockPointer(local_d0,(_HEAD *)(ptVar15 + 200));

+                            local_158 = *puVar19;

+                            uStack_154 = puVar19[1];

+                            uStack_150 = puVar19[2];

+                            uStack_14c = puVar19[3];

+                            HMAssignmentLock(&local_158,0);

+                            iVar5 = IsTopLevelParent(param_10);

+                            if (iVar5 == 0) {

+                              ptVar16 = (tagWND *)GetNonChildAncestor();

+                              iVar5 = ValidateOwnerDepth(ptVar15,ptVar16);

+                              if (iVar5 != 0) {

+                                if (ptVar16 != (tagWND *)0x0) {

+                                  *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0xec) =

+                                       *(undefined4 *)(*(longlong *)(ptVar16 + 0x28) + 0xec);

+                                  SetOrClrWF(*(byte *)(*(longlong *)(ptVar16 + 0x28) + 0xe8) & 0x40,

+                                             ptVar15,0xd840,1);

+                                  local_3b0 = GetWindowCloakStateComponentUIAware(ptVar16);

+                                }

+                                puVar19 = (undefined4 *)

+                                          LockPointer(local_c0,(_HEAD *)(ptVar15 + 0x78));

+                                local_148 = *puVar19;

+                                uStack_144 = puVar19[1];

+                                uStack_140 = puVar19[2];

+                                uStack_13c = puVar19[3];

+                                HMAssignmentLock(&local_148,1);

+                                if ((*(longlong *)(ptVar15 + 0x78) != 0) &&

+                                   (((*(byte *)(*(longlong *)(*(longlong *)(ptVar15 + 0x78) + 0x28)

+                                               + 0x18) & 8) != 0 ||

+                                    (*(int *)(*(longlong *)(ptVar15 + 0x28) + 0xec) != 1)))) {

+                                  SetOrClrWF(1,ptVar15,0x808,1);

+                                }

+                                lVar13 = W32GetUserSessionState();

+                                if (((local_3fc !=

+                                      *(ushort *)(*(longlong *)(lVar13 + 0x4e30) + 0x382)) &&

+                                    (*(longlong *)(ptVar15 + 0x78) != 0)) &&

+                                   (ptVar17 = *(tagTHREADINFO **)

+                                               (*(longlong *)(ptVar15 + 0x78) + 0x10),

+                                   ptVar17 != ptVar12)) {

+                                  zzzAttachThreadInput(ptVar12,ptVar17,1);

+                                }

+                                goto LAB_17;

+                              }

+LAB_16:

+                              UserSetLastError(0x57);

+                              uVar40 = local_3f0;

+                              goto LAB_14;

+                            }

+                            local_1c8 = ptVar15 + 0x78;

+                            *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0x40) = 0;

+                            local_1c0 = 0;

+                            HMAssignmentLock(&local_1c8,0);

+LAB_17:

+                            iVar5 = Feature_Scoobe_ShellHost__private_IsEnabledDeviceUsageNoInline()

+                            ;

+                            if (*(longlong *)(ptVar15 + 0x78) == 0) {

+                              if (iVar5 == 0) {

+                                iVar5 = CoreWindowProp::IsComponent(ptVar15);

+                                if (iVar5 == 0) {

+                                  uVar40 = *(uint *)(*(longlong *)(ptVar15 + 0x28) + 0xec);

+                                  if ((0xf < uVar40) || ((0xaf00U >> (uVar40 & 0x1f) & 1) == 0)) {

+                                    bVar39 = *(byte *)(*(longlong *)(ptVar15 + 0x28) + 0xe8);

+                                    goto LAB_18;

+                                  }

+                                  goto LAB_19;

+                                }

+                              }

+                              else {

+                                iVar5 = CoreWindowProp::IsComponent(ptVar15);

+                                if (iVar5 == 0) {

+                                  iVar5 = *(int *)(*(longlong *)(ptVar15 + 0x28) + 0xec);

+                                  if ((3 < iVar5 - 8U) && (iVar5 != 0xf)) {

+                                    bVar39 = *(byte *)(*(longlong *)(ptVar15 + 0x28) + 0xe8);

+LAB_18:

+                                    if ((bVar39 & 0x40) == 0) goto LAB_20;

+                                  }

+LAB_19:

+                                  local_3b0 = 2;

+                                }

+                              }

+                            }

+LAB_20:

+                            if ((param_10 == (tagWND *)0x0) ||

+                               (param_10 != *(tagWND **)(*(longlong *)(param_10 + 0x18) + 0x70))) {

+                              param_10 = (tagWND *)GetThreadDesktopWindow(0);

+                              Win32HM_LockIntoThread<1>

+                                        (ptVar12,(_HEAD *)param_10,

+                                         (_Win32HMThreadLockItem *)local_360);

+                              local_380 = 1;

+                            }

+                            if ((param_16 & 2) != 0) {

+                              if (*(longlong *)(ptVar12 + 0x648) != 0) goto LAB_16;

+                              SetOrClrWF(1,ptVar15,0xd880,1);

+                              *(ulonglong *)(ptVar12 + 0x550) =

+                                   *(ulonglong *)(ptVar12 + 0x550) | 0x40000;

+                              *(uint *)(*(longlong *)(ptVar12 + 0x1d8) + 0x214) =

+                                   *(uint *)(*(longlong *)(ptVar12 + 0x1d8) + 0x214) | 0x2000000;

+                              if (*(longlong *)(ptVar12 + 0x640) == 0) {

+                                lVar13 = CreateKernelEvent(1,0);

+                                *(longlong *)(ptVar12 + 0x640) = lVar13;

+                                if (lVar13 == 0) {

+                                  uVar40 = 7;

+                                  goto LAB_14;

+                                }

+                              }

+                              local_1a8 = ptVar12 + 0x648;

+                              local_1a0 = ptVar15;

+                              HMAssignmentLock(&local_1a8,0);

+                            }

+                          }

+                          if ((*(uint *)(ptVar15 + 0x17c) & 0x1000000) != 0) {

+                            local_328 = *(longlong *)(ptVar15 + 0x68);

+                            UnlinkWindow(ptVar15,local_328);

+                          }

+                          iVar5 = IsTopLevelParent(param_10);

+                          if (iVar5 == 0) {

+                            *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0xec) =

+                                 *(undefined4 *)(*(longlong *)(param_10 + 0x28) + 0xec);

+                            SetOrClrWF(*(byte *)(*(longlong *)(param_10 + 0x28) + 0xe8) & 0x40,

+                                       ptVar15,0xd840,1);

+                          }

+                          if ((param_10 != (tagWND *)0x0) &&

+                             (iVar5 = ValidateNewParent(ptVar15,param_10,1), iVar5 == 0)) {

+                            uVar40 = 9;

+                            goto LAB_14;

+                          }

+                          plVar21 = (longlong *)LockPointer(local_b0,(_HEAD *)(ptVar15 + 0x68));

+                          local_2d8 = *plVar21;

+                          uStack_2d0 = (undefined4)plVar21[1];

+                          uStack_2cc = *(undefined4 *)((longlong)plVar21 + 0xc);

+                          HMAssignmentLock(&local_2d8,0);

+                          ptVar16 = ptVar33;

+                          if (param_10 != (tagWND *)0x0) {

+                            ptVar16 = (tagWND *)

+                                      (ulonglong)

+                                      -(uint)((*(uint *)(*(longlong *)(param_10 + 0x28) + 0xe8) >> 9

+                                              & 1) != 0);

+                          }

+                          SetWindowSubtreeCoreWindowStatus(ptVar15,ptVar16);

+                          lVar13 = *(longlong *)(ptVar15 + 0x28);

+                          if (((byte)*(undefined4 *)(lVar13 + 0x120) & 0xf) == 2) {

+                            bVar43 = ShouldUseLogPixelsForWindowMetrics(ptVar15);

+                            *(uint *)(lVar13 + 0xe8) =

+                                 (uint)bVar43 << 10 | *(uint *)(lVar13 + 0xe8) & 0xfffffbff;

+                          }

+                          if ((local_3b0 & 2) == 0) {

+                            *(uint *)(ptVar15 + 0x180) = *(uint *)(ptVar15 + 0x180) | 4;

+                          }

+                          if ((local_3b0 != 0) &&

+                             (lVar6 = zzzSetWindowCompositionCloak(ptVar15,local_3b0), lVar6 < 0)) {

+                            uVar7 = RtlNtStatusToDosError(lVar6);

+                            UserSetLastError(uVar7);

+                            uVar40 = 8;

+                            goto LAB_14;

+                          }

+                          AtomicExecutionCheck::AtomicExecutionCheck(local_138);

+                          if (local_328 != 0) {

+                            zzzLockDisplayAreaAndInvalidateDCCache(local_328,0x10);

+                          }

+                          if (param_10 != (tagWND *)0x0) {

+                            zzzLockDisplayAreaAndInvalidateDCCache(param_10,0x10);

+                          }

+                          AtomicExecutionCheck::Disarm(local_138);

+                          if (((((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) == 0x40)

+                               && (iVar5 = _IsTopLevelWindow(ptVar15), iVar5 == 0)) &&

+                              (p_Var27 = *(_HEAD **)(ptVar15 + 0x68), p_Var27 != (_HEAD *)0x0)) &&

+                             (ptVar12 != *(tagTHREADINFO **)(p_Var27 + 0x10))) {

+                            if (param_10 != (tagWND *)p_Var27) {

+                              local_3d0 = 0x20000;

+                              MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x89d);

+                            }

+                            zzzAttachThreadInput

+                                      (ptVar12,*(undefined8 *)(*(longlong *)(ptVar15 + 0x68) + 0x10)

+                                       ,1);

+                            ptVar16 = *(tagWND **)(ptVar15 + 0x68);

+                            ptVar23 = (tagWND *)GetMessageWindow(ptVar15);

+                            if (((ptVar16 != ptVar23) &&

+                                (((*(uint *)(*(longlong *)(ptVar15 + 0x28) + 0x120) ^

+                                  *(uint *)(*(longlong *)(ptVar16 + 0x28) + 0x120)) & 0xf) != 0)) &&

+                               (bVar43 = IsChildWindowDpiIsolationEnabled(ptVar15,ptVar16), !bVar43)

+                               ) {

+                              xxxForceUpdateProcessDpiAwarenessContext

+                                        (ptVar15,*(ulong *)(*(longlong *)

+                                                             (*(longlong *)(ptVar15 + 0x68) + 0x28)

+                                                           + 0x120));

+                            }

+                          }

+                          lVar13 = W32GetUserSessionState();

+                          if (((param_3 != *(ushort *)(lVar13 + 0xa210)) && (param_3 != 0x8001)) &&

+                             (*(int *)(ptVar12 + 0x3b0) == 0)) {

+                            LOCK();

+                            *(int *)(*(longlong *)(local_370[0] + 0x1e8) + 0x14) =

+                                 (int)((ulonglong)_DAT_7 * _DAT_fffff78000000320 >>

+                                      0x18);

+                            UNLOCK();

+                            xxxUpdateInputHangInfo((tagWND *)0x0,1);

+                          }

+                          xxxAdjustSize(ptVar15,&uStack_70,(longlong)&uStack_70 + 4);

+                          ConstrainWindowSIZERECT(&local_78);

+                          if (((*(longlong *)(ptVar15 + 0x18) != 0) &&

+                              ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0x40) == 0)) &&

+                             (-1 < *(char *)(*(longlong *)(ptVar15 + 0x28) + 0x18))) {

+                            CheckFullScreen(ptVar15,&local_78,0,1);

+                          }

+                          MVar9 = (MinMaxOptions)uStack_70;

+                          if ((int)(MinMaxOptions)uStack_70 < 0) {

+                            MVar9 = MVar32;

+                          }

+                          if (uStack_70 < 0) {

+                            uStack_70._4_4_ = MVar32;

+                          }

+                          uStack_70 = CONCAT44(uStack_70._4_4_,MVar9);

+                          RECTFromSIZERECT(*(longlong *)(ptVar15 + 0x28) + 0x58,&local_78);

+                          if ((byte)local_400 == '@') {

+                            ptVar16 = (tagWND *)

+                                      ValidateHmonitorNoRip

+                                                (*(undefined8 *)

+                                                  (*(longlong *)(param_10 + 0x28) + 0x100));

+                          }

+                          else {

+                            ptVar16 = ptVar33;

+                            if (local_2c8 != (tagMONITOR *)0x0) {

+                              ptVar16 = (tagWND *)GetInheritedMonitor(ptVar15);

+                            }

+                          }

+                          if ((ptVar16 != (tagWND *)0x0) ||

+                             (ptVar16 = (tagWND *)

+                                        _MonitorFromRect((LPCRECT)(*(longlong *)(ptVar15 + 0x28) +

+                                                                  0x58),2), ptVar23 = ptVar33,

+                             ptVar16 != (tagWND *)0x0)) {

+                            ptVar23 = *(tagWND **)ptVar16;

+                          }

+                          if (ptVar23 != *(tagWND **)(*(longlong *)(ptVar15 + 0x28) + 0x100)) {

+                            UpdateWindowMonitorAndDpiInfoHelper(ptVar15,(tagMONITOR *)ptVar16);

+                            if ((byte)local_400 != '@') {

+                              UpdateTopLevelWindowDPITransform(ptVar15,ptVar16);

+                            }

+                          }

+                          if (((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1b) & 0x20) != 0) &&

+                             (lVar13 = GetRedirectionBitmap(ptVar15), lVar13 != 0)) {

+                            lVar13 = W32GetUserSessionState();

+                            GreLockVisRgn(*(undefined8 *)(*(longlong *)(lVar13 + 0xdf10) + 0x30));

+                            local_430 = 0;

+                            local_438 = 0;

+                            iVar5 = RecreateRedirectionBitmap(ptVar15,0,0,0);

+                            if (iVar5 < 0) {

+                              lVar13 = W32GetUserSessionState();

+                              GreUnlockVisRgn(*(undefined8 *)(*(longlong *)(lVar13 + 0xdf10) + 0x30)

+                                             );

+                              uVar40 = 3;

+                              goto LAB_14;

+                            }

+                            lVar13 = W32GetUserSessionState();

+                            GreUnlockVisRgn(*(undefined8 *)(*(longlong *)(lVar13 + 0xdf10) + 0x30));

+                          }

+                          if (((*(byte *)(*(longlong *)(*local_3e8[0] + 8) + 8) & 0x20) != 0) ||

+                             (((*(byte *)(*(longlong *)(*local_3e8[0] + 8) + 8) & 0x40) != 0 &&

+                              (*(longlong *)(*local_3e8[0] + 0x28) == 0)))) {

+                            lVar13 = GetStyleWindow(ptVar15,0xb20);

+                            lVar20 = W32GetUserSessionState();

+                            GreLockVisRgn(*(undefined8 *)(*(longlong *)(lVar20 + 0xdf10) + 0x30));

+                            lVar13 = CreateCacheDC(ptVar15,(-(uint)(lVar13 != 0) & 0x4000) + 0x8000,

+                                                   0);

+                            if (lVar13 == 0) {

+                              lVar13 = W32GetUserSessionState();

+                              GreUnlockVisRgn(*(undefined8 *)(*(longlong *)(lVar13 + 0xdf10) + 0x30)

+                                             );

+                              uVar40 = 10;

+                              goto LAB_14;

+                            }

+                            lVar13 = W32GetUserSessionState();

+                            GreUnlockVisRgn(*(undefined8 *)(*(longlong *)(lVar13 + 0xdf10) + 0x30));

+                          }

+                          uVar40 = local_408;

+                          if ((((local_408 >> 0x13 & 1) != 0) &&

+                              ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1a) & 8) == 0)) &&

+                             (iVar5 = xxxSetLayeredWindow(ptVar15,0,0), iVar5 < 0)) {

+                            uVar40 = 0xb;

+                            goto LAB_14;

+                          }

+                          if (((uVar40 >> 0x19 & 1) != 0) &&

+                             (lVar13 = GetStyleWindow(*(undefined8 *)(ptVar15 + 0x68),0xb02),

+                             lVar13 == 0)) {

+                            SetOrClrWF(1,ptVar15,0xb02,1);

+                            iVar5 = SetRedirectedWindow(ptVar15,2);

+                            if (iVar5 < 0) {

+                              SetOrClrWF(0,ptVar15,0xb02,1);

+                              uVar40 = 0xc;

+                              goto LAB_14;

+                            }

+                          }

+                          local_24c = local_3f8;

+                          local_250 = local_3f4;

+                          local_254 = local_404;

+                          local_258 = local_3d8;

+                          local_418 = 1;

+                          local_420 = 1;

+                          local_428 = 0;

+                          local_430 = local_430 & 0xffffffff00000000;

+                          local_438 = 0;

+                          lVar13 = xxxSendTransformableMessageTimeout(ptVar15,0x81,0,&local_278);

+                          uVar40 = local_3f0;

+                          if (lVar13 == 0) goto LAB_14;

+                          if ((*(byte *)(*(longlong *)(*(longlong *)(ptVar15 + 0x88) + 8) + 9) & 2)

+                              != 0) {

+                            ptVar22 = (tagMENU *)xxxGetSystemMenu(ptVar15,0);

+                            local_390 = (HMENU)0x0;

+                            SmartObjStackRefBase<tagMENU>::operator=

+                                      ((SmartObjStackRefBase<tagMENU> *)local_3a0,ptVar22);

+                            bVar43 = SmartObjStackRef<tagMENU>::operator==

+                                               ((SmartObjStackRef<tagMENU> *)local_3a0,(int)ptVar22)

+                            ;

+                            if (!bVar43) {

+                              Win32HMThreadLock<tagMENU>::

+                              Win32HMThreadLock<tagMENU><SmartObjStackRef>

+                                        (local_128,(SmartObjStackRef<tagMENU> *)local_3a0);

+                              xxxRemoveDeleteMenuHelper

+                                        ((SmartObjStackRef<tagMENU> *)local_3a0,5,0x400,1);

+                              xxxRemoveDeleteMenuHelper

+                                        ((SmartObjStackRef<tagMENU> *)local_3a0,5,0x400,1);

+                              Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

+                                        ((Win32HMThreadLockBase<tagWND,1,0> *)local_128);

+                            }

+                          }

+                          if (((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x12) & 2) != 0) &&

+                             (((lStack_220 == 0 || ((int)local_228 != 0)) ||

+                              (*(longlong *)(ptVar15 + 0xb8) != 0)))) {

+                            local_118 = 0;

+                            uStack_110 = 0;

+                            local_240 = *(undefined8 *)(ptVar15 + 0xb8);

+                            p_Var24 = tagWND::ProtectedLargeUnicodeStringWNDstrName::getStrName

+                                                ((ProtectedLargeUnicodeStringWNDstrName *)

+                                                 (ptVar15 + 0xb8),

+                                                 (_LARGE_UNICODE_STRING *)&local_118);

+                            local_228 = *(undefined8 *)p_Var24;

+                            lStack_220 = *(longlong *)(p_Var24 + 8);

+                          }

+                          lVar13 = W32GetUserSessionState();

+                          if ((((**(uint **)(lVar13 + 0x4e30) & 4) != 0) &&

+                              (ptVar12 = local_370[0] + 0x338, *(longlong *)ptVar12 == 0)) &&

+                             ((*(uint *)(ptVar15 + 0x17c) & 0x10000000) != 0)) {

+                            local_330 = xxxCreateDefaultImeWindow(ptVar15,local_3fc,local_338);

+                            local_338 = ptVar12;

+                            HMAssignmentLock(&local_338,0);

+                            if (*(tagHOOK **)ptVar12 != (tagHOOK *)0x0) {

+                              Win32HMThreadLockAlways<tagHOOK>::Win32HMThreadLockAlways<tagHOOK>

+                                        (local_100,local_370[0],*(tagHOOK **)ptVar12);

+                              local_418 = 1;

+                              local_420 = 1;

+                              local_428 = 0;

+                              local_430 = local_430 & 0xffffffff00000000;

+                              local_438 = 0;

+                              xxxSendTransformableMessageTimeout(*(longlong *)ptVar12,0x287,0x21);

+                              Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+                                        ((Win32HMThreadLockBase<tagWND,0,0> *)local_100);

+                            }

+                            ptVar12 = local_370[0];

+                            local_204 = **(uint **)(local_370[0] + 0x208) >> 6 & 1;

+                            if ((*(tagWND **)(local_370[0] + 0x338) != (tagWND *)0x0) &&

+                               (local_204 != 0)) {

+                              Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>

+                                        (local_1b8,*(tagWND **)(local_370[0] + 0x338));

+                              local_418 = 1;

+                              local_420 = 1;

+                              local_428 = 0;

+                              local_430 = local_430 & 0xffffffff00000000;

+                              local_438 = 0;

+                              xxxSendTransformableMessageTimeout

+                                        (*(undefined8 *)(ptVar12 + 0x338),0x287,0x19,

+                                         *(undefined8 *)(*(longlong *)(ptVar12 + 0x1e0) + 0x28));

+                              **(ulonglong **)(ptVar12 + 0x208) =

+                                   **(ulonglong **)(ptVar12 + 0x208) & 0xffffffffffffffbf;

+                              Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

+                                        (local_1b8);

+                            }

+                          }

+                          if ((param_10 == (tagWND *)0x0) ||

+                             (((*(uint *)(ptVar15 + 0x17c) & 0x1000000) != 0 &&

+                              (*(_HEAD **)(ptVar15 + 0x68) != (_HEAD *)param_10)))) {

+LAB_21:

+                            lVar13 = *(longlong *)(ptVar15 + 0x28);

+                            if (((*(byte *)(lVar13 + 0x1f) & 0xc0) == 0x40) &&

+                               ((*(byte *)(*(longlong *)(param_10 + 0x28) + 0x1a) & 0x40) != 0)) {

+                              iVar5 = *(int *)(lVar13 + 0x60);

+                              *(int *)(lVar13 + 0x60) =

+                                   ((int)local_310 - *(int *)(lVar13 + 0x58)) + (int)uStack_308;

+                              *(int *)(*(longlong *)(ptVar15 + 0x28) + 0x58) =

+                                   (*(int *)(*(longlong *)(ptVar15 + 0x28) + 0x60) - iVar5) +

+                                   *(int *)(lVar13 + 0x58);

+                            }

+                            lVar13 = *(longlong *)(ptVar15 + 0x28);

+                            local_68 = *(undefined8 *)(lVar13 + 0x58);

+                            iStack_60 = *(int *)(lVar13 + 0x60);

+                            iStack_5c = *(int *)(lVar13 + 100);

+                            local_418 = 0;

+                            local_420 = 1;

+                            local_428 = 0;

+                            local_430 = local_430 & 0xffffffff00000000;

+                            local_438 = 0;

+                            xxxSendTransformableMessageTimeout(ptVar15,0x83,0,&local_68);

+                            *(MinMaxOptions *)(*(longlong *)(ptVar15 + 0x28) + 0x68) =

+                                 (MinMaxOptions)local_68;

+                            *(MinMaxOptions *)(*(longlong *)(ptVar15 + 0x28) + 0x6c) =

+                                 local_68._4_4_;

+                            *(int *)(*(longlong *)(ptVar15 + 0x28) + 0x70) = iStack_60;

+                            *(int *)(*(longlong *)(ptVar15 + 0x28) + 0x74) = iStack_5c;

+                            local_418 = 1;

+                            local_420 = 1;

+                            local_428 = 0;

+                            local_430 = local_430 & 0xffffffff00000000;

+                            local_438 = 0;

+                            lVar13 = xxxSendTransformableMessageTimeout(ptVar15,1,0,&local_278);

+                            uVar40 = local_3f0;

+                            if (lVar13 != -1) {

+                              SetOrClrWF(1,ptVar15,0x780,1);

+                              xxxConsiderPreferredDpiChange(ptVar15);

+                              iVar5 = IsWindowDesktopComposed(ptVar15);

+                              if (iVar5 != 0) {

+                                uVar7 = *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0x1c);

+                                uVar28 = *(undefined8 *)ptVar15;

+                                uVar26 = ReferenceDwmApiPort();

+                                DwmAsyncChildStyleChange(uVar26,uVar28,0xfffffff0,uVar7);

+                                DwmChildRectChange(ptVar15);

+                                DirtyVisRgnTrackers(ptVar15);

+                                uVar28 = *(undefined8 *)ptVar15;

+                                uVar26 = ReferenceDwmApiPort();

+                                DwmAsyncOwnerChange(uVar26,uVar28);

+                              }

+                              local_438 = 0;

+                              xxxWindowEvent(0x8000,ptVar15,0,0);

+                              if ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x10) & 0x10) == 0) {

+                                xxxSendSizeMessage(ptVar15,0);

+                                if ((param_10 != (tagWND *)0x0) &&

+                                   (p_Var27 = (_HEAD *)_GetDesktopWindow(),

+                                   p_Var27 != (_HEAD *)param_10)) {

+                                  local_68 = CONCAT44(local_68._4_4_ - local_310._4_4_,

+                                                      (MinMaxOptions)local_68 - (int)local_310);

+                                }

+                                local_418 = 0;

+                                local_420 = 1;

+                                local_428 = 0;

+                                local_430 = local_430 & 0xffffffff00000000;

+                                local_438 = 0;

+                                xxxSendTransformableMessageTimeout

+                                          (ptVar15,3,0,

+                                           (longlong)CONCAT22(local_68._4_2_,(undefined2)local_68));

+                              }

+                              lVar13 = W32GetUserSessionState();

+                              MVar9 = *(MinMaxOptions *)(lVar13 + 0x10650) & 0x10000;

+                              MVar32 = MVar9 | 1;

+                              if ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0x20) == 0) {

+                                if ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 1) == 0)

+                                goto LAB_22;

+                                SetOrClrWF(0,ptVar15,0xf01,1);

+                                MVar32 = MVar9 | 0x11;

+                                uVar40 = 3;

+                              }

+                              else {

+                                SetMinimize(ptVar15,0);

+                                uVar40 = 7;

+                              }

+                              xxxMinMaximize(ptVar15,uVar40,MVar32);

+LAB_22:

+                              CalcWindowFullScreen(ptVar15);

+                              ptVar12 = local_370[0];

+                              if ((((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) == 0x40

+                                   ) && ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x18) & 4) == 0)

+                                  ) && (*(longlong *)(ptVar15 + 0x68) != 0)) {

+                                Win32HMThreadLockAlways<tagWND>::

+                                Win32HMThreadLockAlways<tagWND><tagWND::SharedUserObjPointerFieldspwndParent>

+                                          ((Win32HMThreadLockAlways<tagWND> *)local_370,local_370[0]

+                                           ,(SharedUserObjPointerFieldspwndParent<tagWND> *)

+                                            (ptVar15 + 0x68));

+                                local_418 = 0;

+                                local_420 = 1;

+                                local_428 = 0;

+                                local_430 = local_430 & 0xffffffff00000000;

+                                local_438 = 0;

+                                xxxSendTransformableMessageTimeout

+                                          (*(undefined8 *)(ptVar15 + 0x68),0x210,

+                                           (longlong)

+                                           (int)((uint)*(ushort *)

+                                                        (*(longlong *)(ptVar15 + 0x28) + 0x140) <<

+                                                 0x10 | 1),*(undefined8 *)ptVar15);

+                                Win32HMThreadLockBase<tagWND,0,0>::

+                                ~Win32HMThreadLockBase<tagWND,0,0>

+                                          ((Win32HMThreadLockBase<tagWND,0,0> *)local_370);

+                              }

+                              xxxInheritWindowMonitor(ptVar15,0,0);

+                              CDwmWindowNotifyBatch::CDwmWindowNotifyBatch(local_a0,ptVar15);

+                              if ((param_5 & 0x10000000) != 0) {

+                                lVar13 = W32GetUserSessionState();

+                                xxxShowWindowEx(ptVar15,(uchar)local_3a4,

+                                                *(MinMaxOptions *)(lVar13 + 0x10650) & 0x10000 |

+                                                local_3a4 & 0x10000);

+                              }

+                              CDwmWindowNotifyBatch::~CDwmWindowNotifyBatch(local_a0);

+                              if ((((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) == 0)

+                                  || ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1a) & 4) != 0))

+                                 && (iVar5 = *(int *)(*(longlong *)(ptVar12 + 0x1d0) + 700),

+                                    iVar5 != 0)) {

+                                local_418 = 1;

+                                local_420 = 1;

+                                local_428 = 0;

+                                local_430 = local_430 & 0xffffffff00000000;

+                                local_438 = 0;

+                                xxxSendTransformableMessageTimeout(ptVar15,0x32,iVar5);

+                                *(undefined4 *)(*(longlong *)(ptVar12 + 0x1d0) + 700) = 0;

+                              }

+                              if (local_380 != 0) {

+                                Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

+                                          ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_360);

+                              }

+                              ClassUnlock(*local_3e8[0],&local_1f0);

+                              ptVar25 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                                                  ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_290

+                                                  );

+                              if ((ptVar25 == (tagXSTATE *)0x0) ||

+                                 (lVar13 = _HMPheFromObject(ptVar25),

+                                 (*(byte *)(lVar13 + 0x19) & 1) != 0)) {

+                                ptVar25 = (tagXSTATE *)ptVar33;

+                              }

+                              Win32HMOptionalThreadLockAlways<tagWND>::

+                              ~Win32HMOptionalThreadLockAlways<tagWND>

+                                        ((Win32HMOptionalThreadLockAlways<tagWND> *)local_290);

+                              SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

+                                        ((SmartObjStackRef<tagMENU> *)local_3a0);

+                              Win32HMOptionalThreadLock<tagHOOK>::

+                              ~Win32HMOptionalThreadLock<tagHOOK>

+                                        ((Win32HMOptionalThreadLock<tagHOOK> *)local_360);

+                              SmartObjStackRef<tagCLS>::~SmartObjStackRef<tagCLS>

+                                        ((SmartObjStackRef<tagCLS> *)local_3e8);

+                              return (tagWND *)ptVar25;

+                            }

+                          }

+                          else {

+                            ptVar16 = (tagWND *)PWInsertAfter(local_378);

+                            if ((ptVar16 + -2 < (tagWND *)0xfffffffffffffffc) &&

+                               (*(longlong *)(ptVar16 + 0x68) != *(longlong *)(ptVar15 + 0x68))) {

+                              ptVar16 = (tagWND *)(ulonglong)((byte)local_400 == '@');

+                            }

+                            if (*(longlong *)(ptVar15 + 0x78) != 0) {

+                              *(undefined4 *)(*(longlong *)(ptVar15 + 0x28) + 0xec) =

+                                   *(undefined4 *)

+                                    (*(longlong *)(*(longlong *)(ptVar15 + 0x78) + 0x28) + 0xec);

+                              SetOrClrWF(*(byte *)(*(longlong *)

+                                                    (*(longlong *)(ptVar15 + 0x78) + 0x28) + 0xe8) &

+                                         0x40,ptVar15,0xd840,1);

+                            }

+                            iVar5 = ValidateNewParent(ptVar15,param_10,1);

+                            if (iVar5 == 0) {

+                              uVar40 = 9;

+                            }

+                            else {

+                              UnlinkWindow(ptVar15,*(undefined8 *)(ptVar15 + 0x68));

+                              if (((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) != 0x40)

+                                 && (param_10 !=

+                                     (tagWND *)*(_HEAD **)(*(longlong *)(param_10 + 0x18) + 0x70)))

+                              {

+                                if ((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x18) & 8) == 0) {

+                                  if (ptVar16 != (tagWND *)0x0) {

+                                    if (((tagWND *)0xfffffffffffffffd < ptVar16) ||

+                                       (ptVar16 == (tagWND *)0x1)) {

+                                      MVar32 = 1;

+                                    }

+                                    if ((MVar32 != 0) ||

+                                       ((*(byte *)(*(longlong *)(ptVar16 + 0x28) + 0x18) & 8) == 0))

+                                    goto LAB_23;

+                                  }

+                                  ptVar16 = (tagWND *)CalcForegroundInsertAfter(ptVar15);

+                                  if (*(longlong *)(ptVar15 + 0x78) == 0) {

+                                    ptVar16 = CoreWindowProp::GetCompositeAppFrameWindowOrSelf

+                                                        (ptVar16);

+                                  }

+                                }

+                                else {

+                                  lVar13 = W32GetUserSessionState();

+                                  if ((*(longlong *)(lVar13 + 0x4b10) != 0) &&

+                                     (ptVar23 = (tagWND *)GetTopMostInsertAfter(ptVar15),

+                                     ptVar23 != (tagWND *)0x0)) {

+                                    ptVar16 = ptVar23;

+                                  }

+                                }

+                              }

+LAB_23:

+                              if ((ptVar16 < (tagWND *)0x2) ||

+                                 (ptVar16 < (tagWND *)0xfffffffffffffffe)) {

+                                LinkWindow(ptVar15,ptVar16,param_10);

+                                zzzLockDisplayAreaAndInvalidateDCCache(param_10,0x10);

+                                goto LAB_21;

+                              }

+                              uVar40 = 0xd;

+                            }

+                          }

+                          if (local_380 != 0) {

+                            Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

+                                      ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_360);

+                          }

+                          ptVar25 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                                              ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_290);

+                          if (ptVar25 != (tagXSTATE *)0x0) {

+                            xxxDestroyWindow(ptVar15);

+                          }

+                          ClassUnlock(*local_3e8[0],&local_1f0);

+                          if (uVar40 != 0) {

+                            auVar4._8_8_ = 0;

+                            auVar4._0_8_ = _DAT_6 << 8;

+                            _Var31 = SUB168(auVar4 * (ZEXT416(_DAT_7) << 0x20),8);

+                            goto LAB_24;

+                          }

+                        }

+                        else {

+                          lVar13 = Win32AllocPoolZInit(*(undefined4 *)

+                                                        (*(longlong *)(*local_3e8[0] + 8) + 0x54),

+                                                       0x73777355);

+                          *(longlong *)(ptVar15 + 0x118) = lVar13;

+                          if (lVar13 != 0) goto LAB_9;

+                          uVar40 = 5;

+LAB_12:

+                          *(undefined8 *)(*(longlong *)(ptVar15 + 0x28) + 0x78) = 0;

+                          SetOrClrWF(1,ptVar15,0x204,1);

+LAB_14:

+                          bVar39 = *(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f);

+                          if (local_380 != 0) {

+                            Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

+                                      ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_360);

+                          }

+                          SetOrClrWF(1,ptVar15,0x480,1);

+                          SetOrClrWF(1,ptVar15,0x380,1);

+                          if ((bVar39 & 0x10) != 0) {

+                            SetVisible(ptVar15,0);

+                          }

+                          if (*(longlong *)(ptVar15 + 0x68) != 0) {

+                            if ((bVar39 & 0x10) != 0) {

+                              zzzLockDisplayAreaAndInvalidateDCCache

+                                        (*(longlong *)(ptVar15 + 0x68),0x10);

+                            }

+                            if ((((*(byte *)(*(longlong *)(ptVar15 + 0x28) + 0x1f) & 0xc0) == 0x40)

+                                && (iVar5 = _IsTopLevelWindow(ptVar15), iVar5 == 0)) &&

+                               (local_370[0] !=

+                                *(tagTHREADINFO **)(*(longlong *)(ptVar15 + 0x68) + 0x10))) {

+                              zzzAttachThreadInput

+                                        (*(undefined8 *)(ptVar15 + 0x10),

+                                         *(tagTHREADINFO **)(*(longlong *)(ptVar15 + 0x68) + 0x10),0

+                                        );

+                            }

+                            UnlinkWindow(ptVar15,*(undefined8 *)(ptVar15 + 0x68));

+                          }

+                          ClassUnlock(*local_3e8[0],&local_1f0);

+                          xxxFreeWindow(local_370[0],ptVar15,

+                                        (Win32HMOptionalThreadLockAlways<tagWND> *)local_290);

+                          if (uVar40 != 0) {

+                            auVar3._8_8_ = 0;

+                            auVar3._0_8_ = _DAT_6 << 8;

+                            _Var31 = SUB168(auVar3 * (ZEXT416(_DAT_7) << 0x20),8);

+LAB_24:

+                            TraceLoggingCreateWindowFailed(uVar40,_Var31);

+                          }

+                        }

+                        Win32HMOptionalThreadLockAlways<tagWND>::

+                        ~Win32HMOptionalThreadLockAlways<tagWND>

+                                  ((Win32HMOptionalThreadLockAlways<tagWND> *)local_290);

+                        goto LAB_25;

+                      }

+                      DereferenceClass(*(undefined8 *)(ptVar12 + 0x1d0),ptVar15);

+                    }

+                    tagObjLock::LockUnInitializeThreadCreator(*(tagObjLock **)(ptVar15 + 0x90));

+                    Win32FreePool(*(undefined8 *)(ptVar15 + 0x90));

+                    tagObjLock::LockUnInitializeThreadCreator((tagObjLock *)(ptVar15 + 0x38));

+                    HMFreeObject(ptVar15);

+                  }

+                  if ((local_37c != 0) ||

+                     (ptVar17 = PtiCurrent(),

+                     (*(uint *)(*(longlong *)(ptVar17 + 0x1d0) + 0xc) & 0x2000) != 0))

+                  goto LAB_26;

+                  ptVar18 = local_3b8;

+                  if (((ulonglong)local_3b8 & 0xffffffffffff0000) != 0) {

+                    ptVar18 = *(tagMONITOR **)(local_3b8 + 8);

+                  }

+                  iVar5 = RegisterDefaultClass(ptVar18);

+                  if (iVar5 == 0) goto LAB_26;

+                  local_37c = 1;

+                  ptVar18 = local_2a0;

+                } while( true );

+              }

+              if (param_10 == (tagWND *)0x0) {

+                uVar28 = 0x57e;

+                goto LAB_27;

+              }

+              iVar5 = ValidateParentDepth(0,param_10);

+              if (iVar5 != 0) goto LAB_5;

+            }

+          }

+          goto LAB_1;

+        }

+      }

+      else {

+        iVar5 = IsDesktopApp(*(undefined8 *)(ptVar12 + 0x1d0));

+        if (iVar5 == 0) {

+          MVar9 = 1;

+          local_404 = 1;

+          goto LAB_0;

+        }

+      }

+LAB_2:

+      uVar28 = 5;

+      goto LAB_27;

+    }

+  }

+LAB_1:

+  uVar28 = 0x57;

+LAB_27:

+  UserSetLastError(uVar28);

+LAB_4:

+  AtomicExecutionCheck::Disarm(local_2c0);

+LAB_25:

+  SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>((SmartObjStackRef<tagMENU> *)local_3a0);

+  Win32HMOptionalThreadLock<tagHOOK>::~Win32HMOptionalThreadLock<tagHOOK>

+            ((Win32HMOptionalThreadLock<tagHOOK> *)local_360);

+  SmartObjStackRef<tagCLS>::~SmartObjStackRef<tagCLS>((SmartObjStackRef<tagCLS> *)local_3e8);

+  return (tagWND *)0x0;

+LAB_26:

+  uVar28 = 0x57f;

+  goto LAB_27;

 }
```

## `xxxMouseActivate`  (modified)

```diff
--- xxxMouseActivate
+++ EditionChangeForegroundQueueForMouseInput
@@ -1,151 +1,86 @@
 

-/* int __cdecl xxxMouseActivate(struct tagTHREADINFO * __ptr64,struct tagWND * __ptr64,struct

-   tagQMSG const * __ptr64,int) */

-

-int __cdecl xxxMouseActivate(tagTHREADINFO *param_1,tagWND *param_2,tagQMSG *param_3,int param_4)

+undefined8 EditionChangeForegroundQueueForMouseInput(undefined8 param_1)

 

 {

-  byte bVar1;

-  uint uVar2;

-  ulonglong uVar3;

+  tagUIPI_INFO *ptVar1;

+  longlong lVar2;

+  byte bVar3;

   bool bVar4;

-  tagWND *ptVar5;

-  bool bVar6;

-  int iVar7;

-  uint uVar8;

-  tagWND *ptVar9;

-  __int64 *p_Var10;

-  longlong lVar11;

-  byte bVar12;

-  _HEAD *p_Var13;

-  uint uVar14;

-  undefined8 uVar15;

-  tagTHREADINFO *ptVar16;

-  ulonglong in_stack_ffffffffffffff70;

-  short sStack_5c;

-  _Win32HMThreadLockItem local_50 [24];

+  uint uVar5;

+  int *in_RAX;

+  char *pcVar6;

+  __int64 _Var7;

+  undefined8 uVar8;

+  byte bVar9;

+  byte *in_RCX;

+  byte bVar10;

+  undefined8 unaff_RBX;

+  undefined8 *puVar11;

+  int unaff_EBP;

+  longlong unaff_RSI;

+  longlong unaff_RDI;

+  tagUIPI_INFO_INT *unaff_R12;

+  tagHOOK *unaff_R13;

+  __int64 unaff_R15;

+  undefined4 uStack0000000000000030;

+  undefined4 uStack0000000000000034;

+  ulonglong in_stack_00000038;

+  undefined8 in_stack_00000048;

+  undefined8 in_stack_00000050;

+  undefined8 in_stack_00000058;

+  int in_stack_000000c0;

   

-  uVar3 = *(ulonglong *)(param_3 + 0x20);

-  uVar15 = *(undefined8 *)(param_3 + 0x34);

-  uVar2 = *(uint *)(param_3 + 0x18);

-  bVar6 = (*(uint *)(param_3 + 100) >> 0x13 & 1) == 0;

-  bVar4 = (*(uint *)(param_3 + 100) >> 0x16 & 1) != 0;

-  if (*(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x80) != 0) {

-    return 0;

+  ptVar1 = (tagUIPI_INFO *)(unaff_RDI + 1);

+  bVar3 = (byte)in_RAX;

+  *(byte *)(unaff_RSI + 1) = *(byte *)(unaff_RSI + 1) ^ bVar3;

+  *(byte *)in_RAX = (char)*in_RAX + bVar3;

+  bVar10 = (byte)unaff_RBX;

+  uVar5 = (int)in_RAX + *in_RAX;

+  *(byte *)(ulonglong)uVar5 = *(byte *)(ulonglong)uVar5 & (byte)uVar5;

+  bVar9 = (byte)((ulonglong)in_RCX >> 8);

+  puVar11 = (undefined8 *)

+            CONCAT71((int7)(CONCAT62((int6)((ulonglong)unaff_RBX >> 0x10),

+                                     CONCAT11((char)((ulonglong)unaff_RBX >> 8) + bVar3,bVar10)) >>

+                           8),bVar10 + bVar9);

+  uVar5 = uVar5 + 0x80100ff2 + (uint)CARRY1(bVar10,bVar9);

+  pcVar6 = (char *)(ulonglong)uVar5;

+  bVar3 = (byte)uVar5;

+  *in_RCX = *in_RCX ^ bVar3;

+  *pcVar6 = *pcVar6 + bVar3;

+  *puVar11 = param_1;

+  *(undefined4 *)(puVar11 + 1) = *(undefined4 *)(pcVar6 + 0x138);

+  if ((unaff_EBP == 0) || (*(int *)(unaff_R12 + 0xc) != 0)) {

+    UIPrivilegeIsolation::ResetUIPIInfo(ptVar1);

   }

-  ptVar16 = param_1;

-  if ((bVar6) && (iVar7 = IsIndependentInputWindow(param_2), iVar7 != 0)) {

-    if (10 < uVar2 - 0x201) {

-      return 0;

-    }

-    if ((0x449U >> (uVar2 - 0x201 & 0x1f) & 1) == 0) {

-      return 0;

-    }

-    ptVar9 = GetCompositionInputWindowUIOwner(param_2);

-    if (ptVar9 == (tagWND *)0x0) {

-      return 0;

-    }

-    p_Var10 = (__int64 *)_GetTopLevelWindow(ptVar9);

-    PostEventMessageEx((tagTHREADINFO *)p_Var10[2],*(tagQ **)((tagTHREADINFO *)p_Var10[2] + 0x1d8),6

-                       ,(tagWND *)0x0,0,0,*p_Var10,(tagINPUT_MESSAGE_SOURCE *)0x0);

-    return 0;

+  else {

+    lVar2 = *(longlong *)(unaff_RSI + 0x1d1);

+    *(undefined8 *)ptVar1 = *(undefined8 *)(lVar2 + 0x130);

+    *(undefined4 *)(unaff_RDI + 9) = *(undefined4 *)(lVar2 + 0x138);

   }

-  Win32HM_LockIntoThread<1>(ptVar16,(_HEAD *)param_2,local_50);

-  bVar12 = *(byte *)(*(longlong *)(param_2 + 0x28) + 0x18) & 4;

-  p_Var13 = (_HEAD *)param_2;

-  if ((((uVar2 == 0x201) || (uVar2 == 0x204)) || (uVar2 == 0x207)) || (uVar2 == 0x20b)) {

-    bVar1 = *(byte *)(*(longlong *)(param_2 + 0x28) + 0x1f);

-    while ((bVar1 & 0xc0) == 0x40) {

-      p_Var13 = *(_HEAD **)(p_Var13 + 0x68);

-      if (bVar12 == 0) {

-        Win32HM_ExchangeThreadLock<1>(p_Var13,local_50);

-        sStack_5c = (short)((ulonglong)uVar15 >> 0x20);

-        in_stack_ffffffffffffff70 = in_stack_ffffffffffffff70 & 0xffffffff00000000;

-        xxxSendTransformableMessageTimeout

-                  (p_Var13,0x210,uVar2 | uVar3,

-                   CONCAT22(sStack_5c - *(short *)(*(longlong *)(p_Var13 + 0x28) + 0x6c),

-                            (short)uVar15 - *(short *)(*(longlong *)(p_Var13 + 0x28) + 0x68)),0,

-                   in_stack_ffffffffffffff70,0,1,0);

-      }

-      bVar1 = *(byte *)(*(longlong *)(p_Var13 + 0x28) + 0x1f);

-    }

-    if (bVar12 != 0) {

-      Win32HM_ExchangeThreadLock<1>(p_Var13,local_50);

-    }

-  }

-  uVar15 = 0;

-  ptVar9 = *(tagWND **)(*(longlong *)(param_1 + 0x1d8) + 0x90);

-  ptVar5 = param_2;

-  if (bVar4) {

-    ptVar5 = (tagWND *)p_Var13;

-  }

-  if (((bVar6) && (lVar11 = W32GetUserSessionState(), (*(uint *)(lVar11 + 0x10654) & 1) != 0)) &&

-     (uVar2 == 0x200)) {

-    uVar8 = xxxActiveWindowTracking(param_2,0x200,param_4);

-    goto LAB_0;

-  }

-  if (((ptVar9 != ptVar5) || ((*(uint *)(*(longlong *)(param_1 + 0x1d8) + 0x214) & 0x8000) != 0)) &&

-     (ptVar9 = (tagWND *)_GetDesktopWindow(), p_Var13 != (_HEAD *)ptVar9)) {

-    if ((((uVar2 != 0x201) && (uVar2 != 0x204)) && (uVar2 != 0x207)) && (uVar8 = 0, uVar2 != 0x20b))

-    goto LAB_0;

-    if (bVar6) {

+  _Var7 = xxxCallHook2(unaff_R13,0,in_stack_00000038 >> 0x20,unaff_R15,3);

+  *(undefined8 *)(unaff_RSI + 0x639) = in_stack_00000058;

+  *(undefined8 *)ptVar1 = in_stack_00000048;

+  *(undefined4 *)(unaff_RDI + 9) = uStack0000000000000030;

+  *puVar11 = in_stack_00000050;

+  *(undefined4 *)(puVar11 + 1) = uStack0000000000000034;

+  if (_Var7 == 0) {

+    if (in_stack_000000c0 != 0) {

+      bVar4 = IsGpqForegroundAccessibleOnInputThread(SUB41(unaff_EBP,0),unaff_R12);

       if (!bVar4) {

-        if (p_Var13 != (_HEAD *)0x0) {

-          uVar15 = *(undefined8 *)p_Var13;

-        }

-        in_stack_ffffffffffffff70 = in_stack_ffffffffffffff70 & 0xffffffff00000000;

-        uVar14 = xxxSendTransformableMessageTimeout

-                           (param_2,0x21,uVar15,(longlong)(int)(uVar2 << 0x10 | param_4 & 0xffffU),0

-                            ,in_stack_ffffffffffffff70,0,1,1);

-        goto LAB_1;

-      }

-      uVar14 = 2;

-    }

-    else {

-      uVar14 = bVar4 + 3;

-LAB_1:

-      if (((uVar14 != 0) && (uVar14 != 1)) && (uVar14 != 2)) {

-        uVar8 = 0;

-        if ((uVar14 != 3) && (uVar8 = uVar14, uVar14 == 4)) {

-          uVar8 = 1;

-        }

+        MSGLUA_GPQFOREGROUND();

         goto LAB_0;

       }

     }

-    lVar11 = *(longlong *)(param_1 + 0x1d8);

-    if ((((p_Var13 != (_HEAD *)*(tagWND **)(lVar11 + 0x90)) ||

-         ((*(uint *)(lVar11 + 0x214) & 0x8000) != 0)) &&

-        (bVar6 = xxxActivateWindowWithOptions

-                           ((tagWND *)p_Var13,3,0x31,(uint)(*(int *)(lVar11 + 0xac) != 0),0), !bVar6

-        )) || (((*(byte *)(*(longlong *)(p_Var13 + 0x28) + 0x1f) & 8) != 0 || (uVar14 == 2)))) {

-      uVar8 = 1;

-      goto LAB_0;

-    }

+    InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion

+              ((ThreadLockedPerfRegion *)&stack0x00000040);

+    uVar8 = 0;

   }

-  uVar8 = 0;

-  lVar11 = W32GetUserSessionState();

-  if ((((*(uint *)(lVar11 + 0x10654) & 1) != 0) &&

-      (iVar7 = CheckOnTop(param_1,(tagWND *)p_Var13,uVar2), iVar7 != 0)) && (param_4 == 1)) {

-    LOCK();

-    uVar14 = *(uint *)(*(longlong *)(p_Var13 + 0x10) + 0x210);

-    if (uVar14 == 0) {

-      *(uint *)(*(longlong *)(p_Var13 + 0x10) + 0x210) = 0;

-      uVar14 = 0;

-    }

-    UNLOCK();

-    if ((uVar14 & 8) != 0) {

-      uVar8 = (uint)((*(byte *)(*(longlong *)(p_Var13 + 0x28) + 0x18) & 8) == 0);

-    }

+  else {

+LAB_0:

+    InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion

+              ((ThreadLockedPerfRegion *)&stack0x00000040);

+    uVar8 = 1;

   }

-LAB_0:

-  if (*(longlong *)(*(longlong *)(param_1 + 0x1d8) + 0x80) == 0) {

-    xxxSendTransformableMessageTimeout

-              (param_2,0x20,*(undefined8 *)param_2,

-               (longlong)(int)(uVar2 << 0x10 | param_4 & 0xffffU),0,

-               in_stack_ffffffffffffff70 & 0xffffffff00000000,0,1,1);

-  }

-  Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>

-            ((Win32HMThreadLockBase<tagWND,1,0> *)local_50);

   return uVar8;

 }
```

## `_GetPriorityClipboardFormat`  (modified)

```diff
--- _GetPriorityClipboardFormat
+++ _GetPriorityClipboardFormat
@@ -1,42 +1,65 @@
 

 int __stdcall _GetPriorityClipboardFormat(UINT *paFormatPriorityList,int cFormats)

 

 {

-  bool bVar1;

-  int iVar2;

-  undefined7 extraout_var;

-  void *pvVar3;

-  undefined4 in_register_00000014;

-  uint uVar4;

-  _IFIMETRICS *p_Var5;

+  undefined8 uVar1;

+  uint uVar2;

+  uint uVar3;

+  int iVar4;

+  tagWINDOWSTATION *ptVar5;

+  longlong *plVar6;

+  ulonglong uVar7;

+  uint *puVar8;

+  undefined8 local_38;

+  uint local_30;

+  undefined8 local_28;

+  uint local_20;

   

-  p_Var5 = (_IFIMETRICS *)(ulonglong)(uint)cFormats;

-  vIFIMetricsToEnumLogFontW

-            ((tagENUMLOGFONTW *)paFormatPriorityList,

-             (_IFIMETRICS *)CONCAT44(in_register_00000014,cFormats));

-  iVar2 = func_0x0001400f6bb4(p_Var5[0x2c],paFormatPriorityList + 0x47);

-  uVar4 = 0;

-  if ((*(uint *)(p_Var5 + 0x30) & 0x4000) == 0) {

-    bVar1 = IsVariableFont(p_Var5);

-    iVar2 = (int)CONCAT71(extraout_var,bVar1);

-    if (bVar1) goto LAB_0;

+  ptVar5 = CheckClipboardAccess();

+  if (((ptVar5 == (tagWINDOWSTATION *)0x0) || (*(int *)(ptVar5 + 0x88) == 0)) ||

+     (*(longlong *)(ptVar5 + 0x80) == 0)) {

+    iVar4 = 0;

   }

   else {

-LAB_0:

-    if (0xc < *(uint *)(p_Var5 + 4)) {

-      uVar4 = *(uint *)(p_Var5 + *(int *)(p_Var5 + 0xcc) + 4);

-      if (0x10 < uVar4) {

-        uVar4 = 0x10;

+    while (0 < cFormats) {

+      uVar2 = *paFormatPriorityList;

+      cFormats = cFormats + -1;

+      if (uVar2 != 0) {

+        puVar8 = *(uint **)(ptVar5 + 0x80);

+        iVar4 = *(int *)(ptVar5 + 0x88);

+        while (iVar4 != 0) {

+          iVar4 = iVar4 + -1;

+          if (*puVar8 == uVar2) {

+            PsGetCurrentProcessWin32Process();

+            local_38 = *(undefined8 *)(puVar8 + 5);

+            local_30 = puVar8[7];

+            iVar4 = CheckClipboardAccessForIntegrityLevel(&local_38);

+            if (iVar4 != 0) {

+              return uVar2;

+            }

+            iVar4 = IsFmtBlocked(uVar2);

+            if (iVar4 == 0) {

+              return uVar2;

+            }

+            uVar1 = *(undefined8 *)(puVar8 + 5);

+            uVar3 = puVar8[7];

+            plVar6 = (longlong *)PsGetCurrentProcessWin32Process();

+            uVar7 = 0;

+            if (plVar6 != (longlong *)0x0) {

+              uVar7 = (ulonglong)plVar6 & -(ulonglong)(*plVar6 != 0);

+            }

+            local_28 = uVar1;

+            local_20 = uVar3;

+            EtwTraceUIPIClipboardError(0,uVar7,uVar2,&local_28);

+            break;

+          }

+          puVar8 = puVar8 + 8;

+        }

       }

-      pvVar3 = memcpy(paFormatPriorityList + 0x57,p_Var5 + *(int *)(p_Var5 + 0xcc),

-                      (ulonglong)uVar4 * 4 + 8);

-      iVar2 = (int)pvVar3;

-      goto LAB_1;

+      paFormatPriorityList = paFormatPriorityList + 1;

     }

+    iVar4 = -1;

   }

-  paFormatPriorityList[0x57] = 0x8007664;

-LAB_1:

-  paFormatPriorityList[0x58] = uVar4;

-  return iVar2;

+  return iVar4;

 }
```

## `xxxBMPtoDIB`  (modified)

```diff
--- xxxBMPtoDIB
+++ xxxDDETrackGetMessageHook
@@ -1,153 +1,129 @@
 

-/* struct tagBITMAPINFOHEADER * __ptr64 __cdecl xxxBMPtoDIB(struct HBITMAP__ * __ptr64,struct

-   HPALETTE__ * __ptr64,unsigned long * __ptr64) */

-

-tagBITMAPINFOHEADER * __cdecl xxxBMPtoDIB(HBITMAP__ *param_1,HPALETTE__ *param_2,ulong *param_3)

+void xxxDDETrackGetMessageHook(undefined8 *param_1)

 

 {

-  ushort uVar1;

-  ulonglong uVar2;

-  int iVar3;

-  uint uVar4;

-  tagBITMAPINFOHEADER *ptVar5;

-  longlong lVar6;

-  HDC hdc;

-  tagTHREADINFO *ptVar7;

-  HPALETTE hPal;

-  ushort uVar8;

-  uint uVar9;

-  ulonglong uVar10;

-  ulonglong uVar11;

-  ulonglong uVar12;

-  undefined4 local_78;

-  uint uStack_74;

-  undefined4 uStack_70;

-  undefined2 uStack_6c;

-  ushort uStack_6a;

-  uint local_68;

-  uint uStack_64;

-  uint uStack_60;

-  uint uStack_5c;

-  undefined4 uStack_58;

-  undefined4 uStack_54;

-  undefined8 local_50;

-  ulonglong uStack_48;

-  undefined8 local_40;

-  undefined8 uStack_38;

+  longlong *plVar1;

+  tagFREELIST *ptVar2;

+  uint uVar3;

+  int iVar4;

+  uint uVar5;

+  tagWND *ptVar6;

+  tagWND *ptVar7;

+  tagDDECONV *ptVar8;

+  tagTHREADINFO *ptVar9;

+  tagDDECONV *ptVar10;

+  longlong lVar11;

+  undefined8 uVar12;

+  tagXSTATE *ptVar13;

+  _HEAD *p_Var14;

+  longlong lVar15;

+  bool bVar16;

+  _Win32HMThreadLockItem local_48 [16];

+  _Win32HMThreadLockItem local_38 [16];

+  Win32HMThreadLockBase<tagMENU,0,0> local_28 [16];

   

-  local_50 = 0;

-  uStack_48 = 0;

-  local_40 = 0;

-  uStack_38 = 0;

-  iVar3 = GreExtGetObjectW(0,0x20);

-  uVar11 = 0;

-  if (iVar3 != 0) {

-    uVar1 = local_40._2_2_ * (short)local_40;

-    if (uVar1 < 2) {

-      uVar8 = 1;

+  if (*(int *)(param_1 + 1) != 0x3e1) {

+    plVar1 = param_1 + 3;

+    p_Var14 = (_HEAD *)HMValidateHandleNoRipNoIL(*plVar1);

+    if (p_Var14 == (_HEAD *)0x0) {

+      *plVar1 = 0;

+      *(undefined4 *)(param_1 + 1) = 0;

+      return;

+    }

+    uVar5 = *(uint *)(p_Var14 + 0x40);

+    ptVar9 = PtiCurrent();

+    Win32HM_LockIntoThread<0>(ptVar9,p_Var14,local_48);

+    lVar11 = *(longlong *)(p_Var14 + 0x38);

+    lVar15 = xxxClientCopyDDEOut1(lVar11);

+    if (lVar15 == 0) {

+      *(undefined4 *)(param_1 + 1) = 0x3e1;

+      uVar12 = 0;

     }

     else {

-      uVar8 = 4;

-      if (4 < uVar1) {

-        if (uVar1 < 9) {

-          uVar8 = 8;

+      uVar12 = *(undefined8 *)(lVar11 + 0x18);

+    }

+    *plVar1 = lVar15;

+    ptVar13 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                        ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_48);

+    if (ptVar13 != (tagXSTATE *)0x0) {

+      if ((uVar5 >> 9 & 1) == 0) {

+        if (*(longlong *)(p_Var14 + 0x28) == 0) {

+          *(undefined8 *)(p_Var14 + 0x28) = uVar12;

         }

         else {

-          ptVar7 = PtiCurrent();

-          if (*(ushort *)(ptVar7 + 0x2a0) < 0x400) {

-            uVar8 = 0x18;

-          }

-          else if (uVar1 < 0x11) {

-            uVar8 = 0x10;

-          }

-          else {

-            uVar8 = 0x18;

-            if (0x18 < uVar1) {

-              uVar8 = 0x20;

-            }

-          }

+          *(undefined8 *)(p_Var14 + 0x30) = uVar12;

         }

       }

-    }

-    uVar2 = uStack_48;

-    uVar4 = local_50._4_4_;

-    uVar10 = (ulonglong)local_50._4_4_;

-    uVar12 = uStack_48 & 0xffffffff;

-    uStack_64 = 0;

-    uStack_60 = 0;

-    uStack_5c = 0;

-    uStack_58 = 0;

-    uStack_74 = local_50._4_4_;

-    uStack_70 = (undefined4)uStack_48;

-    uStack_54 = 0;

-    local_78 = 0x28;

-    uStack_6c = 1;

-    local_68 = 0;

-    uStack_6a = uVar8;

-    iVar3 = Feature_3532623161__private_IsEnabledDeviceUsageNoInline();

-    if ((((iVar3 == 0) ||

-         (((ulonglong)uVar4 * (ulonglong)uVar8 < 0x100000000 &&

-          ((uint)((ulonglong)uVar4 * (ulonglong)uVar8) < 0xffffffe1)))) &&

-        (uVar10 * uVar8 < 0x100000000)) &&

-       (uVar12 = ((int)(uVar10 * uVar8) + 0x1fU >> 3 & 0x1ffffffc) * uVar12, uVar12 < 0x100000000))

-    {

-      if (uVar8 < 9) {

-        uVar11 = (ulonglong)(uint)((1 << ((byte)uVar8 & 0x1f)) << 2);

-      }

-      else if ((uVar8 - 0x10 & 0xffef) == 0) {

-        uVar11 = 0xc;

-        local_68 = 3;

-      }

-      uVar4 = (int)uVar11 + 0x28;

-      uVar9 = uVar4 + (int)uVar12;

-      if ((uVar4 <= uVar9) &&

-         (ptVar5 = (tagBITMAPINFOHEADER *)Win32AllocPoolZInit(uVar9,0x62637355),

-         ptVar5 != (tagBITMAPINFOHEADER *)0x0)) {

-        if (param_3 != (ulong *)0x0) {

-          *param_3 = uVar9;

-        }

-        *(ulonglong *)ptVar5 = CONCAT44(uStack_74,local_78);

-        *(ulonglong *)(ptVar5 + 8) = CONCAT26(uStack_6a,CONCAT24(uStack_6c,uStack_70));

-        *(uint *)(ptVar5 + 0x10) = local_68;

-        *(uint *)(ptVar5 + 0x14) = uStack_64;

-        *(uint *)(ptVar5 + 0x18) = uStack_60;

-        *(uint *)(ptVar5 + 0x1c) = uStack_5c;

-        *(ulonglong *)(ptVar5 + 0x20) = CONCAT44(uStack_54,uStack_58);

-        lVar6 = W32GetUserSessionState();

-        hdc = (HDC)GreCreateCompatibleDC(*(undefined8 *)(*(longlong *)(lVar6 + 0xdf10) + 0x40));

-        if (hdc != (HDC)0x0) {

-          hPal = (HPALETTE)0x0;

-          ptVar7 = PtiCurrent();

-          local_78 = (undefined4)*(undefined8 *)(ptVar7 + 0x180);

-          uStack_74 = (uint)((ulonglong)*(undefined8 *)(ptVar7 + 0x180) >> 0x20);

-          *(undefined4 **)(ptVar7 + 0x180) = &local_78;

-          local_68 = (uint)Win32FreePool_exref;

-          uStack_64 = (uint)((ulonglong)Win32FreePool_exref >> 0x20);

-          uStack_70 = SUB84(ptVar5,0);

-          uStack_6c = (undefined2)((ulonglong)ptVar5 >> 0x20);

-          uStack_6a = (ushort)((ulonglong)ptVar5 >> 0x30);

-          if (param_2 != (HPALETTE__ *)0x0) {

-            hPal = _SelectPalette(hdc,param_2,0);

-            xxxRealizePalette(hdc);

-          }

-          iVar3 = GreGetDIBitsInternal

-                            (hdc,param_1,ptVar5 + uVar11 + *(uint *)ptVar5,uVar2 & 0xffffffff,

-                             ptVar5 + uVar11 + *(uint *)ptVar5,ptVar5);

-          if (hPal != (HPALETTE)0x0) {

-            _SelectPalette(hdc,hPal,0);

-            xxxRealizePalette(hdc);

-          }

-          GreDeleteDC(hdc);

-          ptVar7 = PtiCurrent();

-          *(ulonglong *)(ptVar7 + 0x180) = CONCAT44(uStack_74,local_78);

-          if (iVar3 != 0) {

-            return ptVar5;

-          }

-        }

-        Win32FreePool(ptVar5);

+      else {

+        FreeDdeXact(p_Var14);

       }

     }

+    Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

+              ((Win32HMOptionalThreadLockAlways<tagWND> *)local_48);

+    return;

   }

-  return (tagBITMAPINFOHEADER *)0x0;

+  ptVar6 = (tagWND *)ValidateHwnd(*param_1);

+  if (ptVar6 == (tagWND *)0x0) {

+    return;

+  }

+  Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>(local_28,(tagMENU *)ptVar6)

+  ;

+  ptVar7 = (tagWND *)HMValidateCatHandleNoSecure(param_1[2]);

+  if (ptVar7 != (tagWND *)0x0) {

+    ptVar8 = FindDdeConv(ptVar6,ptVar7);

+    if (ptVar8 == (tagDDECONV *)0x0) goto LAB_0;

+    iVar4 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

+    uVar5 = *(uint *)(ptVar8 + 0x50);

+    if (iVar4 == 0) {

+      if ((uVar5 & 2) != 0) {

+        uVar3 = *(uint *)(*(longlong *)(ptVar8 + 0x20) + 0x50) & 2;

+        goto LAB_1;

+      }

+    }

+    else if ((uVar5 & 10) != 0) {

+      uVar3 = *(uint *)(*(longlong *)(ptVar8 + 0x20) + 0x50) & 10;

+LAB_1:

+      if (uVar3 != 0) {

+        ptVar9 = PtiCurrent();

+        Win32HM_LockIntoThread<0>(ptVar9,(_HEAD *)ptVar8,local_38);

+        ptVar2 = *(tagFREELIST **)(ptVar8 + 0x48);

+        if (ptVar2 != (tagFREELIST *)0x0) {

+          *(undefined8 *)(ptVar8 + 0x48) = 0;

+          xxxFreeListFree(ptVar2);

+        }

+        iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+        if (iVar4 == 0) {

+          lVar11 = _HMPheFromObject(ptVar8);

+          bVar16 = (bool)(~*(byte *)(lVar11 + 0x19) & 1);

+        }

+        else {

+          ptVar10 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)ptVar8,10);

+          bVar16 = ptVar10 == ptVar8;

+        }

+        if (bVar16 != false) {

+          uVar12 = xxxFreeDdeConv(*(undefined8 *)(ptVar8 + 0x20));

+          *(undefined8 *)(ptVar8 + 0x20) = uVar12;

+        }

+        ptVar13 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                            ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_38);

+        if (ptVar13 != (tagXSTATE *)0x0) {

+          xxxFreeDdeConv(ptVar13);

+        }

+        Win32HMThreadLockBase<tagDDECONV,0,1>::~Win32HMThreadLockBase<tagDDECONV,0,1>

+                  ((Win32HMThreadLockBase<tagDDECONV,0,1> *)local_38);

+        goto LAB_2;

+      }

+    }

+    *(uint *)(ptVar8 + 0x50) = uVar5 | 8;

+  }

+LAB_2:

+  uVar5 = GetAppCompatFlags2(0x9900);

+  if ((uVar5 >> 0xd & 1) != 0) {

+    xxxCleanupDdeConv(ptVar6);

+  }

+LAB_0:

+  Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+            ((Win32HMThreadLockBase<tagWND,0,0> *)local_28);

+  return;

 }
```

## `zzzRecalcThreadAttachment`  (modified)

```diff
--- zzzRecalcThreadAttachment
+++ xxxSetForegroundThreadWithWindowHint
@@ -1,42 +1,232 @@
 

-/* void __cdecl zzzRecalcThreadAttachment(void) */

-

-void __cdecl zzzRecalcThreadAttachment(void)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

+/* void __cdecl xxxSetForegroundThreadWithWindowHint(struct tagTHREADINFO * __ptr64,struct tagWND *

+   __ptr64) */

+

+void __cdecl xxxSetForegroundThreadWithWindowHint(tagTHREADINFO *param_1,tagWND *param_2)

 

 {

-  _LIST_ENTRY *p_Var1;

-  bool bVar2;

-  int iVar3;

-  _LIST_ENTRY *p_Var4;

-  tagTHREADINFO *this;

-  tagQ *this_00;

+  int *piVar1;

+  undefined4 uVar2;

+  undefined4 uVar3;

+  int iVar4;

+  longlong lVar5;

+  _HEAD *p_Var6;

+  tagWND *ptVar7;

+  tagTHREADINFO *ptVar8;

+  _HEAD *p_Var9;

+  char cVar10;

+  uint uVar11;

+  longlong lVar12;

+  bool bVar13;

+  undefined1 auStack_c8 [32];

+  undefined1 local_a8;

+  undefined4 local_a0;

+  undefined2 local_98;

+  undefined *local_90;

+  undefined4 local_88;

+  undefined4 local_80;

+  _Win32HMThreadLockItem local_78 [16];

+  undefined8 local_68;

+  undefined8 uStack_60;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  ulonglong local_48;

   

-  p_Var4 = GetRecalcHeadPtiListEntry();

-  p_Var1 = *(_LIST_ENTRY **)p_Var4;

-  do {

-    if (p_Var1 == p_Var4) {

-      return;

-    }

-    this = GetRecalcPtiFromListEntry(p_Var1);

-    if ((this != (tagTHREADINFO *)0x0) && (*(longlong *)(this + 0x2b8) == 0)) {

-      this_00 = *(tagQ **)(this + 0x1d8);

-      bVar2 = tagQ::AreMultipleThreadsAttached(this_00);

-      if (bVar2) {

-        iVar3 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

-        if (iVar3 == 0) {

-          this_00 = (tagQ *)AllocQueue(0,0);

-        }

-        else {

-          this_00 = tagQ::Alloc(this);

-        }

-        if (this_00 == (tagQ *)0x0) {

-          return;

-        }

+  local_48 = __security_cookie ^ (ulonglong)auStack_c8;

+  lVar5 = W32GetUserSessionState();

+  if (param_1 == *(tagTHREADINFO **)(lVar5 + 0x4a60)) {

+    return;

+  }

+  p_Var6 = (_HEAD *)0x0;

+  uVar3 = 0;

+  uVar2 = uVar3;

+  if (param_1 == (tagTHREADINFO *)0x0) {

+LAB_0:

+    lVar5 = W32GetUserSessionState();

+    p_Var9 = p_Var6;

+    if (*(longlong *)(lVar5 + 0x4a60) != 0) {

+      lVar5 = W32GetUserSessionState();

+      p_Var9 = (_HEAD *)(ulonglong)

+                        *(uint *)(*(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1d0) + 0x38);

+    }

+    EtwTraceFocusedProcessChange(p_Var9,uVar2);

+    lVar5 = W32GetUserSessionState();

+    CitProcessForegroundChange(param_1,param_2,*(undefined8 *)(lVar5 + 0x4a60));

+    if (param_1 != (tagTHREADINFO *)0x0) {

+      ForegroundBoost::SetForegroundPriority(param_1,1,8);

+    }

+    lVar5 = W32GetUserSessionState();

+    if (*(longlong *)(lVar5 + 0x4a60) != 0) {

+      lVar5 = W32GetUserSessionState();

+      ForegroundBoost::SetForegroundPriority(*(tagTHREADINFO **)(lVar5 + 0x4a60),0,8);

+    }

+  }

+  else {

+    lVar5 = W32GetUserSessionState();

+    if ((*(longlong *)(lVar5 + 0x4a60) == 0) ||

+       (lVar5 = W32GetUserSessionState(),

+       *(longlong *)(param_1 + 0x1d0) != *(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1d0))) {

+      uVar2 = *(undefined4 *)(*(longlong *)(param_1 + 0x1d0) + 0x38);

+      goto LAB_0;

+    }

+  }

+  lVar5 = W32GetUserSessionState();

+  p_Var9 = p_Var6;

+  if (*(longlong *)(lVar5 + 0x4a60) != 0) {

+    lVar5 = W32GetUserSessionState();

+    p_Var9 = *(_HEAD **)(*(longlong *)(lVar5 + 0x4a60) + 0x1e0);

+  }

+  if (param_1 != (tagTHREADINFO *)0x0) {

+    p_Var6 = (_HEAD *)PsGetThreadId(*(undefined8 *)param_1);

+  }

+  lVar5 = W32GetUserSessionState();

+  uVar2 = uVar3;

+  if (*(longlong *)(lVar5 + 0x4a60) != 0) {

+    lVar5 = W32GetUserSessionState();

+    uVar2 = PsGetThreadId(**(undefined8 **)(lVar5 + 0x4a60));

+  }

+  EtwTraceFocusChange(uVar2,(ulonglong)p_Var6 & 0xffffffff);

+  lVar5 = W32GetUserSessionState();

+  if ((*(longlong *)(lVar5 + 0x4a60) != 0) &&

+     ((param_1 == (tagTHREADINFO *)0x0 ||

+      (lVar5 = W32GetUserSessionState(),

+      *(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1d0) != *(longlong *)(param_1 + 0x1d0))))) {

+    lVar12 = (ulonglong)_DAT_1 * _DAT_fffff78000000320;

+    lVar5 = W32GetUserSessionState();

+    *(int *)(*(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1d0) + 0x42c) =

+         (int)((ulonglong)lVar12 >> 0x18);

+  }

+  lVar5 = W32GetUserSessionState();

+  if (*(longlong *)(lVar5 + 0x4a60) != 0) {

+    lVar5 = GetKeyboardDelegationTargetQ();

+    if ((lVar5 != 0) && (*(longlong *)(lVar5 + 0x88) != 0)) {

+      zzzDelegateInputFocusLostWindowEvent(*(longlong *)(lVar5 + 0x88),0xe);

+    }

+    DisableDelegation();

+  }

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

+     (cVar10 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    cVar10 = '\0';

+  }

+  bVar13 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((cVar10 != '\0') || (bVar13)) {

+    if (param_1 != (tagTHREADINFO *)0x0) {

+      uVar3 = PsGetThreadId(*(undefined8 *)param_1);

+    }

+    lVar5 = W32GetUserSessionState();

+    if (*(longlong *)(lVar5 + 0x4a60) == 0) {

+      local_88 = 0;

+    }

+    else {

+      lVar5 = W32GetUserSessionState();

+      local_88 = PsGetThreadId(**(undefined8 **)(lVar5 + 0x4a60));

+    }

+    lVar5 = W32GetUserSessionState();

+    local_90 = &WPP_2fba9bb74906360b123a4690c98434c6_Traceguids;

+    local_98 = 0x72;

+    local_a0 = 2;

+    local_a8 = 4;

+    local_80 = uVar3;

+    WPP_RECORDER_AND_TRACE_SF_Dd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar13,

+               *(undefined8 *)(lVar5 + 0x10f98));

+  }

+  lVar5 = W32GetUserSessionState();

+  *(tagTHREADINFO **)(lVar5 + 0x4a60) = param_1;

+  if ((param_1 == (tagTHREADINFO *)0x0) ||

+     (lVar5 = W32GetUserSessionState(),

+     (ulonglong)*(uint *)(*(longlong *)(param_1 + 0x1d0) + 0x38) != *(ulonglong *)(lVar5 + 0xf8c8)))

+  {

+    lVar5 = W32GetUserSessionState();

+    uVar11 = *(uint *)(lVar5 + 0x396c) & 0xfffffffd;

+  }

+  else {

+    lVar5 = W32GetUserSessionState();

+    uVar11 = *(uint *)(lVar5 + 0x396c) | 2;

+  }

+  lVar5 = W32GetUserSessionState();

+  *(uint *)(lVar5 + 0x396c) = uVar11;

+  iVar4 = IsCurrentSessionServiceSession();

+  if (iVar4 == 0) {

+    local_68 = 0;

+    uStack_60 = 0;

+    local_58 = 0;

+    uStack_50 = 0;

+    lVar5 = W32GetUserSessionState();

+    if (*(longlong *)(lVar5 + 0x4a60) != 0) {

+      lVar5 = W32GetUserSessionState();

+      local_68 = CONCAT44(local_68._4_4_,

+                          *(undefined4 *)

+                           (*(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1d0) + 0x38));

+      lVar5 = W32GetUserSessionState();

+      uVar2 = PsGetThreadId(**(undefined8 **)(lVar5 + 0x4a60));

+      local_68 = CONCAT44(uVar2,(undefined4)local_68);

+      if (param_2 == (tagWND *)0x0) {

+        local_58 = 0;

       }

-      tagTHREADINFO::AssignAttachQueue(this,this_00);

-      zzzRecalc2(*(tagQ **)(this + 0x2b8));

-    }

-    p_Var1 = *(_LIST_ENTRY **)p_Var1;

-  } while( true );

+      else {

+        local_58 = *(undefined8 *)param_2;

+      }

+    }

+    SendMessageTo(2,&local_68,0x20);

+  }

+  if ((((param_1 != (tagTHREADINFO *)0x0) &&

+       (lVar5 = W32GetUserSessionState(), *(int *)(lVar5 + 0x36d8) == 1)) &&

+      (ptVar7 = ShellWindowManagement::GetShellSpecialWindow(*(tagDESKTOP **)(param_1 + 0x1f0),1),

+      ptVar7 != (tagWND *)0x0)) && (*(tagTHREADINFO **)(ptVar7 + 0x10) == param_1)) {

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20) == 0)) ||

+       (cVar10 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+      cVar10 = '\0';

+    }

+    bVar13 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar10 != '\0') || (bVar13)) {

+      lVar12 = W32GetUserSessionState();

+      local_90 = &WPP_2fba9bb74906360b123a4690c98434c6_Traceguids;

+      local_98 = 0x73;

+      local_a0 = 6;

+      local_a8 = 4;

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar13,

+                 *(undefined8 *)(lVar12 + 0x10f98));

+    }

+    *(undefined4 *)(lVar5 + 0x36d8) = 2;

+  }

+  lVar5 = W32GetUserSessionState();

+  if ((*(longlong *)(lVar5 + 0x4a60) != 0) &&

+     (lVar5 = W32GetUserSessionState(), *(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1e0) != 0))

+  {

+    lVar5 = W32GetUserSessionState();

+    if ((-1 < (char)*(undefined4 *)(lVar5 + 0x10658)) &&

+       (lVar5 = W32GetUserSessionState(), *(longlong *)(lVar5 + 0x3798) != 0)) {

+      lVar5 = W32GetUserSessionState();

+      lVar5 = *(longlong *)(lVar5 + 0x3798);

+      lVar12 = W32GetUserSessionState();

+      if (lVar5 != *(longlong *)(*(longlong *)(lVar12 + 0x4a60) + 0x1e0)) goto LAB_2;

+    }

+    ptVar8 = PtiCurrent();

+    Win32HM_LockIntoThread<1>(ptVar8,p_Var9,local_78);

+    lVar5 = W32GetUserSessionState();

+    xxxChangeForegroundKeyboardTable

+              (p_Var9,*(undefined8 *)(*(longlong *)(lVar5 + 0x4a60) + 0x1e0),0);

+    Win32HMThreadLockBase<tagMONITOR,1,0>::~Win32HMThreadLockBase<tagMONITOR,1,0>

+              ((Win32HMThreadLockBase<tagMONITOR,1,0> *)local_78);

+  }

+LAB_2:

+  iVar4 = Feature_AsyncKeyStateRecentDown_Removal2__private_IsEnabledDeviceUsageNoInline();

+  if (iVar4 == 0) {

+    lVar5 = W32GetUserSessionState();

+    *(undefined8 *)(lVar5 + 0x3878) = 0;

+    *(undefined8 *)(lVar5 + 0x3880) = 0;

+    *(undefined8 *)(lVar5 + 0x3888) = 0;

+    *(undefined8 *)(lVar5 + 0x3890) = 0;

+    lVar5 = W32GetUserSessionState();

+    piVar1 = (int *)(*(longlong *)(lVar5 + 0x4e30) + 0x1b4c);

+    *piVar1 = *piVar1 + 1;

+  }

+  return;

 }
```

## `xxxDDETrackPostHook`  (modified)

```diff
--- xxxDDETrackPostHook
+++ xxxDDETrackPostHook
@@ -1,7 +1,175 @@
 

-void xxxDDETrackPostHook(void)

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+

+ulong xxxDDETrackPostHook(ulong *param_1,tagWND *param_2,undefined8 param_3,ushort *param_4)

 

 {

-  return;

+  tagFREELIST *ptVar1;

+  int iVar2;

+  longlong lVar3;

+  tagTHREADINFO *ptVar4;

+  tagWND *ptVar5;

+  tagDDECONV *ptVar6;

+  tagDDECONV *ptVar7;

+  uint uVar8;

+  undefined8 uVar9;

+  ulong uVar10;

+  bool bVar11;

+  _Win32HMThreadLockItem local_68 [16];

+  ulonglong local_58;

+  ulonglong uStack_50;

+  undefined8 local_48;

+  undefined8 uStack_40;

+  undefined8 local_38;

+  undefined8 uStack_30;

+  undefined8 local_28;

+  

+  ptVar6 = (tagDDECONV *)0x0;

+  lVar3 = W32GetUserSessionState();

+  if ((*(uint *)(lVar3 + 0x105e0) & 0x4000000) != 0) {

+    uVar10 = *param_1;

+    local_28 = 0;

+    local_58 = 0;

+    uStack_50 = 0;

+    local_48 = 0;

+    uStack_40 = 0;

+    local_38 = 0;

+    uStack_30 = 0;

+    if ((((uVar10 == 0x3e2) || (uVar10 == 0x3e4)) || (uVar10 == 0x3e5)) ||

+       ((uVar10 == 999 || (uVar10 == 1000)))) {

+      xxxClientGetDDEHookData(uVar10,*(undefined8 *)param_4,&local_58);

+    }

+    else {

+      local_58 = (ulonglong)*param_4;

+      uStack_50 = (ulonglong)param_4[1];

+    }

+    xxxMessageEvent(param_2,*param_1,param_3,*(undefined8 *)param_4,0x4000000,&local_58);

+  }

+  ptVar4 = PtiCurrent();

+  if (*(longlong *)(ptVar4 + 0x1d0) == *(longlong *)(*(longlong *)(param_2 + 0x10) + 0x1d0)) {

+    return 2;

+  }

+  if (*param_1 == 0x3e0) {

+    return 0;

+  }

+  ptVar5 = (tagWND *)ValidateHwnd(param_3);

+  if (ptVar5 == (tagWND *)0x0) {

+    uVar10 = (*param_1 == 0x3e1) + 1;

+  }

+  else {

+    ptVar6 = FindDdeConv(ptVar5,param_2);

+    if (ptVar6 == (tagDDECONV *)0x0) {

+      uVar10 = (ulong)(*param_1 == 0x3e1);

+    }

+    else {

+      ptVar4 = PtiCurrent();

+      if ((ptVar4 != *(tagTHREADINFO **)(ptVar6 + 0x10)) &&

+         (ptVar4 = PtiCurrent(), *(short *)(ptVar4 + 0x2a0) != 0x400)) {

+        UserSetLastError(0x580);

+        return 0;

+      }

+      ptVar4 = PtiCurrent();

+      Win32HM_LockIntoThread<0>(ptVar4,(_HEAD *)ptVar6,local_68);

+      ptVar1 = *(tagFREELIST **)(ptVar6 + 0x48);

+      *(undefined8 *)(ptVar6 + 0x48) = 0;

+      xxxFreeListFree(ptVar1);

+      iVar2 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

+      if (iVar2 == 0) {

+        iVar2 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+        if (iVar2 == 0) {

+          lVar3 = _HMPheFromObject(ptVar6);

+          bVar11 = (bool)(~*(byte *)(lVar3 + 0x19) & 1);

+        }

+        else {

+          ptVar7 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)ptVar6,10);

+          bVar11 = ptVar7 == ptVar6;

+        }

+        if (bVar11 != false) {

+          if (*param_1 != 0x3e1) {

+            uVar8 = *(uint *)(ptVar6 + 0x50) & 6;

+            goto LAB_0;

+          }

+          goto LAB_1;

+        }

+LAB_2:

+        uVar10 = 1;

+      }

+      else {

+        iVar2 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+        if (iVar2 == 0) {

+          lVar3 = _HMPheFromObject(ptVar6);

+          bVar11 = (bool)(~*(byte *)(lVar3 + 0x19) & 1);

+        }

+        else {

+          ptVar7 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)ptVar6,10);

+          bVar11 = ptVar7 == ptVar6;

+        }

+        if (bVar11 == false) goto LAB_2;

+        if (*param_1 != 0x3e1) {

+          uVar8 = *(uint *)(ptVar6 + 0x50) & 0xe;

+LAB_0:

+          if (uVar8 != 0) goto LAB_2;

+        }

+LAB_1:

+        if (*(longlong *)(ptVar6 + 0x38) == 0) {

+          if ((*(uint *)(ptVar6 + 0x50) & 1) == 0) {

+            uVar10 = xxxUnexpectedClientPost(param_1,(__int64 *)param_4,ptVar6);

+          }

+          else {

+            uVar10 = xxxUnexpectedServerPost(param_1,(__int64 *)param_4,ptVar6);

+          }

+        }

+        else {

+          uVar10 = (**(code **)(*(longlong *)(ptVar6 + 0x38) + 0x20))();

+        }

+      }

+      Win32HMThreadLockBase<tagKL,0,0>::~Win32HMThreadLockBase<tagKL,0,0>

+                ((Win32HMThreadLockBase<tagKL,0,0> *)local_68);

+    }

+  }

+  if (uVar10 != 1) {

+    return uVar10;

+  }

+  ptVar4 = PtiCurrent();

+  LOCK();

+  uVar8 = *(uint *)(ptVar4 + 0x210);

+  if (uVar8 == 0) {

+    *(uint *)(ptVar4 + 0x210) = 0;

+    uVar8 = 0;

+  }

+  UNLOCK();

+  if ((uVar8 & 1) != 0) {

+    return 1;

+  }

+  uVar9 = 0x8000;

+  uVar8 = *param_1 & 0xffff;

+  if (uVar8 == 0x3e2) {

+    uVar9 = 0x8101;

+  }

+  else if (uVar8 != 0x3e3) {

+    if (uVar8 == 0x3e4) {

+      uVar9 = 0x8001;

+    }

+    else {

+      if (uVar8 != 0x3e5) {

+        if (uVar8 == 0x3e6) goto LAB_3;

+        if (uVar8 != 999) {

+          if (uVar8 != 1000) {

+            return 1;

+          }

+          uVar9 = 0x8800;

+          goto LAB_3;

+        }

+      }

+      uVar9 = 0x8083;

+    }

+  }

+LAB_3:

+  uVar10 = 1;

+  if (ptVar6 != (tagDDECONV *)0x0) {

+    xxxClientFreeDDEHandle(*(undefined8 *)param_4,uVar9);

+    uVar10 = 3;

+  }

+  return uVar10;

 }
```

## `IsMessageAllowedAcrossILByReceiver`  (modified)

```diff
--- IsMessageAllowedAcrossILByReceiver
+++ CheckForMessageAccessCrossIL
@@ -1,90 +1,87 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-int __cdecl IsMessageAllowedAcrossILByReceiver(tagPROCESSINFO *param_1,tagWND *param_2,uint param_3)

+uint CheckForMessageAccessCrossIL

+               (tagPROCESSINFO *param_1,tagPROCESSINFO *param_2,tagWND *param_3,uint param_4,

+               __uint64 param_5,__int64 param_6)

 

 {

-  longlong *plVar1;

-  undefined4 uVar2;

-  undefined4 uVar3;

-  undefined8 uVar4;

-  undefined8 uVar5;

-  ulong uVar6;

-  undefined4 uVar7;

-  int iVar8;

-  int extraout_EAX;

-  int *in_RAX;

-  undefined4 *puVar9;

-  tagMONITOR *ptVar10;

-  ERECTL *this;

-  SmartObjStackRefBase<tagPOPUPMENU> *unaff_RBX;

-  longlong unaff_RBP;

-  ushort unaff_SI;

-  tagMONITOR *unaff_RDI;

-  LPRECT unaff_R14;

-  int unaff_R15D;

+  bool bVar1;

+  int iVar2;

+  uint uVar3;

+  longlong lVar4;

+  tagTHREADINFO *ptVar5;

+  tagUIPI_INFO *ptVar6;

+  tagUIPI_INFO *ptVar7;

+  undefined1 auStackY_88 [32];

+  undefined4 local_58;

+  undefined4 local_54;

+  undefined4 local_50;

+  ulonglong local_48;

   

-  if (*in_RAX < (int)in_RAX) {

-    uVar6 = GetWindowCompositedDpiContext(*(tagWND **)(**(longlong **)unaff_RBX + 0x10));

-    GetMonitorMenuRectForDpi((tagRECT *)(unaff_RBP + -9),unaff_RDI,(ushort)(uVar6 >> 8) & unaff_SI);

-    puVar9 = (undefined4 *)(unaff_RBP + -9);

-    *(undefined8 *)(unaff_RBP + -9) = *(undefined8 *)(unaff_RBP + -9);

-    *(undefined8 *)(unaff_RBP + -1) = *(undefined8 *)(unaff_RBP + -1);

-  }

-  else {

-    puVar9 = (undefined4 *)(unaff_RBP + 0x17);

-    *(undefined8 *)(unaff_RBP + 0x17) = *(undefined8 *)(unaff_RBP + -0x29);

-    *(undefined8 *)(unaff_RBP + 0x1f) = *(undefined8 *)(unaff_RBP + -0x21);

-  }

-  uVar7 = puVar9[1];

-  uVar2 = puVar9[2];

-  uVar3 = puVar9[3];

-  plVar1 = *(longlong **)unaff_RBX;

-  *(undefined4 *)(unaff_RBP + -0x19) = *puVar9;

-  *(undefined4 *)(unaff_RBP + -0x15) = uVar7;

-  *(undefined4 *)(unaff_RBP + -0x11) = uVar2;

-  *(undefined4 *)(unaff_RBP + -0xd) = uVar3;

-  if (((byte)*(undefined4 *)(*(longlong *)(*(longlong *)(*plVar1 + 0x10) + 0x28) + 0x120) & 0xf) ==

-      2) {

-LAB_0:

-    if (unaff_R15D == 0) {

-LAB_1:

-      uVar4 = *(undefined8 *)(unaff_RBP + -0x19);

-      uVar5 = *(undefined8 *)(unaff_RBP + -0x11);

-      unaff_R14->left = (int)uVar4;

-      unaff_R14->top = (int)((ulonglong)uVar4 >> 0x20);

-      unaff_R14->right = (int)uVar5;

-      unaff_R14->bottom = (int)((ulonglong)uVar5 >> 0x20);

-      goto LAB_2;

+  local_48 = __security_cookie ^ (ulonglong)auStackY_88;

+  iVar2 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 == 0) {

+    if (param_2 == param_1) {

+      uVar3 = 1;

+    }

+    else if (param_4 == 0x2cd) {

+      uVar3 = 0;

+    }

+    else {

+      uVar3 = IsMessageAllowedAcrossILByReceiver(param_2,param_3,param_4);

+      if ((uVar3 == 0) && (uVar3 = IsMessageAlwaysAllowedAcrossIL(param_4), uVar3 == 0)) {

+        if ((param_4 != 0x112) ||

+           (((param_5 - 0xf020 & 0xfffffffffffffebf) != 0 || (param_5 == 0xf160)))) {

+          iVar2 = Feature_MsgUseCSRSSTrueIL__private_IsEnabledDeviceUsageNoInline();

+          if (iVar2 == 0) {

+            lVar4 = W32GetUserGdiSessionState();

+            if (*(longlong *)param_2 == *(longlong *)(lVar4 + 0x28)) {

+              local_54 = 0;

+              local_50 = 0;

+              local_58 = 0x2000;

+            }

+            else {

+              local_58 = *(undefined4 *)(param_2 + 0x130);

+              local_54 = *(undefined4 *)(param_2 + 0x134);

+              local_50 = *(undefined4 *)(param_2 + 0x138);

+            }

+            ptVar6 = (tagUIPI_INFO *)(param_1 + 0x130);

+            ptVar7 = (tagUIPI_INFO *)&local_58;

+          }

+          else {

+            ptVar7 = (tagUIPI_INFO *)

+                     (-(ulonglong)(param_2 != (tagPROCESSINFO *)0x0) & (ulonglong)(param_2 + 0x130))

+            ;

+            ptVar6 = (tagUIPI_INFO *)

+                     ((ulonglong)(param_1 + 0x130) & -(ulonglong)(param_1 != (tagPROCESSINFO *)0x0))

+            ;

+          }

+          bVar1 = UIPrivilegeIsolation::CheckAccess(ptVar6,ptVar7,0);

+          if (bVar1) {

+            return 1;

+          }

+          if ((((param_3 == (tagWND *)0x0) || (param_4 != 0x319)) ||

+              (lVar4 = *(longlong *)(param_3 + 0x10), *(tagWND **)(lVar4 + 0x648) != param_3)) ||

+             (ptVar5 = PtiCurrent(), *(longlong *)(lVar4 + 0x1d8) != *(longlong *)(ptVar5 + 0x1d8)))

+          {

+            iVar2 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+            if (iVar2 != 0) {

+              return 0;

+            }

+            EtwTraceUIPIMsgError(param_1,param_2,param_4,param_5);

+            UserSetLastError(5);

+            return 0;

+          }

+        }

+        uVar3 = 1;

+      }

     }

   }

   else {

-    ptVar10 = (tagMONITOR *)

-              ValidateHmonitorNoRip

-                        (*(undefined8 *)

-                          (*(longlong *)(*(longlong *)(**(longlong **)unaff_RBX + 0x10) + 0x28) +

-                          0x100));

-    *(tagMONITOR **)(unaff_RBP + -0x39) = ptVar10;

-    if ((ptVar10 == (tagMONITOR *)0x0) || (ptVar10 == unaff_RDI)) goto LAB_0;

-    uVar7 = W32GetCurrentThreadDpiAwarenessContext();

-    if (*(int *)**(undefined8 **)unaff_RBX < 0) {

-      this = (ERECTL *)(unaff_RDI + 0x70);

-      iVar8 = ERECTL::bWrapped(this);

-      if (iVar8 != 0) goto LAB_3;

-      PhysicalToLogicalDPIRect(unaff_RBP + -0x19,this,uVar7,unaff_RBP + -0x39);

-    }

-    else {

-LAB_3:

-      PhysicalToLogicalDPIRect

-                (unaff_RBP + -0x19,*(longlong *)(unaff_RDI + 0x28) + 0x1c,uVar7,unaff_RBP + -0x39);

-    }

-    if (unaff_R15D == 0) goto LAB_1;

-    PhysicalToLogicalDPIRect

-              (unaff_RBP + 7,*(longlong *)(unaff_RDI + 0x28) + 0x1c,uVar7,unaff_RBP + -0x39);

+    bVar1 = CheckForMessageAccessCrossILEx(param_2,param_3,param_4,param_5,param_6);

+    uVar3 = (uint)bVar1;

   }

-  SubtractRect(unaff_R14,(RECT *)(unaff_RBP + 7),(RECT *)(unaff_RBP + -0x19));

-LAB_2:

-  SmartObjStackRefBase<tagPOPUPMENU>::~SmartObjStackRefBase<tagPOPUPMENU>(unaff_RBX);

-  return extraout_EAX;

+  return uVar3;

 }
```

## `xxxBMPtoDIB`  (modified)

```diff
--- xxxBMPtoDIB
+++ xxxBMPtoDIBV5
@@ -1,12 +1,21 @@
 

-tagBITMAPINFOHEADER * __cdecl xxxBMPtoDIB(HBITMAP__ *param_1,HPALETTE__ *param_2,ulong *param_3)

+/* struct BITMAPV5HEADER * __ptr64 __cdecl xxxBMPtoDIBV5(struct HBITMAP__ * __ptr64,struct

+   HPALETTE__ * __ptr64) */

+

+BITMAPV5HEADER * __cdecl xxxBMPtoDIBV5(HBITMAP__ *param_1,HPALETTE__ *param_2)

 

 {

-  code *pcVar1;

-  tagBITMAPINFOHEADER *ptVar2;

+  tagBITMAPINFOHEADER *ptVar1;

+  BITMAPV5HEADER *pBVar2;

+  ulong local_res18 [4];

   

-  pcVar1 = (code *)swi(3);

-  ptVar2 = (tagBITMAPINFOHEADER *)(*pcVar1)();

-  return ptVar2;

+  local_res18[0] = 0;

+  ptVar1 = xxxBMPtoDIB(param_1,param_2,local_res18);

+  pBVar2 = (BITMAPV5HEADER *)0x0;

+  if (ptVar1 != (tagBITMAPINFOHEADER *)0x0) {

+    pBVar2 = DIBtoDIBV5(ptVar1,local_res18[0]);

+    Win32FreePool(ptVar1);

+  }

+  return pBVar2;

 }
```

## `Feature_MsgUseCSRSSTrueIL__private_IsEnabledDeviceUsageNoInline`  (modified)

```diff
--- Feature_MsgUseCSRSSTrueIL__private_IsEnabledDeviceUsageNoInline
+++ CheckForMessageAccessCrossIL
@@ -1,61 +1,87 @@
 

-undefined8 * Feature_MsgUseCSRSSTrueIL__private_IsEnabledDeviceUsageNoInline(int *param_1)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+

+uint CheckForMessageAccessCrossIL

+               (tagPROCESSINFO *param_1,tagPROCESSINFO *param_2,tagWND *param_3,uint param_4,

+               __uint64 param_5,__int64 param_6)

 

 {

-  undefined8 uVar1;

-  uint uVar2;

-  ulong uVar3;

-  ulonglong in_RAX;

-  undefined8 *_Dst;

-  ulonglong unaff_RBX;

-  ulonglong _Size;

-  ulonglong uVar4;

-  tagBITMAPINFOHEADER *in_stack_00000050;

+  bool bVar1;

+  int iVar2;

+  uint uVar3;

+  longlong lVar4;

+  tagTHREADINFO *ptVar5;

+  tagUIPI_INFO *ptVar6;

+  tagUIPI_INFO *ptVar7;

+  undefined1 auStackY_88 [32];

+  undefined4 local_58;

+  undefined4 local_54;

+  undefined4 local_50;

+  ulonglong local_48;

   

-  *(uint *)(unaff_RBX - 0x7df0d705) = *(uint *)(unaff_RBX - 0x7df0d705) | (uint)in_RAX;

-  *param_1 = *param_1 + -0x74b80000;

-  uVar4 = (ulonglong)*(ushort *)((in_RAX & 0xffffffffffffff50) + 0xe) *

-          (ulonglong)*(uint *)(in_stack_00000050 + 4);

-  if (uVar4 < 0x100000000) {

-    uVar2 = -*(uint *)(in_stack_00000050 + 8);

-    if ((int)uVar2 < 0) {

-      uVar2 = *(uint *)(in_stack_00000050 + 8);

+  local_48 = __security_cookie ^ (ulonglong)auStackY_88;

+  iVar2 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 == 0) {

+    if (param_2 == param_1) {

+      uVar3 = 1;

     }

-    uVar4 = (ulonglong)((int)uVar4 + 0x1fU >> 3 & 0x1ffffffc) * (ulonglong)uVar2;

-    if (uVar4 < 0x100000000) {

-      uVar3 = SizeOfDibColorTable(in_stack_00000050);

-      _Size = (ulonglong)uVar3;

-      uVar2 = (uint)uVar4 + 0x7c;

-      if (((((uint)uVar4 <= uVar2) && (uVar2 = uVar2 + uVar3, uVar3 <= uVar2)) &&

-          (_Size + 0x28 + (uVar4 & 0xffffffff) <= unaff_RBX)) &&

-         (_Dst = (undefined8 *)Win32AllocPoolZInit(uVar2), _Dst != (undefined8 *)0x0)) {

-        memset(_Dst,0,0x7c);

-        uVar1 = *(undefined8 *)(in_stack_00000050 + 8);

-        *_Dst = *(undefined8 *)in_stack_00000050;

-        _Dst[1] = uVar1;

-        uVar1 = *(undefined8 *)(in_stack_00000050 + 0x18);

-        _Dst[2] = *(undefined8 *)(in_stack_00000050 + 0x10);

-        _Dst[3] = uVar1;

-        _Dst[4] = *(undefined8 *)(in_stack_00000050 + 0x20);

-        *(undefined4 *)_Dst = 0x7c;

-        *(undefined4 *)(_Dst + 7) = 0x73524742;

-        *(undefined4 *)((longlong)_Dst + 0x6c) = 4;

-        if ((*(int *)(in_stack_00000050 + 0x10) == 3) &&

-           ((*(short *)(in_stack_00000050 + 0xe) == 0x10 ||

-            (*(short *)(in_stack_00000050 + 0xe) == 0x20)))) {

-          *(undefined4 *)(_Dst + 5) = *(undefined4 *)(in_stack_00000050 + 0x28);

-          *(undefined4 *)((longlong)_Dst + 0x2c) = *(undefined4 *)(in_stack_00000050 + 0x2c);

-          *(undefined4 *)(_Dst + 6) = *(undefined4 *)(in_stack_00000050 + 0x30);

+    else if (param_4 == 0x2cd) {

+      uVar3 = 0;

+    }

+    else {

+      uVar3 = IsMessageAllowedAcrossILByReceiver(param_2,param_3,param_4);

+      if ((uVar3 == 0) && (uVar3 = IsMessageAlwaysAllowedAcrossIL(param_4), uVar3 == 0)) {

+        if ((param_4 != 0x112) ||

+           (((param_5 - 0xf020 & 0xfffffffffffffebf) != 0 || (param_5 == 0xf160)))) {

+          iVar2 = Feature_MsgUseCSRSSTrueIL__private_IsEnabledDeviceUsageNoInline();

+          if (iVar2 == 0) {

+            lVar4 = W32GetUserGdiSessionState();

+            if (*(longlong *)param_2 == *(longlong *)(lVar4 + 0x28)) {

+              local_54 = 0;

+              local_50 = 0;

+              local_58 = 0x2000;

+            }

+            else {

+              local_58 = *(undefined4 *)(param_2 + 0x130);

+              local_54 = *(undefined4 *)(param_2 + 0x134);

+              local_50 = *(undefined4 *)(param_2 + 0x138);

+            }

+            ptVar6 = (tagUIPI_INFO *)(param_1 + 0x130);

+            ptVar7 = (tagUIPI_INFO *)&local_58;

+          }

+          else {

+            ptVar7 = (tagUIPI_INFO *)

+                     (-(ulonglong)(param_2 != (tagPROCESSINFO *)0x0) & (ulonglong)(param_2 + 0x130))

+            ;

+            ptVar6 = (tagUIPI_INFO *)

+                     ((ulonglong)(param_1 + 0x130) & -(ulonglong)(param_1 != (tagPROCESSINFO *)0x0))

+            ;

+          }

+          bVar1 = UIPrivilegeIsolation::CheckAccess(ptVar6,ptVar7,0);

+          if (bVar1) {

+            return 1;

+          }

+          if ((((param_3 == (tagWND *)0x0) || (param_4 != 0x319)) ||

+              (lVar4 = *(longlong *)(param_3 + 0x10), *(tagWND **)(lVar4 + 0x648) != param_3)) ||

+             (ptVar5 = PtiCurrent(), *(longlong *)(lVar4 + 0x1d8) != *(longlong *)(ptVar5 + 0x1d8)))

+          {

+            iVar2 = Feature_NTUSER_Compartment__private_IsEnabledDeviceUsageNoInline();

+            if (iVar2 != 0) {

+              return 0;

+            }

+            EtwTraceUIPIMsgError(param_1,param_2,param_4,param_5);

+            UserSetLastError(5);

+            return 0;

+          }

         }

-        if (uVar3 != 0) {

-          memcpy((undefined4 *)((longlong)_Dst + 0x7c),in_stack_00000050 + 0x28,_Size);

-        }

-        memcpy((void *)(_Size + 0x7c + (longlong)_Dst),in_stack_00000050 + _Size + 0x28,

-               uVar4 & 0xffffffff);

-        return _Dst;

+        uVar3 = 1;

       }

     }

   }

-  return (undefined8 *)0x0;

+  else {

+    bVar1 = CheckForMessageAccessCrossILEx(param_2,param_3,param_4,param_5,param_6);

+    uVar3 = (uint)bVar1;

+  }

+  return uVar3;

 }
```

## `xxxAdviseData`  (modified)

```diff
--- xxxAdviseData
+++ xxxAdviseData
@@ -1,2 +1,112 @@
-Failed to decompile win32kfull.sys - .ProgramDB xxxAdviseData : Error: Decompile error: 
-Low-level Error: DuplicateFunctionError, but could not recover original symbol+

+/* unsigned long __cdecl xxxAdviseData(unsigned long * __ptr64,__int64 * __ptr64,struct tagDDECONV *

+   __ptr64) */

+

+ulong __cdecl xxxAdviseData(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

+

+{

+  tagINTDDEINFO *ptVar1;

+  ushort uVar2;

+  ulong uVar3;

+  int iVar4;

+  tagDDECONV *ptVar5;

+  tagPUBOBJ *ptVar6;

+  void *pvVar7;

+  longlong lVar8;

+  tagXSTATE *ptVar9;

+  uint uVar10;

+  bool bVar11;

+  ulong local_res20 [2];

+  tagINTDDEINFO *local_38;

+  void *local_30;

+  

+  local_res20[0] = 0x83;

+  pvVar7 = (void *)0x0;

+  local_38 = (tagINTDDEINFO *)0x0;

+  local_30 = (void *)0x0;

+  uVar3 = xxxCopyDdeIn((void *)*param_2,local_res20,&local_30,&local_38);

+  iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+  if (iVar4 == 0) {

+    lVar8 = _HMPheFromObject(param_3);

+    bVar11 = (bool)(~*(byte *)(lVar8 + 0x19) & 1);

+  }

+  else {

+    ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3,10);

+    bVar11 = ptVar5 == param_3;

+  }

+  ptVar1 = local_38;

+  if (bVar11 == false) {

+    if (local_38 != (tagINTDDEINFO *)0x0) {

+      Win32FreePool();

+      return 3;

+    }

+    return 3;

+  }

+  if (uVar3 != 2) {

+    return uVar3;

+  }

+  uVar2 = *(ushort *)(local_38 + 0x48);

+  if ((uVar2 & 0xa000) == 0) {

+    uVar2 = uVar2 | 0x2000;

+    *(ushort *)(local_38 + 0x48) = uVar2;

+  }

+  if ((uVar2 & 0x2000) == 0) {

+    iVar4 = AddPublicObject((uint)*(ushort *)(local_38 + 0x4a),*(void **)(local_38 + 0x30),

+                            *(ulong *)(*(longlong *)

+                                        (*(longlong *)(*(longlong *)(param_3 + 0x28) + 0x10) + 0x1d0

+                                        ) + 0x38));

+    uVar10 = local_res20[0];

+    if (iVar4 != 0) {

+      uVar10 = local_res20[0] | 0x2000;

+    }

+  }

+  else {

+    ptVar6 = IsObjectPublic(*(void **)(local_38 + 0x30));

+    if (ptVar6 != (tagPUBOBJ *)0x0) {

+      Win32FreePool(ptVar1);

+      return 3;

+    }

+    iVar4 = GiveObject((uint)*(ushort *)(ptVar1 + 0x4a),*(void **)(ptVar1 + 0x30),

+                       *(ulong *)(*(longlong *)

+                                   (*(longlong *)(*(longlong *)(param_3 + 0x30) + 0x10) + 0x1d0) +

+                                 0x38));

+    uVar3 = local_res20[0];

+    if (iVar4 != 0) {

+      uVar3 = local_res20[0] | 0x4000;

+    }

+    uVar10 = uVar3 | 0x400;

+  }

+  *param_1 = *param_1 | 0x80000000;

+  if (*(short *)(ptVar1 + 0x48) < 0) {

+    pvVar7 = AnticipatePost(*(tagDDECONV **)(param_3 + 0x20),xxxAdviseDataAck,(void *)0x0,local_30,

+                            ptVar1,uVar10);

+  }

+  else {

+    xxxClientFreeDDEHandle(local_30);

+    iVar4 = Feature_3758597435__private_IsEnabledDeviceUsageNoInline();

+    if (iVar4 == 0) {

+      lVar8 = _HMPheFromObject(param_3);

+      bVar11 = (bool)(~*(byte *)(lVar8 + 0x19) & 1);

+    }

+    else {

+      ptVar5 = (tagDDECONV *)HMValidateHandleNoSecure(*(undefined8 *)param_3);

+      bVar11 = ptVar5 == param_3;

+    }

+    if (bVar11 == false) {

+      *param_2 = 0;

+      return 3;

+    }

+    ptVar9 = Createpxs((_func_ulong_ulong_ptr___int64_ptr_tagDDECONV_ptr *)0x0,(void *)0x0,

+                       (void *)0x0,ptVar1,uVar10 | 0x200);

+    if (ptVar9 != (tagXSTATE *)0x0) {

+      *(undefined8 *)(ptVar9 + 0x10) = *(undefined8 *)(*(longlong *)(param_3 + 0x30) + 0x10);

+      pvVar7 = *(void **)ptVar9;

+    }

+  }

+  *param_2 = (__int64)pvVar7;

+  if (pvVar7 == (void *)0x0) {

+    return 3;

+  }

+  return 2;

+}

+
```

## `CursorApiRouter::SetPointerShape`  (modified)

```diff
--- CursorApiRouter::SetPointerShape
+++ CursorApiRouter::SetPointerShape
@@ -1,2 +1,73 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::SetPointerShape : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl CursorApiRouter::SetPointerShape(struct _CURSINFO * __ptr64,unsigned

+   long,unsigned long,unsigned long) __ptr64 */

+

+void __thiscall

+CursorApiRouter::SetPointerShape

+          (CursorApiRouter *this,_CURSINFO *param_1,ulong param_2,ulong param_3,ulong param_4)

+

+{

+  CursorApi CVar1;

+  CursorApi CVar2;

+  bool bVar3;

+  RoutingStateActionNeeded RVar4;

+  int iVar5;

+  longlong lVar6;

+  uint uVar7;

+  CursorApiRouter *this_00;

+  

+  InputTraceLogging::Cursor::Api::SetPointerShape(param_1,param_2,param_3);

+  W32AcquirePushLockExclusiveEx((W32_PUSH_LOCK *)(this + 0x30),0);

+  *(ulong *)this = param_2;

+  this[0x11] = (CursorApiRouter)(param_1 == (_CURSINFO *)0x0);

+  if ((param_1 == (_CURSINFO *)0x0) || ((param_2 & 0x10) == 0)) {

+    *(uint *)(this + 4) = *(uint *)(this + 4) & 0xfffffffe;

+  }

+  else {

+    *(uint *)(this + 4) = *(uint *)(this + 4) | 1;

+  }

+  uVar7 = *(uint *)(this + 4) | 2;

+  if (param_3 == 0) {

+    uVar7 = *(uint *)(this + 4) & 0xfffffffd;

+  }

+  *(uint *)(this + 4) = uVar7;

+  CVar1 = *(CursorApi *)(this + 0x28);

+  *(ulong *)(this + 8) = param_3;

+  RVar4 = UpdateRoutingState(this);

+  CVar2 = *(CursorApi *)(this + 0x28);

+  W32ReleasePushLockExclusiveEx((W32_PUSH_LOCK *)(this + 0x30),0);

+  HandleRoutingStateAction(this,RVar4);

+  uVar7 = CVar2 - 1;

+  this_00 = (CursorApiRouter *)(ulonglong)uVar7;

+  if (uVar7 == 0) {

+    if (CVar1 == 2) {

+      DestroyGreTrailsTimerIfExists((CursorApiRouter *)0x0);

+      GreSetPointer(0,*(undefined4 *)this,0,0);

+      DwmMovePointer(this,*(int *)(this + 0x20),*(int *)(this + 0x24),1,1,(void *)0x0,0);

+    }

+    DwmSetPointer(this,param_1);

+    UpdateDwmCursorDesktopVisibility(this);

+  }

+  else if (uVar7 == 1) {

+    if (CVar1 == 1) {

+      this[0x12] = (CursorApiRouter)0x0;

+      SetDWMCursorDesktopVisibility((CursorApiRouter *)0x1,false);

+      bVar3 = IsGreTrailsTimerNeeded(this_00);

+      if (bVar3) {

+        EnsureGreTrailsTimer(this_00);

+      }

+      GreMovePointer(*(undefined8 *)(this + 0x18),*(undefined4 *)(this + 0x20),

+                     *(undefined4 *)(this + 0x24),1);

+    }

+    GreSetPointer(param_1,param_2,param_3,param_4);

+  }

+  if (CVar2 != CVar1) {

+    bVar3 = (bool)IsInputProcessingActivated();

+    iVar5 = IsRemoteConnection();

+    lVar6 = W32GetUserSessionState();

+    InputTraceLogging::Cursor::Api::ChangeCursorApiMode

+              (true,CVar1,CVar2,*(int *)(lVar6 + 0x4b20) != 0,iVar5 != 0,bVar3);

+  }

+  return;

+}

+
```

## `CRecalcProp::s_OnWindowBecomingChild`  (modified)

```diff
--- CRecalcProp::s_OnWindowBecomingChild
+++ CRecalcProp::s_OnWindowBecomingChild
@@ -1,2 +1,55 @@
-Failed to decompile win32kfull.sys - .ProgramDB CRecalcProp::s_OnWindowBecomingChild : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: static void __cdecl CRecalcProp::s_OnWindowBecomingChild(struct tagWND * __ptr64) */

+

+void __cdecl CRecalcProp::s_OnWindowBecomingChild(tagWND *param_1)

+

+{

+  undefined8 uVar1;

+  CRecalcProp *pCVar2;

+  longlong lVar3;

+  char cVar4;

+  char cVar5;

+  bool bVar6;

+  

+  pCVar2 = GetRecalcProperty(param_1);

+  if (pCVar2 != (CRecalcProp *)0x0) {

+    if ((*(int *)(pCVar2 + 0x18) == 3) || (pCVar2[0x38] != (CRecalcProp)0x0)) {

+      if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0 ||

+          (cVar4 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)))) {

+        cVar4 = '\0';

+      }

+      bVar6 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar4 != '\0') || (bVar6)) {

+        uVar1 = *(undefined8 *)param_1;

+        lVar3 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_q

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar6,

+                   *(undefined8 *)(lVar3 + 0x10f98),4,7,0x5d,

+                   &WPP_9bc0a3e6d113395e20224d2fcd65414d_Traceguids,uVar1);

+      }

+    }

+    else {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+         (cVar4 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+        cVar4 = '\0';

+      }

+      if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+         (cVar5 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+        cVar5 = '\0';

+      }

+      if ((cVar4 != '\0') || (cVar5 != '\0')) {

+        uVar1 = *(undefined8 *)param_1;

+        lVar3 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_q

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,cVar5,

+                   *(undefined8 *)(lVar3 + 0x10f98),5,7,0x5e,

+                   &WPP_9bc0a3e6d113395e20224d2fcd65414d_Traceguids,uVar1);

+      }

+      RemoveRecalcProperty(param_1);

+    }

+  }

+  return;

+}

+
```

## `LFONTCOREOBJ::ppfeMapFont`  (modified)

```diff
--- LFONTCOREOBJ::ppfeMapFont
+++ LFONTCOREOBJ::ppfeMapFont
@@ -1,2 +1,171 @@
-Failed to decompile win32kfull.sys - .ProgramDB LFONTCOREOBJ::ppfeMapFont : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: class PFE * __ptr64 __cdecl LFONTCOREOBJ::ppfeMapFont(struct MAPPER::PARAMETERS &

+   __ptr64,unsigned long * __ptr64,struct _POINTL * __ptr64,unsigned long * __ptr64) __ptr64 */

+

+PFE * __thiscall

+LFONTCOREOBJ::ppfeMapFont

+          (LFONTCOREOBJ *this,PARAMETERS *param_1,ulong *param_2,_POINTL *param_3,ulong *param_4)

+

+{

+  char cVar1;

+  longlong lVar2;

+  SESSION_GLOBALS *pSVar3;

+  longlong lVar4;

+  PFE *pPVar5;

+  longlong lVar6;

+  tagPvtData *ptVar7;

+  longlong lVar8;

+  uint uVar9;

+  int iVar10;

+  longlong *plVar11;

+  longlong *plVar12;

+  longlong lVar13;

+  ulong uVar14;

+  int iVar15;

+  uint local_res8;

+  int local_68;

+  longlong local_58 [3];

+  

+  uVar14 = (ulong)param_3;

+  lVar13 = *(longlong *)param_1;

+  local_68 = 0;

+  local_res8 = 0;

+  lVar2 = *(longlong *)this;

+  iVar10 = 0;

+  plVar11 = (longlong *)(lVar2 + 0x10);

+  pSVar3 = Gre::Base::Globals();

+  lVar4 = W32GetSessionState();

+  lVar4 = *(longlong *)(lVar4 + 0x60);

+  uVar9 = 0;

+  if (param_1[0x57] == (PARAMETERS)0x0) {

+    lVar8 = *(longlong *)this;

+    cVar1 = *(char *)(lVar8 + 0x116);

+    if ((param_1[0x58] != (PARAMETERS)0x0) || (param_1[0x59] != (PARAMETERS)0x0)) {

+      if ((*(uint *)(lVar4 + 0x4f94) & 2) == 0) {

+        if ((byte)(cVar1 - 4U) < 3) goto LAB_0;

+      }

+      else if (cVar1 != '\x03') {

+LAB_0:

+        if ((param_1[0x5a] != (PARAMETERS)0x0) &&

+           (((local_68 = *(int *)(param_1 + 0x40), local_68 == 6 || (local_68 == 4)) ||

+            (local_68 == 5)))) {

+          local_res8 = 0x10000;

+          if (cVar1 == '\x06') {

+            local_res8 = 0x50010000;

+          }

+          else if ((cVar1 == '\x05') || ((*(uint *)(lVar4 + 0x4f94) & 0x10) != 0)) {

+            local_res8 = 0x10010000;

+          }

+        }

+      }

+    }

+    uVar9 = local_res8;

+    iVar10 = 0;

+    if (param_1[0x56] == (PARAMETERS)0x0) {

+      if (*(int *)(lVar8 + 0xc) != *(int *)(*(longlong *)(pSVar3 + 0x6e8) + 0x180098)) {

+        *(undefined4 *)(lVar8 + 8) = 0;

+        *(undefined4 *)(*(longlong *)this + 0xc) =

+             *(undefined4 *)(*(longlong *)(pSVar3 + 0x6e8) + 0x180098);

+      }

+      iVar15 = 1;

+      plVar12 = plVar11;

+      for (iVar10 = 0; iVar10 < *(int *)(*(longlong *)this + 8); iVar10 = iVar10 + 1) {

+        if (((lVar13 == *plVar12) && (*(float *)(plVar12 + 1) == *(float *)(param_1 + 8))) &&

+           ((*(float *)((longlong)plVar12 + 0xc) == *(float *)(param_1 + 0xc) &&

+            ((*(float *)(plVar12 + 2) == *(float *)(param_1 + 0x10) &&

+             (*(float *)((longlong)plVar12 + 0x14) == *(float *)(param_1 + 0x14))))))) {

+          pPVar5 = (PFE *)plVar12[3];

+          if (pPVar5 != (PFE *)0x0) {

+            lVar8 = *(longlong *)pPVar5;

+            local_58[0] = lVar8;

+            lVar6 = W32GetSessionState();

+            if ((*(longlong *)(lVar8 + 0x88) != *(longlong *)(*(longlong *)(lVar6 + 0x60) + 0x4fb8))

+               || (ptVar7 = PFFOBJ::pPvtDataMatch((PFFOBJ *)local_58,(ulong *)0x0),

+                  ptVar7 != (tagPvtData *)0x0)) {

+              if (local_res8 == 0) {

+                if ((*(uint *)(plVar12 + 4) >> 0x10 & 1) == 0) goto LAB_1;

+              }

+              else if (((*(uint *)(plVar12 + 4) & 0x10010000) == local_res8) &&

+                      (local_68 == (int)plVar12[6])) {

+LAB_1:

+                lVar13 = (longlong)iVar10;

+                *param_2 = *(ulong *)(plVar11 + lVar13 * 7 + 4);

+                *(undefined4 *)param_3 = *(undefined4 *)(lVar13 * 0x38 + 0x24 + (longlong)plVar11);

+                *(int *)(param_3 + 4) = (int)plVar11[lVar13 * 7 + 5];

+                *param_4 = *(ulong *)(lVar13 * 0x38 + 0x2c + (longlong)plVar11);

+                goto LAB_2;

+              }

+            }

+          }

+          if (iVar15 < *(int *)(*(longlong *)this + 8)) {

+            memcpy(plVar11 + (longlong)iVar10 * 7,plVar11 + (longlong)iVar15 * 7,

+                   (ulonglong)((*(int *)(*(longlong *)this + 8) - iVar10) * 0x38 - 0x38));

+          }

+          iVar10 = iVar10 + -1;

+          iVar15 = iVar15 + -1;

+          *(int *)(*(longlong *)this + 8) = *(int *)(*(longlong *)this + 8) + -1;

+          plVar12 = plVar12 + -7;

+        }

+        iVar15 = iVar15 + 1;

+        plVar12 = plVar12 + 7;

+      }

+    }

+  }

+  pPVar5 = ppfeGetAMatch(param_1,(tagENUMLOGFONTEXDVW *)(*(longlong *)this + 0xfc),

+                         (ushort *)(*(longlong *)this + 0xb8),uVar14,param_2,param_3,param_4);

+  if (pPVar5 == (PFE *)0x0) {

+    return (PFE *)0x0;

+  }

+  if (param_1[0x57] != (PARAMETERS)0x0) goto LAB_2;

+  if ((uVar9 != 0) && ((*(uint *)(*(longlong *)(pPVar5 + 0x20) + 0x30) & 0x40) != 0)) {

+    uVar9 = *param_2;

+    *param_2 = uVar9 | 0x10000;

+    if (((param_1[0x58] != (PARAMETERS)0x0) || (param_1[0x59] != (PARAMETERS)0x0)) &&

+       ((param_1[0x5a] != (PARAMETERS)0x0 &&

+        ((*(uint *)(*(longlong *)(pPVar5 + 0x20) + 0x30) & 1) != 0)))) {

+      cVar1 = *(char *)(*(longlong *)this + 0x116);

+      if (cVar1 == '\x05') {

+LAB_3:

+        uVar9 = uVar9 | 0x10010000;

+LAB_4:

+        *param_2 = uVar9;

+      }

+      else if (cVar1 != '\x04') {

+        if (cVar1 == '\x06') {

+          uVar9 = uVar9 | 0x50010000;

+          goto LAB_4;

+        }

+        if (((byte)*(undefined4 *)(lVar4 + 0x4f94) & 0x12) == 0x12) goto LAB_3;

+      }

+    }

+  }

+  if (param_1[0x56] == (PARAMETERS)0x0) {

+    if (2 < iVar10) {

+      iVar10 = 0;

+      *(undefined4 *)(*(longlong *)this + 8) = 0;

+    }

+    lVar8 = (longlong)iVar10;

+    plVar11[lVar8 * 7] = lVar13;

+    plVar11[lVar8 * 7 + 3] = (longlong)pPVar5;

+    *(ulong *)(plVar11 + lVar8 * 7 + 4) = *param_2;

+    *(undefined4 *)(lVar8 * 0x38 + 0x24 + (longlong)plVar11) = *(undefined4 *)param_3;

+    *(undefined4 *)(plVar11 + lVar8 * 7 + 5) = *(undefined4 *)(param_3 + 4);

+    *(undefined4 *)(lVar2 + 0x18 + lVar8 * 0x38) = *(undefined4 *)(param_1 + 8);

+    *(undefined4 *)(lVar2 + 0x1c + lVar8 * 0x38) = *(undefined4 *)(param_1 + 0xc);

+    *(undefined4 *)(lVar2 + 0x20 + lVar8 * 0x38) = *(undefined4 *)(param_1 + 0x10);

+    *(undefined4 *)(lVar2 + 0x24 + lVar8 * 0x38) = *(undefined4 *)(param_1 + 0x14);

+    *(ulong *)(lVar8 * 0x38 + 0x2c + (longlong)plVar11) = *param_4;

+    *(int *)(plVar11 + lVar8 * 7 + 6) = local_68;

+    *(int *)(*(longlong *)this + 8) = *(int *)(*(longlong *)this + 8) + 1;

+  }

+LAB_2:

+  if ((*(uint *)(lVar4 + 0x4a00) != 0) && ((*(byte *)(*(longlong *)this + 0x115) & 0x40) == 0)) {

+    uVar9 = *(uint *)(lVar4 + 0x4a00) | *(uint *)(lVar4 + 0x4a04);

+    if (((*(char *)((longlong)param_4 + 3) == '\0') && ((uVar9 & 2) != 0)) ||

+       ((*(char *)((longlong)param_4 + 3) == -1 && ((uVar9 & 1) != 0)))) {

+      *param_4 = (uint)*(ushort *)(lVar4 + 0x4a08) << 8 | *param_4 & 0xff0000ff;

+    }

+  }

+  return pPVar5;

+}

+
```

## `CursorApiRouter::CursorApiRouter`  (modified)

```diff
--- CursorApiRouter::CursorApiRouter
+++ CursorApiRouter::CursorApiRouter
@@ -1,2 +1,27 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::CursorApiRouter : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: __cdecl CursorApiRouter::CursorApiRouter(void) __ptr64 */

+

+CursorApiRouter * __thiscall CursorApiRouter::CursorApiRouter(CursorApiRouter *this)

+

+{

+  this[0x12] = (CursorApiRouter)0x1;

+  *(undefined8 *)(this + 0x50) = 0;

+  *(undefined8 *)this = 0;

+  *(undefined8 *)(this + 8) = 0;

+  *(undefined2 *)(this + 0x10) = 0;

+  *(undefined8 *)(this + 0x18) = 0;

+  *(undefined8 *)(this + 0x20) = 0;

+  *(undefined4 *)(this + 0x28) = 0;

+  *(undefined8 *)(this + 0x40) = 0;

+  *(undefined8 *)(this + 0x48) = 0;

+  *(undefined8 *)(this + 0x58) = 0;

+  *(undefined8 *)(this + 0x60) = 0;

+  *(undefined8 *)(this + 0x68) = 0;

+  *(undefined8 *)(this + 0x70) = 0;

+  *(undefined8 *)(this + 0x78) = 0;

+  this[0x80] = (CursorApiRouter)0x0;

+  *(undefined8 *)(this + 0x30) = 0;

+  *(undefined8 *)(this + 0x38) = 0;

+  return this;

+}

+
```

## `UMPDOBJ::RestoreBitmaps`  (modified)

```diff
--- UMPDOBJ::RestoreBitmaps
+++ UMPDOBJ::RestoreBitmaps
@@ -1,2 +1,54 @@
-Failed to decompile win32kfull.sys - .ProgramDB UMPDOBJ::RestoreBitmaps : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl UMPDOBJ::RestoreBitmaps(struct _SURFOBJ * __ptr64,struct _SURFOBJ *

+   __ptr64,struct _SURFOBJ * __ptr64,void * __ptr64,void * __ptr64,void * __ptr64,void *

+   __ptr64,void * __ptr64,void * __ptr64,int,int,int,int,int,int) __ptr64 */

+

+void __thiscall

+UMPDOBJ::RestoreBitmaps

+          (UMPDOBJ *this,_SURFOBJ *param_1,_SURFOBJ *param_2,_SURFOBJ *param_3,void *param_4,

+          void *param_5,void *param_6,void *param_7,void *param_8,void *param_9,int param_10,

+          int param_11,int param_12,int param_13,int param_14,int param_15)

+

+{

+  int iVar1;

+  

+  iVar1 = Feature_4144735547__private_IsEnabledDeviceUsageNoInline();

+  if (iVar1 == 0) {

+    if (((param_10 != 0) || (param_12 != 0)) || (param_14 != 0)) {

+      bDeleteLargeBitmaps(this,(_SURFOBJ *)(-(ulonglong)(param_11 != 0) & (ulonglong)param_1),

+                          (_SURFOBJ *)(-(ulonglong)(param_13 != 0) & (ulonglong)param_2),

+                          (_SURFOBJ *)(-(ulonglong)(param_15 != 0) & (ulonglong)param_3));

+      if (param_10 != 0) {

+        *(void **)(param_1 + 0x30) = param_4;

+        *(void **)(param_1 + 0x38) = param_5;

+      }

+      if (param_12 != 0) {

+        *(void **)(param_2 + 0x30) = param_6;

+        *(void **)(param_2 + 0x38) = param_7;

+      }

+      if (param_14 != 0) {

+        *(void **)(param_3 + 0x30) = param_8;

+        *(void **)(param_3 + 0x38) = param_9;

+      }

+    }

+  }

+  else {

+    bDeleteLargeBitmaps(this,(_SURFOBJ *)(-(ulonglong)(param_11 != 0) & (ulonglong)param_1),

+                        (_SURFOBJ *)(-(ulonglong)(param_13 != 0) & (ulonglong)param_2),

+                        (_SURFOBJ *)(-(ulonglong)(param_15 != 0) & (ulonglong)param_3));

+    if (param_14 != 0) {

+      *(void **)(param_3 + 0x30) = param_8;

+      *(void **)(param_3 + 0x38) = param_9;

+    }

+    if (param_12 != 0) {

+      *(void **)(param_2 + 0x30) = param_6;

+      *(void **)(param_2 + 0x38) = param_7;

+    }

+    if (param_10 != 0) {

+      *(void **)(param_1 + 0x30) = param_4;

+      *(void **)(param_1 + 0x38) = param_5;

+    }

+  }

+  return;

+}

+
```

## `MAPPER::bNearMatch`  (modified)

```diff
--- MAPPER::bNearMatch
+++ MAPPER::bNearMatch
@@ -1,2 +1,764 @@
-Failed to decompile win32kfull.sys - .ProgramDB MAPPER::bNearMatch : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: int __cdecl MAPPER::bNearMatch(class PFEOBJ & __ptr64,unsigned char * __ptr64,int)

+   __ptr64 */

+

+int __thiscall MAPPER::bNearMatch(MAPPER *this,PFEOBJ *param_1,uchar *param_2,int param_3)

+

+{

+  int *piVar1;

+  MAPPER MVar2;

+  short sVar3;

+  int iVar4;

+  PFE *pPVar5;

+  wchar_t *_Str1;

+  ulonglong uVar6;

+  uchar uVar7;

+  int iVar8;

+  uint uVar9;

+  longlong lVar10;

+  longlong lVar11;

+  longlong lVar12;

+  tagPvtData *ptVar13;

+  MAPPER *pMVar14;

+  SESSION_GLOBALS *pSVar15;

+  _LIST_ENTRY *p_Var16;

+  void *pvVar17;

+  byte bVar18;

+  int iVar19;

+  ulonglong uVar20;

+  undefined8 *puVar21;

+  byte bVar22;

+  uint uVar23;

+  uint uVar24;

+  undefined8 *puVar25;

+  MAPPER MVar26;

+  MAPPER MVar27;

+  wchar_t *pwVar28;

+  wchar_t *_Str2;

+  MAPPER *pMVar29;

+  int iVar30;

+  uint uVar31;

+  bool bVar32;

+  wchar_t *local_res10;

+  longlong local_48 [2];

+  

+  pPVar5 = *(PFE **)param_1;

+  bVar32 = false;

+  uVar31 = 0;

+  *(uint *)(this + 0xf4) = *(uint *)(this + 0xf4) & 0xffffb7ff;

+  local_res10 = (wchar_t *)0x0;

+  lVar10 = W32GetSessionState();

+  lVar10 = *(longlong *)(lVar10 + 0x60);

+  if (*(longlong *)param_1 == *(longlong *)(lVar10 + 0x4d00)) {

+    *(uint *)(this + 0xf4) = *(uint *)(this + 0xf4) | 0x4000;

+  }

+  *(undefined8 *)(this + 0xf8) = *(undefined8 *)(*(longlong *)param_1 + 0x20);

+  if ((*(uint *)((longlong)*(longlong **)param_1 + 0xc) & 2) != 0) goto LAB_0;

+  lVar12 = **(longlong **)param_1;

+  local_48[0] = lVar12;

+  lVar11 = W32GetSessionState();

+  if (((*(longlong *)(lVar12 + 0x88) == *(longlong *)(*(longlong *)(lVar11 + 0x60) + 0x4fb8)) &&

+      (ptVar13 = PFFOBJ::pPvtDataMatch((PFFOBJ *)local_48,(ulong *)0x0),

+      ptVar13 == (tagPvtData *)0x0)) || ((*(uint *)(*(longlong *)param_1 + 0xc) & 0x20) != 0))

+  goto LAB_0;

+  lVar12 = W32GetSessionState();

+  if (((*(longlong *)(**(longlong **)param_1 + 0x88) ==

+        *(longlong *)(*(longlong *)(lVar12 + 0x60) + 0x4fb8)) &&

+      (local_48[0] = **(longlong **)param_1,

+      ptVar13 = PFFOBJ::pPvtDataMatch((PFFOBJ *)local_48,(ulong *)0x0), ptVar13 != (tagPvtData *)0x0

+      )) && (((*(uint *)(ptVar13 + 8) & 0xc) != 0 &&

+             (-1 < *(char *)(*(longlong *)(this + 8) + 0x19))))) goto LAB_0;

+  *(undefined8 *)(this + 0xb8) = 0;

+  *(undefined4 *)(this + 0xc0) = 1;

+  *(undefined4 *)(this + 0xc4) = 1;

+  if ((((int)*(uint *)(this + 0xf4) < 0) &&

+      ((*(uint *)(*(longlong *)(*(longlong *)param_1 + 0x20) + 0x30) & 0x4000) == 0)) ||

+     ((*(char *)(*(longlong *)this + 0x56) != '\0' && (*(longlong *)(pPVar5 + 0x48) == 0))))

+  goto LAB_0;

+  uVar9 = 0;

+  bVar18 = *(byte *)(*(longlong *)(this + 0xf8) + 0x2d);

+  bVar22 = *(byte *)(*(longlong *)(this + 8) + 0x1b) & 3;

+  if (bVar22 == 0) {

+    uVar9 = 0;

+    if ((bVar18 & 1) == 0) goto LAB_1;

+    uVar9 = 1;

+LAB_2:

+    *(uint *)(this + 0xb8) = uVar9;

+    if (*(uint *)(this + 0xb4) <= uVar9) {

+      if (uVar9 != *(uint *)(this + 0xb4)) {

+        return 0;

+      }

+      if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+        return 0;

+      }

+      if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+        return 0;

+      }

+    }

+  }

+  else {

+    bVar18 = bVar18 & 2;

+    if (bVar22 == 1) {

+      uVar9 = -(uint)(bVar18 != 0) & 15000;

+    }

+    else if (bVar18 == 0) {

+      uVar9 = 0x15e;

+    }

+LAB_1:

+    if (uVar9 != 0) goto LAB_2;

+  }

+  bVar22 = *(byte *)(*(longlong *)(this + 0xf8) + 0x2d) & 0x70;

+  bVar18 = *(byte *)(*(longlong *)(this + 8) + 0x1b) & 0x70;

+  uVar20 = (ulonglong)bVar18;

+  if (((bVar18 == 0) && (uVar20 = (ulonglong)bVar22, this[0x114] != (MAPPER)0x2)) &&

+     (uVar20 = (ulonglong)bVar18, bVar22 != 0)) {

+    uVar20 = 0x20;

+    if ((*(uint *)(this + 0xf4) & 0x800000) != 0) {

+      uVar20 = 0x10;

+    }

+LAB_3:

+    local_res10 = *(wchar_t **)(lVar10 + 0x4d20 + (uVar20 >> 4) * 8);

+  }

+  else if ((byte)uVar20 < 0x60) goto LAB_3;

+  if ((byte)uVar20 != bVar22) {

+    if (bVar22 == 0) {

+      iVar8 = 8000;

+    }

+    else {

+      uVar9 = uVar31;

+      if ((byte)uVar20 < 0x31) {

+        if (0x30 < bVar22) {

+LAB_4:

+          uVar9 = 0x32;

+        }

+      }

+      else if (bVar22 < 0x31) goto LAB_4;

+      iVar8 = uVar9 + 9000;

+    }

+    uVar9 = *(int *)(this + 0xb8) + iVar8;

+    *(uint *)(this + 0xb8) = uVar9;

+    if (*(uint *)(this + 0xb4) <= uVar9) {

+      if (uVar9 != *(uint *)(this + 0xb4)) {

+        return 0;

+      }

+      if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+        return 0;

+      }

+      if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+        return 0;

+      }

+    }

+  }

+  MVar26 = this[0x114];

+  if ((MVar26 == (MAPPER)0x1) || ((*(uint *)(this + 0xf4) & 0x8000000) != 0)) {

+    lVar12 = *(longlong *)(*(longlong *)param_1 + 0x20);

+    if (*(int *)(lVar12 + 0x28) == 0) {

+      MVar27 = *(MAPPER *)(lVar12 + 0x2c);

+    }

+    else {

+      if (MVar26 == (MAPPER)0x1) {

+        lVar11 = W32GetSessionState();

+        MVar26 = *(MAPPER *)(*(longlong *)(lVar11 + 0x60) + 0x4d18);

+      }

+      if (MVar26 == (MAPPER)0xfe) {

+        MVar27 = (MAPPER)0xfe;

+      }

+      else {

+        pMVar14 = (MAPPER *)(*(int *)(lVar12 + 0x28) + lVar12);

+        MVar2 = *pMVar14;

+        pMVar29 = pMVar14 + 0x10;

+        for (; pMVar14 < pMVar29; pMVar14 = pMVar14 + 1) {

+          MVar27 = MVar26;

+          if (*pMVar14 == MVar26) goto LAB_5;

+          if (*pMVar14 == (MAPPER)0x1) break;

+        }

+        MVar27 = MVar2;

+        if (*(longlong *)(*(longlong *)param_1 + 0x78) != 0) {

+          puVar25 = *(undefined8 **)(*(longlong *)(*(longlong *)param_1 + 0x78) + 0x10);

+          while( true ) {

+            if (*(longlong *)(*(longlong *)param_1 + 0x78) == 0) {

+              lVar12 = W32GetSessionState();

+              puVar21 = (undefined8 *)(*(longlong *)(lVar12 + 0x60) + 0x3738);

+            }

+            else {

+              puVar21 = (undefined8 *)(*(longlong *)(*(longlong *)param_1 + 0x78) + 0x10);

+            }

+            MVar27 = MVar2;

+            if (puVar25 == puVar21) break;

+            lVar12 = *(longlong *)(puVar25[4] + 0x20);

+            if (*(int *)(lVar12 + 0x28) == 0) {

+              MVar27 = MVar26;

+              if (*(MAPPER *)(lVar12 + 0x2c) == MVar26) break;

+            }

+            else {

+              pMVar14 = (MAPPER *)(*(int *)(lVar12 + 0x28) + lVar12);

+              pMVar29 = pMVar14 + 0x10;

+              for (; pMVar14 < pMVar29; pMVar14 = pMVar14 + 1) {

+                MVar27 = MVar26;

+                if (*pMVar14 == MVar26) goto LAB_5;

+                if (*pMVar14 == (MAPPER)0x1) break;

+              }

+            }

+            puVar25 = (undefined8 *)*puVar25;

+          }

+        }

+      }

+    }

+LAB_5:

+    MVar26 = this[0x114];

+    *param_2 = (uchar)MVar27;

+    if (((MVar26 == (MAPPER)0x1) && ((*(uint *)(this + 0xf4) >> 0x1b & 1) == 0)) &&

+       (*(MAPPER *)(lVar10 + 0x4d18) != MVar27)) {

+      uVar9 = *(int *)(this + 0xb8) + 2;

+      *(uint *)(this + 0xb8) = uVar9;

+      if (*(uint *)(this + 0xb4) <= uVar9) {

+        if (uVar9 != *(uint *)(this + 0xb4)) {

+          return 0;

+        }

+        if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+          return 0;

+        }

+        if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+          return 0;

+        }

+      }

+    }

+  }

+  else {

+    lVar10 = *(longlong *)(*(longlong *)param_1 + 0x20);

+    if (*(int *)(lVar10 + 0x28) == 0) {

+      MVar27 = *(MAPPER *)(lVar10 + 0x2c);

+    }

+    else if (MVar26 == (MAPPER)0xfe) {

+      MVar27 = (MAPPER)0xfe;

+    }

+    else {

+      pMVar14 = (MAPPER *)(*(int *)(lVar10 + 0x28) + lVar10);

+      MVar2 = *pMVar14;

+      pMVar29 = pMVar14 + 0x10;

+      for (; pMVar14 < pMVar29; pMVar14 = pMVar14 + 1) {

+        MVar27 = MVar26;

+        if (*pMVar14 == MVar26) goto LAB_6;

+        if (*pMVar14 == (MAPPER)0x1) break;

+      }

+      MVar27 = MVar2;

+      if (*(longlong *)(*(longlong *)param_1 + 0x78) != 0) {

+        p_Var16 = PFEOBJ::pGetLinkedFontList(param_1);

+        puVar25 = *(undefined8 **)p_Var16;

+        while( true ) {

+          if (*(longlong *)(*(longlong *)param_1 + 0x78) == 0) {

+            lVar10 = W32GetSessionState();

+            puVar21 = (undefined8 *)(*(longlong *)(lVar10 + 0x60) + 0x3738);

+          }

+          else {

+            puVar21 = (undefined8 *)(*(longlong *)(*(longlong *)param_1 + 0x78) + 0x10);

+          }

+          MVar27 = MVar2;

+          if (puVar25 == puVar21) break;

+          lVar10 = *(longlong *)(puVar25[4] + 0x20);

+          if (*(int *)(lVar10 + 0x28) == 0) {

+            MVar27 = MVar26;

+            if (*(MAPPER *)(lVar10 + 0x2c) == MVar26) break;

+          }

+          else {

+            pMVar14 = (MAPPER *)(*(int *)(lVar10 + 0x28) + lVar10);

+            pMVar29 = pMVar14 + 0x10;

+            for (; pMVar14 < pMVar29; pMVar14 = pMVar14 + 1) {

+              MVar27 = MVar26;

+              if (*pMVar14 == MVar26) goto LAB_6;

+              if (*pMVar14 == (MAPPER)0x1) break;

+            }

+          }

+          puVar25 = (undefined8 *)*puVar25;

+        }

+      }

+    }

+LAB_6:

+    *param_2 = (uchar)MVar27;

+    if (this[0x114] != MVar27) {

+      if ((*(uint *)(this + 0xf4) >> 0x1a & 1) == 0) goto LAB_0;

+      uVar9 = *(int *)(this + 0xb8) + 65000;

+      *(uint *)(this + 0xb8) = uVar9;

+      if (*(uint *)(this + 0xb4) <= uVar9) {

+        if (uVar9 != *(uint *)(this + 0xb4)) {

+          return 0;

+        }

+        if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+          return 0;

+        }

+        if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+          return 0;

+        }

+      }

+    }

+  }

+  if (param_3 != 0) {

+    _Str1 = *(wchar_t **)(this + 0x10);

+    pwVar28 = (wchar_t *)

+              ((longlong)*(int *)(*(longlong *)(*(longlong *)param_1 + 0x20) + 8) +

+              *(longlong *)(*(longlong *)param_1 + 0x20));

+    iVar8 = _wcsicmp(_Str1,pwVar28);

+    if (iVar8 != 0) {

+      if ((*(uint *)(*(longlong *)(*(longlong *)param_1 + 0x20) + 0x30) & 0x8000000) != 0) {

+        lVar10 = -1;

+        do {

+          lVar12 = lVar10 + 1;

+          lVar10 = lVar10 + 1;

+        } while (pwVar28[lVar12] != L'\0');

+        pwVar28 = pwVar28 + lVar10;

+        do {

+          _Str2 = pwVar28 + 1;

+          if (*_Str2 == L'\0') break;

+          iVar8 = _wcsicmp(_Str1,_Str2);

+          lVar10 = -1;

+          do {

+            lVar12 = lVar10 + 2;

+            lVar10 = lVar10 + 1;

+          } while (pwVar28[lVar12] != L'\0');

+          pwVar28 = _Str2 + lVar10;

+          bVar32 = iVar8 == 0;

+        } while (iVar8 != 0);

+        if (bVar32) {

+          *(int *)(this + 0xb8) = *(int *)(this + 0xb8) + 1;

+          goto LAB_7;

+        }

+      }

+      if ((local_res10 == (wchar_t *)0x0) ||

+         (iVar8 = _wcsicmp((wchar_t *)

+                           ((longlong)*(int *)(*(longlong *)(*(longlong *)param_1 + 0x20) + 8) +

+                           *(longlong *)(*(longlong *)param_1 + 0x20)),local_res10), iVar8 != 0)) {

+        *(int *)(this + 0xb8) = *(int *)(this + 0xb8) + 10000;

+      }

+      else {

+        *(int *)(this + 0xb8) = *(int *)(this + 0xb8) + 9000;

+      }

+    }

+LAB_7:

+    if (*(uint *)(this + 0xb4) <= *(uint *)(this + 0xb8)) {

+      if (*(uint *)(this + 0xb8) != *(uint *)(this + 0xb4)) {

+        return 0;

+      }

+      if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+        return 0;

+      }

+      if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+        return 0;

+      }

+    }

+  }

+  lVar10 = *(longlong *)(this + 0xf8);

+  if ((*(uint *)(this + 0xf4) >> 0x19 & 1) == 0) {

+    if (*(short *)(*(int *)(lVar10 + 8) + lVar10) == 0x40) goto LAB_0;

+  }

+  else if (*(short *)(*(int *)(lVar10 + 8) + lVar10) != 0x40) goto LAB_0;

+  if ((*(uint *)(lVar10 + 0x30) & 0x3000010) == 0) {

+    if (((*(uint *)(this + 0xf4) & 4) == 0) && (iVar8 = bCalculateWishCell(this), iVar8 == 0))

+    goto LAB_0;

+    lVar10 = *(longlong *)(this + 0xf8);

+    if ((*(uint *)(this + 0xf4) & 2) == 0) {

+      iVar8 = (int)*(short *)(lVar10 + 0x3e) + (int)*(short *)(lVar10 + 0x3c);

+    }

+    else {

+      iVar8 = (int)*(short *)(lVar10 + 0x38);

+    }

+    iVar19 = *(int *)(this + 0xa4);

+    if (((iVar8 < iVar19) &&

+        ((*(uint *)(this + 0xf4) >> 0xf & 1) == 0 && (*(uint *)(lVar10 + 0x30) & 0x100000) != 0)) &&

+       ((int)(iVar8 * 7 + (iVar8 * 7 >> 0x1f & 3U)) >> 2 < iVar19)) {

+      iVar19 = ((int)(iVar8 + (iVar8 >> 0x1f & 3U)) >> 2) + iVar19;

+      if (iVar8 == 0) {

+        return 0;

+      }

+      if ((iVar19 == -0x80000000) && (iVar8 == -1)) {

+        return 0;

+      }

+      uVar23 = iVar19 / iVar8;

+      uVar9 = 0;

+      if (8 < uVar23) {

+        uVar23 = 8;

+      }

+      *(uint *)(this + 0xc4) = uVar23;

+      if (1 < (int)uVar23) {

+        if (((*(uint *)(this + 0xf4) & 0x800) == 0) && (iVar8 <= (int)(uVar23 + 2))) {

+          return 0;

+        }

+        iVar8 = iVar8 * uVar23;

+        uVar9 = (uVar23 - 1) * 5 | uVar23 * 0x14;

+      }

+    }

+    else {

+      *(undefined4 *)(this + 0xc4) = 1;

+      uVar9 = uVar31;

+    }

+    iVar19 = *(int *)(this + 0xa4);

+    if (iVar19 < iVar8) {

+      iVar8 = iVar8 - iVar19;

+      if ((*(uint *)(this + 0xf4) & 0x1080) == 0x1080) {

+        if (1 < iVar8) {

+          uVar9 = uVar9 + (iVar8 + 0x14) * 0x96;

+        }

+      }

+      else {

+        uVar9 = uVar9 + (iVar8 + 4) * 0x96;

+      }

+    }

+    else {

+      uVar9 = uVar9 + (iVar19 - iVar8) * 0x96;

+    }

+    if (uVar9 != 0) {

+      uVar23 = *(int *)(this + 0xb8) + uVar9;

+      *(uint *)(this + 0xb8) = uVar23;

+      if (*(uint *)(this + 0xb4) <= uVar23) {

+        if (uVar23 != *(uint *)(this + 0xb4)) {

+          return 0;

+        }

+        if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+          return 0;

+        }

+        if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+          return 0;

+        }

+      }

+      if ((9999 < uVar9) && ((*(uint *)(this + 0xf4) & 0x4800) == 0)) {

+        return 0;

+      }

+    }

+  }

+  lVar10 = *(longlong *)this;

+  if (((*(char *)(lVar10 + 0x47) != '\0') &&

+      (uVar7 = IFIOBJ::lfOutPrecision((IFIOBJ *)(this + 0xf8)), uVar7 == '\x06')) &&

+     ((*(uint *)(this + 0xf4) & 0x4000) == 0)) {

+    iVar8 = *(int *)(*(longlong *)(this + 0xf8) + 0x80);

+    piVar1 = (int *)(*(longlong *)(this + 0xf8) + 0x84);

+    if (((*(int *)(lVar10 + 0x34) != iVar8) || (*(int *)(lVar10 + 0x38) != *piVar1)) &&

+       (*(int *)(lVar10 + 0x34) * *piVar1 != iVar8 * *(int *)(lVar10 + 0x38))) goto LAB_0;

+  }

+  if (*(char *)(*(longlong *)(this + 8) + 0x14) == '\0') {

+    if ((*(ushort *)(*(longlong *)(this + 0xf8) + 0x34) & 1) != 0) {

+      uVar9 = *(int *)(this + 0xb8) + 4;

+      *(uint *)(this + 0xb8) = uVar9;

+      if (*(uint *)(this + 0xb4) <= uVar9) {

+        if (uVar9 != *(uint *)(this + 0xb4)) {

+          return 0;

+        }

+        if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+          return 0;

+        }

+        if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+          return 0;

+        }

+      }

+    }

+  }

+  else if ((*(ushort *)(*(longlong *)(this + 0xf8) + 0x34) & 1) == 0) {

+    iVar8 = IFIOBJ::bSimItalic((IFIOBJ *)(this + 0xf8));

+    if (iVar8 == 0) {

+      iVar8 = 4;

+    }

+    else {

+      *(uint *)(this + 0xbc) = *(uint *)(this + 0xbc) | 0x4000;

+      iVar8 = 1;

+    }

+    uVar9 = iVar8 + *(int *)(this + 0xb8);

+    *(uint *)(this + 0xb8) = uVar9;

+    if (*(uint *)(this + 0xb4) <= uVar9) {

+      if (uVar9 != *(uint *)(this + 0xb4)) {

+        return 0;

+      }

+      if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+        return 0;

+      }

+      if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+        return 0;

+      }

+    }

+  }

+  uVar9 = *(uint *)(this + 0xf4);

+  iVar8 = (uint)*(ushort *)(*(longlong *)(this + 0xf8) + 0x2e) - *(int *)(this + 0xac);

+  if ((uVar9 >> 0x15 & 1) == 0) {

+    if (iVar8 != 0) {

+      if (((iVar8 < 0) && (iVar8 = -iVar8, 0x96 < iVar8)) &&

+         (pvVar17 = IFIOBJ::pvSimBold((IFIOBJ *)(this + 0xf8)), pvVar17 != (void *)0x0)) {

+        *(uint *)(this + 0xbc) = *(uint *)(this + 0xbc) | 0x2000;

+        iVar8 = iVar8 + -0x78;

+      }

+      uVar23 = (iVar8 * 0x49 >> 8) + *(int *)(this + 0xb8);

+      *(uint *)(this + 0xb8) = uVar23;

+      if (*(uint *)(this + 0xb4) <= uVar23) {

+        if (uVar23 != *(uint *)(this + 0xb4)) {

+          return 0;

+        }

+        if ((uVar9 & 0x1000080) != 0) {

+          return 0;

+        }

+        if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+          return 0;

+        }

+      }

+    }

+  }

+  else {

+    iVar19 = -iVar8;

+    if (-iVar8 < 0) {

+      iVar19 = iVar8;

+    }

+    uVar23 = (iVar19 * 0x13 >> 7) + *(int *)(this + 0xb8);

+    *(uint *)(this + 0xb8) = uVar23;

+    if (*(uint *)(this + 0xb4) <= uVar23) {

+      if (uVar23 != *(uint *)(this + 0xb4)) {

+        return 0;

+      }

+      if ((uVar9 & 0x1000080) != 0) {

+        return 0;

+      }

+      if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+        return 0;

+      }

+    }

+  }

+  if ((char)uVar9 < '\0') {

+LAB_8:

+    if (*(char *)(*(longlong *)(this + 8) + 0x18) != '\t') goto LAB_9;

+LAB_10:

+    if (((char)*(uint *)(this + 0xf4) < '\0') ||

+       ((uVar9 = *(uint *)(*(longlong *)(this + 0xf8) + 0x30), (uVar9 & 1) == 0 &&

+        ((((uVar9 & 2) != 0 || ((uVar9 & 4) != 0)) || ((uVar9 & 8) == 0)))))) {

+      uVar9 = *(int *)(this + 0xb8) + 2;

+      *(uint *)(this + 0xb8) = uVar9;

+      if (*(uint *)(this + 0xb4) <= uVar9) {

+        if (uVar9 != *(uint *)(this + 0xb4)) {

+          return 0;

+        }

+        if ((*(uint *)(this + 0xf4) & 0x1000080) != 0) {

+          return 0;

+        }

+        if (*(uint *)(this + 0xd0) <= *(uint *)(pPVar5 + 0x50)) {

+          return 0;

+        }

+      }

+    }

+  }

+  else {

+    uVar23 = *(uint *)(*(longlong *)(this + 0xf8) + 0x30);

+    if ((((uVar23 & 1) == 0) && ((uVar23 & 2) != 0)) &&

+       ((((uVar9 >> 0x10 & 1) != 0 || (lVar10 = *(longlong *)this, *(char *)(lVar10 + 0x46) != '\0')

+         ) || ((((uVar9 >> 8 & 1) == 0 || (*(int *)(lVar10 + 0x34) != *(int *)(lVar10 + 0x38))) &&

+               ((uVar23 >> 0x1e & 1) == 0)))))) goto LAB_0;

+    if (*(char *)(*(longlong *)(this + 8) + 0x18) == '\a') {

+      uVar7 = IFIOBJ::lfOutPrecision((IFIOBJ *)(this + 0xf8));

+      if (uVar7 != '\b') goto LAB_0;

+    }

+    else {

+      if (*(char *)(*(longlong *)(this + 8) + 0x18) != '\n') goto LAB_8;

+      if (-1 < *(int *)(*(longlong *)(this + 0xf8) + 0x30)) goto LAB_0;

+    }

+LAB_9:

+    pSVar15 = Gre::Base::Globals();

+    if (((*(int *)(*(longlong *)(pSVar15 + 0x6e8) + 0x180094) != 0) &&

+        (((*(char *)(*(longlong *)(this + 8) + 0x18) - 5U & 0xfa) != 0 ||

+         (*(char *)(*(longlong *)(this + 8) + 0x18) == '\t')))) ||

+       (*(char *)(*(longlong *)this + 0x45) != '\0')) goto LAB_10;

+  }

+  lVar10 = *(longlong *)(this + 0xf8);

+  if ((*(uint *)(lVar10 + 0x30) & 0x2000010) == 0) {

+    sVar3 = *(short *)(lVar10 + 0x4c);

+    iVar8 = (int)sVar3;

+    *(undefined4 *)(this + 0xc0) = 1;

+    if (*(int *)(*(longlong *)(this + 8) + 4) == 0) {

+      if ((*(uint *)(lVar10 + 0x30) & 0x100000) == 0 || (*(uint *)(this + 0xf4) & 0x8000) != 0)

+      goto LAB_11;

+      uVar9 = *(uint *)(*(longlong *)this + 0x34);

+      if (uVar9 == 0) {

+        return 0;

+      }

+      uVar20 = (ulonglong)(uint)(*(int *)(*(longlong *)this + 0x38) * 100) / (ulonglong)uVar9;

+      iVar8 = *(int *)(lVar10 + 0x84);

+      iVar19 = *(int *)(lVar10 + 0x80) * 100;

+      if (iVar8 == 0) {

+        return 0;

+      }

+      if ((iVar19 == -0x80000000) && (iVar8 == -1)) {

+        return 0;

+      }

+      uVar9 = *(uint *)(this + 0xc4);

+      uVar6 = (longlong)iVar19 / (longlong)iVar8;

+      iVar19 = (int)uVar6;

+      if (uVar9 == 0) {

+        return 0;

+      }

+      if ((iVar19 == -0x80000000) && (uVar9 == 0xffffffff)) {

+        return 0;

+      }

+      uVar23 = 0;

+      uVar6 = (longlong)((ulonglong)(uint)(iVar19 >> 0x1f) << 0x20 | uVar6 & 0xffffffff) /

+              (longlong)(int)uVar9;

+      uVar24 = (uint)uVar20;

+      if ((*(int *)(lVar10 + 0x80) == iVar8) &&

+         (*(int *)(*(longlong *)this + 0x34) == *(int *)(*(longlong *)this + 0x38))) {

+        uVar23 = 1;

+        if (uVar9 == 1) goto LAB_11;

+LAB_12:

+        if (5 < uVar9) {

+          uVar9 = 5;

+        }

+        *(uint *)(this + 0xc0) = uVar9;

+        uVar31 = uVar9 * 0x14;

+      }

+      else {

+        iVar8 = (int)uVar6;

+        if ((uint)(iVar8 * 3) >> 1 < uVar24) {

+          if (iVar8 == 0) goto LAB_0;

+          uVar9 = (uint)(uVar20 / (uVar6 & 0xffffffff));

+          uVar23 = uVar31;

+          goto LAB_12;

+        }

+      }

+      if ((uVar23 == 0) || (*(int *)(this + 0xc0) != *(int *)(this + 0xc4))) {

+        if (*(uint *)(this + 0xc4) == 0) goto LAB_0;

+        iVar19 = uVar24 - (uint)(iVar19 * *(int *)(this + 0xc0)) / *(uint *)(this + 0xc4);

+        iVar8 = -iVar19;

+        if (iVar8 < 0) {

+          iVar8 = iVar19;

+        }

+        uVar31 = uVar31 + iVar8 * 0x1e;

+      }

+    }

+    else {

+      if (((*(uint *)(this + 0xf4) & 4) == 0) && (iVar19 = bCalculateWishCell(this), iVar19 == 0))

+      goto LAB_0;

+      lVar10 = *(longlong *)(this + 0xf8);

+      if (((*(uint *)(lVar10 + 0x30) >> 0x14 & 1) == 0 || (*(uint *)(this + 0xf4) & 0x8000) != 0) ||

+         (*(int *)(this + 0xa8) <= iVar8)) {

+        if ((*(uint *)(lVar10 + 0x30) >> 0x18 & 1) != 0) {

+          iVar19 = (int)*(short *)(lVar10 + 0x3e) + (int)*(short *)(lVar10 + 0x3c);

+          if (iVar19 == 0) {

+            return 0;

+          }

+          if ((iVar8 * *(int *)(this + 0xa4) == -0x80000000) && (iVar19 == -1)) {

+            return 0;

+          }

+          iVar8 = (iVar8 * *(int *)(this + 0xa4)) / iVar19;

+        }

+      }

+      else {

+        iVar19 = *(int *)(this + 0xa8) - (iVar8 + 1) / 2;

+        if (sVar3 == 0) {

+          return 0;

+        }

+        if ((iVar19 == -0x80000000) && (iVar8 == -1)) {

+          return 0;

+        }

+        uVar9 = iVar19 / iVar8 + 1;

+        if (5 < uVar9) {

+          uVar9 = 5;

+        }

+        *(uint *)(this + 0xc0) = uVar9;

+      }

+      iVar19 = *(int *)(this + 0xc0);

+      if (1 < iVar19) {

+        iVar8 = iVar8 * iVar19;

+        uVar31 = iVar19 * 0x14 | iVar19 - 1U;

+      }

+      iVar19 = *(int *)(this + 0xa8) - iVar8;

+      iVar8 = iVar8 - *(int *)(this + 0xa8);

+      if (-1 < iVar19) {

+        iVar8 = iVar19;

+      }

+      uVar31 = uVar31 + iVar8 * 0x32;

+    }

+    if (uVar31 != 0) {

+      *(uint *)(this + 0xb8) = *(int *)(this + 0xb8) + uVar31;

+      iVar8 = bNoMatch(this,pPVar5);

+      if (iVar8 != 0) {

+        return 0;

+      }

+    }

+  }

+LAB_11:

+  iVar8 = *(int *)(this + 0xc0);

+  if ((1 < iVar8) || (1 < *(int *)(this + 0xc4))) {

+    iVar19 = *(int *)(this + 0xb8);

+    iVar4 = *(int *)(this + 0xc4);

+    *(int *)(this + 0xb8) = iVar19 + 0x32;

+    if (iVar4 < iVar8) {

+      if (iVar4 == 0) goto LAB_0;

+      iVar30 = iVar8 * 100;

+      if (iVar4 != 1) {

+        iVar30 = (iVar4 / 2 + iVar30) / iVar4;

+      }

+LAB_13:

+      *(int *)(this + 0xb8) = iVar19 + 0x32 + iVar30 * 4;

+    }

+    else if (iVar8 < iVar4) {

+      if (iVar8 == 0) goto LAB_0;

+      iVar30 = iVar4 * 100;

+      if (iVar8 != 1) {

+        iVar30 = (iVar8 / 2 + iVar30) / iVar8;

+      }

+      goto LAB_13;

+    }

+    iVar8 = bNoMatch(this,pPVar5);

+    if (iVar8 != 0) {

+      return 0;

+    }

+  }

+  if (((*(uint *)(*(longlong *)(this + 0xf8) + 0x30) & 0x10) == 0) &&

+     ((*(uint *)(this + 0xf4) & 0x41000) != 0x41000)) {

+    if (((*(uint *)(this + 0xf4) >> 0x13 & 1) == 0) && (iVar8 = bCalcOrientation(this), iVar8 == 0))

+    goto LAB_0;

+    uVar31 = *(uint *)(this + 0xb0);

+    uVar9 = uVar31 - *(int *)(*(longlong *)param_1 + 0x44);

+    if (uVar9 != 0) {

+      if ((*(uint *)(this + 0xf4) & 0x480) == 0x480) {

+        if (uVar31 < uVar9) {

+          uVar9 = -uVar9;

+        }

+        uVar9 = uVar9 % 900;

+        if (uVar9 == 0) goto LAB_14;

+      }

+      if ((*(uint *)(*(longlong *)(this + 0xf8) + 0x30) & 0x200000) == 0) goto LAB_0;

+      uVar23 = -uVar9;

+      if (uVar9 <= uVar31) {

+        uVar23 = uVar9;

+      }

+      if (uVar23 != (uVar23 / 900) * 900) goto LAB_0;

+    }

+  }

+LAB_14:

+  uVar31 = *(uint *)(this + 0xf4);

+  if ((uVar31 >> 0x16 & 1) != 0) {

+    *(int *)(this + 0xb8) = *(int *)(this + 0xb8) + 1;

+    iVar8 = bNoMatch(this,pPVar5);

+    if (iVar8 != 0) {

+      return 0;

+    }

+  }

+  if ((int)uVar31 < 0) {

+    pMVar29 = this + 100;

+    pMVar14 = this + 0x60;

+  }

+  else {

+    pMVar29 = (MAPPER *)(*(longlong *)(this + 8) + 0x164);

+    pMVar14 = (MAPPER *)(*(longlong *)(this + 8) + 0x160);

+  }

+  if (*(uint *)pMVar14 == 0) {

+    return 1;

+  }

+  lVar10 = *(longlong *)(this + 0xf8);

+  if (((0xf < *(uint *)(lVar10 + 4)) && (*(int *)(lVar10 + 0xcc) != 0)) &&

+     (lVar10 = *(int *)(lVar10 + 0xcc) + lVar10, lVar10 != 0)) {

+    if (((*(uint *)(lVar10 + 4) != 0) && (*(uint *)pMVar14 == *(uint *)(lVar10 + 4))) &&

+       (*(uint *)(this + 0xb8) < 0x88b9)) {

+      *(PFE **)(this + 0x118) = pPVar5;

+    }

+    if ((*(uint *)pMVar14 == *(uint *)(lVar10 + 4)) &&

+       (iVar8 = memcmp(pMVar29,(void *)(lVar10 + 8),(ulonglong)*(uint *)(lVar10 + 4) << 2),

+       iVar8 == 0)) {

+      return 1;

+    }

+  }

+LAB_0:

+  *(undefined4 *)(this + 0xb8) = 0xfffffffe;

+  return 0;

+}

+
```

## `UMPDOBJ::UMPDENGCALL::UMPDENGCALL`  (modified)

```diff
--- UMPDOBJ::UMPDENGCALL::UMPDENGCALL
+++ UMPDOBJ::UMPDENGCALL::UMPDENGCALL
@@ -1,2 +1,52 @@
-Failed to decompile win32kfull.sys - .ProgramDB UMPDOBJ::UMPDENGCALL::UMPDENGCALL : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: __cdecl UMPDOBJ::UMPDENGCALL::UMPDENGCALL(struct _GRETHREAD * __ptr64) __ptr64 */

+

+UMPDENGCALL * __thiscall UMPDOBJ::UMPDENGCALL::UMPDENGCALL(UMPDENGCALL *this,_GRETHREAD *param_1)

+

+{

+  bool bVar1;

+  int iVar2;

+  UMPDOBJ *pUVar3;

+  _W32THREAD *p_Var4;

+  _GRETHREAD *p_Var5;

+  PUSHLOCKEX local_res8 [8];

+  

+  p_Var5 = param_1;

+  pUVar3 = GetThreadCurrentUMPDObj(param_1);

+  *(UMPDOBJ **)(this + 0x20) = pUVar3;

+  *(undefined8 *)(this + 0x28) = 0;

+  ReEnableTRNH::ReEnableTRNH((ReEnableTRNH *)(this + 0x30),p_Var5);

+  this[0x60] = (UMPDENGCALL)0x0;

+  PushThreadGuardedObject(this,this,UMPDENGCALL_dtor);

+  if (*(UMPDOBJ **)(this + 0x20) != (UMPDOBJ *)0x0) {

+    AcquireClientTerminationLock(*(UMPDOBJ **)(this + 0x20));

+    if (*(char *)(*(longlong *)(this + 0x20) + 0x1c9) == '\0') {

+      iVar2 = KeReadStateEvent(*(undefined8 *)(*(longlong *)(this + 0x20) + 0x20));

+      if (iVar2 != 0) {

+        KeResetEvent(*(undefined8 *)(*(longlong *)(this + 0x20) + 0x20));

+        this[0x60] = (UMPDENGCALL)0x1;

+      }

+      Gre::PUSHLOCKEX::vUnlock(local_res8,0);

+      if (*(_ETHREAD **)(param_1 + -8) != *(_ETHREAD **)(*(longlong *)(this + 0x20) + 0x1b0)) {

+        p_Var4 = W32GetThreadWin32ThreadCrossSessionCheck

+                           (*(_ETHREAD **)(*(longlong *)(this + 0x20) + 0x1b0));

+        bVar1 = ReEnableTRNH::ReTarget

+                          ((ReEnableTRNH *)(this + 0x30),

+                           (_GRETHREAD *)

+                           (-(ulonglong)(p_Var4 != (_W32THREAD *)0x0) & (ulonglong)(p_Var4 + 8)));

+        if (!bVar1) {

+          *(undefined8 *)(this + 0x20) = 0;

+          return this;

+        }

+      }

+      *(int *)(*(longlong *)(this + 0x20) + 0x1c4) =

+           *(int *)(*(longlong *)(this + 0x20) + 0x1c4) + 1;

+    }

+    else {

+      *(undefined8 *)(this + 0x20) = 0;

+      Gre::PUSHLOCKEX::vUnlock(local_res8,0);

+    }

+  }

+  return this;

+}

+
```

## `PFTOBJ::bUnloadWorkhorse`  (modified)

```diff
--- PFTOBJ::bUnloadWorkhorse
+++ PFTOBJ::bUnloadWorkhorse
@@ -1,39 +1,123 @@
 

-int __thiscall

-NSInstrumentation::CSectionBitmapAllocator<36864,144>::bUnloadWorkhorse

-          (PFTOBJ *this,PFF *param_1,PFF **param_2,ulong param_3)

+/* public: int __cdecl PFTOBJ::bUnloadWorkhorse(class PFF * __ptr64,class PFF * __ptr64 *

+   __ptr64,unsigned long) __ptr64 */

+

+int __thiscall PFTOBJ::bUnloadWorkhorse(PFTOBJ *this,PFF *param_1,PFF **param_2,ulong param_3)

 

 {

-  undefined4 *extraout_RAX;

-  undefined4 *puVar1;

-  byte *pbVar2;

-  longlong unaff_RBX;

-  byte *pbVar3;

-  undefined4 *puVar4;

-  longlong unaff_R12;

-  longlong unaff_R13;

-  SURFACE *unaff_R14;

-  longlong unaff_R15;

-  ulong in_stack_00000020;

-  longlong in_stack_000000d0;

-  int in_stack_000000e0;

-  uint in_stack_000000f8;

-  int in_stack_00000100;

-  int in_stack_00000108;

+  int *piVar1;

+  uint uVar2;

+  longlong lVar3;

+  int iVar4;

+  longlong lVar5;

+  tagPvtData *ptVar6;

+  int iVar7;

+  PFF *pPVar8;

+  PFF **local_res10 [2];

+  ulong local_res20 [2];

+  undefined8 *****local_78;

+  undefined8 *****local_70;

+  PFF *local_68 [2];

+  undefined8 local_58;

+  undefined8 uStack_50;

+  undefined8 local_48;

   

-  vClearTypeLookupTableLoop(4,unaff_R14,(BLENDINFO *)param_2,param_3,in_stack_00000020);

-  pbVar2 = (byte *)(in_stack_000000d0 + unaff_R13);

-  puVar4 = (undefined4 *)(unaff_R15 + unaff_R12 * 4);

-  puVar1 = extraout_RAX;

-  for (; in_stack_00000108 != 0; in_stack_00000108 = in_stack_00000108 + -1) {

-    pbVar3 = pbVar2;

-    for (puVar1 = puVar4; puVar1 < puVar4 + in_stack_000000f8; puVar1 = puVar1 + 1) {

-      *puVar1 = *(undefined4 *)(unaff_RBX + (ulonglong)*pbVar3 * 4);

-      pbVar3 = pbVar3 + 1;

+  local_res20[0] = param_3;

+  lVar5 = W32GetSessionState();

+  lVar5 = *(longlong *)(lVar5 + 0x60);

+  iVar7 = 0;

+  if (param_1 != (PFF *)0x0) {

+    ptVar6 = (tagPvtData *)0x0;

+    local_68[0] = param_1;

+    if ((*(uint *)(param_1 + 0x34) & 1) == 0) {

+      iVar7 = bIsPrivatePFT(this);

+      if ((iVar7 == 0) ||

+         (ptVar6 = PFFOBJ::pPvtDataMatch

+                             ((PFFOBJ *)local_68,

+                              (ulong *)(-(ulonglong)((param_3 & 0x1c) != 0) & (ulonglong)local_res20

+                                       )), iVar7 = 0, ptVar6 != (tagPvtData *)0x0)) {

+        local_res10[0] = (PFF **)((ulonglong)local_res10[0] & 0xffffffff00000000);

+        iVar7 = 1;

+        iVar4 = PFFOBJ::bDeleteLoadRef((PFFOBJ *)local_68,param_3,ptVar6,(int *)local_res10);

+        if (iVar4 == 0) {

+          iVar4 = bIsPrivatePFT(this);

+          if ((iVar4 != 0) && ((int)local_res10[0] != 0)) {

+            iVar7 = 0;

+          }

+        }

+        else {

+          PFFOBJ::vRemoveHash((PFFOBJ *)local_68);

+          uVar2 = *(uint *)(param_1 + 0x34);

+          pPVar8 = (PFF *)0x0;

+          if (*(int *)(param_1 + 0x40) == 0) {

+            pPVar8 = param_1;

+          }

+          local_res10[0] = param_2;

+          if (param_2 == (PFF **)0x0) {

+            PUBLIC_PFTOBJ::pPFFGet

+                      ((PUBLIC_PFTOBJ *)this,*(ushort **)(param_1 + 0x18),*(ulong *)(param_1 + 0x20)

+                       ,*(ulong *)(param_1 + 0x24),*(tagDESIGNVECTOR **)(param_1 + 0x28),

+                       *(ulong *)(param_1 + 0x30),local_res10,0);

+          }

+          if (*local_res10[0] == param_1) {

+            *local_res10[0] = *(PFF **)(param_1 + 8);

+          }

+          if (*(longlong *)(param_1 + 8) != 0) {

+            *(undefined8 *)(*(longlong *)(param_1 + 8) + 0x10) = *(undefined8 *)(param_1 + 0x10);

+          }

+          if (*(longlong *)(param_1 + 0x10) != 0) {

+            *(undefined8 *)(*(longlong *)(param_1 + 0x10) + 8) = *(undefined8 *)(param_1 + 8);

+          }

+          lVar3 = *(longlong *)this;

+          if ((uVar2 & 0x200) == 0) {

+            piVar1 = (int *)(lVar3 + 0x20);

+            *piVar1 = *piVar1 + 1;

+          }

+          piVar1 = (int *)(lVar3 + 0x1c);

+          *piVar1 = *piVar1 + -1;

+          iVar7 = 1;

+          param_1 = pPVar8;

+          if (pPVar8 != (PFF *)0x0) goto LAB_0;

+        }

+      }

     }

-    pbVar2 = pbVar2 + in_stack_000000e0;

-    puVar4 = (undefined4 *)((longlong)puVar4 + (longlong)in_stack_00000100);

+    else {

+      iVar7 = 1;

+      if ((((*(int *)(param_1 + 0x38) == 0) && (*(int *)(param_1 + 0x3c) == 0)) &&

+          (*(longlong *)(param_1 + 0x98) == 0)) && (*(int *)(param_1 + 0x40) == 0)) {

+LAB_0:

+        local_70 = &local_78;

+        local_78 = &local_78;

+        local_68[0] = param_1;

+        prfntKillList(local_68,&local_78);

+        if ((undefined8 ******)local_78 == &local_78) {

+          local_58 = 0;

+          uStack_50 = 0;

+          local_48 = 0;

+          iVar7 = bKillPFFOBJ(local_68,&local_58);

+          if (iVar7 == 0) {

+            GreReleaseSemaphoreCommon<17,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+                      (GreReleaseSemaphoreExclusiveInternal_exref,*(HSEMAPHORE__ **)(lVar5 + 0x4f78)

+                      );

+          }

+          else {

+            GreReleaseSemaphoreCommon<17,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+                      (GreReleaseSemaphoreExclusiveInternal_exref,*(HSEMAPHORE__ **)(lVar5 + 0x4f78)

+                      );

+            vCleanupFontFile((PFFCLEANUP *)&local_58);

+          }

+        }

+        else {

+          GreReleaseSemaphoreCommon<17,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+                    (GreReleaseSemaphoreExclusiveInternal_exref,*(HSEMAPHORE__ **)(lVar5 + 0x4f78));

+          vKillRFONTList(local_68,&local_78);

+        }

+        return 1;

+      }

+    }

   }

-  return (int)puVar1;

+  GreReleaseSemaphoreCommon<17,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+            (GreReleaseSemaphoreExclusiveInternal_exref,*(HSEMAPHORE__ **)(lVar5 + 0x4f78));

+  return iVar7;

 }
```

## `xxxAdviseDataAck`  (modified)

```diff
--- xxxAdviseDataAck
+++ xxxAdviseData
@@ -1,10 +1,2 @@
-

-/* WARNING: Control flow encountered bad instruction data */

-

-ulong __cdecl xxxAdviseDataAck(ulong *param_1,__int64 *param_2,tagDDECONV *param_3)

-

-{

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

-}

-

+Failed to decompile win32kfull.sys - .ProgramDB xxxAdviseData : Error: Decompile error: 
+Low-level Error: DuplicateFunctionError, but could not recover original symbol
```

## `PFFOBJ::pPvtDataMatch`  (modified)

```diff
--- PFFOBJ::pPvtDataMatch
+++ PFFOBJ::pPvtDataMatch
@@ -1,2 +1,53 @@
-Failed to decompile win32kfull.sys - .ProgramDB PFFOBJ::pPvtDataMatch : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: struct tagPvtData * __ptr64 __cdecl PFFOBJ::pPvtDataMatch(unsigned long * __ptr64)

+   __ptr64 */

+

+tagPvtData * __thiscall PFFOBJ::pPvtDataMatch(PFFOBJ *this,ulong *param_1)

+

+{

+  bool bVar1;

+  bool bVar2;

+  int iVar3;

+  uint uVar4;

+  tagPvtData *ptVar5;

+  

+  iVar3 = Feature_Servicing_MSRC109103__private_IsEnabledDeviceUsageNoInline();

+  if (iVar3 == 0) {

+    ptVar5 = *(tagPvtData **)(*(longlong *)this + 0x98);

+    while( true ) {

+      if (ptVar5 == (tagPvtData *)0x0) {

+        return (tagPvtData *)0x0;

+      }

+      if (((*(uint *)(ptVar5 + 8) & 4) != 0) &&

+         (iVar3 = PsGetCurrentThreadId(), *(int *)(ptVar5 + 0xc) == iVar3)) break;

+      uVar4 = PsGetCurrentProcessId();

+      if (*(uint *)(ptVar5 + 0xc) == (uVar4 & 0xfffffffc)) {

+        return ptVar5;

+      }

+      ptVar5 = *(tagPvtData **)(ptVar5 + 0x10);

+    }

+    return ptVar5;

+  }

+  if ((param_1 == (ulong *)0x0) || ((*param_1 & 4) != 0)) {

+    bVar1 = true;

+    if ((param_1 != (ulong *)0x0) && ((*param_1 & 4) != 0)) {

+      bVar2 = false;

+      goto LAB_0;

+    }

+  }

+  else {

+    bVar1 = false;

+  }

+  bVar2 = true;

+LAB_0:

+  for (ptVar5 = *(tagPvtData **)(*(longlong *)this + 0x98);

+      ((ptVar5 != (tagPvtData *)0x0 &&

+       (((!bVar1 || ((*(uint *)(ptVar5 + 8) & 4) == 0)) ||

+        (iVar3 = PsGetCurrentThreadId(), *(int *)(ptVar5 + 0xc) != iVar3)))) &&

+      (((!bVar2 || ((*(uint *)(ptVar5 + 8) & 4) != 0)) ||

+       (uVar4 = PsGetCurrentProcessId(), *(uint *)(ptVar5 + 0xc) != (uVar4 & 0xfffffffc)))));

+      ptVar5 = *(tagPvtData **)(ptVar5 + 0x10)) {

+  }

+  return ptVar5;

+}

+
```

## `ShellWindowPos::ShellSetWindowPosAsync`  (modified)

```diff
--- ShellWindowPos::ShellSetWindowPosAsync
+++ ShellWindowPos::ShellSetWindowPosAsync
@@ -1,2 +1,192 @@
-Failed to decompile win32kfull.sys - .ProgramDB ShellWindowPos::ShellSetWindowPosAsync : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* void __cdecl ShellWindowPos::ShellSetWindowPosAsync(struct tagWND * __ptr64,struct HWND__ *

+   __ptr64,struct tagRECT const * __ptr64,enum _SHELLSETWINDOWPOS_STATE,enum

+   _SHELLSETWINDOWPOS_OPTIONS,unsigned long) */

+

+void __cdecl

+ShellWindowPos::ShellSetWindowPosAsync

+          (tagWND *param_1,HWND__ *param_2,tagRECT *param_3,_SHELLSETWINDOWPOS_STATE param_4,

+          _SHELLSETWINDOWPOS_OPTIONS param_5,ulong param_6)

+

+{

+  undefined8 uVar1;

+  undefined4 uVar2;

+  uint uVar3;

+  longlong lVar4;

+  tagMONITOR *ptVar5;

+  _SHELLSETWINDOWPOS_STATE _Var6;

+  char cVar7;

+  bool bVar8;

+  undefined1 auStack_1b8 [32];

+  undefined1 local_198;

+  undefined4 local_190;

+  undefined2 local_188;

+  undefined *local_180;

+  undefined8 local_178;

+  undefined4 local_170;

+  _SHELLSETWINDOWPOS_STATE local_168;

+  undefined8 *local_160;

+  tagWND *local_158;

+  undefined4 local_150;

+  undefined4 uStack_14c;

+  undefined4 uStack_148;

+  undefined4 uStack_144;

+  undefined4 uStack_140;

+  undefined4 uStack_13c;

+  ulong uStack_138;

+  undefined4 uStack_134;

+  undefined4 uStack_130;

+  uint local_128;

+  uint local_124;

+  int local_11c;

+  int local_118;

+  int local_114;

+  int local_110;

+  HWND__ *local_108;

+  undefined4 local_100;

+  undefined8 local_fc;

+  undefined8 uStack_f4;

+  ulonglong local_bc;

+  undefined8 uStack_b4;

+  undefined8 local_ac;

+  ulonglong uStack_a4;

+  undefined4 local_9c;

+  undefined8 *local_98;

+  CThreadLockedCurrentMonitorTopologyPtr local_70 [40];

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStack_1b8;

+  local_160 = *(undefined8 **)(param_1 + 0x10);

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) ||

+     (cVar7 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    cVar7 = '\0';

+  }

+  bVar8 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  local_168 = param_4;

+  local_158 = param_1;

+  if ((cVar7 != '\0') || (bVar8)) {

+    uVar2 = PsGetThreadId(*local_160);

+    uVar1 = *(undefined8 *)param_1;

+    W32GetUserSessionState();

+    local_180 = &WPP_d7d5758568693c5693b1b3651f13a046_Traceguids;

+    local_188 = 0xb;

+    local_190 = 4;

+    local_198 = 4;

+    local_178 = uVar1;

+    local_170 = uVar2;

+    WPP_RECORDER_AND_TRACE_SF_qd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,bVar8);

+  }

+  AdvancedWindowPos::CWindowAction::CWindowAction((CWindowAction *)&local_128,0);

+  if (((param_2 != (HWND__ *)0x0) && (param_5 == 1)) &&

+     ((param_3 == (tagRECT *)0x0 && (lVar4 = HMValidateHandleNoSecure(param_2,1), lVar4 != 0)))) {

+    local_160 = *(undefined8 **)(lVar4 + 0x10);

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) ||

+       (cVar7 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+      cVar7 = '\0';

+    }

+    bVar8 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar7 != '\0') || (bVar8)) {

+      uVar2 = PsGetThreadId(*local_160);

+      W32GetUserSessionState();

+      local_178 = CONCAT44(local_178._4_4_,uVar2);

+      local_180 = &WPP_d7d5758568693c5693b1b3651f13a046_Traceguids;

+      local_188 = 0xc;

+      local_190 = 4;

+      local_198 = 4;

+      WPP_RECORDER_AND_TRACE_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,bVar8);

+    }

+  }

+  uVar3 = local_124 | 0x800;

+  local_98 = local_160;

+  if ((param_5 & 0x10) == 0) {

+    local_124 = uVar3;

+    if ((param_5 & 1) == 0) {

+      local_128 = local_128 | 0x10;

+    }

+    else if ((param_5 & 2) == 0) {

+      local_128 = local_128 | 8;

+      local_108 = param_2;

+    }

+  }

+  else {

+    local_128 = local_128 | 0x10;

+    local_124 = local_124 | 0x802;

+  }

+  _Var6 = local_168;

+  if (local_168 == 0) {

+    local_100 = 0;

+    uVar3 = local_128 | 0x20;

+    if (param_3 == (tagRECT *)0x0) goto LAB_0;

+  }

+  else {

+    if (local_168 == 1) {

+      uVar3 = local_128 | 0x20;

+      local_100 = 1;

+      if (param_3 != (tagRECT *)0x0) {

+        if ((param_5 & 8) == 0) {

+          if ((param_5 & 4) != 0) {

+            local_128 = uVar3;

+            ptVar5 = (tagMONITOR *)_MonitorFromRect(param_3,2);

+            AdvancedWindowPos::CWindowAction::SetMonitor

+                      ((CWindowAction *)&local_128,ptVar5,true,(tagWND *)0x0);

+            _Var6 = local_168;

+            uVar3 = local_128;

+          }

+        }

+        else {

+          local_fc._0_4_ = param_3->left;

+          local_fc._4_4_ = param_3->top;

+          uStack_f4._0_4_ = param_3->right;

+          uStack_f4._4_4_ = param_3->bottom;

+          uVar3 = local_128 | 0x60;

+        }

+      }

+      goto LAB_0;

+    }

+    if (local_168 == 2) {

+      local_100 = 1;

+      uVar3 = local_128 | 0x20;

+      goto LAB_0;

+    }

+    uVar3 = local_128;

+    if ((local_168 != 3) || (param_3 == (tagRECT *)0x0)) goto LAB_0;

+    local_100 = 3;

+  }

+  local_128 = local_128 | 0x20;

+  AdvancedWindowPos::CWindowAction::SetFrameBounds((CWindowAction *)&local_128,param_3);

+  uVar3 = local_128;

+LAB_0:

+  local_128 = uVar3;

+  if ((param_5 & 0x20) == 0) {

+    if ((_Var6 == 3) && (param_3 == (tagRECT *)0x0)) {

+      uStack_134 = 0;

+      uStack_130 = 0;

+      uStack_138 = param_6;

+      uStack_14c = 0;

+      uStack_148 = 0;

+      uStack_144 = 0;

+      uStack_140 = 0;

+      local_150 = 2;

+      local_bc = 2;

+      uStack_b4 = 0;

+      uStack_13c = 3;

+      local_ac = 0x300000000;

+      uStack_a4 = (ulonglong)param_6;

+      local_9c = 0;

+    }

+    else {

+      local_bc = CONCAT44(local_11c,(undefined4)local_bc) | 2;

+      uStack_a4 = CONCAT44(uStack_a4._4_4_,param_6);

+      uStack_b4 = CONCAT44(local_11c + local_114,local_118);

+      local_ac = CONCAT44(local_100,local_110 + local_118);

+    }

+    local_128 = local_128 | 0x400;

+  }

+  AdvancedWindowPos::xxxApplyWindowAction(local_158,(WindowAction *)&local_128,0xb);

+  CThreadLockedCurrentMonitorTopologyPtr::~CThreadLockedCurrentMonitorTopologyPtr(local_70);

+  return;

+}

+
```

## `UMPDOBJ::bThunkLargeBitmaps`  (modified)

```diff
--- UMPDOBJ::bThunkLargeBitmaps
+++ UMPDOBJ::bThunkLargeBitmaps
@@ -1,2 +1,50 @@
-Failed to decompile win32kfull.sys - .ProgramDB UMPDOBJ::bThunkLargeBitmaps : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: int __cdecl UMPDOBJ::bThunkLargeBitmaps(struct _SURFOBJ * __ptr64,struct _SURFOBJ *

+   __ptr64,struct _SURFOBJ * __ptr64,void * __ptr64 * __ptr64,void * __ptr64 * __ptr64,void *

+   __ptr64 * __ptr64,void * __ptr64 * __ptr64,void * __ptr64 * __ptr64,void * __ptr64 * __ptr64,int

+   * __ptr64,int * __ptr64,int * __ptr64,int * __ptr64,int * __ptr64,int * __ptr64,unsigned long *

+   __ptr64) __ptr64 */

+

+int __thiscall

+UMPDOBJ::bThunkLargeBitmaps

+          (UMPDOBJ *this,_SURFOBJ *param_1,_SURFOBJ *param_2,_SURFOBJ *param_3,void **param_4,

+          void **param_5,void **param_6,void **param_7,void **param_8,void **param_9,int *param_10,

+          int *param_11,int *param_12,int *param_13,int *param_14,int *param_15,ulong *param_16)

+

+{

+  int iVar1;

+  int iVar2;

+  _SURFOBJ *p_Var3;

+  

+  if (((param_1 == (_SURFOBJ *)0x0) && (param_2 == (_SURFOBJ *)0x0)) && (param_3 == (_SURFOBJ *)0x0)

+     ) {

+    iVar1 = 1;

+  }

+  else {

+    iVar2 = bThunkLargeBitmap(this,param_1,param_4,param_5,param_10,param_11,param_16);

+    iVar1 = 0;

+    if (iVar2 != 0) {

+      iVar2 = bThunkLargeBitmap(this,param_2,param_6,param_7,param_12,param_13,param_16);

+      iVar1 = 0;

+      if (iVar2 != 0) {

+        iVar1 = bThunkLargeBitmap(this,param_3,param_8,param_9,param_14,param_15,param_16);

+      }

+    }

+    iVar2 = Feature_4144735547__private_IsEnabledDeviceUsageNoInline();

+    p_Var3 = (_SURFOBJ *)0x0;

+    if ((iVar2 == 0) && (iVar1 == 0)) {

+      if ((param_15 == (int *)0x0) || (*param_15 == 0)) {

+        param_3 = p_Var3;

+      }

+      if ((param_13 == (int *)0x0) || (*param_13 == 0)) {

+        param_2 = p_Var3;

+      }

+      if ((param_11 == (int *)0x0) || (*param_11 == 0)) {

+        param_1 = p_Var3;

+      }

+      bDeleteLargeBitmaps(this,param_1,param_2,param_3);

+    }

+  }

+  return iVar1;

+}

+
```

## `CRecalcProp::UpdateActionForAnchor`  (modified)

```diff
--- CRecalcProp::UpdateActionForAnchor
+++ CRecalcProp::UpdateActionForAnchor
@@ -1,2 +1,159 @@
-Failed to decompile win32kfull.sys - .ProgramDB CRecalcProp::UpdateActionForAnchor : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void __cdecl CRecalcProp::UpdateActionForAnchor(class AdvancedWindowPos::CWindowAction *

+   __ptr64,struct CMonitorTopology::MonitorData const * __ptr64 * __ptr64,enum

+   CRecalcContext::Result * __ptr64,class CRecalcState * __ptr64,enum ProcessingReason,bool) __ptr64

+    */

+

+void __thiscall

+CRecalcProp::UpdateActionForAnchor

+          (CRecalcProp *this,CWindowAction *param_1,MonitorData **param_2,Result *param_3,

+          CRecalcState *param_4,ProcessingReason param_5,bool param_6)

+

+{

+  ushort uVar1;

+  int iVar2;

+  int iVar3;

+  int iVar4;

+  tagWND *ptVar5;

+  undefined8 uVar6;

+  undefined8 uVar7;

+  bool bVar8;

+  char cVar9;

+  int iVar10;

+  longlong lVar11;

+  MonitorData *pMVar12;

+  tagRECT *ptVar13;

+  CMonitorTopology *this_00;

+  char cVar14;

+  bool bVar15;

+  undefined8 in_stack_ffffffffffffff48;

+  undefined4 uVar16;

+  CMonitorTopology *local_78 [2];

+  tagRECT local_68;

+  tagRECT local_58 [2];

+  

+  uVar16 = (undefined4)((ulonglong)in_stack_ffffffffffffff48 >> 0x20);

+  if ((!param_6) || (bVar8 = DesktopRecalcSettings::RestoreStateSettingEnabled(), !bVar8)) {

+    ClearAnchorPosition(this);

+    iVar10 = Feature_RecalcAtomicBookkeeping__private_IsEnabledDeviceUsageNoInline();

+    if (((iVar10 != 0) && (!param_6)) && (param_5 == 3)) {

+      ptVar13 = CRecalcState::GetRestoreRect(local_58,*(tagWND **)(this + 0x10));

+      uVar6._0_4_ = ptVar13->left;

+      uVar6._4_4_ = ptVar13->top;

+      uVar7._0_4_ = ptVar13->right;

+      uVar7._4_4_ = ptVar13->bottom;

+      this_00 = CTopologyManager::GetCurrent();

+      local_78[0] = this_00;

+      local_68._0_8_ = uVar6;

+      local_68._8_8_ = uVar7;

+      pMVar12 = CMonitorTopology::MonitorDataFromRect(this_00,*(tagWND **)(this + 0x10),&local_68);

+      if (pMVar12 != (MonitorData *)0x0) {

+        *(CMonitorTopology **)(this + 0x50) = this_00;

+        cVar14 = '\x01';

+        LOCK();

+        *(int *)this_00 = *(int *)this_00 + 1;

+        UNLOCK();

+        *(undefined8 *)(this + 0x3c) = uVar6;

+        *(undefined8 *)(this + 0x44) = uVar7;

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+           (cVar9 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+          cVar9 = '\0';

+        }

+        if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+           (*(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+          cVar14 = '\0';

+        }

+        if ((cVar9 != '\0') || (cVar14 != '\0')) {

+          iVar10 = *(int *)(this + 0x48);

+          iVar2 = *(int *)(this + 0x40);

+          iVar3 = *(int *)(this + 0x44);

+          iVar4 = *(int *)(this + 0x3c);

+          lVar11 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_dddddd

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,cVar14,

+                     *(undefined8 *)(lVar11 + 0x10f98),5,7,0x7b,

+                     &WPP_9bc0a3e6d113395e20224d2fcd65414d_Traceguids,CONCAT44(uVar16,iVar4),iVar2,

+                     iVar3,iVar10,iVar3 - iVar4,iVar10 - iVar2);

+        }

+      }

+      CCurrentMonitorTopologyPtr::~CCurrentMonitorTopologyPtr

+                ((CCurrentMonitorTopologyPtr *)local_78);

+    }

+    return;

+  }

+  bVar8 = ShouldMigrateFromAnchor(this);

+  if (!bVar8) {

+    SetAnchorPosition(this,param_4);

+    return;

+  }

+  bVar8 = true;

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+     (cVar14 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+    cVar14 = '\0';

+  }

+  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+     (cVar9 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+    cVar9 = '\0';

+  }

+  if ((cVar14 != '\0') || (cVar9 != '\0')) {

+    iVar10 = *(int *)(this + 0x48);

+    iVar2 = *(int *)(this + 0x40);

+    iVar3 = *(int *)(this + 0x44);

+    iVar4 = *(int *)(this + 0x3c);

+    lVar11 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_dddddd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,cVar9,

+               *(undefined8 *)(lVar11 + 0x10f98),5,7,0x7c,

+               &WPP_9bc0a3e6d113395e20224d2fcd65414d_Traceguids,CONCAT44(uVar16,iVar4),iVar2,iVar3,

+               iVar10,iVar3 - iVar4,iVar10 - iVar2);

+  }

+  local_78[0] = *(CMonitorTopology **)(this + 0x3c);

+  local_78[1] = *(CMonitorTopology **)(this + 0x44);

+  pMVar12 = CMonitorTopology::MonitorDataFromRect

+                      (*(CMonitorTopology **)(this + 0x50),*(tagWND **)(this + 0x10),

+                       (tagRECT *)local_78);

+  if (pMVar12 != (MonitorData *)0x0) {

+    ptVar5 = *(tagWND **)(this + 0x10);

+    *param_3 = 6;

+    bVar8 = IsArranged(ptVar5);

+    if (bVar8) {

+      CMonitorTopology::MonitorData::LogicalWorkArea

+                (*param_2,(tagRECT *)local_78,*(tagWND **)(this + 0x10));

+      *(uint *)(param_1 + 4) = *(uint *)(param_1 + 4) | 0x40000;

+      *(CMonitorTopology **)(param_1 + 0x98) = local_78[0];

+      *(CMonitorTopology **)(param_1 + 0xa0) = local_78[1];

+    }

+    uVar6 = *(undefined8 *)(this + 0x3c);

+    uVar7 = *(undefined8 *)(this + 0x44);

+    *(uint *)param_1 = *(uint *)param_1 | 0x40;

+    *param_2 = pMVar12;

+    *(undefined8 *)(param_1 + 0x2c) = uVar6;

+    *(undefined8 *)(param_1 + 0x34) = uVar7;

+    uVar1 = *(ushort *)(pMVar12 + 0x28);

+    *(uint *)(param_1 + 4) = *(uint *)(param_1 + 4) | 0x100;

+    *(uint *)(param_1 + 0x60) = (uint)uVar1;

+    uVar16 = *(undefined4 *)(param_4 + 0x18);

+    *(uint *)param_1 = *(uint *)param_1 | 0x20;

+    *(undefined4 *)(param_1 + 0x28) = uVar16;

+    return;

+  }

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+  {

+    bVar8 = false;

+  }

+  bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((!bVar8) && (!bVar15)) {

+    return;

+  }

+  uVar6 = **(undefined8 **)(this + 0x10);

+  lVar11 = W32GetUserSessionState();

+  WPP_RECORDER_AND_TRACE_SF_q

+            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar8,bVar15,

+             *(undefined8 *)(lVar11 + 0x10f98),2,7,0x7d,

+             &WPP_9bc0a3e6d113395e20224d2fcd65414d_Traceguids,uVar6);

+  return;

+}

+
```

## `UMPDOBJ::bThunkLargeBitmap`  (modified)

```diff
--- UMPDOBJ::bThunkLargeBitmap
+++ PALLOCNOZ
@@ -1,2 +1,26 @@
-Failed to decompile win32kfull.sys - .ProgramDB UMPDOBJ::bThunkLargeBitmap : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+

+undefined8 PALLOCNOZ(undefined8 param_1,longlong param_2)

+

+{

+  undefined8 uVar1;

+  longlong unaff_RBP;

+  longlong *unaff_RSI;

+  

+  *(int *)(param_2 + 0x358) = (int)unaff_RBP;

+  uVar1 = GreCreateSemaphore();

+  *(undefined8 *)(*unaff_RSI + 0x1f8) = uVar1;

+  if (*(longlong *)(*unaff_RSI + 0x1f8) == unaff_RBP) {

+    if (*(longlong *)(*unaff_RSI + 0x358) != 0) {

+      GreDeleteSemaphore();

+      *(longlong *)(*unaff_RSI + 0x358) = unaff_RBP;

+    }

+    uVar1 = 0;

+  }

+  else {

+    uVar1 = 1;

+  }

+  return uVar1;

+}

+
```

## `CRecalcProp::xxxProcessPendingRecalcState`  (modified)

```diff
--- CRecalcProp::xxxProcessPendingRecalcState
+++ CRecalcProp::xxxProcessPendingRecalcState
@@ -1,2 +1,303 @@
-Failed to decompile win32kfull.sys - .ProgramDB CRecalcProp::xxxProcessPendingRecalcState : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* private: void __cdecl CRecalcProp::xxxProcessPendingRecalcState(class CRecalcState *

+   __ptr64,bool,class CRecalcContext * __ptr64) __ptr64 */

+

+void __thiscall

+CRecalcProp::xxxProcessPendingRecalcState

+          (CRecalcProp *this,CRecalcState *param_1,bool param_2,CRecalcContext *param_3)

+

+{

+  CRecalcState *this_00;

+  CMonitorTopology *pCVar1;

+  undefined8 uVar2;

+  CRecalcContext *pCVar3;

+  char cVar4;

+  int iVar5;

+  InputTracing_MonitorTopologyCompareResult IVar6;

+  longlong lVar7;

+  MonitorData *pMVar8;

+  CMonitorTopology *this_01;

+  CHECKPOINT *pCVar9;

+  MonitorData *pMVar10;

+  char cVar11;

+  char cVar12;

+  tagWND *ptVar13;

+  uint uVar14;

+  bool bVar15;

+  undefined4 uVar16;

+  undefined4 uVar17;

+  undefined1 auStackY_1f8 [32];

+  undefined4 local_184;

+  CMonitorTopology *local_178 [2];

+  MonitorData *local_168;

+  tagMONITOR *local_160;

+  CRecalcContext *local_158;

+  undefined8 local_148;

+  LONG LStack_140;

+  LONG LStack_13c;

+  uint local_138;

+  uint local_134;

+  int local_12c;

+  int local_128;

+  int local_124;

+  int local_120;

+  int local_110;

+  undefined8 local_10c;

+  undefined8 uStack_104;

+  uint local_d8;

+  longlong local_80 [5];

+  ulonglong local_58;

+  

+  local_58 = __security_cookie ^ (ulonglong)auStackY_1f8;

+  this_00 = *(CRecalcState **)(this + 0x20);

+  local_184 = *(undefined4 *)(*(longlong *)(this_00 + 0x10) + 0xc);

+  local_158 = param_3;

+  AdvancedWindowPos::CWindowAction::CWindowAction((CWindowAction *)&local_138,1);

+  ptVar13 = *(tagWND **)(this + 0x10);

+  uVar14 = local_138 | 0x200;

+  local_138 = uVar14;

+  iVar5 = IsImmersiveBand(ptVar13);

+  cVar4 = '\0';

+  if (iVar5 != 0) {

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+       (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+      cVar11 = cVar4;

+    }

+    if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+       (cVar12 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+      cVar12 = cVar4;

+    }

+    if ((cVar11 != '\0') || (cVar12 != '\0')) {

+      lVar7 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_d

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,cVar12,

+                 *(undefined8 *)(lVar7 + 0x10f98));

+      uVar14 = local_138;

+    }

+    uVar16 = 9;

+    lVar7 = *(longlong *)(*(longlong *)(this + 0x10) + 0x28);

+    local_12c = *(int *)(lVar7 + 0x58);

+    local_128 = *(int *)(lVar7 + 0x5c);

+    local_138 = uVar14 | 6;

+    local_124 = *(int *)(lVar7 + 0x60) - *(int *)(lVar7 + 0x58);

+    local_120 = *(int *)(lVar7 + 100) - *(int *)(lVar7 + 0x5c);

+    goto LAB_0;

+  }

+  local_138 = uVar14 | 0x80;

+  if (param_1 == (CRecalcState *)0x0) {

+    pCVar9 = CHECKPOINT::GetIfValid(ptVar13);

+    if (pCVar9 == (CHECKPOINT *)0x0) {

+      lVar7 = *(longlong *)(*(longlong *)(this + 0x10) + 0x28);

+      uVar16 = *(undefined4 *)(lVar7 + 0x58);

+      uVar17 = *(undefined4 *)(lVar7 + 0x5c);

+      LStack_140 = *(LONG *)(lVar7 + 0x60);

+      LStack_13c = *(LONG *)(lVar7 + 100);

+    }

+    else {

+      uVar16 = *(undefined4 *)(pCVar9 + 0x14);

+      uVar17 = *(undefined4 *)(pCVar9 + 0x18);

+      LStack_140 = *(LONG *)(pCVar9 + 0x1c);

+      LStack_13c = *(LONG *)(pCVar9 + 0x20);

+    }

+    local_148 = (CMonitorTopology *)CONCAT44(uVar17,uVar16);

+    local_178[0] = local_148;

+    local_178[1] = (CMonitorTopology *)_LStack_140;

+    pMVar10 = CMonitorTopology::MonitorDataFromRect

+                        (*(CMonitorTopology **)(this_00 + 0x10),*(tagWND **)(this + 0x10),

+                         (tagRECT *)&local_148);

+    pCVar3 = local_158;

+    local_168 = pMVar10;

+    if (pMVar10 == (MonitorData *)0x0) {

+      lVar7 = GetDispInfo();

+      local_160 = *(tagMONITOR **)(lVar7 + 0x68);

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+         ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+        cVar4 = '\0';

+      }

+      else {

+        cVar4 = '\x01';

+      }

+      bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      uVar16 = 5;

+      if ((cVar4 != '\0') || (uVar14 = local_138, bVar15)) {

+        lVar7 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_qdddd

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar15,

+                   *(undefined8 *)(lVar7 + 0x10f98));

+        uVar14 = local_138;

+      }

+    }

+    else {

+      local_160 = CRecalcState::GetMigrateMonitor

+                            (this_00,*(tagWND **)(this + 0x10),local_158,pMVar10);

+      if (local_160 == (tagMONITOR *)0x0) {

+        local_138 = local_138 | 0x20;

+        local_178[0] = (CMonitorTopology *)CONCAT44(local_178[0]._4_4_,3);

+        local_110 = 2;

+        lVar7 = GetDispInfo();

+        local_160 = *(tagMONITOR **)(lVar7 + 0x68);

+      }

+      else {

+        local_178[0] = (CMonitorTopology *)CONCAT44(local_178[0]._4_4_,4);

+        lVar7 = W32GetUserSessionState();

+        if (((((*(uint *)(lVar7 + 0x10650) & 0x10000) != 0) && (*(int *)(this_00 + 0x40) == 0)) &&

+            (*(int *)(pCVar3 + 0x20) == 0)) &&

+           (IVar6 = CMonitorTopology::CompareToCurrent(*(CMonitorTopology **)(this_00 + 0x10),0),

+           IVar6 == 0x10)) {

+          local_134 = local_134 | 0x1000;

+        }

+      }

+      UpdateActionForAnchor

+                (this,(CWindowAction *)&local_138,&local_168,(Result *)local_178,this_00,

+                 *(ProcessingReason *)(pCVar3 + 0x20),param_2);

+      pMVar10 = local_168;

+      uVar16 = local_178[0]._0_4_;

+      uVar14 = local_138;

+    }

+  }

+  else {

+    local_184 = *(undefined4 *)(*(longlong *)(param_1 + 0x10) + 0xc);

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+       (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+      cVar11 = cVar4;

+    }

+    if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+       (cVar4 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+      cVar4 = '\0';

+    }

+    if ((cVar11 != '\0') || (cVar4 != '\0')) {

+      lVar7 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_d

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,cVar4,

+                 *(undefined8 *)(lVar7 + 0x10f98));

+    }

+    pMVar10 = *(MonitorData **)(param_1 + 0x48);

+    local_168 = pMVar10;

+    pMVar8 = CMonitorTopology::GetCurrentMonitorDataFromId((MonitorId *)(pMVar10 + 0x30),false);

+    local_160 = (tagMONITOR *)ValidateHmonitor(*(undefined8 *)pMVar8);

+    ClearAnchorPosition(this);

+    iVar5 = Feature_RecalcAtomicBookkeeping__private_IsEnabledDeviceUsageNoInline();

+    if ((iVar5 == 0) ||

+       ((*(byte *)(*(longlong *)(*(longlong *)(this + 0x10) + 0x28) + 0x1f) & 0x20) == 0)) {

+LAB_1:

+      if (param_1[0x3d] == (CRecalcState)0x0) {

+        local_110 = *(int *)(param_1 + 0x18);

+        local_10c = *(undefined8 *)(param_1 + 0x2c);

+        uStack_104 = *(undefined8 *)(param_1 + 0x34);

+        local_134 = local_134 | 0x100;

+        local_d8 = (uint)*(ushort *)(pMVar10 + 0x28);

+        uVar16 = 7;

+        uVar14 = local_138 | 0x60;

+        if (local_110 == 3) {

+          local_12c = (int)*(undefined8 *)(param_1 + 0x1c);

+          local_124 = (int)*(undefined8 *)(param_1 + 0x24) - local_12c;

+          local_128 = (int)((ulonglong)*(undefined8 *)(param_1 + 0x1c) >> 0x20);

+          local_120 = (int)((ulonglong)*(undefined8 *)(param_1 + 0x24) >> 0x20) - local_128;

+          uVar14 = local_138 | 0x66;

+        }

+        goto LAB_2;

+      }

+    }

+    else if (param_1[0x3d] == (CRecalcState)0x0) {

+      this_01 = CTopologyManager::GetCurrent();

+      pCVar1 = *(CMonitorTopology **)(param_1 + 0x2c);

+      uVar2 = *(undefined8 *)(param_1 + 0x34);

+      local_178[0] = this_01;

+      local_148 = pCVar1;

+      _LStack_140 = uVar2;

+      pMVar8 = CMonitorTopology::MonitorDataFromRect

+                         (this_01,*(tagWND **)(this + 0x10),(tagRECT *)&local_148);

+      if (pMVar8 != (MonitorData *)0x0) {

+        *(CMonitorTopology **)(this + 0x50) = this_01;

+        LOCK();

+        *(int *)this_01 = *(int *)this_01 + 1;

+        UNLOCK();

+        *(CMonitorTopology **)(this + 0x3c) = pCVar1;

+        *(undefined8 *)(this + 0x44) = uVar2;

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+           (cVar4 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+          cVar4 = '\0';

+        }

+        if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+           (cVar11 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+          cVar11 = '\0';

+        }

+        if ((cVar4 != '\0') || (pMVar10 = local_168, cVar11 != '\0')) {

+          lVar7 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_dddddd

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,cVar11,

+                     *(undefined8 *)(lVar7 + 0x10f98));

+          pMVar10 = local_168;

+        }

+      }

+      CCurrentMonitorTopologyPtr::~CCurrentMonitorTopologyPtr

+                ((CCurrentMonitorTopologyPtr *)local_178);

+      goto LAB_1;

+    }

+    cVar4 = '\0';

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+       (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+      cVar11 = '\0';

+    }

+    if (((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED) &&

+       (*(short *)(WPP_GLOBAL_Control + 0x48) != 0)) {

+      cVar4 = '\x01';

+    }

+    if ((cVar11 != '\0') || (cVar4 != '\0')) {

+      lVar7 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,cVar4,

+                 *(undefined8 *)(lVar7 + 0x10f98));

+    }

+    uVar16 = 8;

+    uVar14 = local_138;

+    if ((*(byte *)(*(longlong *)(*(longlong *)(this + 0x10) + 0x28) + 0x1f) & 0x20) != 0) {

+      local_110 = 0;

+      uVar14 = local_138 | 0x20;

+    }

+  }

+LAB_2:

+  local_138 = uVar14;

+  if (local_160 != (tagMONITOR *)0x0) {

+    AdvancedWindowPos::CWindowAction::SetMonitor

+              ((CWindowAction *)&local_138,local_160,true,*(tagWND **)(this + 0x10));

+  }

+  if (pMVar10 != (MonitorData *)0x0) {

+    AdvancedWindowPos::CWindowAction::SetPreviousMonitorData

+              ((CWindowAction *)&local_138,pMVar10,*(tagWND **)(this + 0x10));

+  }

+LAB_0:

+  *(undefined4 *)local_158 = uVar16;

+  uVar16 = *(undefined4 *)(local_80[0] + 0xc);

+  *(undefined4 *)(local_158 + 0x10) = local_184;

+  *(undefined4 *)(local_158 + 0xc) = uVar16;

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x40) == 0)) ||

+     (cVar4 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+    cVar4 = '\0';

+  }

+  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+     (cVar11 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+    cVar11 = '\0';

+  }

+  if ((cVar4 != '\0') || (cVar11 != '\0')) {

+    CRecalcContext::GetResultString(local_158);

+    lVar7 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_qs

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,cVar11,

+               *(undefined8 *)(lVar7 + 0x10f98));

+  }

+  this[0x38] = (CRecalcProp)0x1;

+  AdvancedWindowPos::xxxApplyWindowAction(*(tagWND **)(this + 0x10),(WindowAction *)&local_138,0xe);

+  this[0x38] = (CRecalcProp)0x0;

+  CThreadLockedCurrentMonitorTopologyPtr::~CThreadLockedCurrentMonitorTopologyPtr

+            ((CThreadLockedCurrentMonitorTopologyPtr *)local_80);

+  return;

+}

+
```

## `CursorApiRouter::HidePointer`  (modified)

```diff
--- CursorApiRouter::HidePointer
+++ CursorApiRouter::HidePointer
@@ -1,2 +1,38 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::HidePointer : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: bool __cdecl CursorApiRouter::HidePointer(bool) __ptr64 */

+

+bool __thiscall CursorApiRouter::HidePointer(CursorApiRouter *this,bool param_1)

+

+{

+  int iVar1;

+  int iVar2;

+  longlong lVar3;

+  bool bVar4;

+  

+  lVar3 = UserGetHDEV();

+  if (lVar3 == 0) {

+    return false;

+  }

+  bVar4 = false;

+  W32AcquirePushLockExclusiveEx((W32_PUSH_LOCK *)(this + 0x30),0);

+  iVar1 = *(int *)(this + 0x28);

+  if (iVar1 == 1) {

+    iVar2 = GreUpdatePointerState(param_1);

+  }

+  else {

+    if (iVar1 != 2) goto LAB_0;

+    iVar2 = GreHidePointer(param_1);

+  }

+  bVar4 = iVar2 != 0;

+  if (bVar4) {

+    this[0x10] = (CursorApiRouter)param_1;

+  }

+LAB_0:

+  W32ReleasePushLockExclusiveEx((W32_PUSH_LOCK *)(this + 0x30),0);

+  InputTraceLogging::Cursor::Api::HidePointer(param_1,bVar4,(bool)this[0x10]);

+  if ((bVar4 != false) && (iVar1 == 1)) {

+    UpdateDwmCursorDesktopVisibility(this);

+  }

+  return true;

+}

+
```

## ``anonymous_namespace'::CheckImmersiveForegroundAccess`  (modified)

```diff
--- `anonymous_namespace'::CheckImmersiveForegroundAccess
+++ `anonymous_namespace'::CheckImmersiveForegroundAccess
@@ -1,2 +1,161 @@
-Failed to decompile win32kfull.sys - .ProgramDB `anonymous_namespace'::CheckImmersiveForegroundAccess : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+undefined8 `anonymous_namespace'::CheckImmersiveForegroundAccess(longlong param_1,byte param_2)

+

+{

+  undefined4 uVar1;

+  int iVar2;

+  int iVar3;

+  longlong *plVar4;

+  longlong lVar5;

+  byte bVar6;

+  ulonglong uVar7;

+  undefined8 uVar8;

+  char cVar9;

+  bool bVar10;

+  undefined2 uVar11;

+  undefined4 uVar12;

+  

+  plVar4 = (longlong *)PsGetCurrentProcessWin32Process();

+  uVar7 = 0;

+  if (plVar4 != (longlong *)0x0) {

+    uVar7 = (ulonglong)plVar4 & -(ulonglong)(*plVar4 != 0);

+  }

+  iVar2 = IsDesktopApp(uVar7);

+  if ((*(uint *)(uVar7 + 0x330) >> 8 & 1) != 0) {

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

+       (cVar9 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+      cVar9 = '\0';

+    }

+    bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar9 == '\0') && (!bVar10)) {

+      return 1;

+    }

+    uVar12 = *(undefined4 *)(uVar7 + 0x38);

+    lVar5 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_d

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar10,

+               *(undefined8 *)(lVar5 + 0x10f98),4,2,0x10,

+               &WPP_2fba9bb74906360b123a4690c98434c6_Traceguids,uVar12);

+    return 1;

+  }

+  cVar9 = '\x01';

+  if (*(int *)(uVar7 + 0x134) == 0) {

+LAB_0:

+    if (iVar2 == 0) goto LAB_1;

+  }

+  else {

+    iVar3 = IsImmersiveAppRestricted(uVar7);

+    if (iVar3 != 0) {

+      bVar6 = param_2 & 0xfe;

+      if ((param_2 & 8) != 0) {

+        bVar6 = param_2 | 1;

+      }

+      if ((bVar6 & 0x10) == 0) {

+        param_2 = bVar6 & 0xfd;

+      }

+      else {

+        param_2 = bVar6 | 2;

+      }

+    }

+    if ((param_2 & 1) == 0) {

+      lVar5 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d0);

+      bVar10 = UIPrivilegeIsolation::IsSameAppContainer

+                         ((UIPIAccessor *)(uVar7 + 0x130),

+                          (UIPIAccessor *)(-(ulonglong)(lVar5 != 0) & lVar5 + 0x130U),1);

+      if (!bVar10) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+          cVar9 = '\0';

+        }

+        bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar9 == '\0') && (!bVar10)) {

+          return 0;

+        }

+        uVar12 = *(undefined4 *)(lVar5 + 0x38);

+        uVar1 = *(undefined4 *)(uVar7 + 0x38);

+        lVar5 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_Dd

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar10,

+                   *(undefined8 *)(lVar5 + 0x10f98),4,2,0x11,

+                   &WPP_2fba9bb74906360b123a4690c98434c6_Traceguids,uVar1,uVar12);

+        return 0;

+      }

+    }

+    if ((param_2 & 2) == 0) {

+      lVar5 = W32GetUserSessionState();

+      if (*(longlong *)(lVar5 + 0x4a50) != 0) {

+        lVar5 = W32GetUserSessionState();

+        lVar5 = PtiKbdFromQ(*(undefined8 *)(lVar5 + 0x4a50));

+        bVar10 = UIPrivilegeIsolation::IsSameAppContainer

+                           ((UIPIAccessor *)(uVar7 + 0x130),

+                            (UIPIAccessor *)

+                            (-(ulonglong)(*(longlong *)(lVar5 + 0x1d0) != 0) &

+                            *(longlong *)(lVar5 + 0x1d0) + 0x130U),1);

+        if (!bVar10) {

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+            cVar9 = '\0';

+          }

+          bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar9 == '\0') && (!bVar10)) {

+            return 0;

+          }

+          uVar12 = *(undefined4 *)(uVar7 + 0x38);

+          lVar5 = W32GetUserSessionState();

+          uVar8 = *(undefined8 *)(lVar5 + 0x10f98);

+          uVar11 = 0x12;

+          goto LAB_2;

+        }

+      }

+      goto LAB_0;

+    }

+    iVar2 = IsImmersiveAppRestricted(uVar7);

+    if (iVar2 != 0) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x4f7);

+    }

+  }

+  lVar5 = W32GetUserSessionState();

+  if ((*(longlong *)(lVar5 + 0x4a50) != 0) &&

+     (lVar5 = W32GetUserSessionState(), *(longlong *)(*(longlong *)(lVar5 + 0x4a50) + 0x90) != 0)) {

+    lVar5 = W32GetUserSessionState();

+    iVar2 = IsImmersiveBand(*(undefined8 *)(*(longlong *)(lVar5 + 0x4a50) + 0x90));

+    if (iVar2 != 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)

+         ) {

+        cVar9 = '\0';

+      }

+      bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar9 == '\0') && (!bVar10)) {

+        return 0;

+      }

+      uVar12 = *(undefined4 *)(uVar7 + 0x38);

+      lVar5 = W32GetUserSessionState();

+      uVar8 = *(undefined8 *)(lVar5 + 0x10f98);

+      uVar11 = 0x13;

+LAB_2:

+      WPP_RECORDER_AND_TRACE_SF_d

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar10,uVar8,4,2,uVar11,

+                 &WPP_2fba9bb74906360b123a4690c98434c6_Traceguids,uVar12);

+      return 0;

+    }

+  }

+LAB_1:

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    cVar9 = '\0';

+  }

+  bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((cVar9 != '\0') || (bVar10)) {

+    lVar5 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar10,

+               *(undefined8 *)(lVar5 + 0x10f98),4,2,0x14,

+               &WPP_2fba9bb74906360b123a4690c98434c6_Traceguids);

+  }

+  return 1;

+}

+
```

## `RFONTOBJ::bGetWidthTable`  (modified)

```diff
--- RFONTOBJ::bGetWidthTable
+++ RFONTOBJ::bGetWidthTable
@@ -1,2 +1,268 @@
-Failed to decompile win32kfull.sys - .ProgramDB RFONTOBJ::bGetWidthTable : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Type propagation algorithm not settling */

+/* public: int __cdecl RFONTOBJ::bGetWidthTable(class UDCOBJ & __ptr64,unsigned long,unsigned short

+   * __ptr64,unsigned long,unsigned short * __ptr64) __ptr64 */

+

+int __thiscall

+RFONTOBJ::bGetWidthTable

+          (RFONTOBJ *this,UDCOBJ *param_1,ulong param_2,ushort *param_3,ulong param_4,

+          ushort *param_5)

+

+{

+  ushort uVar1;

+  uint uVar2;

+  _FONTOBJ *p_Var3;

+  longlong lVar4;

+  char cVar5;

+  uint uVar6;

+  int iVar7;

+  ulonglong uVar8;

+  char cVar9;

+  char cVar10;

+  uint uVar11;

+  uint uVar12;

+  ushort *puVar13;

+  char cVar14;

+  undefined4 in_register_00000084;

+  ulong *puVar15;

+  ulong uVar16;

+  ulonglong uVar17;

+  ulong uVar18;

+  ulonglong uVar19;

+  uint uVar20;

+  undefined1 auStackY_258 [32];

+  uint local_1f8;

+  ushort *local_1d8;

+  ushort *local_1d0;

+  undefined8 local_1a0;

+  longlong lStack_198;

+  undefined8 local_188 [2];

+  ulong local_178 [72];

+  ulonglong local_58;

+  

+  uVar8 = CONCAT44(in_register_00000084,param_2);

+  local_58 = __security_cookie ^ (ulonglong)auStackY_258;

+  cVar10 = '\x01';

+  uVar17 = (ulonglong)param_4;

+  uVar20 = 1;

+  local_1a0 = 0;

+  lStack_198 = 0;

+  cVar5 = '\x01';

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x7c) & 1) == 0)) ||

+     (cVar9 = '\x01', (byte)WPP_GLOBAL_Control[0x79] < 5)) {

+    cVar9 = '\0';

+  }

+  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+     (uVar8 = CONCAT71((int7)(uVar8 >> 8),1), *(short *)(WPP_GLOBAL_Control + 0x98) == 0)) {

+    uVar8 = uVar8 & 0xffffffffffffff00;

+  }

+  if ((cVar9 != '\0') || ((char)uVar8 != '\0')) {

+    WPP_RECORDER_AND_TRACE_SF_

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x68),cVar9,uVar8,

+               *(undefined8 *)(WPP_GLOBAL_Control + 0x90));

+  }

+  if (*(longlong *)(*(longlong *)(*(longlong *)this + 0x60) + 0xc20) == 0) {

+    uVar8 = uVar17;

+    puVar13 = param_5;

+    if (param_4 != 0) {

+      for (; uVar8 != 0; uVar8 = uVar8 - 1) {

+        *puVar13 = 0xffff;

+        puVar13 = puVar13 + 1;

+      }

+    }

+    uVar20 = 0;

+    if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+       (cVar5 = '\x01', (*(uint *)(WPP_GLOBAL_Control + 0x7c) & 1) == 0)) {

+      cVar5 = '\0';

+    }

+    if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+       (cVar9 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x98) == 0)) {

+      cVar9 = '\0';

+    }

+    if ((cVar5 != '\0') || (cVar9 != '\0')) {

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x68),cVar5,cVar9,

+                 *(undefined8 *)(WPP_GLOBAL_Control + 0x90));

+    }

+  }

+  else {

+    local_1d8 = param_5;

+    if (param_4 != 0) {

+      uVar8 = (ulonglong)param_2;

+      uVar18 = param_4;

+      local_1d0 = param_3;

+      if (param_4 <= param_2) {

+        uVar8 = uVar17;

+        uVar20 = 1;

+      }

+      do {

+        uVar11 = (uint)uVar8;

+        uVar16 = 0;

+        if (uVar11 == 0) {

+          uVar16 = 2;

+          uVar12 = 0x46;

+          if (uVar18 < 0x46) {

+            uVar12 = uVar18;

+          }

+        }

+        else {

+          uVar12 = 0x46;

+          if (uVar11 < 0x46) {

+            uVar12 = uVar11;

+          }

+        }

+        puVar15 = local_178;

+        vXlatGlyphArray(this,local_1d0,uVar12,puVar15,uVar16,0);

+        p_Var3 = *(_FONTOBJ **)this;

+        local_188[0] = *(undefined8 *)(p_Var3 + 0x80);

+        uVar6 = PFFOBJ::QueryAdvanceWidths

+                          ((PFFOBJ *)local_188,*(DHPDEV__ **)(p_Var3 + 0x70),p_Var3,(ulong)puVar15,

+                           local_178,local_1d8,uVar12);

+        lVar4 = *(longlong *)this;

+        uVar2 = *(uint *)(lVar4 + 0x2d0);

+        if (uVar6 == 0xffffffff) {

+          *(uint *)(lVar4 + 0x2d0) = uVar2 & 0xffffffbf;

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x7c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x79] < 5)) {

+            cVar5 = '\0';

+          }

+          if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+             (*(short *)(WPP_GLOBAL_Control + 0x98) == 0)) {

+            cVar10 = '\0';

+          }

+          goto joined_r0x000140251813;

+        }

+        if ((uVar2 & 0x40) != 0) {

+          *(uint *)(lVar4 + 0x2d0) = uVar2 & 0xffffffbf;

+          uVar1 = *(ushort *)(*(longlong *)(*(longlong *)(*(longlong *)this + 0x78) + 0x20) + 0x74);

+          local_1f8 = 0;

+          if (uVar12 != 0) {

+            puVar15 = local_178;

+            puVar13 = local_1d0;

+            do {

+              if ((*puVar15 == *(ulong *)(*(longlong *)this + 0x1c8)) && (*puVar13 != uVar1)) {

+                if ((uVar16 == 2) ||

+                   ((iVar7 = bIsLinkedGlyph(this,*puVar13), iVar7 == 0 &&

+                    (iVar7 = bIsSystemTTGlyph(this,*puVar13), iVar7 == 0)))) {

+                  *(undefined2 *)(((longlong)local_1d8 - (longlong)local_1d0) + (longlong)puVar13) =

+                       0xffff;

+                  if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                     (cVar9 = '\x01', (*(uint *)(WPP_GLOBAL_Control + 0x7c) & 1) == 0)) {

+                    cVar9 = '\0';

+                  }

+                  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+                     (cVar14 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x98) == 0)) {

+                    cVar14 = '\0';

+                  }

+                  if ((cVar9 != '\0') || (uVar20 = 0, cVar14 != '\0')) {

+                    WPP_RECORDER_AND_TRACE_SF_DdD

+                              (*(undefined8 *)(WPP_GLOBAL_Control + 0x68),cVar9,cVar14,

+                               *(undefined8 *)(WPP_GLOBAL_Control + 0x90));

+                    uVar20 = 0;

+                  }

+                }

+                else {

+                  iVar7 = bGetGlyphMetrics(this,1,(_GLYPHPOS *)&local_1a0,local_1d0 + local_1f8,

+                                           param_1,false,(ESTROBJ *)0x0);

+                  if (iVar7 == 0) {

+                    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x7c) & 1) == 0)) ||

+                       (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x79] < 5)) {

+                      cVar5 = '\0';

+                    }

+                    if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+                       (*(short *)(WPP_GLOBAL_Control + 0x98) == 0)) {

+                      cVar10 = '\0';

+                    }

+                    goto joined_r0x000140251813;

+                  }

+                  *(undefined2 *)(((longlong)local_1d8 - (longlong)local_1d0) + (longlong)puVar13) =

+                       *(undefined2 *)(lStack_198 + 0xc);

+                }

+              }

+              local_1f8 = local_1f8 + 1;

+              puVar15 = puVar15 + 1;

+              puVar13 = puVar13 + 1;

+            } while (local_1f8 < uVar12);

+          }

+        }

+        uVar20 = uVar20 & uVar6;

+        uVar18 = uVar18 - uVar12;

+        local_1d8 = local_1d8 + uVar12;

+        local_1d0 = local_1d0 + uVar12;

+        if (uVar11 != 0) {

+          uVar8 = (ulonglong)(uVar11 - uVar12);

+        }

+      } while (uVar18 != 0);

+    }

+    if (uVar20 != 0) goto LAB_0;

+  }

+  uVar8 = 0;

+  uVar19 = (ulonglong)param_2;

+  if (param_4 <= param_2) {

+    uVar8 = 0;

+    uVar19 = uVar17;

+  }

+  for (; (uint)uVar8 < (uint)uVar19; uVar8 = (ulonglong)((uint)uVar8 + 1)) {

+    if (param_5[uVar8] == 0xffff) {

+      iVar7 = bGetGlyphMetrics(this,1,(_GLYPHPOS *)&local_1a0,param_3 + uVar8,param_1,false,

+                               (ESTROBJ *)0x0);

+      if (iVar7 == 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x7c) & 1) == 0)) ||

+           (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x79] < 5)) {

+          cVar5 = '\0';

+        }

+        if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+           (*(short *)(WPP_GLOBAL_Control + 0x98) == 0)) {

+          cVar10 = '\0';

+        }

+joined_r0x000140251813:

+        if ((cVar5 != '\0') || (cVar10 != '\0')) {

+          WPP_RECORDER_AND_TRACE_SF_

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x68),cVar5,cVar10,

+                     *(undefined8 *)(WPP_GLOBAL_Control + 0x90));

+        }

+        return -1;

+      }

+      param_5[uVar8] = *(ushort *)(lStack_198 + 0xc);

+    }

+  }

+LAB_0:

+  if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+     (cVar5 = '\x01', (*(uint *)(WPP_GLOBAL_Control + 0x7c) & 1) == 0)) {

+    cVar5 = '\0';

+  }

+  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+     (cVar10 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x98) == 0)) {

+    cVar10 = '\0';

+  }

+  if ((cVar5 != '\0') || (cVar10 != '\0')) {

+    WPP_RECORDER_AND_TRACE_SF_d

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x68),cVar5,cVar10,

+               *(undefined8 *)(WPP_GLOBAL_Control + 0x90));

+  }

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x7c) & 1) == 0)) ||

+     (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x79] < 5)) {

+    cVar5 = '\0';

+  }

+  if (((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED) ||

+     (cVar10 = '\x01', *(short *)(WPP_GLOBAL_Control + 0x98) == 0)) {

+    cVar10 = '\0';

+  }

+  if ((cVar5 != '\0') || (cVar10 != '\0')) {

+    WPP_RECORDER_AND_TRACE_SF_

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x68),cVar5,cVar10,

+               *(undefined8 *)(WPP_GLOBAL_Control + 0x90));

+  }

+  uVar11 = uVar20;

+  if ((param_4 == param_2) && (uVar11 = 0xffffffff, uVar20 != 0xffffffff)) {

+    uVar11 = 1;

+  }

+  return uVar11;

+}

+
```

## `tagQ::zzzAttachToQueue`  (modified)

```diff
--- tagQ::zzzAttachToQueue
+++ xxxProcessActivationEvent
@@ -1,2 +1,173 @@
-Failed to decompile win32kfull.sys - .ProgramDB tagQ::zzzAttachToQueue : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

+

+void __cdecl xxxProcessActivationEvent(tagQMSG *param_1)

+

+{

+  int *piVar1;

+  char *pcVar2;

+  undefined4 uVar3;

+  int iVar4;

+  longlong in_RAX;

+  longlong lVar5;

+  ulonglong uVar6;

+  tagWND *ptVar7;

+  tagTHREADINFO *ptVar8;

+  char cVar9;

+  uint uVar10;

+  longlong unaff_RBX;

+  longlong lVar11;

+  undefined8 *unaff_RDI;

+  ForegroundBoostSource in_R8D;

+  _HEAD *p_Var12;

+  _HEAD *unaff_R13;

+  bool bVar13;

+  undefined4 uStack0000000000000060;

+  undefined4 uStack0000000000000064;

+  undefined8 in_stack_00000068;

+  

+  pcVar2 = (char *)(unaff_RBX + -0x3d + (longlong)param_1 * 4);

+  *pcVar2 = *pcVar2 + (char)in_RAX;

+  ForegroundBoost::SetForegroundPriority(*(tagTHREADINFO **)(in_RAX + 0x4a60),0,in_R8D);

+  lVar5 = W32GetUserSessionState();

+  p_Var12 = unaff_R13;

+  if (*(_HEAD **)(lVar5 + 0x4a60) != unaff_R13) {

+    lVar5 = W32GetUserSessionState();

+    p_Var12 = *(_HEAD **)(*(longlong *)(lVar5 + 0x4a60) + 0x1e0);

+  }

+  uVar3 = SUB84(unaff_R13,0);

+  if (unaff_RDI == (undefined8 *)0x0) {

+    uVar6 = (ulonglong)unaff_R13 & 0xffffffff;

+  }

+  else {

+    uVar6 = PsGetThreadId(*unaff_RDI);

+  }

+  lVar5 = W32GetUserSessionState();

+  if (*(_HEAD **)(lVar5 + 0x4a60) != unaff_R13) {

+    lVar5 = W32GetUserSessionState();

+    uVar3 = PsGetThreadId(**(undefined8 **)(lVar5 + 0x4a60));

+  }

+  EtwTraceFocusChange(uVar3,uVar6 & 0xffffffff);

+  lVar5 = W32GetUserSessionState();

+  if ((*(_HEAD **)(lVar5 + 0x4a60) != unaff_R13) &&

+     ((unaff_RDI == (undefined8 *)0x0 ||

+      (lVar5 = W32GetUserSessionState(),

+      *(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1d0) != unaff_RDI[0x3a])))) {

+    lVar11 = (ulonglong)_DAT_0 * _DAT_fffff78000000320;

+    lVar5 = W32GetUserSessionState();

+    *(int *)(*(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1d0) + 0x42c) =

+         (int)((ulonglong)lVar11 >> 0x18);

+  }

+  lVar5 = W32GetUserSessionState();

+  if (*(_HEAD **)(lVar5 + 0x4a60) != unaff_R13) {

+    lVar5 = GetKeyboardDelegationTargetQ();

+    if ((lVar5 != 0) && (*(longlong *)(lVar5 + 0x88) != 0)) {

+      zzzDelegateInputFocusLostWindowEvent(*(longlong *)(lVar5 + 0x88),0xe);

+    }

+    DisableDelegation();

+  }

+  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

+     (cVar9 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    cVar9 = (char)unaff_R13;

+  }

+  bVar13 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((cVar9 != '\0') || (bVar13)) {

+    if (unaff_RDI != (undefined8 *)0x0) {

+      PsGetThreadId(*unaff_RDI);

+    }

+    lVar5 = W32GetUserSessionState();

+    if (*(_HEAD **)(lVar5 + 0x4a60) != unaff_R13) {

+      lVar5 = W32GetUserSessionState();

+      PsGetThreadId(**(undefined8 **)(lVar5 + 0x4a60));

+    }

+    lVar5 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_Dd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar13,

+               *(undefined8 *)(lVar5 + 0x10f98),4);

+  }

+  lVar5 = W32GetUserSessionState();

+  *(undefined8 **)(lVar5 + 0x4a60) = unaff_RDI;

+  if ((unaff_RDI == (undefined8 *)0x0) ||

+     (lVar5 = W32GetUserSessionState(),

+     (ulonglong)*(uint *)(unaff_RDI[0x3a] + 0x38) != *(ulonglong *)(lVar5 + 0xf8c8))) {

+    lVar5 = W32GetUserSessionState();

+    uVar10 = *(uint *)(lVar5 + 0x396c) & 0xfffffffd;

+  }

+  else {

+    lVar5 = W32GetUserSessionState();

+    uVar10 = *(uint *)(lVar5 + 0x396c) | 2;

+  }

+  lVar5 = W32GetUserSessionState();

+  *(uint *)(lVar5 + 0x396c) = uVar10;

+  iVar4 = IsCurrentSessionServiceSession();

+  if (iVar4 == 0) {

+    _uStack0000000000000060 = 0;

+    in_stack_00000068 = 0;

+    lVar5 = W32GetUserSessionState();

+    if (*(_HEAD **)(lVar5 + 0x4a60) != unaff_R13) {

+      lVar5 = W32GetUserSessionState();

+      _uStack0000000000000060 =

+           CONCAT44(uStack0000000000000064,

+                    *(undefined4 *)(*(longlong *)(*(longlong *)(lVar5 + 0x4a60) + 0x1d0) + 0x38));

+      lVar5 = W32GetUserSessionState();

+      uVar3 = PsGetThreadId(**(undefined8 **)(lVar5 + 0x4a60));

+      _uStack0000000000000060 = CONCAT44(uVar3,uStack0000000000000060);

+    }

+    SendMessageTo(2,&stack0x00000060,0x20);

+  }

+  if ((unaff_RDI != (undefined8 *)0x0) &&

+     (lVar5 = W32GetUserSessionState(), *(int *)(lVar5 + 0x36d8) == 1)) {

+    ptVar7 = ShellWindowManagement::GetShellSpecialWindow((tagDESKTOP *)unaff_RDI[0x3e],1);

+    if ((ptVar7 != (tagWND *)0x0) && (*(undefined8 **)(ptVar7 + 0x10) == unaff_RDI)) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x20) == 0)) ||

+         (cVar9 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+        cVar9 = (char)unaff_R13;

+      }

+      bVar13 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar9 != '\0') || (bVar13)) {

+        lVar11 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar13,

+                   *(undefined8 *)(lVar11 + 0x10f98),4);

+      }

+      *(undefined4 *)(lVar5 + 0x36d8) = 2;

+    }

+  }

+  lVar5 = W32GetUserSessionState();

+  if ((*(_HEAD **)(lVar5 + 0x4a60) != unaff_R13) &&

+     (lVar5 = W32GetUserSessionState(),

+     *(_HEAD **)(*(longlong *)(lVar5 + 0x4a60) + 0x1e0) != unaff_R13)) {

+    lVar5 = W32GetUserSessionState();

+    if ((-1 < (char)*(undefined4 *)(lVar5 + 0x10658)) &&

+       (lVar5 = W32GetUserSessionState(), *(_HEAD **)(lVar5 + 0x3798) != unaff_R13)) {

+      lVar5 = W32GetUserSessionState();

+      lVar5 = *(longlong *)(lVar5 + 0x3798);

+      lVar11 = W32GetUserSessionState();

+      if (lVar5 != *(longlong *)(*(longlong *)(lVar11 + 0x4a60) + 0x1e0)) goto LAB_1;

+    }

+    ptVar8 = PtiCurrent();

+    Win32HM_LockIntoThread<1>(ptVar8,p_Var12,(_Win32HMThreadLockItem *)&stack0x00000050);

+    lVar5 = W32GetUserSessionState();

+    xxxChangeForegroundKeyboardTable

+              (p_Var12,*(undefined8 *)(*(longlong *)(lVar5 + 0x4a60) + 0x1e0),0);

+    Win32HMThreadLockBase<tagMONITOR,1,0>::~Win32HMThreadLockBase<tagMONITOR,1,0>

+              ((Win32HMThreadLockBase<tagMONITOR,1,0> *)&stack0x00000050);

+  }

+LAB_1:

+  iVar4 = Feature_AsyncKeyStateRecentDown_Removal2__private_IsEnabledDeviceUsageNoInline();

+  if (iVar4 == 0) {

+    lVar5 = W32GetUserSessionState();

+    *(undefined8 *)(lVar5 + 0x3878) = 0;

+    *(undefined8 *)(lVar5 + 0x3880) = 0;

+    *(undefined8 *)(lVar5 + 0x3888) = 0;

+    *(undefined8 *)(lVar5 + 0x3890) = 0;

+    lVar5 = W32GetUserSessionState();

+    piVar1 = (int *)(*(longlong *)(lVar5 + 0x4e30) + 0x1b4c);

+    *piVar1 = *piVar1 + 1;

+  }

+  return;

+}

+
```

## `CMonitorTopology::MonitorDataFromRect`  (modified)

```diff
--- CMonitorTopology::MonitorDataFromRect
+++ xxxSetWindowLongPtr
@@ -1,2 +1,137 @@
-Failed to decompile win32kfull.sys - .ProgramDB CMonitorTopology::MonitorDataFromRect : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Variable defined which should be unmapped: param_5 */

+

+__uint64 __cdecl

+xxxSetWindowLongPtr(tagWND *param_1,int param_2,__uint64 param_3,int param_4,int param_5)

+

+{

+  longlong lVar1;

+  uint *puVar2;

+  tagTHREADINFO *ptVar3;

+  tagQ *ptVar4;

+  int iVar5;

+  char *in_RAX;

+  longlong lVar6;

+  __uint64 extraout_RAX;

+  __uint64 _Var7;

+  __uint64 extraout_RAX_00;

+  uint uVar8;

+  undefined4 uVar9;

+  longlong unaff_RBX;

+  int unaff_EBP;

+  tagMENU *unaff_RSI;

+  longlong unaff_R12;

+  longlong unaff_R13;

+  longlong *unaff_R14;

+  int unaff_R15D;

+  undefined8 in_stack_00000020;

+  undefined4 uVar10;

+  uint uStack0000000000000030;

+  uint uStack0000000000000038;

+  undefined4 uStack0000000000000040;

+  AtomicExecutionCheck in_stack_00000050;

+  undefined4 uStack00000000000000a0;

+  

+  uVar10 = (undefined4)((ulonglong)in_stack_00000020 >> 0x20);

+  *in_RAX = *in_RAX + (char)in_RAX;

+  HMAssignmentUnlock();

+  InputTraceLogging::Mouse::SetCapture((tagQ *)*unaff_R14,(tagWND *)0x0,SUB41(unaff_R15D,0));

+  lVar1 = *unaff_R14;

+  if (lVar1 != 0) {

+    lVar6 = *(longlong *)(unaff_R13 + 0x1f0);

+    if ((((*(uint *)(lVar6 + 0x30) & 0xc0) != 0) && (*(int *)(lVar6 + 200) == unaff_R15D)) &&

+       (((*(longlong *)(lVar6 + 0xc0) == unaff_RBX && (unaff_EBP != 2)) ||

+        ((*(longlong *)(lVar6 + 0xc0) == *(longlong *)(lVar1 + 0x80) &&

+         (*(int *)(lVar1 + 0xac) != 2)))))) {

+      in_stack_00000050 = SUB81(unaff_R12,0);

+      AtomicExecutionCheck::Arm(&stack0x00000050);

+      xxxCancelMouseMoveTracking

+                (*(undefined4 *)(lVar6 + 0x30),*(undefined8 *)(lVar6 + 0xc0),

+                 *(undefined4 *)(lVar6 + 200));

+      AtomicExecutionCheck::Disarm(&stack0x00000050);

+    }

+    unaff_RSI = (tagMENU *)LockCaptureWindow(lVar1);

+    *(int *)(lVar1 + 0xac) = unaff_EBP;

+    if (unaff_RBX != 0) {

+      lVar6 = *(longlong *)(unaff_RBX + 0x10);

+      iVar5 = IsMiPEnabledForThread(lVar6);

+      if (((iVar5 != 0) && (iVar5 = IsMiPEnabledForWindow(), iVar5 == 0)) &&

+         (puVar2 = *(uint **)(lVar6 + 0x600), puVar2 != (uint *)0x0)) {

+        uVar8 = *puVar2;

+        if ((((uVar8 & 4) == 0) && ((uVar8 & 2) == 0)) &&

+           (((uVar8 & 0x10) == 0 && ((byte)(SUB41(unaff_R15D,0) & (byte)uVar8) != 0)))) {

+          if (((uVar8 & 0x20) == 0) && ((puVar2[9] & 0x1f0) == 0)) {

+            uVar8 = uVar8 | 2;

+          }

+          else {

+            uVar8 = uVar8 | 4;

+          }

+          *puVar2 = uVar8;

+          **(uint **)(lVar6 + 0x600) = **(uint **)(lVar6 + 0x600) & 0xffffffef;

+        }

+      }

+    }

+  }

+  lVar6 = W32GetUserSessionState();

+  *(int *)(lVar6 + 0x114d8) = *(int *)(lVar6 + 0x114d8) + unaff_R15D;

+  uVar8 = (uint)unaff_R12;

+  if (unaff_RBX == 0) {

+    if (unaff_RSI == (tagMENU *)0x0) goto LAB_0;

+    ptVar3 = *(tagTHREADINFO **)(unaff_RSI + 0x10);

+    if ((*(ulonglong *)(ptVar3 + 0x2b0) >> 0x3c & 1) != 0) {

+      ptVar4 = *(tagQ **)(ptVar3 + 0x1d8);

+      *(uint *)(ptVar4 + 0x214) = *(uint *)(ptVar4 + 0x214) | 0x20;

+      iVar5 = Feature_ConsistentPendingMouse2__private_IsEnabledDeviceUsageNoInline();

+      if (iVar5 == 0) {

+        SetSystemInputSource(ptVar4 + 0x22c);

+      }

+      else {

+        SetSystemPendingMouseMoveData(ptVar4);

+      }

+      WakeSomeone(ptVar4,ptVar3,0x200,(tagQMSG *)0x0);

+    }

+    GenerateMouseMove(0);

+LAB_1:

+    lVar6 = W32GetUserSessionState();

+    uVar9 = 3;

+    if (*(uint *)(lVar6 + 0x114d8) <= uVar8) {

+      uVar9 = 1;

+    }

+    xxxWindowEvent(9,unaff_RSI,0,0,CONCAT44(uVar10,uVar9));

+    if (unaff_RBX != 0) goto LAB_2;

+  }

+  else {

+    if (unaff_RSI != (tagMENU *)0x0) goto LAB_1;

+LAB_2:

+    W32GetUserSessionState();

+    xxxWindowEvent(8);

+  }

+  if ((unaff_RSI != (tagMENU *)0x0) &&

+     ((short)unaff_R12 <= *(short *)(*(longlong *)(unaff_RSI + 0x28) + 0x2a))) {

+    if ((*(longlong *)(unaff_R13 + 0x288) != unaff_R12) && (unaff_RBX != 0)) {

+      *(uint *)(lVar1 + 0x214) = *(uint *)(lVar1 + 0x214) | 0x100000;

+    }

+    Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+              ((Win32HMThreadLockBase<tagMENU,0,0> *)&stack0x00000050,unaff_RSI);

+    zzzEndDeferWinEventNotify();

+    uStack0000000000000040 = 1;

+    uStack0000000000000030 = uVar8;

+    uStack0000000000000038 = uVar8;

+    xxxSendMessageCallback(unaff_RSI,0x215,0);

+    Win32HMThreadLockBase<tagWND,0,0>::~Win32HMThreadLockBase<tagWND,0,0>

+              ((Win32HMThreadLockBase<tagWND,0,0> *)&stack0x00000050);

+    lVar1 = *(longlong *)(unaff_R13 + 0x1d8);

+    _Var7 = extraout_RAX;

+    if (lVar1 == 0) {

+      uStack00000000000000a0 = 0x20000;

+      _Var7 = MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x16d);

+    }

+    puVar2 = (uint *)(lVar1 + 0x214);

+    *puVar2 = *puVar2 & 0xffefffff;

+    return _Var7;

+  }

+LAB_0:

+  zzzEndDeferWinEventNotify();

+  return extraout_RAX_00;

+}

+
```

## `PFFOBJ::bAddPvtData`  (modified)

```diff
--- PFFOBJ::bAddPvtData
+++ PFFOBJ::bAddPvtData
@@ -1,2 +1,48 @@
-Failed to decompile win32kfull.sys - .ProgramDB PFFOBJ::bAddPvtData : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: int __cdecl PFFOBJ::bAddPvtData(unsigned long) __ptr64 */

+

+int __thiscall PFFOBJ::bAddPvtData(PFFOBJ *this,ulong param_1)

+

+{

+  uint uVar1;

+  tagPvtData *ptVar2;

+  uint *puVar3;

+  ulong local_res10 [2];

+  

+  local_res10[0] = param_1;

+  ptVar2 = pPvtDataMatch(this,local_res10);

+  if (ptVar2 == (tagPvtData *)0x0) {

+    puVar3 = (uint *)Win32AllocPoolZInit(0x38,0x70767447);

+    if (puVar3 == (uint *)0x0) {

+      return 0;

+    }

+    puVar3[2] = param_1 & 0x3c;

+    *puVar3 = (uint)((param_1 & 0x2c) == 0);

+    puVar3[1] = (uint)((param_1 & 0x2c) != 0);

+    if ((param_1 & 4) == 0) {

+      uVar1 = PsGetCurrentProcessId();

+      uVar1 = uVar1 & 0xfffffffc;

+    }

+    else {

+      uVar1 = PsGetCurrentThreadId();

+    }

+    puVar3[3] = uVar1;

+    if ((param_1 & 4) != 0) {

+      PushThreadGuardedObject(puVar3 + 6,*(undefined8 *)this,CleanupPvtData);

+    }

+    *(undefined8 *)(puVar3 + 4) = *(undefined8 *)(*(longlong *)this + 0x98);

+    *(uint **)(*(longlong *)this + 0x98) = puVar3;

+  }

+  else {

+    if ((param_1 & 0x2c) == 0) {

+      *(int *)ptVar2 = *(int *)ptVar2 + 1;

+    }

+    else {

+      *(int *)(ptVar2 + 4) = *(int *)(ptVar2 + 4) + 1;

+    }

+    *(uint *)(ptVar2 + 8) = *(uint *)(ptVar2 + 8) | param_1 & 0x3c;

+  }

+  *(undefined4 *)(this + 8) = 1;

+  return 1;

+}

+
```

## `UMPDOBJ::bSendLargeBitmap`  (modified)

```diff
--- UMPDOBJ::bSendLargeBitmap
+++ UMPDOBJ::bSendLargeBitmap
@@ -1,2 +1,109 @@
-Failed to decompile win32kfull.sys - .ProgramDB UMPDOBJ::bSendLargeBitmap : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* public: int __cdecl UMPDOBJ::bSendLargeBitmap(struct _SURFOBJ * __ptr64,int * __ptr64) __ptr64 */

+

+int __thiscall UMPDOBJ::bSendLargeBitmap(UMPDOBJ *this,_SURFOBJ *param_1,int *param_2)

+

+{

+  _SURFOBJ *p_Var1;

+  ulong uVar2;

+  ulong uVar3;

+  int iVar4;

+  void *pvVar5;

+  void *_Dst;

+  uint uVar6;

+  undefined1 auStackY_148 [32];

+  uint local_118;

+  longlong local_108;

+  void *local_100;

+  void *local_f8;

+  void *local_f0;

+  _SURFOBJ *local_e8;

+  UMPDOBJ *local_e0;

+  _SURFOBJ *local_d8;

+  int *local_d0;

+  _SURFOBJ local_c8 [48];

+  void *local_98;

+  undefined8 local_78;

+  undefined8 uStack_70;

+  undefined8 local_68;

+  void *pvStack_60;

+  void *local_58;

+  ulonglong uStack_50;

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStackY_148;

+  local_108 = 0;

+  local_118 = 0;

+  local_78 = 0;

+  uStack_70 = 0;

+  local_68 = 0;

+  pvStack_60 = (void *)0x0;

+  local_58 = (void *)0x0;

+  uStack_50 = 0;

+  local_e0 = this;

+  local_d8 = param_1;

+  local_d0 = param_2;

+  pvVar5 = UMPDAllocUserMem(this,*(ulong *)(param_1 + 0x28));

+  if (pvVar5 != (void *)0x0) {

+    local_78 = CONCAT44(0x76,(undefined4)local_78);

+    local_78 = local_78 & 0xffffffffffffff00;

+    local_68 = *(undefined8 *)this;

+    local_f8 = pvVar5;

+    local_f0 = pvVar5;

+    local_58 = pvVar5;

+    uVar2 = ulGetMaxSize(this);

+    if (0x37 < uVar2) {

+      uVar6 = *(uint *)(param_1 + 0x28);

+      p_Var1 = param_1 + 0x30;

+      local_100 = *(void **)p_Var1;

+      local_e8 = p_Var1;

+      while (uVar6 != 0) {

+        uVar3 = uVar6;

+        if (uVar2 - 0x38 < uVar6) {

+          uVar3 = uVar2 - 0x38;

+        }

+        uStack_50 = CONCAT44(uStack_50._4_4_,uVar3);

+        pvStack_60 = _AllocUserMem(this,uVar3,0);

+        if (pvStack_60 == (void *)0x0) break;

+        _Dst = GetKernelPtr(this,pvStack_60);

+        memcpy(_Dst,local_100,uStack_50 & 0xffffffff);

+        uVar3 = Thunk(this,&local_78,0x30,&local_108,8);

+        if ((uVar3 == 0xffffffff) || (local_108 == 0)) break;

+        local_118 = local_118 + (int)uStack_50;

+        uVar6 = uVar6 - (int)uStack_50;

+        local_58 = (void *)((ulonglong)local_118 + (longlong)pvVar5);

+        local_100 = (void *)(*(longlong *)p_Var1 + (ulonglong)local_118);

+        ResetHeap(this);

+      }

+      iVar4 = Feature_4144735547__private_IsEnabledDeviceUsageNoInline();

+      if (iVar4 == 0) {

+        iVar4 = *(int *)p_Var1;

+        *(void **)p_Var1 = pvVar5;

+        *(ulonglong *)(param_1 + 0x38) =

+             (ulonglong)(uint)(*(int *)(param_1 + 0x38) - iVar4) + (longlong)local_f8;

+        if (uVar6 == 0) goto LAB_0;

+        ResetHeap(this);

+      }

+      else {

+        if (uVar6 == 0) {

+          iVar4 = *(int *)p_Var1;

+          *(void **)p_Var1 = pvVar5;

+          *(ulonglong *)(param_1 + 0x38) =

+               (ulonglong)(uint)(*(int *)(param_1 + 0x38) - iVar4) + (longlong)local_f8;

+LAB_0:

+          *param_2 = 1;

+          return 1;

+        }

+        memset(local_c8,0,0x50);

+        local_98 = pvVar5;

+        ResetHeap(this);

+        param_1 = local_c8;

+      }

+      bDeleteLargeBitmaps(this,param_1,(_SURFOBJ *)0x0,(_SURFOBJ *)0x0);

+      return 0;

+    }

+  }

+  return 0;

+}

+
```

## `CursorApiRouter::ForceSetCurrentCursorShape`  (modified)

```diff
--- CursorApiRouter::ForceSetCurrentCursorShape
+++ CursorApiRouter::RefreshRoutingState
@@ -1,2 +1,15 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::ForceSetCurrentCursorShape : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl CursorApiRouter::RefreshRoutingState(void) __ptr64 */

+

+void __thiscall CursorApiRouter::RefreshRoutingState(CursorApiRouter *this)

+

+{

+  RoutingStateActionNeeded RVar1;

+  

+  W32AcquirePushLockExclusiveEx((W32_PUSH_LOCK *)(this + 0x30),0);

+  RVar1 = UpdateRoutingState(this);

+  W32ReleasePushLockExclusiveEx((W32_PUSH_LOCK *)(this + 0x30),0);

+  HandleRoutingStateAction(this,RVar1);

+  return;

+}

+
```

## `CursorApiRouter::ForceSetCurrentCursorShape`  (modified)

```diff
--- CursorApiRouter::ForceSetCurrentCursorShape
+++ CursorApiRouter::ForceResendCursorState
@@ -1,2 +1,34 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::ForceSetCurrentCursorShape : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl CursorApiRouter::ForceResendCursorState(void) __ptr64 */

+

+void __thiscall CursorApiRouter::ForceResendCursorState(CursorApiRouter *this)

+

+{

+  undefined4 uVar1;

+  undefined8 uVar2;

+  int iVar3;

+  bool bVar4;

+  

+  if (*(int *)(this + 0x28) == 1) {

+    InputTraceLogging::Cursor::Api::ForceSetCurrentCursorShape((bool)this[0x11]);

+    SetPointer(this[0x11] == (CursorApiRouter)0x0);

+    uVar1 = *(undefined4 *)(this + 0xc);

+    uVar2 = ReferenceDwmApiPort();

+    iVar3 = DwmAsyncChangeCursorSynchronization(uVar2,uVar1);

+    if (iVar3 < 0) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x142);

+    }

+    this[0x12] = (CursorApiRouter)0x1;

+    UpdateDwmCursorDesktopVisibility(this);

+  }

+  else {

+    bVar4 = false;

+    if ((this[0x11] != (CursorApiRouter)0x0) || (this[0x10] != (CursorApiRouter)0x0)) {

+      bVar4 = true;

+    }

+    InputTraceLogging::Cursor::Api::ForceSetCurrentCursorShape(bVar4);

+    SetPointer(bVar4 ^ 1);

+  }

+  return;

+}

+
```

## `CursorApiRouter::DwmSetPointer`  (modified)

```diff
--- CursorApiRouter::DwmSetPointer
+++ CursorApiRouter::SetDWMCursorDesktopVisibility
@@ -1,2 +1,33 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::DwmSetPointer : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void __cdecl CursorApiRouter::SetDWMCursorDesktopVisibility(bool) __ptr64 */

+

+void __thiscall CursorApiRouter::SetDWMCursorDesktopVisibility(CursorApiRouter *this,bool param_1)

+

+{

+  int iVar1;

+  longlong lVar2;

+  undefined8 local_38;

+  undefined8 uStack_30;

+  undefined8 local_28;

+  undefined8 uStack_20;

+  undefined8 local_18;

+  ulonglong uStack_10;

+  

+  lVar2 = ReferenceDwmApiPort();

+  if (lVar2 != 0) {

+    uStack_30 = 0;

+    local_18 = 0;

+    local_38 = 0x800000300008;

+    uStack_10 = (ulonglong)CONCAT14(param_1,0x40000061);

+    local_28 = 0;

+    uStack_20 = 0;

+    iVar1 = LpcRequestPort(lVar2,&local_38);

+    ObfDereferenceObject(lVar2);

+    if (-1 < iVar1) {

+      return;

+    }

+  }

+  MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x2cd);

+  return;

+}

+
```

## `NTOSKRNL.EXE::RtlLookupElementGenericTableAvl`  (modified)

```diff
--- NTOSKRNL.EXE::RtlLookupElementGenericTableAvl calling
+++ NTOSKRNL.EXE::RtlLookupElementGenericTableAvl calling
@@ -2,0 +3,2 @@
+UserCheckForMessageAccessWithWindowCapability
+UserSetWindowMessageCapability
```

## `WIN32KBASE.SYS::UPDWORDPointer`  (modified)

```diff
--- WIN32KBASE.SYS::UPDWORDPointer calling
+++ WIN32KBASE.SYS::UPDWORDPointer calling
@@ -9,0 +10 @@
+FindMyMousePersistentHotkeyCallback
@@ -15,0 +17,2 @@
+TryDismissFindMyMousePersistent
+TryShowFindMyMousePersistent
```

## `NTOSKRNL.EXE::RtlLogUnexpectedCodepath`  (modified)

```diff
--- NTOSKRNL.EXE::RtlLogUnexpectedCodepath calling
+++ NTOSKRNL.EXE::RtlLogUnexpectedCodepath calling
@@ -1,0 +2 @@
+NtGdiFONTOBJ_pQueryGlyphAttrs
@@ -3,0 +5,2 @@
+vDIBPatBlt
+vSetPointer
```

## `NTOSKRNL.EXE::ExReleasePushLockExclusiveEx`  (modified)

```diff
--- NTOSKRNL.EXE::ExReleasePushLockExclusiveEx calling
+++ NTOSKRNL.EXE::ExReleasePushLockExclusiveEx calling
@@ -2 +1,0 @@
-CursorApiRouter::HidePointer
```

## `NTOSKRNL.EXE::RtlInsertElementGenericTableAvl`  (modified)

```diff
--- NTOSKRNL.EXE::RtlInsertElementGenericTableAvl calling
+++ NTOSKRNL.EXE::RtlInsertElementGenericTableAvl calling
@@ -2,0 +3 @@
+UserSetWindowMessageCapability
```

## `NTOSKRNL.EXE::ObfDereferenceObject`  (modified)

```diff
--- NTOSKRNL.EXE::ObfDereferenceObject calling
+++ NTOSKRNL.EXE::ObfDereferenceObject calling
@@ -6,0 +7 @@
+CursorApiRouter::SetDWMCursorDesktopVisibility
@@ -75,0 +77 @@
+DwmAsyncUpdateCursorHotspot
```

## `WIN32K.SYS::W32GetSessionState`  (modified)

```diff
--- WIN32K.SYS::W32GetSessionState calling
+++ WIN32K.SYS::W32GetSessionState calling
@@ -20,0 +21 @@
+DeleteInactiveRFONTsCollectAndDelete
```

## `NTOSKRNL.EXE::PsGetCurrentThreadWin32Thread`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentThreadWin32Thread calling
+++ NTOSKRNL.EXE::PsGetCurrentThreadWin32Thread calling
@@ -14 +13,0 @@
-NtUserPostMessage
@@ -17 +15,0 @@
-_PostTransformableMessageIL
```

## `NTOSKRNL.EXE::PsGetCurrentThreadId`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentThreadId calling
+++ NTOSKRNL.EXE::PsGetCurrentThreadId calling
@@ -10 +9,0 @@
-LFONTCOREOBJ::ppfeMapFont
@@ -12 +10,0 @@
-MAPPER::bNearMatch
```

## `WIN32KBASE.SYS::Win32AllocPoolZInit`  (modified)

```diff
--- WIN32KBASE.SYS::Win32AllocPoolZInit calling
+++ WIN32KBASE.SYS::Win32AllocPoolZInit calling
@@ -0,0 +1 @@
+AddCapabilityToDescriptor
```

## `NTOSKRNL.EXE::PsGetCurrentProcessId`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentProcessId calling
+++ NTOSKRNL.EXE::PsGetCurrentProcessId calling
@@ -10 +9,0 @@
-LFONTCOREOBJ::ppfeMapFont
@@ -12 +10,0 @@
-MAPPER::bNearMatch
```

## `WIN32KBASE.SYS::PopThreadGuardedObject`  (modified)

```diff
--- WIN32KBASE.SYS::PopThreadGuardedObject calling
+++ WIN32KBASE.SYS::PopThreadGuardedObject calling
@@ -10,0 +11 @@
+DeleteInactiveRFONTsCollectAndDelete
```

## `NTOSKRNL.EXE::RtlEqualSid`  (modified)

```diff
--- NTOSKRNL.EXE::RtlEqualSid calling
+++ NTOSKRNL.EXE::RtlEqualSid calling
@@ -0,0 +1 @@
+FindAceIndex
```

## `WIN32KBASE.SYS::EtwTraceUIPIMsgError`  (modified)

```diff
--- WIN32KBASE.SYS::EtwTraceUIPIMsgError calling
+++ WIN32KBASE.SYS::EtwTraceUIPIMsgError calling
@@ -1 +1,2 @@
-CheckProcessIdentity
+CheckForMessageAccessCrossIL
+CheckForMessageAccessCrossILEx
@@ -3 +3,0 @@
-NtUserPostMessage
@@ -6,4 +5,0 @@
-_PostMessageCheckIL
-_PostTransformableMessageIL
-xxxInterSendMsgEx
-xxxRealDefWindowProc
@@ -11 +6,0 @@
-xxxWrapRealDefWindowProc
```

## `WIN32K.SYS::W32GetUserSessionState`  (modified)

```diff
--- WIN32K.SYS::W32GetUserSessionState calling
+++ WIN32K.SYS::W32GetUserSessionState calling
@@ -8 +7,0 @@
-<lambda_5ccc6b4f899570d19274b91c59ba0764>::<lambda_invoker_cdecl>
@@ -10,0 +10 @@
+<lambda_9114549c32f8207a17bf5c7fbde88540>::<lambda_invoker_cdecl>
@@ -268 +267,0 @@
-CreateDPIBitmapStrip
@@ -270,0 +270 @@
+CreateGlobalDpiBitmapStrip
@@ -276,0 +277 @@
+CreateScreenBitmap
@@ -1214,0 +1216 @@
+TryShowFindMyMousePersistent
@@ -1253,0 +1256 @@
+UserCheckForMessageAccessWithWindowCapability
@@ -1268,0 +1272,2 @@
+UserSetUserObjectCapability
+UserSetWindowMessageCapability
```

## `NTOSKRNL.EXE::LpcRequestPort`  (modified)

```diff
--- NTOSKRNL.EXE::LpcRequestPort calling
+++ NTOSKRNL.EXE::LpcRequestPort calling
@@ -0,0 +1 @@
+CursorApiRouter::SetDWMCursorDesktopVisibility
@@ -63,0 +65 @@
+DwmAsyncUpdateCursorHotspot
```

## `WIN32K.SYS::W32GetUserGdiSessionState`  (modified)

```diff
--- WIN32K.SYS::W32GetUserGdiSessionState calling
+++ WIN32K.SYS::W32GetUserGdiSessionState calling
@@ -3,0 +4,2 @@
+CheckForMessageAccessCrossIL
+CheckForMessageAccessCrossILEx
@@ -20,2 +21,0 @@
-NtUserPostMessage
-NtUserPostThreadMessage
@@ -53,2 +52,0 @@
-_PostMessageCheckIL
-_PostTransformableMessageIL
@@ -66 +63,0 @@
-xxxInterSendMsgEx
@@ -69 +65,0 @@
-xxxRealDefWindowProc
```

## `NTOSKRNL.EXE::RtlSetDaclSecurityDescriptor`  (modified)

```diff
--- NTOSKRNL.EXE::RtlSetDaclSecurityDescriptor calling
+++ NTOSKRNL.EXE::RtlSetDaclSecurityDescriptor calling
@@ -0,0 +1 @@
+AddCapabilityToDescriptor
```

## `NTOSKRNL.EXE::KeLeaveCriticalRegion`  (modified)

```diff
--- NTOSKRNL.EXE::KeLeaveCriticalRegion calling
+++ NTOSKRNL.EXE::KeLeaveCriticalRegion calling
@@ -6 +5,0 @@
-CursorApiRouter::HidePointer
```

## `WIN32KBASE.SYS::PopThreadGuardedObject`  (modified)

```diff
--- WIN32KBASE.SYS::PopThreadGuardedObject calling
+++ WIN32KBASE.SYS::UserReferenceDwmApiPort calling
@@ -1,42 +1,35 @@
-APIDCOBJ::~APIDCOBJ
-BRUSHMEMOBJ::~BRUSHMEMOBJ
-BRUSHSELOBJ::~BRUSHSELOBJ
-CAutoTGO::vUnguard
-COLORSPACEREF::~COLORSPACEREF
-DCOBJ::~DCOBJ
-DCOBJA::~DCOBJA
-DEVLOCKBLTOBJ::~DEVLOCKBLTOBJ
-DLODCOBJ::~DLODCOBJ
-DWMSPRITEREF::~DWMSPRITEREF
-DeleteInactiveRFONTsCollectAndDelete
-EPATHOBJ_bSimpleFill
-EPATHOBJ_bSimpleStroke
-EPATHOBJ_bSimpleStrokeAndFill
-EUDCCountRegion::~EUDCCountRegion
-EXLATEOBJ::bInitXlateObj
-EXLATEOBJ::vAddToCache
-GrepBitBltImpl
-HDEV_DeleteRfontsAndUnloadDeviceFonts
-HmgInsertObjectHelper::~HmgInsertObjectHelper
-HmgLockResult<META>::~HmgLockResult<META>
-HmgShareLockResult<LFONT>::~HmgShareLockResult<LFONT>
-NtGdiExtEscape
-OPTAPIDCOBJ::~OPTAPIDCOBJ
-PFEMEMOBJ::bInit
-PFFMEMOBJ::vKeepIt
-PFFMEMOBJ::~PFFMEMOBJ
-PFFOBJ::bRemovePvtData
-PUBLIC_PFTOBJ::bLoadFonts
-RFONTOBJ::bMakeInactiveHelper
-RFONTOBJ::bRealizeFont
-RGNOBJAPI::~RGNOBJAPI
-SFMLOGICALSURFACEREF::~SFMLOGICALSURFACEREF
-SURFREFDC::~SURFREFDC
-UMPDDrvQueryFont
-UMPDDrvQueryFontTree
-UMPDOBJ::UMPDENGCALL::~UMPDENGCALL
-XFERDCOBJ::XFERDCOBJ
-XFERDCOBJ::~XFERDCOBJ
-vKillEudcRFONTs
-vKillRFONTList
-vRemoveAllInactiveRFONTs
+CheckAndProcessWindowResizeComplete
+DWM_ARRANGEMENT_DATA::SendShrinkWidthToDwm
+DWM_ARRANGEMENT_DATA::SetPreviewInsertAfter
+DwmSetPointerShape
+GreCreateSpriteInternal
+GreDeleteSpriteInternal
+GreDwmNotifySpriteMonitorChange
+GreFillRgn
+GreFrameRgn
+GreHintSpriteShape
+GrePolyBezier
+GrePolyPolygon
+GrePolyPolyline
+GreProtectSpriteContent
+GreTransferDwmStateToSpriteState
+GreTransferSpriteStateToDwmState
+GreUpdateSpriteVisRgn
+GreWindowResizeStarted
+GrepUpdateSpriteImpl
+NtGdiInvertRgn
+NtGdiLineTo
+NtGdiPolyPatBlt
+NtGdiRectangle
+SpDdNotifyFullscreenSpriteUpdate
+WindowMargins::CheckForChanges
+bMoveDevPreviewRect
+bSetDevDragRect
+bSetDevPreviewRect
+bSpDwmNotifyDirty
+bSpDwmUpdateSurface
+vSpDwmMigrateSpriteLSurfReference
+vSpDwmUpdateSpriteVisibility
+vSpDwmZorderSprite
+xxxSwitchDesktop
+zzzLockDisplayAreaAndInvalidateDCCache
```

## `NTOSKRNL.EXE::PsGetCurrentProcessWin32Process`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentProcessWin32Process calling
+++ NTOSKRNL.EXE::PsGetCurrentProcessWin32Process calling
@@ -4,0 +5 @@
+CheckForMessageAccessCrossILEx
@@ -65 +65,0 @@
-NtUserScheduleDispatchNotification
@@ -135,0 +136 @@
+_ScheduleDispatchNotification
```

## `WIN32KBASE.SYS::PushThreadGuardedObject`  (modified)

```diff
--- WIN32KBASE.SYS::PushThreadGuardedObject calling
+++ WIN32KBASE.SYS::PushThreadGuardedObject calling
@@ -6,0 +7 @@
+DeleteInactiveRFONTsCollectAndDelete
```

## `NTOSKRNL.EXE::RtlCreateAcl`  (modified)

```diff
--- NTOSKRNL.EXE::RtlCreateAcl calling
+++ NTOSKRNL.EXE::RtlCreateAcl calling
@@ -0,0 +1 @@
+AddCapabilityToDescriptor
```

## `WIN32KBASE.SYS::ReferenceDwmApiPort`  (modified)

```diff
--- WIN32KBASE.SYS::ReferenceDwmApiPort calling
+++ WIN32KBASE.SYS::ReferenceDwmApiPort calling
@@ -14,0 +15 @@
+CursorApiRouter::ForceResendCursorState
@@ -15,0 +17 @@
+CursorApiRouter::SetDWMCursorDesktopVisibility
@@ -51,0 +54,2 @@
+TryDismissFindMyMousePersistent
+TryShowFindMyMousePersistent
```

## `NTOSKRNL.EXE::RtlLengthSid`  (modified)

```diff
--- NTOSKRNL.EXE::RtlLengthSid calling
+++ NTOSKRNL.EXE::RtlLengthSid calling
@@ -0,0 +1 @@
+AddCapabilityToDescriptor
```

## `WIN32KBASE.SYS::ValidateHwndStrict`  (modified)

```diff
--- WIN32KBASE.SYS::ValidateHwndStrict calling
+++ WIN32KBASE.SYS::ValidateHwndStrict calling
@@ -11,0 +12 @@
+NtUserSetWindowMessageCapability
```

## `WIN32KBASE.SYS::EnterSharedCrit`  (modified)

```diff
--- WIN32KBASE.SYS::EnterSharedCrit calling
+++ WIN32KBASE.SYS::EnterSharedCrit calling
@@ -7,0 +8 @@
+NtUserCountClipboardFormats
```

## `WIN32KBASE.SYS::Win32FreePool`  (modified)

```diff
--- WIN32KBASE.SYS::Win32FreePool calling
+++ WIN32KBASE.SYS::Win32FreePool calling
@@ -1,0 +2 @@
+AddCapabilityToDescriptor
@@ -356,0 +358,2 @@
+UserSetUserObjectCapability
+UserSetWindowMessageCapability
@@ -418,0 +422 @@
+xxxBMPtoDIBV5
```

## `WIN32KBASE.SYS::Win32AllocPool`  (modified)

```diff
--- WIN32KBASE.SYS::Win32AllocPool calling
+++ WIN32KBASE.SYS::Win32AllocPool calling
@@ -15,0 +16 @@
+UmfdEscPATHOBJ_bCommonTo
```

## `WIN32KBASE.SYS::GreReleasePushLockExclusive`  (modified)

```diff
--- WIN32KBASE.SYS::GreReleasePushLockExclusive calling
+++ WIN32KBASE.SYS::GreReleasePushLockExclusive calling
@@ -5 +4,0 @@
-DwmSetPointerShape
```

## `WIN32KBASE.SYS::IsImmersiveAppRestricted`  (modified)

```diff
--- WIN32KBASE.SYS::IsImmersiveAppRestricted calling
+++ WIN32KBASE.SYS::IsImmersiveAppRestricted calling
@@ -4 +3,0 @@
-IsGpqForegroundAccessibleExplicit
```

## `WIN32KBASE.SYS::UIPrivilegeIsolation::CheckAccess`  (modified)

```diff
--- WIN32KBASE.SYS::UIPrivilegeIsolation::CheckAccess calling
+++ WIN32KBASE.SYS::UIPrivilegeIsolation::CheckAccess calling
@@ -2 +2,2 @@
-CheckProcessIdentity
+CheckForMessageAccessCrossIL
+CheckForMessageAccessCrossILEx
@@ -12 +12,0 @@
-NtUserPostMessage
@@ -15 +14,0 @@
-NtUserScheduleDispatchNotification
@@ -23,2 +22 @@
-_PostMessageCheckIL
-_PostTransformableMessageIL
+_ScheduleDispatchNotification
@@ -26 +23,0 @@
-xxxInterSendMsgEx
@@ -29 +25,0 @@
-xxxRealDefWindowProc
@@ -36 +31,0 @@
-xxxWrapRealDefWindowProc
```
