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

`win32kfull.sys` 10.0.26100.9711 -> 10.0.26100.9974 (ghidriff).

## `zzzChangeStates`  (modified)

```diff
--- zzzChangeStates
+++ zzzChangeStates
@@ -1,66 +1,552 @@
 

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

+/* long __cdecl zzzChangeStates(struct tagWND * __ptr64,struct tagSMWP * __ptr64) */

 

 long __cdecl zzzChangeStates(tagWND *param_1,tagSMWP *param_2)

 

 {

-  long extraout_EAX;

-  int *in_RAX;

-  longlong lVar1;

-  int unaff_EBX;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  char cVar2;

-  int unaff_EDI;

-  tagWND *unaff_R12;

-  int unaff_R14D;

-  char unaff_R15B;

-  undefined4 uStack0000000000000028;

-  undefined2 uStack0000000000000030;

-  undefined *puStack0000000000000038;

-  int iStack0000000000000040;

-  int iStack0000000000000048;

-  int iStack0000000000000050;

-  int iStack0000000000000058;

-  int iStack0000000000000060;

+  ushort uVar1;

+  uint uVar2;

+  LONG LVar3;

+  LONG LVar4;

+  bool bVar5;

+  int iVar6;

+  BOOL BVar7;

+  tagWND *this;

+  tagWND *ptVar8;

+  tagTHREADINFO *ptVar9;

+  tagWND *ptVar10;

+  HRGN__ *pHVar11;

+  undefined8 uVar12;

+  longlong lVar13;

+  longlong lVar14;

+  undefined4 uVar15;

+  tagRECT *ptVar16;

+  byte bVar17;

+  tagCVR *ptVar18;

+  int iVar19;

+  int iVar20;

+  int iVar21;

+  int iVar22;

+  undefined1 auStack_168 [32];

+  undefined8 local_148;

+  int *local_140;

+  undefined8 local_138;

+  undefined8 local_130;

+  undefined4 local_128;

+  undefined8 local_120;

+  undefined4 local_118;

+  ulonglong local_110;

+  int local_108;

+  int local_104;

+  int local_100;

+  int local_fc;

+  undefined8 local_f8;

+  int local_f0;

+  int local_ec;

+  int local_e8;

+  tagWND *local_e0;

+  tagSMWP *local_d8;

+  int local_d0;

+  int local_cc;

+  undefined4 local_c8;

+  undefined4 local_c4;

+  RECT local_c0;

+  AtomicExecutionCheck local_b0 [8];

+  undefined8 local_a8;

+  AtomicExecutionCheck local_a0 [8];

+  undefined8 local_98;

+  Win32HMThreadLockBase<tagMENU,0,0> local_90 [16];

+  Win32HMThreadLockBase<tagMENU,0,0> local_80 [16];

+  tagRECT local_70;

+  RECT local_60;

+  RECT local_50;

+  ulonglong local_40;

   

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

-  iStack0000000000000058 = unaff_ESI + unaff_EBX;

-  iStack0000000000000050 = (int)param_1;

-  puStack0000000000000038 = &WPP_d5ddea0c10d736f924d65ff85e42bc85_Traceguids;

-  uStack0000000000000030 = 0x1d;

-  uStack0000000000000028 = 4;

-  iStack0000000000000040 = unaff_R14D;

-  iStack0000000000000048 = unaff_ESI;

-  iStack0000000000000060 = unaff_EDI;

-  WPP_RECORDER_AND_TRACE_SF_dddddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) ||

-     (cVar2 = unaff_R15B, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

-    cVar2 = '\0';

+  local_40 = __security_cookie ^ (ulonglong)auStack_168;

+  iVar19 = 0;

+  local_104 = 0;

+  local_fc = 0;

+  local_108 = 0;

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

+  local_98 = 0;

+  local_e0 = param_1;

+  local_d8 = param_2;

+  AtomicExecutionCheck::Arm(local_a0);

+  Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+            (local_80,(tagMENU *)param_1);

+  ptVar18 = *(tagCVR **)(param_2 + 0x28);

+  iVar22 = *(int *)(param_2 + 0x1c) + -1;

+  iVar6 = 0;

+  local_e8 = iVar22;

+  if (-1 < iVar22) {

+    do {

+      ptVar8 = (tagWND *)0x0;

+      local_100 = 0;

+      local_f0 = 0;

+      local_f8 = 0;

+      local_70.left = 0;

+      local_70.top = 0;

+      local_70.right = 0;

+      local_70.bottom = 0;

+      if (*(longlong *)ptVar18 != 0) {

+        local_e8 = iVar22;

+        this = (tagWND *)HMValidateHandleNoSecure(*(longlong *)ptVar18,1);

+        if ((this == (tagWND *)0x0) ||

+           (iVar6 = IsStillWindowC(*(HWND__ **)(ptVar18 + 8)), iVar6 == 0)) {

+          *(undefined4 *)(ptVar18 + 0x20) = 0x180f;

+          *(undefined8 *)ptVar18 = 0;

+        }

+        uVar2 = *(uint *)(ptVar18 + 0x20);

+        if (((uVar2 >> 0x13 & 1) == 0) && ((uVar2 & 0x18e7) == 0x1807)) {

+          *(uint *)(ptVar18 + 0x20) = uVar2 | 8;

+        }

+        else if (((uVar2 & 0x18e7) == 0x1803) &&

+                (((*(byte *)(*(longlong *)(this + 0x28) + 0x13) & 4) == 0 &&

+                 (iVar6 = ValidateZorder(ptVar18), iVar6 != 0)))) {

+          *(uint *)(ptVar18 + 0x20) = *(uint *)(ptVar18 + 0x20) | 0xc;

+          if (*(longlong *)(ptVar18 + 0x60) != 0) {

+            GreDeleteObject();

+            *(undefined8 *)(ptVar18 + 0x60) = 0;

+          }

+        }

+        else {

+          if ((*(uint *)(ptVar18 + 0x20) & 0x1803) != 0x1803) {

+            lVar14 = *(longlong *)(this + 0x28);

+            if (((*(byte *)(lVar14 + 0x1b) & 0x20) == 0) && ((*(byte *)(lVar14 + 0x1a) & 8) == 0)) {

+LAB_0:

+              local_ec = (int)local_f8;

+              iVar22 = local_f8._4_4_;

+            }

+            else {

+              local_ec = *(int *)(lVar14 + 0x60) - *(int *)(lVar14 + 0x58);

+              iVar22 = *(int *)(lVar14 + 100) - *(int *)(lVar14 + 0x5c);

+              if ((local_ec == *(int *)(ptVar18 + 0x18)) && (iVar22 == *(int *)(ptVar18 + 0x1c)))

+              goto LAB_0;

+              local_100 = 1;

+            }

+            if ((*(int *)(lVar14 + 0x58) != *(int *)(ptVar18 + 0x10)) ||

+               (*(int *)(lVar14 + 0x5c) != *(int *)(ptVar18 + 0x14))) {

+              local_f0 = 1;

+            }

+            local_70._0_8_ = *(undefined8 *)(*(longlong *)(param_1 + 0x28) + 0x68);

+            local_70._8_8_ = *(undefined8 *)(*(longlong *)(param_1 + 0x28) + 0x70);

+            bVar5 = IsChildWindowDpiBoundary(this);

+            if (bVar5) {

+              if ((*(uint *)(ptVar18 + 0x9c) & 0x100) == 0) {

+                ptVar8 = this + 0xe0;

+                *(undefined4 *)ptVar8 = 0;

+                *(undefined4 *)(this + 0xe4) = 0;

+              }

+              LogicalToPhysicalInPlaceRectWithSubpixel(param_1,&local_70,ptVar8);

+              PhysicalToLogicalInPlaceRectWithSubpixel(this,&local_70,ptVar8);

+              local_108 = 1;

+            }

+            lVar14 = *(longlong *)(this + 0x28);

+            iVar6 = *(int *)(lVar14 + 0x58);

+            iVar21 = *(int *)(lVar14 + 0x5c);

+            *(undefined4 *)(lVar14 + 0x58) = *(undefined4 *)(ptVar18 + 0x10);

+            *(undefined4 *)(*(longlong *)(this + 0x28) + 0x5c) = *(undefined4 *)(ptVar18 + 0x14);

+            ptVar8 = (tagWND *)_GetDesktopWindow();

+            LVar4 = local_70.top;

+            LVar3 = local_70.left;

+            if (param_1 != ptVar8) {

+              *(int *)(*(longlong *)(this + 0x28) + 0x58) =

+                   *(int *)(*(longlong *)(this + 0x28) + 0x58) + local_70.left;

+              *(int *)(*(longlong *)(this + 0x28) + 0x5c) =

+                   *(int *)(*(longlong *)(this + 0x28) + 0x5c) + local_70.top;

+            }

+            lVar14 = *(longlong *)(this + 0x28);

+            iVar6 = *(int *)(lVar14 + 0x58) - iVar6;

+            *(int *)(lVar14 + 0x60) = *(int *)(lVar14 + 0x58) + *(int *)(ptVar18 + 0x18);

+            iVar21 = *(int *)(lVar14 + 0x5c) - iVar21;

+            *(int *)(*(longlong *)(this + 0x28) + 100) =

+                 *(int *)(*(longlong *)(this + 0x28) + 0x5c) + *(int *)(ptVar18 + 0x1c);

+            lVar14 = *(longlong *)(this + 0x28);

+            if (*(int *)(lVar14 + 0x60) < *(int *)(lVar14 + 0x58)) {

+              *(int *)(lVar14 + 0x60) = *(int *)(lVar14 + 0x58);

+            }

+            lVar14 = *(longlong *)(this + 0x28);

+            if (*(int *)(lVar14 + 100) < *(int *)(lVar14 + 0x5c)) {

+              *(int *)(lVar14 + 100) = *(int *)(lVar14 + 0x5c);

+            }

+            ptVar9 = PtiCurrent();

+            lVar14 = *(longlong *)(ptVar9 + 0x1d8);

+            if (this == *(tagWND **)(lVar14 + 0x1a0)) {

+              iVar19 = (*(int *)(*(longlong *)(this + 0x28) + 0x68) - *(int *)(ptVar18 + 0x28)) +

+                       *(int *)(ptVar18 + 0x48);

+              iVar20 = (*(int *)(*(longlong *)(this + 0x28) + 0x6c) - *(int *)(ptVar18 + 0x2c)) +

+                       *(int *)(ptVar18 + 0x4c);

+              ptVar8 = (tagWND *)_GetDesktopWindow();

+              if (local_e0 != ptVar8) {

+                iVar19 = iVar19 - LVar3;

+                iVar20 = iVar20 - LVar4;

+              }

+              if (iVar20 != 0 || iVar19 != 0) {

+                *(int *)(lVar14 + 0x1b4) = *(int *)(lVar14 + 0x1b4) + iVar19;

+                *(int *)(lVar14 + 0x1b8) = *(int *)(lVar14 + 0x1b8) + iVar20;

+              }

+            }

+            lVar14 = *(longlong *)(this + 0x28);

+            local_70._0_8_ = *(longlong *)(lVar14 + 0x68);

+            local_70._8_8_ = *(longlong *)(lVar14 + 0x70);

+            *(undefined4 *)(lVar14 + 0x68) = *(undefined4 *)(ptVar18 + 0x28);

+            *(undefined4 *)(*(longlong *)(this + 0x28) + 0x6c) = *(undefined4 *)(ptVar18 + 0x2c);

+            ptVar8 = local_e0;

+            ptVar10 = (tagWND *)_GetDesktopWindow();

+            if (ptVar8 != ptVar10) {

+              *(int *)(*(longlong *)(this + 0x28) + 0x68) =

+                   *(int *)(*(longlong *)(this + 0x28) + 0x68) + LVar3;

+              *(int *)(*(longlong *)(this + 0x28) + 0x6c) =

+                   *(int *)(*(longlong *)(this + 0x28) + 0x6c) + LVar4;

+            }

+            *(int *)(*(longlong *)(this + 0x28) + 0x70) =

+                 *(int *)(*(longlong *)(this + 0x28) + 0x68) + *(int *)(ptVar18 + 0x30);

+            *(int *)(*(longlong *)(this + 0x28) + 0x74) =

+                 *(int *)(*(longlong *)(this + 0x28) + 0x6c) + *(int *)(ptVar18 + 0x34);

+            lVar14 = local_70._0_8_ - *(longlong *)(*(longlong *)(this + 0x28) + 0x68);

+            if (lVar14 == 0) {

+              lVar14 = local_70._8_8_ - *(longlong *)(*(longlong *)(this + 0x28) + 0x70);

+            }

+            FixupMonitorRgn(this,(bool)(~(byte)(*(uint *)(ptVar18 + 0x20) >> 3) & 1));

+            if (local_100 != 0) {

+              *(uint *)(ptVar18 + 0x9c) = *(uint *)(ptVar18 + 0x9c) | 1;

+              if ((*(uint *)(ptVar18 + 0x9c) & 0x1000) != 0) {

+                tagWND::ComputeDominantState(this);

+              }

+              lVar13 = *(longlong *)(this + 0x28);

+              if (((*(byte *)(lVar13 + 0x1b) & 0x20) == 0) ||

+                 ((*(byte *)(lVar13 + 0x1a) & 0x20) != 0)) {

+                iVar19 = IsWindowDesktopComposed(this);

+                if (iVar19 != 0) {

+                  lVar13 = *(longlong *)(this + 0x28);

+                  local_d0 = *(int *)(lVar13 + 0x60) - *(int *)(lVar13 + 0x58);

+                  local_cc = *(int *)(lVar13 + 100) - *(int *)(lVar13 + 0x5c);

+                  lVar13 = W32GetUserSessionState();

+                  local_110 = 0;

+                  local_118 = 0;

+                  local_120 = 0;

+                  local_140 = &local_d0;

+                  local_128 = 0;

+                  local_130 = 0;

+                  local_138 = 0;

+                  local_148 = (undefined4 *)0x0;

+                  local_104 = UpdateSprite(*(undefined8 *)(*(longlong *)(lVar13 + 0xdf10) + 0x30),

+                                           this);

+                }

+              }

+              else {

+                bVar17 = *(byte *)(lVar13 + 0x1a) & 8;

+                local_f8 = 0;

+                local_140 = (int *)(-(ulonglong)(bVar17 != 0) & (ulonglong)&local_f8);

+                local_148 = (undefined4 *)((ulonglong)local_148 & 0xffffffff00000000);

+                local_104 = RecreateRedirectionBitmap

+                                      (this,*(int *)(lVar13 + 0x58) - *(int *)(ptVar18 + 0x50),

+                                       *(int *)(lVar13 + 0x5c) - *(int *)(ptVar18 + 0x54),0);

+                lVar13 = local_f8;

+                if ((bVar17 != 0) && (-1 < local_104)) {

+                  if (local_f8 == 0) {

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

+                    local_a8 = 0;

+                    AtomicExecutionCheck::Arm(local_b0);

+                    xxxInternalInvalidate(this,1,0x401);

+                    AtomicExecutionCheck::Disarm(local_b0);

+                  }

+                  else {

+                    iVar19 = SetOldRedirectionBitmap(this,local_f8);

+                    if (iVar19 != 0) {

+                      lVar13 = 0;

+                    }

+                  }

+                }

+                if (lVar13 != 0) {

+                  DeleteOrSetRedirectionBitmap(this,lVar13,1);

+                }

+              }

+            }

+            if (((iVar6 != 0) || (iVar21 != 0)) &&

+               (pHVar11 = tagWND::GetExplicitClipRgn(this), pHVar11 != (HRGN__ *)0x0)) {

+              GreOffsetRgn(pHVar11,iVar6,iVar21);

+            }

+            if (((*(int *)(ptVar18 + 0x48) != 0) || (*(int *)(ptVar18 + 0x4c) != 0)) ||

+               (local_108 != 0)) {

+              if (1 < *(ulonglong *)(*(longlong *)(this + 0x28) + 0x88)) {

+                GreOffsetRgn(*(ulonglong *)(*(longlong *)(this + 0x28) + 0x88),

+                             *(int *)(ptVar18 + 0x48),*(undefined4 *)(ptVar18 + 0x4c));

+              }

+              OffsetChildren(this,*(undefined4 *)(ptVar18 + 0x48),*(undefined4 *)(ptVar18 + 0x4c),0)

+              ;

+            }

+            if (((local_f0 != 0) || (lVar14 != 0)) ||

+               ((iVar6 != 0 ||

+                (param_1 = local_e0, param_2 = local_d8, iVar19 = local_108, iVar21 != 0)))) {

+              local_c8 = *(undefined4 *)(*(longlong *)(this + 0x28) + 0x58);

+              local_c4 = *(undefined4 *)(*(longlong *)(this + 0x28) + 0x5c);

+              local_60.left = 0;

+              local_60.top = 0;

+              local_60.right = 0;

+              local_60.bottom = 0;

+              bVar17 = 0;

+              if (local_f0 != 0) {

+                if ((*(uint *)(this + 0x17c) & 0x400) != 0) {

+                  RemoveWindowFullScreen(this);

+                }

+                iVar19 = local_100;

+                lVar14 = *(longlong *)(this + 0x28);

+                if ((*(byte *)(lVar14 + 0x1a) & 8) != 0) {

+                  if (local_100 != 0) {

+                    local_c0.right = *(int *)(lVar14 + 0x60) - *(int *)(lVar14 + 0x58);

+                    local_c0.bottom = *(int *)(lVar14 + 100) - *(int *)(lVar14 + 0x5c);

+                    local_60.bottom = -iVar21 + iVar22;

+                    local_60.right = local_ec + -iVar6;

+                    local_c0.left = 0;

+                    local_c0.top = 0;

+                    local_60.top = -iVar21;

+                    local_60.left = -iVar6;

+                    IntersectRect(&local_60,&local_60,&local_c0);

+                  }

+                  lVar14 = W32GetUserSessionState();

+                  if (*(int *)(lVar14 + 0xa990) != 0) {

+                    InvalidateGDIWindows(this);

+                    GreClientRgnUpdated(1);

+                  }

+                  if (iVar19 != 0) {

+                    iVar22 = IsWindowDesktopComposed(this);

+                    bVar17 = 1;

+                    if (iVar22 == 0) goto LAB_1;

+                  }

+                  bVar17 = 0;

+                }

+              }

+LAB_1:

+              param_1 = local_e0;

+              param_2 = local_d8;

+              iVar19 = local_108;

+              if ((*(byte *)(*(longlong *)(this + 0x28) + 0x1a) & 8) != 0) {

+                lVar14 = W32GetUserSessionState();

+                local_110 = -(ulonglong)bVar17 & (ulonglong)&local_60;

+                local_118 = 0;

+                local_148 = &local_c8;

+                local_120 = 0;

+                local_128 = 0;

+                local_130 = 0;

+                local_138 = 0;

+                local_140 = (int *)0x0;

+                local_104 = UpdateSprite(*(undefined8 *)(*(longlong *)(lVar14 + 0xdf10) + 0x30),this

+                                        );

+                param_1 = local_e0;

+                param_2 = local_d8;

+                iVar19 = local_108;

+              }

+            }

+          }

+          iVar22 = local_108;

+          if ((*(uint *)(ptVar18 + 0x20) & 4) == 0) {

+            if (((*(ulonglong *)(ptVar18 + 8) < 2) ||

+                (iVar6 = IsPseudoHwnd(), iVar22 = local_108, iVar6 == 0)) &&

+               (iVar6 = ValidateWindowPos(ptVar18,param_1), iVar22 = iVar19, iVar6 != 0)) {

+              UnlinkWindow(this,param_1);

+              uVar12 = PWInsertAfter(*(undefined8 *)(ptVar18 + 8));

+              LinkWindow(this,uVar12,param_1);

+              local_fc = local_fc + 1;

+              if ((*(byte *)(*(longlong *)(this + 0x28) + 0x13) & 4) != 0) {

+                SetOrClrWF(0,this,0x304,1);

+                SetOrClrWF((byte)~*(byte *)(*(longlong *)(this + 0x28) + 0x18) >> 3 & 1,this,0x808,1

+                          );

+              }

+            }

+            else {

+              local_108 = iVar22;

+              *(uint *)(ptVar18 + 0x20) = *(uint *)(ptVar18 + 0x20) | 4;

+              SetOrClrWF(0,this,0x304,1);

+              iVar22 = local_108;

+            }

+          }

+          local_108 = iVar22;

+          uVar2 = *(uint *)(ptVar18 + 0x9c);

+          if (((uVar2 & 0x20) != 0) && ((*(byte *)(*(longlong *)(this + 0x28) + 0x1f) & 0x20) == 0))

+          {

+            if ((uVar2 >> 9 & 1) == 0) {

+              local_70.left = 0;

+              local_70.top = 0;

+              local_70.right = 0;

+              local_70.bottom = 0;

+              if ((char)uVar2 < '\0') {

+                local_70._0_8_ = *(undefined8 *)(ptVar18 + 0x88);

+                local_70._8_8_ = *(undefined8 *)(ptVar18 + 0x90);

+              }

+              iVar22 = ERECTL::bWrapped((ERECTL *)&local_70);

+              ptVar16 = &local_70;

+              if (iVar22 != 0) {

+                ptVar16 = (tagRECT *)0x0;

+              }

+              lVar14 = GetNewMonitor(this,ptVar16);

+            }

+            else {

+              lVar14 = ValidateHmonitorNoRip(*(undefined8 *)(ptVar18 + 0x80));

+            }

+            if (lVar14 != 0) {

+              if ((*(uint *)(ptVar18 + 0x9c) & 0x200) == 0) {

+                uVar12 = *(undefined8 *)(ptVar18 + 0x80);

+              }

+              else {

+                uVar12 = *(undefined8 *)(*(longlong *)(this + 0x28) + 0x100);

+              }

+              lVar13 = ValidateHmonitor(uVar12);

+              if (lVar13 == lVar14) {

+                lVar13 = *(longlong *)(this + 0x28);

+                if ((((*(short *)(lVar13 + 0x11e) == 0) ||

+                     (*(short *)(*(longlong *)(lVar14 + 0x28) + 0x3c) == *(short *)(lVar13 + 0x11e))

+                     ) || ((((byte)*(undefined4 *)(lVar13 + 0x120) & 0xf) != 2 ||

+                           (((*(uint *)(*(longlong *)(this + 0x10) + 0x2b0) & 0x2000000) != 0 ||

+                            (iVar22 = _IsTopLevelWindow(this), iVar22 == 0)))))) &&

+                   ((((byte)*(undefined4 *)(lVar13 + 0x120) & 0xf) != 3 ||

+                    ((uVar1 = *(ushort *)(*(longlong *)(lVar14 + 0x28) + 0x54),

+                     uVar1 == ((ushort)((uint)*(undefined4 *)(lVar13 + 0x120) >> 8) & 0x1ff) ||

+                     (uVar1 == *(ushort *)(this + 0x130))))))) goto LAB_2;

+              }

+              iVar22 = UpdateMonitorForWindowAndChildren(this,lVar14,ptVar18 + 0xa0,0);

+              *(uint *)(ptVar18 + 0x9c) =

+                   (iVar22 << 6 ^ *(uint *)(ptVar18 + 0x9c)) & 0x40 ^ *(uint *)(ptVar18 + 0x9c);

+            }

+          }

+LAB_2:

+          Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+                    (local_90,(tagMENU *)this);

+          if ((*(uint *)(ptVar18 + 0x20) & 0x40) == 0) {

+            if ((char)*(uint *)(ptVar18 + 0x20) < '\0') {

+              bVar5 = IsTrayWindow(this,1);

+              if (((((byte)*(undefined4 *)(ptVar18 + 0x20) & 0x1f) != 0x1f) && (bVar5)) &&

+                 ((*(ushort *)(*(longlong *)(this + 0x28) + 0x2a) & 0x2fff) != 0x2aa)) {

+                *(uint *)(param_2 + 0x18) = *(uint *)(param_2 + 0x18) | 1;

+                *(uint *)(ptVar18 + 0x20) = *(uint *)(ptVar18 + 0x20) | 0x20000000;

+                local_108 = iVar19;

+              }

+              SetRedrawProp(this,0);

+              bVar5 = SetVisible(this,10);

+              if (bVar5) {

+                DecomposeWindowIfNeeded(this);

+              }

+              lVar14 = W32GetUserSessionState();

+              uVar15 = 3;

+              if (*(int *)(lVar14 + 0x11528) == 0) {

+                uVar15 = 1;

+              }

+              local_148 = (undefined4 *)CONCAT44(local_148._4_4_,uVar15);

+              xxxWindowEvent(0x8003,this,0);

+            }

+          }

+          else {

+            if ((*(uint *)(*(longlong *)(*(longlong *)(this + 0x10) + 0x1d0) + 0xc) & 0x40) != 0) {

+              iVar22 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+              if (iVar22 == 0) {

+                zzzCalcStartCursorHide(*(undefined8 *)(*(longlong *)(this + 0x10) + 0x1d0),5000);

+              }

+              else {

+                zzzSetStartGlass();

+              }

+            }

+            SetRedrawProp(this,0);

+            bVar5 = SetVisible(this,9);

+            lVar14 = W32GetUserSessionState();

+            uVar15 = 3;

+            if (*(int *)(lVar14 + 0x11528) == 0) {

+              uVar15 = 1;

+            }

+            local_148 = (undefined4 *)CONCAT44(local_148._4_4_,uVar15);

+            xxxWindowEvent(0x8002,this,0);

+            if ((bVar5) &&

+               (*(uint *)(ptVar18 + 0x9c) = *(uint *)(ptVar18 + 0x9c) | 2,

+               (*(byte *)(*(longlong *)(this + 0x28) + 0x1a) & 8) == 0)) {

+              local_104 = ComposeWindowIfNeeded(this,0);

+            }

+            bVar5 = IsTrayWindow(this,1);

+            lVar14 = *(longlong *)(this + 0x28);

+            if ((*(ushort *)(lVar14 + 0x2a) & 0x2fff) == 0x2aa) {

+              if ((*(byte *)(lVar14 + 0x10) & 0x40) != 0) {

+                *(uint *)(param_2 + 0x18) = *(uint *)(param_2 + 0x18) | 1;

+                *(uint *)(ptVar18 + 0x20) = *(uint *)(ptVar18 + 0x20) | 0x40000000;

+              }

+              if (!bVar5) goto LAB_3;

+            }

+            else {

+              if ((*(byte *)(lVar14 + 0x10) & 0x40) != 0) {

+                *(uint *)(param_2 + 0x18) = *(uint *)(param_2 + 0x18) | 1;

+                *(uint *)(ptVar18 + 0x20) = *(uint *)(ptVar18 + 0x20) | 0x40000000;

+              }

+              if ((bVar5) || (*(longlong *)(this + 0x78) != 0)) {

+                *(uint *)(param_2 + 0x18) = *(uint *)(param_2 + 0x18) | 1;

+                *(uint *)(ptVar18 + 0x20) = *(uint *)(ptVar18 + 0x20) | 0x10000000;

+                if (bVar5) goto LAB_4;

+                *(uint *)(ptVar18 + 0x9c) = *(uint *)(ptVar18 + 0x9c) | 8;

+              }

+LAB_3:

+              if ((*(longlong *)(this + 0x78) == 0) &&

+                 ((*(uint *)(ptVar18 + 0x20) & 0x40000000) != 0)) {

+                *(uint *)(ptVar18 + 0x9c) = *(uint *)(ptVar18 + 0x9c) | 0x10;

+              }

+            }

+LAB_4:

+            local_108 = iVar19;

+            if ((((*(uint *)(ptVar18 + 0x20) & 0x4008) != 8) &&

+                ((*(byte *)(*(longlong *)(*(longlong *)(this + 0x88) + 8) + 9) & 8) != 0)) &&

+               (lVar14 = W32GetUserSessionState(),

+               *(longlong *)(this + 0x18) == *(longlong *)(lVar14 + 0x4b58))) {

+              local_70.left = 0;

+              local_70.top = 0;

+              local_70.right = 0;

+              local_70.bottom = 0;

+              for (ptVar8 = *(tagWND **)(*(longlong *)(this + 0x68) + 0x70); ptVar8 != (tagWND *)0x0

+                  ; ptVar8 = *(tagWND **)(ptVar8 + 0x58)) {

+                if (ptVar8 == this) {

+                  W32GetUserSessionState();

+                  CreateSpb(this,0);

+                  break;

+                }

+                lVar14 = *(longlong *)(ptVar8 + 0x28);

+                if ((*(byte *)(lVar14 + 0x1f) & 0x10) != 0) {

+                  local_50.left = *(LONG *)(lVar14 + 0x58);

+                  local_50.top = *(LONG *)(lVar14 + 0x5c);

+                  local_50.right = *(LONG *)(lVar14 + 0x60);

+                  local_50.bottom = *(LONG *)(lVar14 + 100);

+                  TransformRectBetweenCoordinateSpaces(&local_50,&local_50,this);

+                  BVar7 = IntersectRect(&local_70,(RECT *)(*(longlong *)(this + 0x28) + 0x58),

+                                        &local_50);

+                  if (BVar7 != 0) break;

+                }

+              }

+            }

+          }

+          if (((*(byte *)(*(longlong *)(this + 0x28) + 0x1f) & 0x10) != 0) &&

+             ((*(uint *)(ptVar18 + 0x20) & 0x8000) != 0)) {

+            SetOrClrWF(1,this);

+          }

+          if (*(longlong *)(ptVar18 + 0x70) != 0) {

+            SelectWindowRgn(this);

+          }

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

+                    ((Win32HMThreadLockBase<tagWND,0,0> *)local_90);

+          iVar22 = local_e8;

+          iVar19 = local_108;

+        }

+      }

+      ptVar18 = ptVar18 + 0xa8;

+      iVar22 = iVar22 + -1;

+    } while (-1 < iVar22);

+    iVar6 = local_104;

+    local_e8 = iVar22;

+    if (local_fc != 0) {

+      lVar14 = W32GetUserSessionState();

+      local_148 = (undefined4 *)

+                  (CONCAT44(local_148._4_4_,-(uint)(*(int *)(lVar14 + 0x11528) != 0)) &

+                  0xffffffff00000002);

+      xxxWindowEvent(0x8004,param_1,0xfffffffc);

+      iVar6 = local_104;

+    }

   }

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

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

-    unaff_R15B = '\0';

-  }

-  if ((cVar2 != '\0') || (unaff_R15B != '\0')) {

-    lVar1 = W32GetUserSessionState();

-    iStack0000000000000050 = *(int *)(unaff_RBP + -0x19);

-    iStack0000000000000058 = *(int *)(unaff_RBP + -0x15);

-    iStack0000000000000040 = *(int *)(unaff_RBP + -0x21);

-    iStack0000000000000048 = *(int *)(unaff_RBP + -0x1d);

-    iStack0000000000000060 = iStack0000000000000050 - iStack0000000000000040;

-    puStack0000000000000038 = &WPP_d5ddea0c10d736f924d65ff85e42bc85_Traceguids;

-    uStack0000000000000030 = 0x1e;

-    uStack0000000000000028 = 4;

-    WPP_RECORDER_AND_TRACE_SF_dddddd

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar2,

-               CONCAT31((int3)((uint)iStack0000000000000050 >> 8),unaff_R15B),

-               *(undefined8 *)(lVar1 + 0x10f88),5);

-  }

-  AddWFFULLSCREEN(unaff_R12);

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

-            ((Win32HMThreadLockBase<tagKL,0,0> *)(unaff_RBP + -9));

-  return extraout_EAX;

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

+            ((Win32HMThreadLockBase<tagWND,0,0> *)local_80);

+  AtomicExecutionCheck::Disarm(local_a0);

+  return iVar6;

 }
```

## `NtUserSetWindowsHookEx`  (modified)

```diff
--- NtUserSetWindowsHookEx
+++ NtUserSetWindowsHookEx
@@ -1,38 +1,127 @@
 

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

-

-void NtUserSetWindowsHookEx(undefined4 param_1)

+HHOOK__ * NtUserSetWindowsHookEx

+                    (void *param_1,uint *param_2,int param_3,uint param_4,_func___int64 *param_5,

+                    tagHookFlags param_6)

 

 {

-  char *pcVar1;

-  char in_AL;

-  undefined7 in_register_00000001;

-  char in_CL;

-  undefined8 *unaff_RBX;

-  ulonglong unaff_RSI;

-  undefined2 in_FS;

-  undefined8 in_stack_00000048;

-  undefined8 in_stack_00000050;

-  undefined8 in_stack_00000058;

-  undefined8 in_stack_00000060;

-  undefined8 in_stack_00000068;

-  undefined8 in_stack_00000070;

+  uint uVar1;

+  tagTHREADINFO *ptVar2;

+  undefined8 uVar3;

+  HHOOK__ *pHVar4;

+  longlong lVar5;

+  char cVar6;

+  HHOOK__ *pHVar7;

+  bool bVar8;

+  void *local_res8;

+  uint *local_res10;

+  ushort uStackX_22;

+  longlong local_68;

+  HHOOK__ *local_60;

+  HHOOK__ *local_50;

   

-  pcVar1 = (char *)(CONCAT71(in_register_00000001,in_AL) + -0x75);

-  *pcVar1 = *pcVar1 + in_CL;

-  *(undefined2 *)(CONCAT71(in_register_00000001,in_AL) + unaff_RSI * 4) = in_FS;

-  *(char *)CONCAT71(in_register_00000001,in_AL) =

-       *(char *)CONCAT71(in_register_00000001,in_AL) + in_AL;

-  pcVar1 = (char *)(CONCAT71(in_register_00000001,in_AL) + -0x77);

-  *pcVar1 = *pcVar1 + in_CL;

-  (*(code *)(CONCAT71(in_register_00000001,in_AL) & 0xffffffffffffff20))

-            (param_1,unaff_RSI & 0xffffffff);

-  *unaff_RBX = in_stack_00000048;

-  unaff_RBX[1] = in_stack_00000050;

-  unaff_RBX[2] = in_stack_00000058;

-  unaff_RBX[3] = in_stack_00000060;

-  unaff_RBX[4] = in_stack_00000068;

-  unaff_RBX[5] = in_stack_00000070;

-  return;

+                    /* 0x29a6a0  2056  NtUserSetWindowsHookEx */

+  if (0xf < param_4 + 1) {

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

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

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

+      cVar6 = '\0';

+    }

+    else {

+      cVar6 = '\x01';

+    }

+    bVar8 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar8)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_d

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

+                 *(undefined8 *)(lVar5 + 0x10f88),2,5,0xd,

+                 &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids,param_4);

+    }

+    uVar3 = 0x592;

+LAB_0:

+    UserSetLastError(uVar3);

+    return (HHOOK__ *)0x0;

+  }

+  cVar6 = '\x01';

+  if (param_4 < 2) {

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

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

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

+      cVar6 = '\0';

+    }

+    bVar8 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar8)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

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

+                 *(undefined8 *)(lVar5 + 0x10f88),3,5,0xe,

+                 &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids);

+    }

+    ptVar2 = PtiCurrent();

+    *(ulonglong *)(*(longlong *)(ptVar2 + 0x208) + 0xe0) =

+         *(ulonglong *)(*(longlong *)(ptVar2 + 0x208) + 0xe0) | 0x1000;

+    uVar3 = 5;

+    goto LAB_0;

+  }

+  EnterLeaveCritShared::EnterLeaveCritShared((EnterLeaveCritShared *)&local_68,1);

+  pHVar4 = (HHOOK__ *)0x0;

+  ptVar2 = (tagTHREADINFO *)pHVar4;

+  if ((param_3 != 0) &&

+     (ptVar2 = (tagTHREADINFO *)PtiFromThreadId(param_3), ptVar2 == (tagTHREADINFO *)0x0)) {

+    UserSetLastError(0x57);

+    goto LAB_1;

+  }

+  pHVar7 = pHVar4;

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

+    uVar3 = PsGetCurrentProcess();

+    local_68 = PsGetProcessPeb(uVar3);

+    ProbeForRead(local_68,2000,1);

+    local_res8 = param_1;

+    local_res10 = param_2;

+    if (*(void **)(local_68 + 0x10) == param_1) {

+      local_res8 = (void *)0x0;

+      local_res10 = (uint *)0x0;

+    }

+    param_1 = local_res8;

+    if ((local_res8 != (void *)0x0) && (local_res10 != (uint *)0x0)) {

+      if (*(uint **)MmUserProbeAddress_exref <= local_res10) {

+        local_res10 = *(uint **)MmUserProbeAddress_exref;

+      }

+      uVar1 = *local_res10;

+      local_68 = CONCAT44(local_68._4_4_,uVar1);

+      pHVar7 = *(HHOOK__ **)(local_res10 + 2);

+      local_60 = pHVar7;

+      if (((ulonglong)pHVar7 & 1) != 0) {

+                    /* WARNING: Subroutine does not return */

+        ExRaiseDatatypeMisalignment();

+      }

+      if ((pHVar7 + (ulonglong)(ushort)uVar1 + 2 <= pHVar7) ||

+         (*(HHOOK__ **)MmUserProbeAddress_exref <= pHVar7 + (ulonglong)(ushort)uVar1 + 2)) {

+                    /* WARNING: Subroutine does not return */

+        ExRaiseAccessViolation();

+      }

+      uStackX_22 = (ushort)(uVar1 >> 0x10);

+      if (uStackX_22 < (ushort)uVar1) {

+        if ((uVar1 & 1) == 0) goto LAB_2;

+      }

+      else {

+        local_50 = pHVar7;

+        if ((uVar1 & 1) == 0) goto LAB_3;

+      }

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xd44);

+LAB_2:

+                    /* WARNING: Subroutine does not return */

+      ExRaiseAccessViolation();

+    }

+  }

+LAB_3:

+  if ((param_6 != 0) && ((param_6 & 0xffffffbd) != 0)) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xd50);

+  }

+  pHVar4 = zzzSetWindowsHookEx(param_1,(ushort *)pHVar7,ptVar2,param_4,param_5,param_6,(int *)0x0);

+  EtwTraceAuditApiSetWindowsHookEx(param_4,pHVar7,param_1,param_5,(ulonglong)pHVar4 & 0xffffffff);

+LAB_1:

+  UserSessionSwitchLeaveCrit();

+  return pHVar4;

 }
```

## `xxxSendMessageToClient`  (modified)

```diff
--- xxxSendMessageToClient
+++ xxxSendMessageToClient
@@ -1,142 +1,176 @@
+

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

+/* void __cdecl xxxSendMessageToClient(struct tagWND * __ptr64,unsigned int,unsigned

+   __int64,__int64,struct tagSMS * __ptr64,int,__int64 * __ptr64) */

 

 void __cdecl

 xxxSendMessageToClient

           (tagWND *param_1,uint param_2,__uint64 param_3,__int64 param_4,tagSMS *param_5,int param_6

           ,__int64 *param_7)

 

 {

-  WIDEPATHOBJ *this;

-  _POINTFIX *p_Var1;

-  WIDEPATHOBJ *this_00;

-  undefined8 uVar2;

-  int iVar3;

-  ulong uVar4;

-  int *in_RAX;

-  WIDEPATHOBJ *pWVar5;

-  undefined4 in_register_00000014;

-  WIDENER *unaff_RBX;

+  tagWND *ptVar1;

+  longlong *plVar2;

+  bool bVar3;

+  bool bVar4;

+  uint uVar5;

   int iVar6;

-  LINEDATA *pLVar7;

-  EVECTORFX *pEVar8;

-  int unaff_R12D;

-  int unaff_R13D;

-  int iVar9;

-  int unaff_R15D;

-  undefined8 uStack0000000000000040;

-  undefined8 uStack0000000000000048;

-  ulong in_stack_00000090;

-  int in_stack_000000a4;

+  longlong lVar7;

+  code *pcVar8;

+  __int64 _Var9;

+  longlong lVar10;

+  tagTHREADINFO *ptVar11;

+  ushort uVar12;

+  undefined8 uVar13;

+  ulonglong uVar14;

+  uint uVar15;

+  short sVar16;

+  __uint64 _Var17;

+  uint local_res10 [2];

+  __uint64 local_res18;

+  __int64 local_res20;

+  tagWND *local_58 [4];

   

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

-  *(char *)(in_RAX + 0x12021d42) = (char)in_RAX[0x12021d42] + (char)((ulonglong)param_1 >> 8);

-  pathwide::WIDENER::vVecDrawCompute

-            ((WIDENER *)((ulonglong)unaff_RBX & 0xffffffff),

-             (LINEDATA *)CONCAT44(in_register_00000014,param_2));

-  uVar2 = *(undefined8 *)(*(longlong *)(unaff_RBX + 0x2c8) + 0x48);

-  this = (WIDEPATHOBJ *)(unaff_RBX + 0x468);

-  p_Var1 = (_POINTFIX *)(unaff_RBX + 0x2b4);

-  uStack0000000000000040 = uVar2;

-  uStack0000000000000048 = uVar2;

-  if (*(int **)(unaff_RBX + 0x4e8) < *(int **)(unaff_RBX + 0x4f0)) {

-    **(int **)(unaff_RBX + 0x4e8) = *(int *)p_Var1 + unaff_R15D;

-    *(int *)(*(longlong *)(unaff_RBX + 0x4e8) + 4) = *(int *)(unaff_RBX + 0x2b8) + in_stack_000000a4

-    ;

-    *(longlong *)(unaff_RBX + 0x4e8) = *(longlong *)(unaff_RBX + 0x4e8) + 8;

+  bVar4 = true;

+  _Var17 = param_3;

+  local_res10[0] = param_2;

+  local_res18 = param_3;

+  local_res20 = param_4;

+  uVar15 = param_2;

+  if (param_2 - 0x241 < 4) {

+LAB_0:

+    sVar16 = (short)_Var17;

+    bVar3 = true;

   }

   else {

-    pathwide::WIDEPATHOBJ::vGrowPathAndAddPoint(this,p_Var1,(EVECTORFX *)&stack0x000000a8,0);

+    iVar6 = IsPointerInputClientMessage(param_2);

+    sVar16 = (short)_Var17;

+    if (iVar6 != 0) goto LAB_0;

+    bVar3 = false;

   }

-  this_00 = (WIDEPATHOBJ *)(unaff_RBX + 0x3d0);

-  if (*(int **)(unaff_RBX + 0x450) < *(int **)(unaff_RBX + 0x458)) {

-    **(int **)(unaff_RBX + 0x450) = *(int *)p_Var1 - unaff_R15D;

-    *(int *)(*(longlong *)(unaff_RBX + 0x450) + 4) = *(int *)(unaff_RBX + 0x2b8) - in_stack_000000a4

-    ;

-    *(longlong *)(unaff_RBX + 0x450) = *(longlong *)(unaff_RBX + 0x450) + 8;

+  if ((!bVar3) || (bVar3 = bVar4, uVar15 == 0x253)) {

+    bVar3 = false;

   }

-  else {

-    pathwide::WIDEPATHOBJ::vGrowPathAndAddPoint

-              (this_00,p_Var1,(EVECTORFX *)&stack0x000000a8,unaff_R13D);

-  }

-  iVar3 = uStack0000000000000048._4_4_;

-  iVar9 = (int)uVar2;

-  if ((unaff_R15D == iVar9) && (in_stack_000000a4 == uStack0000000000000048._4_4_)) {

-    return;

-  }

-  pLVar7 = *(LINEDATA **)(unaff_RBX + 0x2c0);

-  if (in_stack_00000090 == 0) {

-    in_stack_00000090 =

-         pathwide::WIDEPENOBJ::cptAddRound

-                   ((WIDEPENOBJ *)(unaff_RBX + 0x330),unaff_RBX,pLVar7,

-                    *(LINEDATA **)(unaff_RBX + 0x2c8),0,unaff_R12D,unaff_R12D);

-    iVar6 = (int)pLVar7;

-    pathwide::WIDEPATHOBJ::vAddPoint(this,p_Var1,iVar6);

-    if ((*(uint *)(unaff_RBX + 0x28) & 0x10) != 0) goto LAB_0;

-    if (*(int **)(unaff_RBX + 0x4e8) < *(int **)(unaff_RBX + 0x4f0)) {

-      **(int **)(unaff_RBX + 0x4e8) = *(int *)p_Var1 + iVar9;

-      *(int *)(*(longlong *)(unaff_RBX + 0x4e8) + 4) = *(int *)(unaff_RBX + 0x2b8) + iVar3;

-      *(longlong *)(unaff_RBX + 0x4e8) = *(longlong *)(unaff_RBX + 0x4e8) + 8;

-    }

-    else {

-      pEVar8 = (EVECTORFX *)&stack0x00000040;

-      pathwide::WIDEPATHOBJ::vGrowPathAndAddPoint(this,p_Var1,pEVar8,0);

-      iVar6 = (int)pEVar8;

-    }

-    if (in_stack_00000090 != 0) {

-      pLVar7 = *(LINEDATA **)(unaff_RBX + 0x2c8);

-      pathwide::WIDEPENOBJ::cptAddRound

-                ((WIDEPENOBJ *)(unaff_RBX + 0x330),unaff_RBX,pLVar7,

-                 *(LINEDATA **)(unaff_RBX + 0x2c0),1,unaff_R12D,unaff_R12D);

-      iVar6 = (int)pLVar7;

-    }

-    pWVar5 = this;

-    if (*(int **)(unaff_RBX + 0x4e8) < *(int **)(unaff_RBX + 0x4f0)) {

-      **(int **)(unaff_RBX + 0x4e8) = *(int *)p_Var1 + unaff_R15D;

-      *(int *)(*(longlong *)(unaff_RBX + 0x4e8) + 4) =

-           in_stack_000000a4 + *(int *)(unaff_RBX + 0x2b8);

-      *(longlong *)(unaff_RBX + 0x4e8) = *(longlong *)(unaff_RBX + 0x4e8) + 8;

-    }

-    else {

-      pEVar8 = (EVECTORFX *)&stack0x000000a8;

-      pathwide::WIDEPATHOBJ::vGrowPathAndAddPoint(this,p_Var1,pEVar8,0);

-      iVar6 = (int)pEVar8;

+  if (bVar3) {

+LAB_1:

+    if ((sVar16 != 1) &&

+       (iVar6 = PrepareSentPointerMessageForClient(local_res10,&local_res18,&local_res20,0),

+       param_4 = local_res20, param_3 = local_res18, param_2 = local_res10[0], iVar6 == 0)) {

+      *param_7 = 0;

+      return;

     }

   }

   else {

-    uVar4 = pathwide::WIDEPENOBJ::cptAddRound

-                      ((WIDEPENOBJ *)(unaff_RBX + 0x330),unaff_RBX,pLVar7,

-                       *(LINEDATA **)(unaff_RBX + 0x2c8),in_stack_00000090,unaff_R12D,unaff_R12D);

-    iVar6 = (int)pLVar7;

-    pathwide::WIDEPATHOBJ::vAddPoint(this_00,p_Var1,iVar6);

-    if ((*(uint *)(unaff_RBX + 0x28) & 0x10) != 0) goto LAB_0;

-    pathwide::WIDENER::vAddLeft(unaff_RBX,(EVECTORFX *)&stack0x00000040,iVar6);

-    if (uVar4 != 0) {

-      pLVar7 = *(LINEDATA **)(unaff_RBX + 0x2c8);

-      pathwide::WIDEPENOBJ::cptAddRound

-                ((WIDEPENOBJ *)(unaff_RBX + 0x330),unaff_RBX,pLVar7,

-                 *(LINEDATA **)(unaff_RBX + 0x2c0),0,unaff_R12D,unaff_R12D);

-      iVar6 = (int)pLVar7;

+    if ((uVar15 != 0x210) || (sVar16 != 0x246)) {

+      bVar4 = false;

     }

-    pathwide::WIDENER::vAddLeft(unaff_RBX,(EVECTORFX *)&stack0x000000a8,iVar6);

-    pWVar5 = this_00;

+    if (bVar4) goto LAB_1;

   }

-  pathwide::WIDEPATHOBJ::vAddPoint(pWVar5,p_Var1,iVar6);

-LAB_0:

-  if (*(int **)(unaff_RBX + 0x4e8) < *(int **)(unaff_RBX + 0x4f0)) {

-    **(int **)(unaff_RBX + 0x4e8) = *(int *)p_Var1 + iVar9;

-    *(int *)(*(longlong *)(unaff_RBX + 0x4e8) + 4) = *(int *)(unaff_RBX + 0x2b8) + iVar3;

-    *(longlong *)(unaff_RBX + 0x4e8) = *(longlong *)(unaff_RBX + 0x4e8) + 8;

+  ptVar1 = param_1 + 0x28;

+  uVar15 = *(byte *)(*(longlong *)ptVar1 + 0x12) >> 3 & 1;

+  local_58[0] = ptVar1;

+  iVar6 = PsGetWin32KFilterSet();

+  if (iVar6 == 5) {

+    ptVar11 = PtiCurrent();

+    lVar7 = *(longlong *)(ptVar11 + 0x208);

+    plVar2 = *(longlong **)(lVar7 + 0xf8);

+    LOCK();

+    UNLOCK();

+    param_4 = local_res20;

+    param_3 = local_res18;

+    param_2 = local_res10[0];

+    if (plVar2 == (longlong *)0x0) goto LAB_2;

+    lVar10 = PsGetCurrentProcessWow64Process();

+    uVar13 = 1;

+    if (lVar10 == 0) {

+      uVar13 = 4;

+    }

+    ProbeForRead(plVar2,0x20,uVar13);

+    param_4 = local_res20;

+    param_3 = local_res18;

+    param_2 = local_res10[0];

+    if (*plVar2 == 0) goto LAB_2;

+    *(ulonglong *)(lVar7 + 0xe0) = *(ulonglong *)(lVar7 + 0xe0) | 0x100;

+LAB_3:

+    if (0x3ff < (param_2 & 0x1ffff)) {

+      lVar7 = W32GetUserSessionState();

+      _Var9 = SfnDWORD(param_1,param_2,param_3,param_4,*(undefined8 *)(*(longlong *)ptVar1 + 0x78),

+                       *(undefined8 *)(*(longlong *)(lVar7 + 0x4e30) + 0x2f0),uVar15,param_5);

+      goto LAB_4;

+    }

+    pcVar8 = (code *)(&gapfnScSendMessage)

+                     [(byte)*(undefined2 *)(&MessageTable + (ulonglong)(param_2 & 0xffff) * 2)];

+    lVar7 = W32GetUserSessionState();

+    uVar13 = *(undefined8 *)(*(longlong *)(lVar7 + 0x4e30) + 0x2f0);

+    uVar14 = *(ulonglong *)(*(longlong *)ptVar1 + 0x78);

   }

   else {

-    pathwide::WIDEPATHOBJ::vGrowPathAndAddPoint(this,p_Var1,(EVECTORFX *)&stack0x00000040,0);

+LAB_2:

+    lVar7 = W32GetUserSessionState();

+    if ((-1 < *(int *)(lVar7 + 0xfb60)) || (param_2 == 0x5a)) goto LAB_3;

+    uVar12 = *(ushort *)(*(longlong *)ptVar1 + 0x2a) & 0x2fff;

+    local_res10[0] = (uint)uVar12;

+    if ((9 < (ushort)(uVar12 - 0x2a1)) && (uVar12 != 0x29a)) goto LAB_3;

+    lVar7 = *(longlong *)(*(longlong *)ptVar1 + 0x78);

+    lVar10 = W32GetUserSessionState();

+    if (lVar7 != *(longlong *)

+                  (*(longlong *)(lVar10 + 0x4e30) + -0x1288 + (ulonglong)(ushort)local_res10[0] * 8)

+       ) {

+      lVar7 = *(longlong *)(*(longlong *)ptVar1 + 0x78);

+      lVar10 = W32GetUserSessionState();

+      param_4 = local_res20;

+      if (lVar7 != *(longlong *)

+                    (*(longlong *)(lVar10 + 0x4e30) + -0x1348 +

+                    (ulonglong)(ushort)local_res10[0] * 8)) goto LAB_3;

+    }

+    lVar10 = W32GetUserSessionState();

+    uVar5 = local_res10[0];

+    lVar7 = *(longlong *)(lVar10 + 8 + ((ulonglong)(ushort)local_res10[0] + 0x24c) * 0x10);

+    if ((lVar7 != 0) &&

+       (((*(uint *)(lVar10 + ((ulonglong)(ushort)local_res10[0] + 0x24c) * 0x10) < param_2 ||

+         ((*(byte *)((ulonglong)(param_2 >> 3) + lVar7) & (byte)(1 << ((byte)param_2 & 7))) == 0))

+        && ((*(byte *)(*(longlong *)ptVar1 + 0x12) & 1) == 0)))) {

+      Win32HMOptionalThreadLockAlways<tagMENU>::Win32HMOptionalThreadLockAlways<tagMENU>

+                ((Win32HMOptionalThreadLockAlways<tagMENU> *)local_58);

+      if (param_6 != 0) {

+        Win32HMThreadLockBase<tagMENU,1,1>::ManualLock<void>

+                  ((Win32HMThreadLockBase<tagMENU,1,1> *)local_58,(tagMENU *)param_1);

+      }

+      _Var9 = xxxDefWindowProc(param_1,param_2,param_3,local_res20);

+      *param_7 = _Var9;

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

+                ((Win32HMOptionalThreadLock<tagHOOK> *)local_58);

+      return;

+    }

+    if (0x3ff < (param_2 & 0x1ffff)) {

+      if ((ushort)local_res10[0] == 0x29a) {

+        lVar7 = W32GetUserSessionState();

+        uVar13 = *(undefined8 *)(*(longlong *)(lVar7 + 0x4e30) + 0x1da8);

+      }

+      else {

+        lVar7 = W32GetUserSessionState();

+        uVar13 = *(undefined8 *)

+                  (*(longlong *)(lVar7 + 0x4e30) + -0x1200 + (ulonglong)(uVar5 & 0xffff) * 8);

+      }

+      _Var9 = SfnDWORD(param_1,param_2,param_3,local_res20,uVar15,uVar13,uVar15,param_5);

+      goto LAB_4;

+    }

+    pcVar8 = (code *)(&gapfnScSendMessage)

+                     [(byte)*(undefined2 *)(&MessageTable + (ulonglong)(param_2 & 0xffff) * 2)];

+    if ((ushort)local_res10[0] == 0x29a) {

+      lVar7 = W32GetUserSessionState();

+      uVar13 = *(undefined8 *)(*(longlong *)(lVar7 + 0x4e30) + 0x1da8);

+    }

+    else {

+      lVar7 = W32GetUserSessionState();

+      uVar13 = *(undefined8 *)

+                (*(longlong *)(lVar7 + 0x4e30) + -0x1200 + (ulonglong)(uVar5 & 0xffff) * 8);

+    }

+    uVar14 = (ulonglong)uVar15;

   }

-  if (*(int **)(unaff_RBX + 0x450) < *(int **)(unaff_RBX + 0x458)) {

-    **(int **)(unaff_RBX + 0x450) = *(int *)p_Var1 - iVar9;

-    *(int *)(*(longlong *)(unaff_RBX + 0x450) + 4) = *(int *)(unaff_RBX + 0x2b8) - iVar3;

-    *(longlong *)(unaff_RBX + 0x450) = *(longlong *)(unaff_RBX + 0x450) + 8;

-  }

-  else {

-    pathwide::WIDEPATHOBJ::vGrowPathAndAddPoint(this_00,p_Var1,(EVECTORFX *)&stack0x00000040,1);

-  }

+  _Var9 = (*pcVar8)(param_1,param_2,param_3,local_res20,uVar14,uVar13,uVar15,param_5);

+LAB_4:

+  *param_7 = _Var9;

   return;

 }
```

## `xxxInitTerminal`  (modified)

```diff
--- xxxInitTerminal
+++ xxxInitTerminal
@@ -1,37 +1,142 @@
+

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

+/* long __cdecl xxxInitTerminal(struct tagTERMINAL * __ptr64) */

 

 long __cdecl xxxInitTerminal(tagTERMINAL *param_1)

 

 {

-  char cVar1;

-  ulonglong in_RAX;

-  int *piVar2;

-  _tlgProvider_t *p_Var3;

-  _GUID *in_R8;

-  _GUID *p_Var4;

-  undefined4 in_stack_000000f0;

+  uint uVar1;

+  bool bVar2;

+  int iVar3;

+  longlong lVar4;

+  longlong lVar5;

+  undefined8 uVar6;

+  undefined1 auStack_468 [32];

+  undefined8 *local_448;

+  undefined8 local_440;

+  undefined8 local_438;

+  undefined8 local_430;

+  undefined8 local_428;

+  undefined8 local_420;

+  undefined8 uStack_418;

+  undefined8 local_410;

+  undefined8 uStack_408;

+  undefined8 local_400;

+  undefined8 uStack_3f8;

+  undefined1 local_3e8 [52];

+  int local_3b4;

+  ulonglong local_28;

   

-  piVar2 = (int *)(in_RAX & 0xffffffffffffff40);

-  *piVar2 = *piVar2 + (int)piVar2;

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

-  p_Var4 = (_GUID *)&stack0x00000040;

-  _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 *)param_1,&DAT_0,in_R8,(_tlgWrapperByVal<8> *)p_Var4,

-             (_tlgWrapSz<char> *)&stack0x00000048,(_tlgWrapperByVal<4> *)&stack0x000000f0,

-             (_tlgWrapSz<unsigned_short> *)&stack0x000000f8);

-  if (5 < DAT_1) {

-    p_Var3 = (_tlgProvider_t *)&DAT_1;

-    cVar1 = _tlgKeywordOn(&DAT_1,1);

-    if (cVar1 != '\0') {

-      in_stack_000000f0 = 0x80070005;

-      _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_Var3,&DAT_2,in_R8,p_Var4,(_tlgWrapSz<char> *)&stack0x00000040,

-                 (_tlgWrapperByVal<4> *)&stack0x000000f0,

-                 (_tlgWrapSz<unsigned_short> *)&stack0x000000f8);

+  local_28 = __security_cookie ^ (ulonglong)auStack_468;

+  local_430 = 0;

+  local_428 = 0;

+  memset(local_3e8,0,0x3b8);

+  local_420 = 0;

+  uStack_418 = 0;

+  local_410 = 0;

+  uStack_408 = 0;

+  local_400 = 0;

+  uStack_3f8 = 0;

+  if (*(longlong *)(param_1 + 0x38) == 0) {

+    local_420 = 0x30;

+    uStack_418 = 0;

+    uStack_408 = 0x200;

+    local_410 = 0;

+    bVar2 = false;

+    local_448 = (undefined8 *)((ulonglong)local_448 & 0xffffffffffffff00);

+    local_400 = 0;

+    uStack_3f8 = 0;

+    iVar3 = ZwCreateEvent(&local_430,0x1f0003,&local_420,0);

+    if (iVar3 < 0) {

+      return iVar3;

     }

+    local_440 = 0;

+    local_438 = 0;

+    local_448 = &local_438;

+    iVar3 = ObReferenceObjectByHandle(local_430,0x1f0003,*(undefined8 *)ExEventObjectType_exref,0);

+    *(undefined8 *)(param_1 + 0x38) = local_438;

+    ZwClose(local_430);

+    if (iVar3 < 0) {

+      return iVar3;

+    }

+    if (((*(uint *)param_1 & 2) == 0) && (iVar3 = xxxInitInput(param_1), iVar3 == 0)) {

+      iVar3 = -0x3fffffe9;

+    }

+    else {

+      local_448 = (undefined8 *)((ulonglong)local_448 & 0xffffffffffffff00);

+      iVar3 = ZwCreateEvent(&local_428,0x1f0003,&local_420,0);

+      if (-1 < iVar3) {

+        local_440 = 0;

+        local_438 = 0;

+        local_448 = &local_438;

+        iVar3 = ObReferenceObjectByHandle

+                          (local_428,0x1f0003,*(undefined8 *)ExEventObjectType_exref,0);

+        *(undefined8 *)(param_1 + 0x28) = local_438;

+        ZwClose(local_428);

+        if (-1 < iVar3) {

+          uVar6 = *(undefined8 *)(param_1 + 0x28);

+          iVar3 = InitCreateSystemThreadsMsg(local_3e8,1,param_1);

+          if (iVar3 != 0) {

+            UserSessionSwitchLeaveCrit();

+            lVar4 = W32GetUserGdiSessionState();

+            lVar4 = *(longlong *)(lVar4 + 0x28);

+            lVar5 = PsGetCurrentProcess();

+            if (lVar5 == lVar4) {

+              lVar4 = W32GetUserSessionState();

+              iVar3 = LpcRequestPort(*(undefined8 *)(lVar4 + 0x117d8),local_3e8);

+            }

+            else {

+              local_438 = 0x3b8;

+              lVar4 = W32GetUserSessionState();

+              local_440 = 0;

+              local_448 = &local_438;

+              iVar3 = LpcSendWaitReceivePort

+                                (*(undefined8 *)(lVar4 + 0x117d8),0x20000,local_3e8,local_3e8);

+            }

+            if (-1 < iVar3) {

+              lVar4 = W32GetUserGdiSessionState();

+              lVar4 = *(longlong *)(lVar4 + 0x28);

+              lVar5 = PsGetCurrentProcess();

+              if ((lVar5 == lVar4) || (-1 < local_3b4)) {

+                local_448 = (undefined8 *)0x0;

+                KeWaitForSingleObject(uVar6,0xd,0);

+                bVar2 = true;

+              }

+            }

+            EnterCrit(1);

+            if (bVar2) goto LAB_0;

+          }

+          ObfDereferenceObject(*(undefined8 *)(param_1 + 0x38));

+          ObfDereferenceObject(uVar6);

+          *(undefined8 *)(param_1 + 0x28) = 0;

+          goto LAB_1;

+        }

+      }

+    }

+    ObfDereferenceObject(*(undefined8 *)(param_1 + 0x38));

+    *(undefined8 *)(param_1 + 0x38) = 0;

   }

-  UserSessionSwitchLeaveCrit();

-  return 0;

+  else {

+    uVar6 = *(undefined8 *)(param_1 + 0x28);

+    ObfReferenceObject(uVar6);

+    UserSessionSwitchLeaveCrit();

+    local_448 = (undefined8 *)0x0;

+    KeWaitForSingleObject(uVar6,0xd,0,0);

+    EnterCrit(1);

+LAB_0:

+    ObfDereferenceObject(uVar6);

+    uVar1 = *(uint *)param_1;

+    *(undefined8 *)(param_1 + 0x28) = 0;

+    if ((uVar1 & 8) == 0) {

+      *(uint *)param_1 = uVar1 | 1;

+      return 0;

+    }

+    *(uint *)param_1 = uVar1 & 0xfffffff7;

+    ObfDereferenceObject(*(undefined8 *)(param_1 + 0x38));

+LAB_1:

+    *(undefined8 *)(param_1 + 0x38) = 0;

+    iVar3 = -0x3fffffe9;

+  }

+  return iVar3;

 }
```

## `xxxFreeWindow_Phase1`  (modified)

```diff
--- xxxFreeWindow_Phase1
+++ xxxFreeWindow_Phase1
@@ -1,126 +1,37 @@
+

+/* void __cdecl xxxFreeWindow_Phase1(struct tagWND * __ptr64,struct tagTHREADINFO * __ptr64) */

 

 void __cdecl xxxFreeWindow_Phase1(tagWND *param_1,tagTHREADINFO *param_2)

 

 {

-  byte bVar1;

-  uint uVar2;

-  uint uVar3;

-  int iVar4;

-  undefined1 *puVar5;

-  undefined1 *puVar6;

-  int *piVar7;

-  int *unaff_RBX;

-  undefined1 *puVar8;

-  byte *unaff_RSI;

-  int *unaff_RDI;

-  int in_R8D;

-  int in_R11D;

-  undefined4 in_register_0000009c;

-  int unaff_R12D;

-  int unaff_R13D;

-  byte *pbVar9;

-  byte *unaff_R14;

-  longlong unaff_R15;

-  int in_stack_00000048;

-  int in_stack_0000004c;

-  int in_stack_000000c0;

-  int in_stack_000000e0;

-  int in_stack_000000e8;

+  bool bVar1;

+  int iVar2;

+  longlong lVar3;

   

-  do {

-    uVar2 = *(uint *)(unaff_R15 + (ulonglong)((uint)param_1 & 0xf) * 4);

-    uVar3 = *(uint *)(unaff_R15 + (((ulonglong)param_2 & 0xffffffff) >> 4) * 4);

-    iVar4 = *(int *)(unaff_R15 + (ulonglong)((uint)param_2 & 0xf) * 4);

-    *unaff_RBX = uVar2 * 0x1000000 + in_R8D;

-    unaff_RBX[1] = uVar3 * 0x10000 + (uVar2 >> 8);

-    unaff_RBX[2] = iVar4 * 0x100 + (uVar3 >> 0x10);

-    unaff_RBX = unaff_RBX + 3;

-    unaff_R12D = unaff_R12D + in_R11D;

-    while (in_stack_00000048 <= unaff_R12D) {

-      if (unaff_R13D != 0) {

-        puVar8 = (undefined1 *)(unaff_R15 + (ulonglong)(*unaff_R14 >> 4) * 4);

-        puVar5 = puVar8 + CONCAT44(in_register_0000009c,in_R11D);

-        *(undefined1 *)unaff_RBX = *puVar8;

-        *(undefined1 *)((longlong)unaff_RBX + 1) = *puVar5;

-        puVar8 = (undefined1 *)((longlong)unaff_RBX + 1) + CONCAT44(in_register_0000009c,in_R11D);

-        *puVar8 = puVar5[CONCAT44(in_register_0000009c,in_R11D)];

-        puVar8 = puVar8 + CONCAT44(in_register_0000009c,in_R11D);

-        if (unaff_R13D != 1) {

-          puVar5 = (undefined1 *)(unaff_R15 + (ulonglong)(*unaff_R14 & 0xf) * 4);

-          puVar6 = puVar5 + CONCAT44(in_register_0000009c,in_R11D);

-          *puVar8 = *puVar5;

-          puVar8 = puVar8 + CONCAT44(in_register_0000009c,in_R11D);

-          *puVar8 = *puVar6;

-          puVar8 = puVar8 + CONCAT44(in_register_0000009c,in_R11D);

-          *puVar8 = puVar6[CONCAT44(in_register_0000009c,in_R11D)];

-          puVar8 = puVar8 + CONCAT44(in_register_0000009c,in_R11D);

-          if (unaff_R13D + -1 != in_R11D) {

-            puVar5 = (undefined1 *)

-                     (unaff_R15 +

-                     (ulonglong)(unaff_R14[CONCAT44(in_register_0000009c,in_R11D)] >> 4) * 4);

-            puVar6 = puVar5 + CONCAT44(in_register_0000009c,in_R11D);

-            *puVar8 = *puVar5;

-            puVar8[CONCAT44(in_register_0000009c,in_R11D)] = *puVar6;

-            (puVar8 + CONCAT44(in_register_0000009c,in_R11D))

-            [CONCAT44(in_register_0000009c,in_R11D)] =

-                 puVar6[CONCAT44(in_register_0000009c,in_R11D)];

-          }

-        }

-      }

-      in_stack_000000e8 = in_stack_000000e8 - in_R11D;

-      unaff_RSI = unaff_RSI + in_stack_000000c0;

-      unaff_RDI = (int *)((longlong)unaff_RDI + (longlong)in_stack_000000e0);

-      if (in_stack_000000e8 == 0) {

-        return;

-      }

-      iVar4 = in_stack_0000004c - in_R11D;

-      piVar7 = unaff_RDI;

-      pbVar9 = unaff_RSI;

-      if (iVar4 == 0) {

-LAB_0:

-        puVar8 = (undefined1 *)(unaff_R15 + (ulonglong)(*pbVar9 & 0xf) * 4);

-        puVar5 = puVar8 + CONCAT44(in_register_0000009c,in_R11D);

-        *(undefined1 *)piVar7 = *puVar8;

-        puVar8 = (undefined1 *)((longlong)piVar7 + CONCAT44(in_register_0000009c,in_R11D));

-        *puVar8 = *puVar5;

-        puVar8 = puVar8 + CONCAT44(in_register_0000009c,in_R11D);

-        *puVar8 = puVar5[CONCAT44(in_register_0000009c,in_R11D)];

-        unaff_RBX = (int *)(puVar8 + CONCAT44(in_register_0000009c,in_R11D));

-        unaff_R14 = pbVar9 + CONCAT44(in_register_0000009c,in_R11D);

-      }

-      else {

-        if (iVar4 == in_R11D) {

-LAB_1:

-          puVar8 = (undefined1 *)(unaff_R15 + (ulonglong)(*pbVar9 >> 4) * 4);

-          *(undefined1 *)piVar7 = *puVar8;

-          puVar5 = (undefined1 *)((longlong)piVar7 + CONCAT44(in_register_0000009c,in_R11D));

-          *puVar5 = puVar8[CONCAT44(in_register_0000009c,in_R11D)];

-          puVar5 = puVar5 + CONCAT44(in_register_0000009c,in_R11D);

-          *puVar5 = puVar8[CONCAT44(in_register_0000009c,in_R11D) + 1];

-          piVar7 = (int *)(puVar5 + CONCAT44(in_register_0000009c,in_R11D));

-          goto LAB_0;

-        }

-        unaff_RBX = unaff_RDI;

-        unaff_R14 = unaff_RSI;

-        if (iVar4 - in_R11D == in_R11D) {

-          puVar8 = (undefined1 *)(unaff_R15 + (ulonglong)(*unaff_RSI & 0xf) * 4);

-          *(undefined1 *)unaff_RDI = *puVar8;

-          *(undefined1 *)((longlong)unaff_RDI + 1) = puVar8[CONCAT44(in_register_0000009c,in_R11D)];

-          puVar5 = (undefined1 *)((longlong)unaff_RDI + 1) + CONCAT44(in_register_0000009c,in_R11D);

-          *puVar5 = puVar8[CONCAT44(in_register_0000009c,in_R11D) + 1];

-          piVar7 = (int *)(puVar5 + CONCAT44(in_register_0000009c,in_R11D));

-          pbVar9 = unaff_RSI + 1;

-          goto LAB_1;

-        }

-      }

-      unaff_R12D = 0;

+  bVar1 = false;

+  if (-1 < *(char *)(*(longlong *)(param_1 + 0x28) + 0x14)) {

+    iVar2 = IsMotherDesktopWindow();

+    if (iVar2 == 0) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x126a);

     }

-    bVar1 = *unaff_R14;

-    param_2 = (tagTHREADINFO *)(ulonglong)unaff_R14[CONCAT44(in_register_0000009c,in_R11D)];

-    unaff_R14 = unaff_R14 + CONCAT44(in_register_0000009c,in_R11D) +

-                CONCAT44(in_register_0000009c,in_R11D);

-    param_1 = (tagWND *)(ulonglong)bVar1;

-    in_R8D = *(int *)(unaff_R15 + (ulonglong)(bVar1 >> 4) * 4);

-  } while( true );

+  }

+  xxxFW_DestroyIMEWindowIfRequired(param_1,param_2);

+  if (*(longlong *)(param_1 + 0x18) != 0) {

+    bVar1 = CleanupShellRelatedData(param_1);

+  }

+  if (*(int *)(param_1 + 0x104) != 0) {

+    CleanupInputDelegation(param_1);

+  }

+  InputTransform::ClearTransforms(param_1);

+  FreeWindowMessageFilter(param_1);

+  FreeWindowGCData(param_1);

+  lVar3 = _HMPheFromObject(param_1);

+  if (((*(byte *)(lVar3 + 0x19) & 1) != 0) && (param_2 != *(tagTHREADINFO **)(param_1 + 0x10))) {

+    HMChangeOwnerThread(param_1,param_2);

+  }

+  if (bVar1 != false) {

+    xxxDeferredDesktopRotation();

+  }

+  return;

 }
```

## `xxxMouseEventDirect`  (modified)

```diff
--- xxxMouseEventDirect
+++ xxxMouseEventDirect
@@ -1,135 +1,190 @@
 

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

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

+/* int __cdecl xxxMouseEventDirect(unsigned long,unsigned long,unsigned long,unsigned long,unsigned

+   __int64,unsigned __int64,unsigned __int64,int) */

 

 int __cdecl

 xxxMouseEventDirect(ulong param_1,ulong param_2,ulong param_3,ulong param_4,__uint64 param_5,

                    __uint64 param_6,__uint64 param_7,int param_8)

 

 {

-  ulong uVar1;

-  undefined8 uVar2;

-  uint uVar3;

+  undefined8 uVar1;

+  undefined1 auVar2 [16];

+  int iVar3;

   int iVar4;

-  int extraout_EAX;

-  char *in_RAX;

-  longlong lVar5;

-  InteractiveControlManager *this;

-  void *pvVar6;

-  longlong unaff_RBP;

-  int iVar7;

-  longlong unaff_R12;

-  uint unaff_R13D;

-  char unaff_R14B;

+  int iVar5;

+  uint uVar6;

+  byte bVar7;

+  undefined2 uVar8;

+  ulong uVar9;

+  undefined4 uVar10;

+  tagTHREADINFO *ptVar11;

+  longlong lVar12;

+  int *piVar13;

+  uint uVar14;

+  ulong uVar15;

+  bool bVar16;

+  undefined1 auStack_f8 [32];

+  uint local_d8;

+  undefined8 local_d0;

+  undefined8 local_c8;

+  undefined8 local_b8;

+  int local_b0;

+  int local_ac;

+  __uint64 local_a8;

+  tagTHREADINFO *local_a0;

+  undefined1 local_98 [16];

+  undefined1 local_88 [16];

+  undefined2 local_78;

+  ushort local_76;

+  undefined2 local_74;

+  undefined2 uStack_72;

+  undefined4 local_70;

+  undefined8 local_6c;

+  undefined4 local_64;

+  ulonglong local_60;

   

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

-  do {

-    iVar4 = (int)in_RAX;

-    if (iVar4 == 0) {

-      EnterCrit(unaff_R13D);

-      xxxRemoveQueueCompletion();

-LAB_0:

-      UserSessionSwitchLeaveCrit();

+  local_60 = __security_cookie ^ (ulonglong)auStack_f8;

+  local_76 = 0;

+  ptVar11 = PtiCurrent();

+  local_a0 = ptVar11;

+  EtwTraceBeginInjectMouse(param_5 & 0xffffffff,param_1,param_2);

+  if (param_5 == 0) {

+    auVar2._8_8_ = 0;

+    auVar2._0_8_ = _DAT_0 << 8;

+    param_5 = SUB168(auVar2 * (ZEXT416(_DAT_1) << 0x20),8);

+    param_6 = KeQueryPerformanceCounter(0);

+  }

+  local_a8 = param_6;

+  InputTraceLogging::Mouse::InjectInput(2,param_6);

+  uVar1 = *(undefined8 *)(ptVar11 + 0x1d0);

+  lVar12 = W32GetUserSessionState();

+  uVar14 = param_4 & 0x187e;

+  *(undefined8 *)(lVar12 + 0x4a18) = uVar1;

+  uVar15 = 0;

+  if ((param_4 & 0x180) == 0 || (param_4 >> 0xc & 1) == 0 && (param_4 >> 0xb & 1) == 0) {

+    if ((param_4 & 0x1800) == 0x1800) {

+      uVar14 = param_4 & 0x7e;

+      uVar15 = 0;

     }

-    else {

-      iVar7 = (int)unaff_R12;

-      if (iVar4 != 4) {

-        if (iVar4 == 2) {

-          EnterCrit(unaff_R13D);

-          lVar5 = W32GetUserSessionState();

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

-            if ((*(int *)(lVar5 + 0x10dfc) != iVar7) && (*(longlong *)(lVar5 + 0x10e28) != 0)) {

-              HDXDrvEscape(*(longlong *)(lVar5 + 0x10e28),unaff_R13D,0,0);

-            }

+    else if ((param_4 & 0x1800) == 0) {

+      if ((param_3 & 0xfffffffc) == 0) {

+        if ((char)param_4 < '\0') {

+          uVar6 = uVar14 | 0x80;

+          if ((param_3 & 1) == 0) {

+            uVar6 = uVar14;

           }

-          else {

-            uVar2 = *(undefined8 *)(*(longlong *)(lVar5 + 0xdf10) + 0x10);

-            W32GetUserSessionState();

-            DrvEscapeRemoteDrivers(uVar2);

+          uVar14 = uVar6;

+          if ((param_3 & 2) != 0) {

+            uVar14 = uVar14 | 0x200;

           }

         }

-        else {

-          if ((iVar4 - 1U & 0xfffffffd) != 0) goto LAB_1;

-          EnterCrit(unaff_R13D);

-          iVar4 = Feature_Servicing_win32k_timers_threadlocking__private_IsEnabledDeviceUsageNoInline

-                            ();

-          if (iVar4 == 0) {

-            xxxTimersProc_Old();

+        if ((param_4 & 0x100) != 0) {

+          uVar6 = uVar14 | 0x100;

+          if ((param_3 & 1) == 0) {

+            uVar6 = uVar14;

           }

-          else {

-            xxxTimersProc();

-          }

-        }

-        goto LAB_0;

-      }

-      *(int *)(unaff_RBP + -0x69) = iVar7;

-      lVar5 = W32GetUserSessionState();

-      KeClearEvent(*(undefined8 *)(lVar5 + 0x4990));

-      while (iVar4 = GetRITWakeReason((ulong *)(unaff_RBP + -0x69)), iVar4 != 0) {

-        uVar1 = *(ulong *)(unaff_RBP + -0x69);

-        InputTraceLogging::Win32k::WakeRit(uVar1);

-        if (uVar1 == unaff_R13D) {

-          EnterCrit(unaff_R13D);

-          xxxProcessMouseEvent();

-          goto LAB_2;

-        }

-        if (uVar1 == 2) {

-          InitiateWin32kCleanup();

-          if (*(longlong *)(unaff_RBP + -0x59) != unaff_R12) {

-            EnterCrit(unaff_R13D);

-            lVar5 = W32GetUserSessionState();

-            *(longlong *)(lVar5 + 0x4990) = unaff_R12;

-            ObfDereferenceObject(*(undefined8 *)(unaff_RBP + 0x17));

-            UserSessionSwitchLeaveCrit();

-            if (*(longlong *)(unaff_RBP + -0x59) != 0) {

-              ZwClose();

-            }

-          }

-          uVar3 = 0;

-          EnterCrit(unaff_R13D);

-          CleanupSensorExplicitly(unaff_R13D);

-          lVar5 = W32GetUserSessionState();

-          if (*(int *)(lVar5 + 0x4b20) == iVar7) {

-            CleanupSensorExplicitly(2);

-          }

-          UserSessionSwitchLeaveCrit();

-          CRitTimerScanWakeSystem::CleanupRitTimerScanWakeEvent();

-          iVar4 = extraout_EAX;

-          if (*(LegacyInputDispatcher **)(unaff_RBP + -0x61) != (LegacyInputDispatcher *)0x0) {

-            pvVar6 = LegacyInputDispatcher::_scalar_deleting_destructor_

-                               (*(LegacyInputDispatcher **)(unaff_RBP + -0x61),uVar3);

-            iVar4 = (int)pvVar6;

-          }

-          return iVar4;

-        }

-        if (uVar1 == 4) {

-          lVar5 = W32GetUserSessionState();

-          xxxClientEnableMMCSS(**(uint **)(lVar5 + 0x4e30) >> 0xc & unaff_R13D);

-        }

-        else {

-          if (uVar1 == 0x20) {

-            EnterCrit(unaff_R13D);

-            goto LAB_2;

-          }

-          if (uVar1 == 0x40) {

-            EnterCrit(unaff_R13D);

-            CheckPointerDeviceConfiguration();

-            this = InteractiveControlManager::Instance();

-            InteractiveControlManager::UpdateExternalParameters(this);

-            TraceLoggingMouseWheelRoutingValueAtStartup();

-            goto LAB_2;

-          }

-          if (uVar1 == 0x100) {

-            EnterCrit(unaff_R13D);

-            IVContainerForegroundSync::xxxIVSyncForeground();

-LAB_2:

-            UserSessionSwitchLeaveCrit();

+          uVar14 = uVar6;

+          if ((param_3 & 2) != 0) {

+            uVar14 = uVar14 | 0x400;

           }

         }

       }

     }

-LAB_1:

-    uVar3 = LegacyInputDispatcher::WaitAndDispatch(*(LegacyInputDispatcher **)(unaff_RBP + -0x61));

-    in_RAX = (char *)(ulonglong)uVar3;

-  } while( true );

+    else {

+      uVar9 = 0xffff8000;

+      if (-0x8001 < (int)param_3) {

+        uVar9 = param_3;

+      }

+      uVar15 = 0x7fff;

+      if (((int)uVar9 < 0x7fff) && (uVar15 = 0xffff8000, -0x8001 < (int)param_3)) {

+        uVar15 = param_3;

+      }

+    }

+  }

+  else {

+    uVar14 = param_4 & 0x7e;

+    uVar15 = 0;

+  }

+  local_78 = 0xfffe;

+  bVar16 = (param_4 >> 0xf & 1) != 0;

+  local_76 = (ushort)bVar16;

+  if ((param_4 >> 0xe & 1) != 0) {

+    local_76 = bVar16 | 2;

+  }

+  if ((param_4 >> 0xd & 1) != 0) {

+    local_76 = local_76 | 8;

+  }

+  if ((param_4 >> 0x11 & 1) != 0) {

+    local_76 = local_76 | 0x20;

+  }

+  if ((param_4 & 0x10000) != 0) {

+    local_76 = local_76 | 0x10;

+  }

+  if ((param_4 & 0x40000) != 0) {

+    local_76 = local_76 | 0x40;

+  }

+  uVar8 = 0;

+  if (uVar15 != 0) {

+    uVar8 = (short)uVar15;

+  }

+  _local_74 = CONCAT22(uVar8,(short)(uVar14 >> 1));

+  if ((((param_4 & 0xc001) == 0xc001) &&

+      (bVar7 = W32GetCurrentThreadDpiAwarenessContext(), (bVar7 & 0xf) != 2)) &&

+     (lVar12 = W32GetUserSessionState(), 1 < *(uint *)**(undefined8 **)(lVar12 + 0xdf10))) {

+    piVar13 = (int *)GetScreenRect(local_98);

+    iVar3 = *piVar13;

+    iVar4 = piVar13[1];

+    iVar5 = piVar13[3];

+    local_b0 = EngMulDiv(param_1,piVar13[2] - iVar3,0xffff);

+    local_b0 = local_b0 + iVar3;

+    local_ac = EngMulDiv(param_2,iVar5 - iVar4,0xffff);

+    local_b8 = 0;

+    local_ac = local_ac + iVar4;

+    uVar10 = W32GetCurrentThreadDpiAwarenessContext();

+    LogicalToPhysicalDPIPoint(&local_b8,&local_b0,uVar10,0);

+    piVar13 = (int *)GetPhysicalScreenRect(local_88);

+    iVar3 = piVar13[1];

+    iVar4 = piVar13[3];

+    param_1 = EngMulDiv((int)local_b8 - *piVar13,0xffff,piVar13[2] - *piVar13);

+    param_2 = EngMulDiv(local_b8._4_4_ - iVar3,0xffff,iVar4 - iVar3);

+  }

+  local_64 = (undefined4)param_7;

+  local_70 = 0;

+  local_6c = CONCAT44(param_2,param_1);

+  UserSessionSwitchLeaveCrit();

+  if ((param_4 & 1) == 0) {

+    local_6c = 0;

+    local_76 = local_76 & 0xfffe;

+    uVar14 = 0x18;

+  }

+  else {

+    uVar14 = 0x10;

+    if ((param_4 & 0x40000) != 0 || (param_4 & 0x10000) != 0) {

+      uVar14 = 0x12;

+    }

+  }

+  uVar6 = uVar14 | 0x40;

+  if (-1 < *(int *)(*(longlong *)(local_a0 + 0x1d0) + 0xc)) {

+    uVar6 = uVar14;

+  }

+  local_c8 = 0;

+  local_d0 = 0;

+  local_d8 = uVar6 | 0x100;

+  if (param_8 != 0) {

+    local_d8 = uVar6;

+  }

+  SynthesizeMouseInput(0,&local_78,param_5,local_a8);

+  EnterCrit(1,0);

+  if (param_8 != 0) {

+    xxxProcessMouseEvent();

+  }

+  lVar12 = W32GetUserSessionState();

+  if ((*(uint *)(lVar12 + 0x10650) & 0x100) != 0) {

+    ResetAccessibilityCountersOnMouseInput();

+  }

+  EtwTraceEndInjectMouse(param_5 & 0xffffffff,param_1,param_2);

+  return 1;

 }
```

## `NtUserGetDCEx`  (modified)

```diff
--- NtUserGetDCEx
+++ NtUserGetDCEx
@@ -1,52 +1,72 @@
 

-undefined8 NtUserGetDCEx(_tlgProvider_t *param_1,undefined8 param_2,_GUID *param_3,_GUID *param_4)

+HDC NtUserGetDCEx(longlong param_1,HRGN param_2,uint param_3)

 

 {

-  char cVar1;

-  char *in_RAX;

-  _tlgProvider_t *p_Var2;

-  undefined8 unaff_RDI;

-  undefined8 unaff_R14;

-  undefined8 in_stack_00000040;

-  undefined4 in_stack_00000090;

-  undefined8 in_stack_000000a0;

-  char *in_stack_000000a8;

+  bool bVar1;

+  int iVar2;

+  longlong lVar3;

+  longlong lVar4;

+  HWND hWnd;

+  tagTHREADINFO *ptVar5;

+  HDC pHVar6;

+  undefined4 uVar7;

+  HDC pHVar8;

   

-  cVar1 = (char)in_RAX;

-  cRam00000000fa6c645c = cRam00000000fa6c645c + cVar1;

-  *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 = 0x80070057;

-    in_stack_000000a8 = "InvalidParameter";

-    param_4 = (_GUID *)&stack0x00000040;

-    in_stack_00000040 = unaff_RDI;

-    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);

-  }

-  if (5 < DAT_1) {

-    p_Var2 = (_tlgProvider_t *)&DAT_1;

-    cVar1 = _tlgKeywordOn();

-    if (cVar1 != '\0') {

-      in_stack_00000090 = 0x80070057;

-      in_stack_000000a8 = "InvalidParameter";

-      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);

+                    /* 0x23c650  1686  NtUserGetDCEx */

+  lVar3 = EnterSharedCrit(0,1);

+  pHVar6 = (HDC)0x0;

+  if ((((param_2 == (HRGN)0x0) || (iVar2 = GreIsValidRegion(param_2), iVar2 != 0)) &&

+      (lVar4 = W32GetUserSessionState(), param_2 != *(HRGN *)(lVar4 + 0xa8c0))) &&

+     ((param_3 & 0xffdaf800) == 0)) {

+    if (param_1 == 0) {

+      ptVar5 = PtiCurrent();

+      hWnd = *(HWND *)(*(longlong *)(*(longlong *)(ptVar5 + 0x1f0) + 8) + 0x18);

+      iVar2 = Feature_LearningModeExpansion__private_IsEnabledDeviceUsageNoInline();

+      if (iVar2 == 0) {

+        bVar1 = tagPROCESSINFO::HasUILimit(*(tagPROCESSINFO **)(lVar3 + 0x1d0),1);

+        if (bVar1) {

+          pHVar8 = pHVar6;

+          if (hWnd != (HWND)0x0) {

+            pHVar8 = *(HDC *)hWnd;

+          }

+          lVar3 = ValidateHwnd(pHVar8);

+          if (lVar3 == 0) {

+            uVar7 = 5;

+            goto LAB_0;

+          }

+        }

+      }

+      else {

+        bVar1 = tagPROCESSINFO::HasUILimit(*(tagPROCESSINFO **)(lVar3 + 0x1d0),1);

+        if (bVar1) {

+          pHVar8 = pHVar6;

+          if (hWnd != (HWND)0x0) {

+            pHVar8 = *(HDC *)hWnd;

+          }

+          lVar3 = ValidateHwnd(pHVar8);

+          if (lVar3 == 0) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x1b82);

+          }

+        }

+      }

+    }

+    else {

+      hWnd = (HWND)ValidateHwnd(param_1);

+      if (hWnd == (HWND)0x0) goto LAB_1;

+    }

+    if (((param_2 == (HRGN)0x0) || (iVar2 = GreLockRegion(param_2), iVar2 != 0)) &&

+       (pHVar6 = _GetDCEx(hWnd,param_2,param_3), param_2 != (HRGN)0x0)) {

+      GreUnlockRegion(param_2);

     }

   }

-  UserSetLastError(0);

+  else {

+    uVar7 = 0x57;

+LAB_0:

+    pHVar6 = (HDC)0x0;

+    UserSetLastError(uVar7);

+  }

+LAB_1:

   UserSessionSwitchLeaveCrit();

-  return 0;

+  return pHVar6;

 }
```

## `PostPointerEventMessage`  (modified)

```diff
--- PostPointerEventMessage
+++ PostPointerEventMessage
@@ -1,133 +1,77 @@
 

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

-

-ulonglong PostPointerEventMessage(undefined8 param_1)

+void PostPointerEventMessage(longlong param_1,int param_2,longlong param_3,int param_4)

 

 {

-  uint uVar1;

-  undefined4 uVar2;

-  longlong *plVar3;

-  undefined4 uVar4;

-  undefined4 uVar5;

-  undefined4 uVar6;

-  undefined4 uVar7;

-  undefined4 uVar8;

-  char *in_RAX;

-  longlong lVar9;

-  undefined **ppuVar10;

-  ulonglong uVar11;

-  longlong lVar12;

-  undefined4 uVar13;

-  int unaff_EBX;

-  char unaff_SIL;

-  int unaff_EDI;

-  longlong unaff_R13;

-  longlong unaff_R14;

-  bool bVar14;

-  undefined1 uStack0000000000000081;

-  undefined1 in_stack_00000090;

-  undefined4 in_stack_000000a0;

-  longlong in_stack_000000d0;

+  undefined8 *puVar1;

+  undefined8 *puVar2;

+  tagTHREADINFO *ptVar3;

+  bool bVar4;

+  int iVar5;

+  longlong lVar6;

+  longlong lVar7;

+  undefined4 *puVar8;

+  undefined4 local_48;

+  undefined4 local_44;

+  longlong local_40;

+  longlong local_38;

+  undefined8 local_30;

   

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

-  if (((short)CONCAT71((int7)((ulonglong)in_RAX >> 8),(char)in_RAX + (char)((ulonglong)param_1 >> 8)

-                      ) == 0x3f7ab800) ||

-     (lVar9 = GETCLIENTWNDINFO(), *(longlong *)(lVar9 + 0x20) == 0)) {

-    unaff_SIL = '\0';

+                    /* 0x2124a0  2150  PostPointerEventMessage */

+  lVar6 = W32GetUserSessionState();

+  puVar1 = *(undefined8 **)(lVar6 + 0x4140);

+  if (param_4 == 0) {

+    iVar5 = PHIDTtoPT(param_1);

+    param_3 = (longlong)iVar5;

   }

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

-    UserSetLastError(0x5a7);

-    ppuVar10 = &WPP_GLOBAL_Control;

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) {

-      unaff_EDI = 0;

+  do {

+    if (puVar1 == (undefined8 *)(lVar6 + 0x4140)) {

+      return;

     }

-    bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if (((char)unaff_EDI != '\0') || (bVar14)) {

-      lVar9 = W32GetUserSessionState();

-      ppuVar10 = (undefined **)

-                 WPP_RECORDER_AND_TRACE_SF_q

-                           (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)unaff_EDI,bVar14,

-                            *(undefined8 *)(lVar9 + 0x10f88),2);

+    puVar2 = (undefined8 *)puVar1[-2];

+    ptVar3 = (tagTHREADINFO *)puVar2[2];

+    if (param_4 == 0) {

+      if (((*(int *)(puVar1 + -1) != 0) &&

+          (lVar7 = W32GetUserSessionState(),

+          *(longlong *)(ptVar3 + 0x1f0) == *(longlong *)(lVar7 + 0x4b58))) &&

+         ((*(int *)(param_1 + 0x18) != 7 ||

+          (bVar4 = ShouldReceiveTouchpadMessages(ptVar3,(HWND__ *)*puVar2), bVar4)))) {

+        _PostMessage(puVar2,param_2,param_3,*(undefined8 *)(param_1 + 800));

+      }

     }

-    uVar11 = (ulonglong)ppuVar10 & 0xffffffffffffff00;

-  }

-  else {

-    lVar9 = GETCLIENTWNDINFO();

-    lVar9 = *(longlong *)(lVar9 + 0x20);

-    lVar12 = PsGetCurrentProcessWow64Process();

-    ProbeForRead(lVar9,0x24,(-(uint)(lVar12 != 0) & 0xfffffffd) + 4);

-    uVar4 = *(undefined4 *)(lVar9 + 8);

-    uVar5 = *(undefined4 *)(lVar9 + 0xc);

-    uVar6 = *(undefined4 *)(lVar9 + 0x10);

-    uVar7 = *(undefined4 *)(lVar9 + 0x18);

-    uVar2 = *(undefined4 *)(lVar9 + 0x1c);

-    uVar8 = *(undefined4 *)(lVar9 + 0x20);

-    uVar13 = *(undefined4 *)(lVar9 + 0x14);

-    if (unaff_EBX != unaff_EDI) {

-      uVar13 = *(undefined4 *)(lVar9 + 4);

-    }

-    uVar1 = *(uint *)(unaff_R13 + 4);

-    if ((byte)((byte)unaff_EDI & (byte)uVar1) != 0) {

-      *(undefined4 *)(unaff_R13 + 8) = uVar13;

-      if (unaff_EBX != unaff_EDI) {

-        uVar7 = uVar4;

-      }

-      *(undefined4 *)(unaff_R13 + 0xc) = uVar7;

-    }

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

-      if (unaff_EBX != unaff_EDI) {

-        uVar2 = uVar5;

-      }

-      *(undefined4 *)(unaff_R13 + 0x10) = uVar2;

-    }

-    if ((uVar1 & 4) != 0) {

-      uVar2 = uVar8;

-      if (unaff_EBX != unaff_EDI) {

-        uVar2 = uVar6;

-      }

-      *(undefined4 *)(unaff_R13 + 0x14) = uVar2;

-    }

-    if ((uVar1 & 0x10) != 0) {

-      lVar9 = *(longlong *)(*(longlong *)(unaff_R14 + 0x10) + 0x208);

-      lVar12 = PsGetCurrentProcessWow64Process();

-      ProbeForRead(lVar9,0x130,(-(uint)(lVar12 != 0) & 0xfffffffd) + 4);

-      plVar3 = *(longlong **)(lVar9 + 0x118);

-      lVar9 = PsGetCurrentProcessWow64Process();

-      ProbeForRead(plVar3,0x10,(-(uint)(lVar9 != 0) & 0xfffffffd) + 4);

-      lVar9 = *plVar3;

-      lVar12 = PsGetCurrentProcessWow64Process();

-      ProbeForRead(lVar9,0x68,(-(uint)(lVar12 != 0) & 0xfffffffd) + 4);

-      if (((lVar9 == 0) || (*(int *)(lVar9 + 0x58) != unaff_EBX)) ||

-         (*(longlong *)(lVar9 + 8) != unaff_R14)) {

-        if (unaff_EBX != unaff_EDI) {

-          uVar8 = uVar6;

+    else if ((param_2 == 0x238) && (param_3 - 1U < 2)) {

+      iVar5 = W32GetCurrentWin32kSessionId();

+      bVar4 = false;

+      if (**(int **)(*(longlong *)(ptVar3 + 0x1f0) + 0x28) == iVar5) {

+LAB_0:

+        if (*(int *)(param_1 + 0x18) == 7) {

+          bVar4 = ShouldReceiveTouchpadMessages(ptVar3,*(HWND__ **)puVar1[-2]);

+          goto LAB_1;

         }

-        *(undefined4 *)(unaff_R13 + 0x18) = uVar8;

       }

       else {

-        *(undefined4 *)(unaff_R13 + 0x18) = *(undefined4 *)(lVar9 + 0x54);

+LAB_1:

+        if (bVar4 == false) goto LAB_2;

+      }

+      local_38 = puVar1[-2];

+      local_44 = 0;

+      local_48 = 0;

+      local_40 = *(longlong *)(local_38 + 0x10);

+      local_30 = *(undefined8 *)(local_40 + 0x1d8);

+      puVar8 = &local_44;

+      iVar5 = AdjustPwndPtiPqForDelegation(&local_30,&local_38,&local_40,param_2,0,puVar8,&local_48)

+      ;

+      if (iVar5 != 0) {

+        PostInputMessage(local_30,local_38,param_2,param_3,*(undefined8 *)(param_1 + 800),

+                         (ulonglong)puVar8 & 0xffffffff00000000,0,0,0,0,0,0,local_44,local_48,

+                         local_40);

       }

     }

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

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

-      unaff_EDI = 0;

-      in_stack_00000090 = 0;

+    else {

+      lVar7 = W32GetUserSessionState();

+      if (*(longlong *)(ptVar3 + 0x1f0) == *(longlong *)(lVar7 + 0x4b58)) goto LAB_0;

     }

-    uStack0000000000000081 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if (((char)unaff_EDI != '\0') || ((bool)uStack0000000000000081)) {

-      W32GetUserSessionState();

-      GetScrollbarTypeString(in_stack_000000a0);

-      WPP_RECORDER_AND_TRACE_SF_qsDddddd

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),in_stack_00000090,uStack0000000000000081

-                );

-      unaff_R13 = in_stack_000000d0;

-    }

-    uVar11 = (ulonglong)

-             CONCAT31((int3)(*(uint *)(unaff_R13 + 4) >> 8),(*(uint *)(unaff_R13 + 4) & 0x17) != 0);

-  }

-  return uVar11;

+LAB_2:

+    puVar1 = (undefined8 *)*puVar1;

+  } while( true );

 }
```

## `MagContextThreadCallout`  (modified)

```diff
--- MagContextThreadCallout
+++ MagContextThreadCallout
@@ -1,22 +1,101 @@
 

-void MagContextThreadCallout(CRotationMgr *param_1,undefined8 param_2)

+void MagContextThreadCallout(undefined8 param_1,longlong param_2,longlong *param_3,int param_4)

 

 {

-  undefined4 in_EAX;

-  ORIENTATION_PREFERENCE OVar1;

-  tagAR_STATE tVar2;

-  undefined4 in_register_00000004;

-  undefined4 unaff_EBX;

-  undefined8 unaff_RSI;

-  undefined4 local_res18;

+  longlong *plVar1;

+  longlong *plVar2;

+  undefined8 uVar3;

+  longlong lVar4;

+  code *pcVar5;

+  int iVar6;

+  uint uVar7;

+  undefined8 uVar8;

+  undefined8 uVar9;

+  undefined8 *puVar10;

+  longlong *plVar11;

   

-  *(undefined4 *)(CONCAT44(in_register_00000004,in_EAX) + 8) = unaff_EBX;

-  *(undefined8 *)(CONCAT44(in_register_00000004,in_EAX) + 0x10) = unaff_RSI;

-  *(undefined4 *)(CONCAT44(in_register_00000004,in_EAX) + 0x18) = 0;

-  OVar1 = CRotationMgr::GetActivePpiPreference

-                    ((ulong *)(CONCAT44(in_register_00000004,in_EAX) + 0x18));

-  tVar2 = CRotationMgr::QueryAutoRotationState(param_1);

-  DispBrokerAsyncRefreshOrientation(tVar2,local_res18,OVar1,param_2);

+                    /* 0x26a240  1180  MagContextThreadCallout */

+  if ((param_3 == (longlong *)0x0) &&

+     (param_3 = (longlong *)MagpFindThreadContext(), param_3 == (longlong *)0x0)) {

+    return;

+  }

+  if (param_4 == 1) {

+    plVar11 = (longlong *)param_3[5];

+    while (plVar11 != param_3 + 5) {

+      plVar2 = (longlong *)*plVar11;

+      if (((longlong *)plVar2[1] != plVar11) ||

+         (puVar10 = (undefined8 *)plVar11[1], (longlong *)*puVar10 != plVar11)) goto LAB_0;

+      *puVar10 = plVar2;

+      plVar1 = plVar11 + 3;

+      plVar2[1] = (longlong)puVar10;

+      puVar10 = (undefined8 *)*plVar1;

+      if (puVar10 == (undefined8 *)0xffffffffffffffff) {

+        if (*(longlong **)(*(longlong *)(param_3[2] + 0x1f0) + 0xf0) == plVar11) {

+          uVar3 = *(undefined8 *)**(undefined8 **)(*(longlong *)(param_3[2] + 0x1f0) + 8);

+          uVar9 = ReferenceDwmApiPort();

+          DwmAsyncMagnSetDesktopColorTransform(uVar9,uVar3,&DAT_1);

+          *(undefined8 *)(*(longlong *)(param_3[2] + 0x1f0) + 0xf0) = 0;

+        }

+        if (*(longlong **)(*(longlong *)(param_3[2] + 0x1f0) + 0xe8) == plVar11) {

+          uVar3 = *(undefined8 *)**(undefined8 **)(*(longlong *)(param_3[2] + 0x1f0) + 8);

+          uVar9 = ReferenceDwmApiPort();

+          DwmAsyncMagnSetDesktopTransform(uVar9,uVar3,&DAT_2,0,0);

+          *(undefined8 *)(*(longlong *)(param_3[2] + 0x1f0) + 0xe8) = 0;

+        }

+      }

+      else {

+        uVar7 = *(uint *)(plVar11 + 2);

+        if ((uVar7 & 0x40) != 0) {

+          iVar6 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+          if (iVar6 == 0) {

+            ChangeComposableCursor();

+          }

+          else {

+            ChangeCursorSynchronization(0);

+          }

+          *(uint *)(plVar11 + 2) = *(uint *)(plVar11 + 2) & 0xffffffbf;

+          uVar7 = *(uint *)(plVar11 + 2);

+          puVar10 = (undefined8 *)*plVar1;

+        }

+        if ((uVar7 & 0x20) == 0) {

+          uVar3 = *(undefined8 *)**(undefined8 **)(*(longlong *)(param_3[2] + 0x1f0) + 8);

+          if (puVar10 == (undefined8 *)0x0) {

+            uVar9 = 0;

+          }

+          else {

+            uVar9 = *puVar10;

+          }

+          uVar8 = ReferenceDwmApiPort();

+          DwmAsyncMagnDestroy(uVar8,uVar9,uVar3);

+        }

+        if (*plVar1 != 0) {

+          HMAssignmentUnlock(plVar1);

+        }

+      }

+      if (plVar11[0x1d] != 0) {

+        Win32FreePool();

+      }

+      if (plVar11[0x20] != 0) {

+        Win32FreePool();

+      }

+      Win32FreePool(plVar11);

+      plVar11 = plVar2;

+    }

+    lVar4 = *param_3;

+    if ((*(longlong **)(lVar4 + 8) != param_3) ||

+       (plVar11 = (longlong *)param_3[1], (longlong *)*plVar11 != param_3)) {

+LAB_0:

+      pcVar5 = (code *)swi(0x29);

+      (*pcVar5)(3);

+      pcVar5 = (code *)swi(3);

+      (*pcVar5)();

+      return;

+    }

+    *plVar11 = lVar4;

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

+    Win32FreePool(param_3);

+    *(ulonglong *)(param_2 + 0x550) = *(ulonglong *)(param_2 + 0x550) & 0xfffffffffffffff7;

+  }

   return;

 }
```

## `MapDesktop`  (modified)

```diff
--- MapDesktop
+++ MapDesktop
@@ -1,89 +1,133 @@
 

-void MapDesktop(longlong param_1,int param_2,int param_3,ulonglong param_4)

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

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

+

+int MapDesktop(longlong param_1)

 

 {

-  undefined4 uVar1;

-  undefined4 uVar2;

-  undefined4 uVar3;

-  undefined1 uVar4;

-  SHORT SVar5;

-  uint uVar6;

-  undefined8 in_RAX;

-  int *piVar7;

-  longlong unaff_RBX;

-  ulonglong unaff_RDI;

-  ulonglong uVar8;

-  int iVar9;

-  undefined4 *in_stack_00000050;

+  int *piVar1;

+  undefined8 uVar2;

+  char cVar3;

+  bool bVar4;

+  int iVar5;

+  DomainLockType DVar6;

+  int iVar7;

+  longlong *plVar8;

+  longlong lVar9;

+  longlong *plVar10;

+  undefined1 auStack_e8 [32];

+  longlong *local_c8;

+  undefined8 *local_c0;

+  undefined8 *local_b8;

+  undefined4 local_b0;

+  undefined4 local_a8;

+  undefined4 local_a0;

+  ReEnterLeaveCritIfNotOwnedAtAll local_98 [8];

+  undefined8 local_90;

+  longlong local_88 [2];

+  undefined8 local_78;

+  undefined8 local_70;

+  tagDomLock *local_68;

+  undefined1 local_60;

+  longlong local_58;

+  undefined1 local_50;

+  undefined8 local_48;

+  undefined1 local_40;

+  undefined1 local_38;

+  ulonglong local_30;

   

-  uVar4 = in((short)param_2);

-  *(byte *)(unaff_RBX + -0xccf3bf) = *(byte *)(unaff_RBX + -0xccf3bf) & (byte)param_1;

-  uVar8 = unaff_RDI & 0xffffffff;

-  *in_stack_00000050 = (int)CONCAT71((int7)((ulonglong)in_RAX >> 8),uVar4);

-  *(undefined8 *)(in_stack_00000050 + 1) = *(undefined8 *)(param_1 + 0x28);

-  *(ulonglong *)(in_stack_00000050 + 3) = unaff_RDI;

-  *(ulonglong *)(in_stack_00000050 + 5) = unaff_RDI;

-  in_stack_00000050[9] = (int)unaff_RDI;

-  if (param_2 != 0) {

-    uVar8 = 0x80;

-    in_stack_00000050[9] = 0x80;

-  }

-  if (*(int *)(param_1 + 8) == 2) {

-    in_stack_00000050[7] = 1;

-    if ((*(uint *)(param_1 + 0x68) & 1) != 0) {

-      uVar1 = *(undefined4 *)(param_1 + 0x74);

-      uVar2 = *(undefined4 *)(param_1 + 0x78);

-      uVar3 = *(undefined4 *)(param_1 + 0x7c);

-      in_stack_00000050[3] = *(undefined4 *)(param_1 + 0x70);

-      in_stack_00000050[4] = uVar1;

-      in_stack_00000050[5] = uVar2;

-      in_stack_00000050[6] = uVar3;

-    }

-  }

-  else if (*(int *)(param_1 + 8) == 3) {

-    in_stack_00000050[7] = 2;

-    uVar6 = (uint)uVar8;

-    if ((param_3 != 0) && ((*(uint *)(param_1 + 0x68) & 1) != 0)) {

-      uVar6 = uVar6 | 0x20;

-      in_stack_00000050[9] = uVar6;

-    }

-    if ((*(uint *)(param_1 + 0x68) & 4) != 0) {

-      in_stack_00000050[9] = uVar6 | 0x40;

-    }

-  }

-  if ((*(uint *)(param_1 + 0x14) & 4) == 0) {

-    uVar6 = (byte)~(byte)*(uint *)(param_1 + 0x14) & 2 | 1;

+                    /* 0x16d040  1182  MapDesktop */

+  local_30 = __security_cookie ^ (ulonglong)auStack_e8;

+  piVar1 = *(int **)(param_1 + 0x20);

+  local_70 = 0;

+  local_90 = 0;

+  iVar7 = 0;

+  local_88[1] = 0;

+  local_88[0] = 0;

+  ReEnterLeaveCritIfNotOwnedAtAll::ReEnterLeaveCritIfNotOwnedAtAll(local_98);

+  if (*(int *)(param_1 + 0x10) == 3) goto LAB_0;

+  plVar8 = (longlong *)PsGetProcessWin32Process(*(undefined8 *)(param_1 + 0x18));

+  if ((plVar8 == (longlong *)0x0) || (*plVar8 == 0)) {

+    iVar7 = -0x3ffffff3;

   }

   else {

-    iVar9 = (int)param_4;

-    param_4 = (ulonglong)(uint)-iVar9;

-    uVar6 = (iVar9 != 0) + 2;

+    lVar9 = W32GetUserGdiSessionState();

+    if ((*(longlong *)(param_1 + 0x18) == *(longlong *)(lVar9 + 0x28)) ||

+       (iVar5 = IsProcessDwm(), iVar5 != 0)) {

+LAB_1:

+      uVar2 = *(undefined8 *)(piVar1 + 0x20);

+      iVar5 = PsGetProcessSessionIdEx(*(undefined8 *)(param_1 + 0x18));

+      if (iVar5 == *piVar1) {

+        DVar6 = DLT_DESKTOP::getDLT();

+        local_68 = GetDomainLockRef(DVar6);

+        local_60 = 1;

+        local_58 = W32GetUserSessionState();

+        local_58 = local_58 + 0xa618;

+        local_50 = 0;

+        local_48 = 0;

+        local_40 = 0;

+        local_38 = 0;

+        bVar4 = IS_USERCRIT_OWNED_SHAREDONLY();

+        if (bVar4) {

+          local_38 = 1;

+          DomainSharedBase<>::DomainExclusiveBase<DLT_HANDLEMANAGER>::ObjectLockBase<>::

+          vInitAndLock<>((ObjectLockBase<> *)&local_68);

+        }

+        lVar9 = W32GetUserSessionState();

+        local_78 = *(undefined8 *)(lVar9 + 0xa640);

+        LockRefactorStagingAssertOwned((tagDomLock *)&local_78);

+        lVar9 = GetDesktopView(plVar8,piVar1);

+        if (lVar9 != 0) {

+          SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::ObjectLock<>::

+          ~ObjectLock<>((ObjectLock<> *)&local_68);

+          goto LAB_0;

+        }

+        plVar10 = (longlong *)Win32AllocPoolWithQuotaZInit(0x18,0x69707355);

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

+          iVar7 = -0x3fffffe9;

+          SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::ObjectLock<>::

+          ~ObjectLock<>((ObjectLock<> *)&local_68);

+        }

+        else {

+          local_90 = 0x1000;

+          local_a0 = 2;

+          local_a8 = 0x400000;

+          local_b0 = 2;

+          local_b8 = &local_70;

+          local_c0 = &local_90;

+          local_c8 = (longlong *)0x0;

+          iVar7 = MmMapViewOfSection(uVar2,*(undefined8 *)(param_1 + 0x18),local_88,0);

+          if (iVar7 < 0) {

+            Win32FreePool(plVar10);

+          }

+          else {

+            plVar10[1] = (longlong)piVar1;

+            plVar10[2] = local_88[0];

+            *plVar10 = plVar8[0x57];

+            plVar8[0x57] = (longlong)plVar10;

+          }

+          SharedUserCritOnly::DomainShared<DLT_HANDLEMANAGER>::DomainExclusive<>::ObjectLock<>::

+          ~ObjectLock<>((ObjectLock<> *)&local_68);

+          if (-1 < iVar7) goto LAB_0;

+        }

+        goto LAB_2;

+      }

+    }

+    else {

+      local_c8 = local_88 + 1;

+      cVar3 = ObFindHandleForObject

+                        (*(undefined8 *)(param_1 + 0x18),piVar1,

+                         *(undefined8 *)ExDesktopObjectType_exref,0);

+      if (cVar3 != '\0') goto LAB_1;

+    }

+    iVar7 = -0x3fffffde;

   }

-  in_stack_00000050[8] = uVar6;

-  piVar7 = (int *)UPDWORDPointer(0x202c,param_2,uVar8,param_4);

-  if (*piVar7 != (int)unaff_RDI) {

-    SVar5 = _GetAsyncKeyState(0x10);

-    if (SVar5 < 0) {

-      in_stack_00000050[9] = in_stack_00000050[9] | 1;

-    }

-    SVar5 = _GetAsyncKeyState(0x11);

-    if (SVar5 < 0) {

-      in_stack_00000050[9] = in_stack_00000050[9] | 2;

-    }

-    SVar5 = _GetAsyncKeyState(0xa4);

-    if (SVar5 < 0) {

-      in_stack_00000050[9] = in_stack_00000050[9] | 4;

-    }

-    SVar5 = _GetAsyncKeyState(0xa5);

-    if (SVar5 < 0) {

-      in_stack_00000050[9] = in_stack_00000050[9] | 0x10;

-    }

-    SVar5 = _GetAsyncKeyState(0x5b);

-    if ((-1 < SVar5) && (SVar5 = _GetAsyncKeyState(0x5c), -1 < SVar5)) {

-      return;

-    }

-    in_stack_00000050[9] = in_stack_00000050[9] | 8;

+LAB_2:

+  SetLastNtError(iVar7);

+LAB_0:

+  if (local_98[0] != (ReEnterLeaveCritIfNotOwnedAtAll)0x0) {

+    UserSessionSwitchLeaveCrit();

   }

-  return;

+  return iVar7;

 }
```

## `PrepareForLogoff`  (modified)

```diff
--- PrepareForLogoff
+++ PrepareForLogoff
@@ -1,11 +1,47 @@
 

-void PrepareForLogoff(void)

+undefined8 PrepareForLogoff(void)

 

 {

-  code *pcVar1;

+  bool bVar1;

+  tagTHREADINFO *ptVar2;

+  longlong lVar3;

+  longlong lVar4;

+  _UNICODE_STRING *p_Var5;

+  undefined8 uVar6;

+  undefined8 local_38;

+  undefined8 uStack_30;

+  longlong local_28;

+  undefined8 local_10;

   

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

-  (*pcVar1)();

-  return;

+  ptVar2 = PtiCurrent();

+  bVar1 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(ptVar2 + 0x1d0),0x80);

+  if (bVar1) {

+    lVar3 = W32GetUserSessionState();

+    lVar3 = *(longlong *)(lVar3 + 0xf8c0);

+    lVar4 = PsGetThreadProcessId(*(undefined8 *)ptVar2);

+    if (lVar4 == lVar3) {

+      lVar3 = W32GetUserSessionState();

+      if (((*(short *)(lVar3 + 0x10df0) == 0) &&

+          (lVar3 = *(longlong *)(*(longlong *)(ptVar2 + 0x1d0) + 0x290), lVar3 != 0)) &&

+         ((*(int *)(lVar3 + 0xb8) != 0 || (*(int *)(lVar3 + 0xbc) != 0)))) {

+        local_10 = 0;

+        local_38 = 0;

+        uStack_30 = 0;

+        local_28 = -1;

+        p_Var5 = CreateProfileUserName

+                           ((Win32RawOptionalLockedItemAlways<tagPROFILEUSERNAME,&void___cdecl_Win32FreePool(void*___ptr64)>

+                             *)&local_38);

+        RegisterPerUserKeyboardIndicators(p_Var5);

+        if (local_28 != -1) {

+          PopAndFreeAlwaysW32ThreadLock(&local_38);

+        }

+      }

+    }

+    uVar6 = 1;

+  }

+  else {

+    uVar6 = 0;

+  }

+  return uVar6;

 }
```

## `NtUserAutoRotateScreen`  (modified)

```diff
--- NtUserAutoRotateScreen
+++ xxxInitTerminal
@@ -1,20 +1,37 @@
 

-longlong NtUserAutoRotateScreen(undefined8 param_1,void *param_2)

+long __cdecl xxxInitTerminal(tagTERMINAL *param_1)

 

 {

-  longlong unaff_RSI;

-  int unaff_EDI;

-  void *unaff_R14;

-  bool in_CF;

+  char cVar1;

+  ulonglong in_RAX;

+  int *piVar2;

+  _tlgProvider_t *p_Var3;

+  _GUID *in_R8;

+  _GUID *p_Var4;

+  undefined4 in_stack_000000f0;

   

-  if (!in_CF) {

-    unaff_R14 = param_2;

-  }

-  RtlCopyVolatileMemory(unaff_R14,&stack0x00000070,8);

-  if (unaff_RSI != 0) {

-    ObfDereferenceObject();

+  piVar2 = (int *)(in_RAX & 0xffffffffffffff40);

+  *piVar2 = *piVar2 + (int)piVar2;

+  *(char *)piVar2 = (char)*piVar2 + (char)piVar2;

+  p_Var4 = (_GUID *)&stack0x00000040;

+  _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 *)param_1,&DAT_0,in_R8,(_tlgWrapperByVal<8> *)p_Var4,

+             (_tlgWrapSz<char> *)&stack0x00000048,(_tlgWrapperByVal<4> *)&stack0x000000f0,

+             (_tlgWrapSz<unsigned_short> *)&stack0x000000f8);

+  if (5 < DAT_1) {

+    p_Var3 = (_tlgProvider_t *)&DAT_1;

+    cVar1 = _tlgKeywordOn(&DAT_1,1);

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

+      in_stack_000000f0 = 0x80070005;

+      _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_Var3,&DAT_2,in_R8,p_Var4,(_tlgWrapSz<char> *)&stack0x00000040,

+                 (_tlgWrapperByVal<4> *)&stack0x000000f0,

+                 (_tlgWrapSz<unsigned_short> *)&stack0x000000f8);

+    }

   }

   UserSessionSwitchLeaveCrit();

-  return (longlong)unaff_EDI;

+  return 0;

 }
```

## `NtUserApplyWindowAction`  (modified)

```diff
--- NtUserApplyWindowAction
+++ NtUserApplyWindowAction
@@ -1,12 +1,219 @@
 

-longlong NtUserApplyWindowAction(void)

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

+

+undefined4 NtUserApplyWindowAction(HWND__ *param_1,undefined8 param_2)

 

 {

-  int unaff_EDI;

-  Win32HMThreadLockBase<tagWND,0,0> local_res20 [8];

+  HWND__ *pHVar1;

+  tagTHREADINFO *ptVar2;

+  ulonglong uVar3;

+  byte bVar4;

+  int iVar5;

+  ulong uVar6;

+  tagTHREADINFO *ptVar7;

+  longlong lVar8;

+  tagWND *ptVar9;

+  char cVar10;

+  char cVar11;

+  undefined4 uVar12;

+  undefined8 uVar13;

+  bool bVar14;

+  undefined1 auStack_188 [32];

+  undefined1 local_168;

+  undefined4 local_160;

+  undefined2 local_158;

+  undefined *local_150;

+  HWND__ *local_148;

+  longlong local_128;

+  char local_120;

+  Win32HMThreadLockAlways<tagHOOK> local_118 [24];

+  ulonglong local_100;

+  undefined8 uStack_f8;

+  undefined8 local_f0;

+  undefined8 uStack_e8;

+  undefined8 local_e0;

+  undefined8 uStack_d8;

+  undefined8 local_d0;

+  undefined8 uStack_c8;

+  undefined4 local_c0;

+  undefined4 uStack_bc;

+  undefined4 uStack_b8;

+  undefined4 uStack_b4;

+  undefined4 local_b0;

+  undefined4 uStack_ac;

+  undefined4 uStack_a8;

+  undefined4 uStack_a4;

+  ulonglong local_98;

+  undefined8 uStack_90;

+  undefined8 local_88;

+  undefined8 uStack_80;

+  undefined8 local_78;

+  undefined8 uStack_70;

+  undefined8 local_68;

+  undefined8 uStack_60;

+  undefined4 local_58;

+  undefined4 uStack_54;

+  undefined4 uStack_50;

+  undefined4 uStack_4c;

+  undefined4 local_48;

+  undefined4 uStack_44;

+  undefined4 uStack_40;

+  undefined4 uStack_3c;

+  ulonglong local_38;

   

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

+                    /* 0x28d590  1521  NtUserApplyWindowAction */

+  local_38 = __security_cookie ^ (ulonglong)auStack_188;

+  ptVar7 = (tagTHREADINFO *)EnterCrit(0);

+  memset(&local_98,0,0x60);

+  memset(&local_100,0,0x60);

+  RtlCopyFromUser(&local_100,param_2,0x60);

+  local_98 = local_100;

+  uStack_90 = uStack_f8;

+  local_88 = local_f0;

+  uStack_80 = uStack_e8;

+  local_78 = local_e0;

+  uStack_70 = uStack_d8;

+  local_68 = local_d0;

+  uStack_60 = uStack_c8;

+  local_58 = local_c0;

+  uStack_54 = uStack_bc;

+  uStack_50 = uStack_b8;

+  uStack_4c = uStack_b4;

+  local_48 = local_b0;

+  uStack_44 = uStack_ac;

+  uStack_40 = uStack_a8;

+  uStack_3c = uStack_a4;

+  iVar5 = Feature_ApplyWindowActionConvergence__private_IsEnabledDeviceUsageNoInline();

+  uVar12 = 0;

+  if (iVar5 == 0) {

+    bVar4 = W32GetCurrentThreadDpiAwarenessContext();

+    cVar11 = '\0';

+    if ((bVar4 & 0xf) == 2) {

+      iVar5 = IAMThreadAccessGranted(ptVar7);

+      if (iVar5 == 0) {

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

+      }

+      else {

+        CDisableILCheckAuto::CDisableILCheckAuto((CDisableILCheckAuto *)&local_128);

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

+        cVar11 = '\x01';

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

+          *(undefined1 *)(local_128 + 0x6ac) = 1;

+          cVar11 = '\x01';

+        }

+      }

+      cVar10 = '\x01';

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

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

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

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

+          cVar10 = '\0';

+        }

+        bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar10 != '\0') || (bVar14)) {

+          lVar8 = W32GetUserSessionState();

+          uVar13 = *(undefined8 *)(lVar8 + 0x10f88);

+          local_158 = 0x60;

+          local_148 = param_1;

+LAB_0:

+          local_150 = &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids;

+          local_160 = 4;

+          local_168 = 3;

+          WPP_RECORDER_AND_TRACE_SF_q

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar14,uVar13);

+        }

+      }

+      else {

+        iVar5 = _IsTopLevelWindow(ptVar9);

+        if (iVar5 != 0) {

+          ptVar2 = *(tagTHREADINFO **)(ptVar9 + 0x10);

+          if ((ptVar2 == ptVar7) || (cVar11 != '\0')) {

+            uVar3 = local_98 & 0x400;

+            Win32HMThreadLockAlways<tagHOOK>::Win32HMThreadLockAlways<tagHOOK>

+                      (local_118,ptVar7,(tagHOOK *)ptVar9);

+            uVar6 = WindowActions::xxxApplyActionOld

+                              (ptVar9,ptVar2 == ptVar7,(_WINDOW_ACTION *)&local_98);

+            if (uVar6 != 0) {

+              if ((uVar3 == 0) && ((local_98 & 0x400) != 0)) {

+                WindowActions::RemoveLastSystemOperationData(ptVar9);

+              }

+              UserSetLastError(uVar6);

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

+                        ((Win32HMThreadLockBase<tagWND,0,0> *)local_118);

+              goto LAB_1;

+            }

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

+                      ((Win32HMThreadLockBase<tagWND,0,0> *)local_118);

+            goto LAB_2;

+          }

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

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

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

+            cVar10 = '\0';

+          }

+          bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar10 != '\0') || (bVar14)) {

+            lVar8 = W32GetUserSessionState();

+            local_150 = &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids;

+            local_158 = 0x62;

+            local_160 = 4;

+            local_168 = 3;

+            WPP_RECORDER_AND_TRACE_SF_

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar14,

+                       *(undefined8 *)(lVar8 + 0x10f88));

+          }

+          uVar6 = 5;

+          goto LAB_3;

+        }

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

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

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

+          cVar10 = '\0';

+        }

+        bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar10 != '\0') || (bVar14)) {

+          pHVar1 = *(HWND__ **)ptVar9;

+          lVar8 = W32GetUserSessionState();

+          uVar13 = *(undefined8 *)(lVar8 + 0x10f88);

+          local_158 = 0x61;

+          local_148 = pHVar1;

+          goto LAB_0;

+        }

+      }

+      uVar6 = 0x57;

+    }

+    else {

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

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) && (2 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        cVar11 = '\x01';

+      }

+      bVar14 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar11 != '\0') || (bVar14)) {

+        lVar8 = W32GetUserSessionState();

+        local_150 = &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids;

+        local_158 = 0x5f;

+        local_160 = 4;

+        local_168 = 3;

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar14,

+                   *(undefined8 *)(lVar8 + 0x10f88));

+      }

+      uVar6 = 0x139f;

+    }

+  }

+  else {

+    uVar6 = WindowActions::xxxApplyAction(param_1,(_WINDOW_ACTION *)&local_98);

+    if (uVar6 == 0) {

+LAB_2:

+      uVar12 = 1;

+      goto LAB_1;

+    }

+  }

+LAB_3:

+  UserSetLastError(uVar6);

+LAB_1:

   UserSessionSwitchLeaveCrit();

-  return (longlong)unaff_EDI;

+  return uVar12;

 }
```

## `EditionCreateDesktopEntryPoint`  (modified)

```diff
--- EditionCreateDesktopEntryPoint
+++ EditionCreateDesktopEntryPoint
@@ -1,18 +1,43 @@
 

-longlong EditionCreateDesktopEntryPoint(void)

+undefined8

+EditionCreateDesktopEntryPoint

+          (ulonglong param_1,longlong param_2,longlong param_3,uint param_4,undefined4 param_5,

+          undefined4 param_6)

 

 {

-  int unaff_EBX;

-  undefined4 *unaff_RDI;

-  undefined4 unaff_R14D;

-  longlong in_stack_00000040;

+  undefined8 uVar1;

+  bool bVar2;

+  int iVar3;

+  undefined4 uVar4;

+  longlong lVar5;

+  undefined8 local_18 [2];

   

-  *unaff_RDI = unaff_R14D;

-  if (in_stack_00000040 != 0) {

-    Win32FreePool(in_stack_00000040);

+                    /* 0x23ab00  124  EditionCreateDesktopEntryPoint */

+  local_18[0] = 0;

+  lVar5 = EnterCrit(0,0);

+  bVar2 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(lVar5 + 0x1d0),0x40);

+  if (bVar2) {

+    if (((param_4 < 2) && (param_2 == 0)) && (param_3 == 0)) {

+      if ((param_1 & 3) != 0) {

+                    /* WARNING: Subroutine does not return */

+        ExRaiseDatatypeMisalignment();

+      }

+      iVar3 = xxxCreateDesktopEx(param_1,param_4,param_5,param_6,local_18,0);

+      if (-1 < iVar3) goto LAB_0;

+      local_18[0] = 0;

+      uVar4 = RtlNtStatusToDosError(iVar3);

+    }

+    else {

+      uVar4 = 0x57;

+    }

   }

-  AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)&stack0x00000078);

+  else {

+    uVar4 = 5;

+  }

+  UserSetLastError(uVar4);

+LAB_0:

+  uVar1 = local_18[0];

   UserSessionSwitchLeaveCrit();

-  return (longlong)unaff_EBX;

+  return uVar1;

 }
```

## `CheckAndProcessWindowResizeComplete`  (modified)

```diff
--- CheckAndProcessWindowResizeComplete
+++ CheckAndProcessWindowResizeComplete
@@ -1,10 +1,73 @@
 

-/* WARNING: Control flow encountered bad instruction data */

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

+/* void __cdecl CheckAndProcessWindowResizeComplete(class DWMSPRITE * __ptr64,int,int * __ptr64) */

 

 void __cdecl CheckAndProcessWindowResizeComplete(DWMSPRITE *param_1,int param_2,int *param_3)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  uint uVar1;

+  uint uVar2;

+  undefined8 *puVar3;

+  SFMLOGICALSURFACE *this;

+  undefined8 uVar4;

+  undefined8 uVar5;

+  int iVar6;

+  undefined8 uVar7;

+  undefined8 uVar8;

+  ulong local_res10 [2];

+  ulong local_res18 [2];

+  _HLSURF_REDIRECTIONSTYLE local_res20 [2];

+  

+  if ((param_2 == 0) &&

+     ((iVar6 = 0, *(int *)(param_1 + 0x80) != 0 || (iVar6 = 0, *(int *)(param_1 + 0x7c) != 1))))

+  goto LAB_0;

+  puVar3 = *(undefined8 **)(param_1 + 0x98);

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

+    if (param_2 == 0) {

+      iVar6 = DwmCheckForDeferredUpdateSpriteCommands(*puVar3);

+      if (iVar6 == 0) goto LAB_1;

+    }

+    else {

+LAB_1:

+      this = *(SFMLOGICALSURFACE **)(param_1 + 0x98);

+      local_res20[0] = 0;

+      local_res18[0] = 0;

+      local_res10[0] = 0;

+      SFMLOGICALSURFACE::GetRedirectionInfo

+                (this,local_res20,local_res18,local_res10,(void **)0x0,(_LUID *)0x0);

+      uVar1 = *(uint *)(this + 0xfc);

+      uVar2 = *(uint *)(param_1 + 0x94);

+      uVar4 = *(undefined8 *)(param_1 + 0x68);

+      iVar6 = *(int *)(param_1 + 0x7c);

+      *(undefined8 *)(param_1 + 0x68) = 0;

+      uVar8 = *(undefined8 *)this;

+      uVar5 = *(undefined8 *)param_1;

+      uVar7 = UserReferenceDwmApiPort();

+      DwmAsyncUpdateSprite

+                (uVar7,uVar5,uVar8,

+                 ((uVar2 & 0xe | 0x20) << 2 | uVar2 & 0x40 | uVar1 & 1) * 2 | uVar1 & 0xc |

+                 uVar2 & 1,param_1 + 0x48,0,local_res20[0],local_res18[0],local_res10[0],0 < iVar6,

+                 uVar4);

+    }

+    uVar4 = *puVar3;

+    uVar8 = UserReferenceDwmApiPort();

+    DwmAsyncProcessSurfaceComplete(uVar8,uVar4);

+  }

+  *(undefined4 *)(param_1 + 0x7c) = 0;

+  if (*(longlong *)(param_1 + 0x60) != 0) {

+    ObfDereferenceObject();

+    *(undefined8 *)(param_1 + 0x60) = 0;

+  }

+  iVar6 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar6 != 0) && (*(longlong **)(param_1 + 0x70) != (longlong *)0x0)) {

+    (**(code **)(**(longlong **)(param_1 + 0x70) + 0x40))();

+    *(undefined8 *)(param_1 + 0x70) = 0;

+  }

+  iVar6 = 1;

+LAB_0:

+  if (param_3 != (int *)0x0) {

+    *param_3 = iVar6;

+  }

+  return;

 }
```

## `TerminateDesktopThreads`  (modified)

```diff
--- TerminateDesktopThreads
+++ TerminateDesktopThreads
@@ -1,98 +1,238 @@
 

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

+/* void __cdecl TerminateDesktopThreads(void) */

 

 void __cdecl TerminateDesktopThreads(void)

 

 {

-  bool bVar1;

-  char cVar2;

+  int iVar1;

+  longlong lVar2;

   longlong lVar3;

-  char *in_RAX;

-  tagPROCESS_HID_TABLE *ptVar4;

-  tagPROCESS_HID_TABLE *unaff_RBX;

-  void *unaff_RBP;

-  tagPROCESS_HID_TABLE *unaff_RSI;

-  undefined8 unaff_RDI;

-  WhyBgInputSkipped WVar5;

-  ulong unaff_R12D;

-  tagRAWMOUSE *unaff_R13;

-  char unaff_R14B;

-  longlong unaff_R15;

-  char in_CF;

-  __uint64 in_stack_00000080;

-  undefined8 in_stack_00000090;

-  undefined4 in_stack_00000098;

-  undefined8 in_stack_000000a0;

-  undefined4 in_stack_000000a8;

+  longlong lVar4;

+  char cVar5;

+  char cVar6;

+  longlong *plVar7;

+  ulonglong uVar8;

+  uint uVar9;

+  bool bVar10;

+  bool bVar11;

+  bool bVar12;

+  undefined8 local_res10;

+  uint in_stack_ffffffffffffffb0;

+  longlong local_38 [2];

   

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

-  do {

-    if (((char)in_RAX == '\0') &&

-       (-1 < *(int *)(*(longlong *)(*(longlong *)(*(longlong *)(unaff_RBX + 0x40) + 0x10) + 0x1d0) +

-                     0xc))) {

-      in_stack_00000090 = in_stack_000000a0;

-      in_stack_00000098 = in_stack_000000a8;

-      EtwTraceUIPIInputError

-                (*(longlong *)(*(longlong *)(unaff_RBX + 0x40) + 0x10),0,unaff_RDI,&stack0x00000090,

-                 5);

-      WVar5 = 2;

+  local_38[0] = 0;

+  local_38[1] = 0;

+  bVar12 = false;

+  lVar2 = W32GetUserSessionState();

+  if (*(longlong *)(lVar2 + 0xcb8) != 0) {

+    lVar2 = W32GetUserSessionState();

+    CTouchProcessor::CleanupInputDestHwndRefsForDesktopThreadExit

+              (*(CTouchProcessor **)(lVar2 + 0xcb8));

+  }

+  lVar2 = W32GetUserSessionState();

+  lVar3 = W32GetUserSessionState();

+  cVar6 = '\0';

+  if (*(longlong *)(lVar2 + 0x10d10) == 0) {

+    lVar4 = 0;

+    if (*(longlong *)(lVar2 + 0x10cd8) != 0) {

+      HMAssignmentUnlock();

+      lVar4 = 0;

+    }

+  }

+  else {

+    local_38[0] = *(longlong *)(lVar2 + 0x10d10);

+    ObfReferenceObject();

+    if (*(longlong *)(lVar2 + 0x10d08) == 0) {

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

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

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

+        cVar5 = cVar6;

+      }

+      bVar12 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar5 != '\0') || (bVar12)) {

+        lVar4 = W32GetUserSessionState();

+        in_stack_ffffffffffffffb0 = 0;

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar12,

+                   *(undefined8 *)(lVar4 + 0x10f88),4,0x14,0xb,

+                   &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+      }

+      IPostQuitMessage(*(undefined8 *)(lVar2 + 0x10ce0),0);

+      bVar12 = true;

     }

     else {

-      if (*(longlong *)(*(longlong *)(*(longlong *)(unaff_RBX + 0x40) + 0x10) + 0x1d0) == unaff_R15)

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

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

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

+        cVar5 = '\0';

+      }

+      bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar5 != '\0') || (bVar10)) {

+        lVar4 = W32GetUserSessionState();

+        in_stack_ffffffffffffffb0 = 0;

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar10,

+                   *(undefined8 *)(lVar4 + 0x10f88),4,0x14,10,

+                   &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+      }

+      *(uint *)(lVar2 + 0x10cd0) = *(uint *)(lVar2 + 0x10cd0) | 0x10;

+      KeSetEvent(*(undefined8 *)(lVar2 + 0x10d08),1,0);

+    }

+    HYDRA_HINT(0x80000);

+    lVar4 = 1;

+  }

+  uVar9 = (uint)lVar4;

+  if (*(longlong *)(lVar3 + 0x10d58) != 0) {

+    local_38[lVar4] = *(longlong *)(lVar3 + 0x10d58);

+    ObfReferenceObject();

+    uVar9 = uVar9 + 1;

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

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

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

+      cVar5 = cVar6;

+    }

+    bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar5 != '\0') || (bVar10)) {

+      lVar4 = W32GetUserSessionState();

+      in_stack_ffffffffffffffb0 = 0;

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar10,

+                 *(undefined8 *)(lVar4 + 0x10f88),4,0x14,0xc,

+                 &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+    }

+    if (*(longlong *)(lVar3 + 0x10d50) == 0) {

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

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

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

+        cVar5 = cVar6;

+      }

+      bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar5 != '\0') || (bVar10)) {

+        lVar4 = W32GetUserSessionState();

+        in_stack_ffffffffffffffb0 = 0;

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar10,

+                   *(undefined8 *)(lVar4 + 0x10f88),4,0x14,0xe,

+                   &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+      }

+      IPostQuitMessage(*(undefined8 *)(lVar3 + 0x10d28),0);

+      bVar10 = true;

       goto LAB_0;

-      if (((*(uint *)(unaff_RBX + 100) & 8) == 0) || (unaff_R14B != '\0')) {

-        bVar1 = ThrottleRawMouseInputToBackgroundListener

-                          (unaff_RBX,unaff_RBP,unaff_R13,in_stack_00000080,unaff_R12D);

-        if (!bVar1) {

-          PostRawMouseInputToBackgroundListener

-                    (unaff_RBX,unaff_RBP,unaff_R13,in_stack_00000080,unaff_R12D);

-          goto LAB_0;

-        }

-        WVar5 = 4;

-      }

-      else {

-        WVar5 = 3;

-      }

-    }

+    }

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

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

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

+      cVar5 = cVar6;

+    }

+    bVar10 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar5 != '\0') || (bVar10)) {

+      lVar4 = W32GetUserSessionState();

+      in_stack_ffffffffffffffb0 = 0;

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar10,

+                 *(undefined8 *)(lVar4 + 0x10f88),4,0x14,0xd,

+                 &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+    }

+    *(uint *)(lVar3 + 0x10d18) = *(uint *)(lVar3 + 0x10d18) | 0x10;

+    KeSetEvent(*(undefined8 *)(lVar3 + 0x10d50),1);

+  }

+  bVar10 = false;

+LAB_0:

+  if (uVar9 != 0) {

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

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

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

+      cVar5 = cVar6;

+    }

+    bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar5 != '\0') || (bVar11)) {

+      lVar4 = W32GetUserSessionState();

+      in_stack_ffffffffffffffb0 = 0;

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar11,

+                 *(undefined8 *)(lVar4 + 0x10f88),4,0x14,0xf,

+                 &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+    }

+    local_res10 = 0xfffffffffa0a1f00;

     while( true ) {

-      while( true ) {

-        InputTraceLogging::RawInput::SkipBackgroundListener(unaff_RBX,unaff_RBP,WVar5);

-LAB_0:

-        do {

-          unaff_RBX = *(tagPROCESS_HID_TABLE **)unaff_RBX;

-          if (unaff_RBX == unaff_RSI) {

-            cVar2 = RawMouseThrottlingTimerActive();

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

-              return;

-            }

-            ptVar4 = *(tagPROCESS_HID_TABLE **)unaff_RSI;

-            while( true ) {

-              if (ptVar4 == unaff_RSI) {

-                ArmRawMouseThrottlingTimer(0,0);

-                return;

-              }

-              if (((*(uint *)(ptVar4 + 100) & 1) != 0) && (*(int *)(ptVar4 + 0x70) == 2)) break;

-              ptVar4 = *(tagPROCESS_HID_TABLE **)ptVar4;

-            }

-            return;

-          }

-        } while ((*(uint *)(unaff_RBX + 100) & 4) == 0);

-        lVar3 = *(longlong *)(unaff_RBX + 0x40);

-        if (((lVar3 != 0) && (-1 < *(char *)(*(longlong *)(lVar3 + 0x28) + 0x14))) &&

-           (-1 < *(char *)(*(longlong *)(lVar3 + 0x28) + 0x13))) break;

-        WVar5 = 0;

-      }

-      unaff_RDI = *(undefined8 *)(*(longlong *)(lVar3 + 0x10) + 0x1d8);

-      lVar3 = W32GetUserSessionState();

-      if (*(longlong *)(*(longlong *)(unaff_RBX + 0x40) + 0x18) == *(longlong *)(lVar3 + 0x4b58))

-      break;

-      WVar5 = 1;

-    }

-    bVar1 = UIPrivilegeIsolation::CheckAccess

-                      ((tagUIPI_INFO *)

-                       (*(longlong *)(*(longlong *)(*(longlong *)(unaff_RBX + 0x40) + 0x10) + 0x1d0)

-                       + 0x358),(tagUIPI_INFO *)&stack0x000000a0);

-    in_RAX = (char *)(ulonglong)bVar1;

-  } while( true );

+      UserSessionSwitchLeaveCrit();

+      in_stack_ffffffffffffffb0 = in_stack_ffffffffffffffb0 & 0xffffff00;

+      iVar1 = KeWaitForMultipleObjects

+                        (uVar9,local_38,0,0xd,0,in_stack_ffffffffffffffb0,&local_res10,0);

+      EnterCrit(1);

+      if (iVar1 != 0x102) break;

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

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

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

+        cVar5 = cVar6;

+      }

+      bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar5 != '\0') || (bVar11)) {

+        lVar4 = W32GetUserSessionState();

+        in_stack_ffffffffffffffb0 = 0;

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar11,

+                   *(undefined8 *)(lVar4 + 0x10f88),2,0x14,0x10,

+                   &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+      }

+      HYDRA_HINT(0x800000);

+      if ((bVar12) && (*(longlong *)(lVar2 + 0x10ce0) != 0)) {

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

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

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

+          cVar5 = cVar6;

+        }

+        bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar5 != '\0') || (bVar11)) {

+          lVar4 = W32GetUserSessionState();

+          in_stack_ffffffffffffffb0 = 0;

+          WPP_RECORDER_AND_TRACE_SF_

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar11,

+                     *(undefined8 *)(lVar4 + 0x10f88),2,0x14,0x11,

+                     &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+        }

+        IPostQuitMessage(*(undefined8 *)(lVar2 + 0x10ce0),0);

+      }

+      if ((bVar10) && (*(longlong *)(lVar3 + 0x10d28) != 0)) {

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

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

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

+          cVar5 = cVar6;

+        }

+        bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar5 != '\0') || (bVar11)) {

+          lVar4 = W32GetUserSessionState();

+          in_stack_ffffffffffffffb0 = 0;

+          WPP_RECORDER_AND_TRACE_SF_

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar11,

+                     *(undefined8 *)(lVar4 + 0x10f88),2,0x14,0x12,

+                     &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+        }

+        IPostQuitMessage(*(undefined8 *)(lVar3 + 0x10d28),0);

+      }

+    }

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

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

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

+      cVar6 = '\0';

+    }

+    bVar12 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar12)) {

+      lVar2 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar12,

+                 *(undefined8 *)(lVar2 + 0x10f88),4,0x14,0x13,

+                 &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+    }

+    plVar7 = local_38;

+    uVar8 = (ulonglong)uVar9;

+    do {

+      ObfDereferenceObject(*plVar7);

+      plVar7 = plVar7 + 1;

+      uVar8 = uVar8 - 1;

+    } while (uVar8 != 0);

+  }

+  HYDRA_HINT(0x800);

+  return;

 }
```

## `RedistributeInput`  (modified)

```diff
--- RedistributeInput
+++ RedistributeInput
@@ -1,237 +1,240 @@
 

-/* WARNING: Instruction at (ram,0x0001400ae0d4) overlaps instruction at (ram,0x0001400ae0d3)

-    */

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

+/* void __cdecl RedistributeInput(struct tagQMSG * __ptr64,struct tagQ * __ptr64,struct

+   tagTHREADINFO * __ptr64) */

 

 void __cdecl RedistributeInput(tagQMSG *param_1,tagQ *param_2,tagTHREADINFO *param_3)

 

 {

-  _POINTL *p_Var1;

-  HDEV__ *pHVar2;

-  _SURFOBJ *p_Var3;

-  undefined8 uVar4;

-  bool bVar5;

-  uint unaff_1000016a;

-  uint unaff_10000172;

-  int iVar6;

-  longlong lVar7;

-  uint uVar8;

-  uint uVar9;

-  uint *unaff_RBX;

-  longlong lVar10;

-  undefined8 *unaff_RBP;

-  uint *unaff_RSI;

-  uint unaff_EDI;

-  _SURFOBJ *p_Var11;

-  uint uVar12;

-  uint uVar13;

-  uint in_R10D;

-  uint in_R11D;

-  uint unaff_R12D;

-  code *pcVar14;

-  longlong unaff_R13;

-  _SURFOBJ *p_Var15;

-  _SURFOBJ *unaff_R14;

-  longlong unaff_R15;

-  char in_SF;

-  bool in_OF;

-  uint *in_stack_00000070;

+  tagQ *ptVar1;

+  undefined8 uVar2;

+  int iVar3;

+  uint uVar4;

+  tagTHREADINFO *ptVar5;

+  longlong lVar6;

+  tagTHREADINFO *ptVar7;

+  tagQMSG *ptVar8;

+  tagQMSG *ptVar9;

+  tagTHREADINFO *ptVar10;

+  ulonglong uVar11;

+  tagQMSG *ptVar12;

+  undefined **ppuVar13;

+  tagQMSG *ptVar14;

+  tagQMSG *ptVar15;

+  char cVar16;

+  char cVar17;

+  tagQMSG *ptVar18;

+  bool bVar19;

+  tagQMSG *local_res20;

   

-  uVar12 = (uint)param_3;

-  if (in_OF) {

-    SPRITERANGELOCK::vUnlockExclusive((SPRITERANGELOCK *)(ulonglong)(unaff_EDI + 0x78));

-    SPRITERANGELOCK::vLockShared((SPRITERANGELOCK *)(unaff_R15 + 0x78));

-    unaff_R14 = *(_SURFOBJ **)(unaff_RSI + 0x20);

-    if (unaff_R14 != (_SURFOBJ *)0x0) {

-      uVar12 = *unaff_RBX;

-      unaff_RSI[0x22] = -uVar12;

-      uVar8 = unaff_RBX[1];

-      unaff_RSI[0x26] = unaff_EDI;

-      unaff_RSI[0x23] = -uVar8;

-      if (unaff_R13 == 0) {

-        uVar8 = 0;

+  ptVar5 = PtiCurrent();

+  ptVar8 = (tagQMSG *)0x0;

+  local_res20 = (tagQMSG *)0x0;

+  ptVar14 = ptVar8;

+  while (ptVar12 = (tagQMSG *)0x0, ptVar15 = param_1, param_1 != (tagQMSG *)0x0) {

+    while( true ) {

+      ptVar7 = *(tagTHREADINFO **)(ptVar15 + 0x68);

+      ppuVar13 = &WPP_RECORDER_INITIALIZED;

+      ptVar10 = ptVar7;

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

+          (uVar11 = *(ulonglong *)(ptVar7 + 0x550), (uVar11 >> 0x1d & 1) != 0)) &&

+         (iVar3 = IsHiddenByInputService(ptVar15), iVar3 != 0)) {

+        *(ulonglong *)(ptVar7 + 0x550) = uVar11 & 0xffffffffdfffffff;

+        ptVar10 = *(tagTHREADINFO **)(ptVar15 + 0x68);

+      }

+      if ((*(uint *)(ptVar5 + 0x550) >> 0x12 & 1) != 0) {

+        iVar3 = *(int *)(ptVar15 + 0x18);

+        if (ptVar10 == ptVar5) {

+          if ((((iVar3 == 0x100) || (iVar3 == 0x101)) || (iVar3 == 0x102)) &&

+             (param_3 != (tagTHREADINFO *)0x0)) {

+            *(tagTHREADINFO **)(ptVar15 + 0x68) = param_3;

+          }

+        }

+        else if ((iVar3 == 0x201) || (iVar3 == 0x204)) {

+          lVar6 = HMValidateHandleNoSecure(*(undefined8 *)(ptVar15 + 0x10),1);

+          ptVar12 = (tagQMSG *)0x0;

+          ppuVar13 = &WPP_RECORDER_INITIALIZED;

+          if ((lVar6 != 0) && (*(tagTHREADINFO **)(lVar6 + 0x10) == ptVar5)) {

+            *(tagTHREADINFO **)(ptVar15 + 0x68) = ptVar5;

+          }

+        }

+      }

+      ptVar18 = *(tagQMSG **)(ptVar15 + 0x68);

+      if ((((ptVar15 == *(tagQMSG **)(param_2 + 0x58)) &&

+           (ptVar1 = *(tagQ **)(ptVar18 + 0x1d8), param_2 != ptVar1)) &&

+          (*(tagQMSG **)(ptVar1 + 0x48) == ptVar12)) &&

+         ((*(longlong *)(param_2 + 0x48) != 0 &&

+          (*(tagQ **)(*(longlong *)(param_2 + 0x48) + 0x1d8) == ptVar1)))) {

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

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

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

+          cVar16 = (char)ptVar12;

+        }

+        bVar19 = (undefined **)WPP_RECORDER_INITIALIZED != ppuVar13;

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

+          lVar6 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_qqq

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

+                     *(undefined8 *)(lVar6 + 0x10f88),4);

+          ptVar12 = (tagQMSG *)0x0;

+          ppuVar13 = &WPP_RECORDER_INITIALIZED;

+        }

+        *(undefined8 *)(*(longlong *)(ptVar18 + 0x1d8) + 0x48) = *(undefined8 *)(param_2 + 0x48);

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

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

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

+          cVar16 = (char)ptVar12;

+        }

+        bVar19 = (undefined **)WPP_RECORDER_INITIALIZED != ppuVar13;

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

+          lVar6 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_qqq

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

+                     *(undefined8 *)(lVar6 + 0x10f88),4);

+          ptVar12 = (tagQMSG *)0x0;

+          ppuVar13 = &WPP_RECORDER_INITIALIZED;

+        }

+        *(tagQMSG **)(param_2 + 0x48) = ptVar12;

+      }

+      if (*(int *)(ptVar15 + 0x60) == 4) {

+        ptVar18 = ptVar12;

+      }

+      iVar3 = IsProcessedByInputService(ptVar15);

+      ptVar9 = ptVar12;

+      if (iVar3 == 0) {

+        ptVar9 = ptVar18;

+      }

+      if (ptVar9 == (tagQMSG *)0x0) break;

+      if ((ptVar14 == (tagQMSG *)0x0) || (ptVar8 != ptVar9)) {

+        lVar6 = *(longlong *)(ptVar9 + 0x1d8);

+        ptVar14 = *(tagQMSG **)(lVar6 + 0x20);

+        if ((ptVar14 == (tagQMSG *)0x0) || (*(int *)(ptVar15 + 0x30) - *(int *)(ptVar14 + 0x30) < 0)

+           ) {

+          ptVar14 = (tagQMSG *)(lVar6 + 0x18);

+          local_res20 = ptVar14;

+        }

+        else {

+          local_res20 = (tagQMSG *)(lVar6 + 0x18);

+        }

+      }

+      if (*(tagQMSG **)ptVar14 != (tagQMSG *)0x0) {

+        ptVar8 = *(tagQMSG **)ptVar14;

+        do {

+          ptVar12 = ptVar8;

+          if (*(int *)(ptVar15 + 0x30) - *(int *)(ptVar12 + 0x30) < 0) break;

+          ptVar8 = *(tagQMSG **)ptVar12;

+          ptVar14 = ptVar12;

+        } while (*(tagQMSG **)ptVar12 != (tagQMSG *)0x0);

+      }

+      *(uint *)(ptVar15 + 100) = *(uint *)(ptVar15 + 100) & 0xfffe1fff;

+      InputTraceLogging::Delivery::UpdateISODState(ptVar15);

+      ptVar18 = *(tagQMSG **)ptVar15;

+      *(longlong *)ptVar15 = *(longlong *)ptVar14;

+      if (*(longlong *)ptVar14 == 0) {

+        *(longlong *)(ptVar15 + 8) = *(longlong *)(local_res20 + 8);

+        *(tagQMSG **)(local_res20 + 8) = ptVar15;

       }

       else {

-        uVar8 = (*(uint **)(unaff_R13 + 0x70))[2] | **(uint **)(unaff_R13 + 0x70);

-      }

-      unaff_RSI[0x27] = uVar8;

-      unaff_EDI = *unaff_RBX;

-      in_R10D = unaff_RBX[1];

-      unaff_R12D = unaff_RBX[2];

-      in_R11D = unaff_RBX[3];

-      *(uint *)(unaff_RBP + 2) = unaff_EDI;

-      unaff_RBX = in_stack_00000070;

-      unaff_1000016a = unaff_R12D;

-      unaff_10000172 = in_R11D;

-      goto code_r0x0001400ae0c4;

+        *(undefined8 *)(ptVar15 + 8) = *(undefined8 *)(*(longlong *)ptVar14 + 8);

+        *(tagQMSG **)(*(longlong *)ptVar14 + 8) = ptVar15;

+      }

+      *(tagQMSG **)ptVar14 = ptVar15;

+      *(int *)(local_res20 + 0x10) = *(int *)(local_res20 + 0x10) + 1;

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

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

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

+        cVar16 = '\0';

+      }

+      bVar19 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

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

+        lVar6 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_qiqdd

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

+                   *(undefined8 *)(lVar6 + 0x10f88));

+      }

+      ptVar12 = (tagQMSG *)0x0;

+      if ((*(int *)(ptVar15 + 0x60) != 0) &&

+         (uVar4 = INTERLOCKEDINT::operator_int

+                            ((INTERLOCKEDINT *)(*(longlong *)(ptVar9 + 0x1e8) + 8)),

+         (uVar4 >> 0xd & 1) == 0)) {

+        SetWakeBit(ptVar9,0x2040);

+        ptVar12 = (tagQMSG *)0x0;

+      }

+      if ((ptVar15 == *(tagQMSG **)(param_2 + 0x58)) && (param_2 != *(tagQ **)(ptVar9 + 0x1d8))) {

+        if (*(tagQMSG **)(*(tagQ **)(ptVar9 + 0x1d8) + 0x58) == ptVar12) {

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

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

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

+            cVar16 = (char)ptVar12;

+          }

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

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

+            cVar17 = (char)ptVar12;

+          }

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

+            lVar6 = W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_qqq

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

+                       *(undefined8 *)(lVar6 + 0x10f88),5);

+            ptVar12 = (tagQMSG *)0x0;

+          }

+          *(undefined8 *)(*(longlong *)(ptVar9 + 0x1d8) + 0x58) = *(undefined8 *)(param_2 + 0x58);

+        }

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

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

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

+          cVar16 = (char)ptVar12;

+        }

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

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

+          cVar17 = (char)ptVar12;

+        }

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

+          uVar2 = *(undefined8 *)(param_2 + 0x58);

+          lVar6 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_qq

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

+                     *(undefined8 *)(lVar6 + 0x10f88),5,0x12,0x2a,

+                     &WPP_ac69e8c37fc734a920f2a9c1fca2be71_Traceguids,param_2,uVar2);

+          ptVar12 = (tagQMSG *)0x0;

+        }

+        *(tagQMSG **)(param_2 + 0x58) = ptVar12;

+      }

+      if (ptVar18 == (tagQMSG *)0x0) goto LAB_0;

+      *(tagQMSG **)(ptVar18 + 8) = ptVar12;

+      ptVar8 = ptVar9;

+      ptVar14 = ptVar15;

+      ptVar15 = ptVar18;

     }

-  }

-  else {

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

-      register0x00000020 = (BADSPACEBASE *)&stack0xfffffffffffffff8;

-code_r0x0001400ae0d5:

-      uVar8 = unaff_RBX[2];

-      uVar9 = unaff_RBX[1] - unaff_RSI[0x23];

-      uVar13 = unaff_RBX[3] - unaff_RSI[0x23];

-      if ((int)unaff_EDI < (int)(*unaff_RBX + uVar12)) {

-        unaff_EDI = *unaff_RBX + uVar12;

-      }

-      *(uint *)(unaff_RBP + 2) = unaff_EDI;

-      if ((int)in_R10D < (int)uVar9) {

-        in_R10D = uVar9;

-      }

-      bVar5 = (int)(uVar8 + uVar12) < (int)unaff_R12D;

-      unaff_R12D = unaff_1000016a;

-      if (bVar5) {

-        unaff_R12D = uVar8 + uVar12;

-      }

-      *(uint *)(unaff_RBP + 3) = unaff_R12D;

-      bVar5 = (int)uVar13 < (int)in_R11D;

-      in_R11D = unaff_10000172;

-      if (bVar5) {

-        in_R11D = uVar13;

-      }

-      *(uint *)((longlong)unaff_RBP + 0x1c) = in_R11D;

-      if ((int)unaff_R12D < (int)unaff_EDI) goto LAB_0;

-      if ((int)in_R11D < (int)in_R10D) {

-        in_R10D = in_R11D;

-      }

-      *(uint *)((longlong)unaff_RBP + 0x14) = in_R10D;

+    if (*(longlong *)ptVar15 != 0) {

+      *(tagQMSG **)(*(longlong *)ptVar15 + 8) = ptVar12;

     }

-    else {

-code_r0x0001400ae0c4:

-      *(uint *)((longlong)unaff_RBP + 0x14) = in_R10D;

-      *(uint *)(unaff_RBP + 3) = unaff_R12D;

-      *(uint *)((longlong)unaff_RBP + 0x1c) = in_R11D;

-      if (unaff_RBX != (uint *)0x0) goto code_r0x0001400ae0d5;

+    ptVar18 = *(tagQMSG **)(param_2 + 0x58);

+    param_1 = *(tagQMSG **)ptVar15;

+    if (ptVar15 == ptVar18) {

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

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

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

+        cVar16 = (char)ptVar12;

+      }

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

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

+        cVar17 = (char)ptVar12;

+      }

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

+        lVar6 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_qq

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

+                   *(undefined8 *)(lVar6 + 0x10f88),5,0x12,0x27,

+                   &WPP_ac69e8c37fc734a920f2a9c1fca2be71_Traceguids,param_2,ptVar18);

+        ptVar12 = (tagQMSG *)0x0;

+      }

+      *(tagQMSG **)(param_2 + 0x58) = ptVar12;

     }

-    if ((in_R10D != in_R11D) && (unaff_EDI != unaff_R12D)) {

-      uVar12 = *unaff_RSI;

-      if ((uVar12 & 0x40) == 0) {

-        p_Var15 = *(_SURFOBJ **)((longlong)register0x00000020 + 0x60);

-      }

-      else if (((uVar12 >> 9 & 1) == 0) ||

-              (p_Var15 = *(_SURFOBJ **)((longlong)register0x00000020 + 0x60),

-              *(longlong *)(unaff_R14 + 0x140) != *(longlong *)(p_Var15 + 8))) {

-        *unaff_RSI = uVar12 | 0x80;

-        goto LAB_0;

-      }

-      p_Var1 = *(_POINTL **)((longlong)register0x00000020 + 0x58);

-      unaff_RBP[-0xe] = unaff_RBP[2];

-      unaff_RBP[-0xd] = unaff_RBP[3];

-      *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae266;

-      ERECTL::bOffsetAdd((ERECTL *)(unaff_RBP + -0xe),p_Var1,0);

-      *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae276;

-      MULTISURF::MULTISURF((MULTISURF *)(unaff_RBP + -0xc),p_Var15,(_RECTL *)(unaff_RBP + -0xe));

-      p_Var11 = (_SURFOBJ *)0x0;

-      uVar12 = *(uint *)(unaff_R14 + 0x58);

-      *(undefined8 *)((longlong)register0x00000020 + 0x60) = 0;

-      *(undefined8 *)((longlong)register0x00000020 + 0x70) = 0;

-      if ((uVar12 >> 10 & 1) == 0) {

-        if ((*(uint *)(p_Var15 + 0x58) >> 10 & 1) == 0) {

-          pcVar14 = EngCopyBits;

-        }

-        else {

-          pcVar14 = *(code **)(*(longlong *)(p_Var15 + 0x18) + 0xb10);

-        }

-      }

-      else {

-        pHVar2 = *(HDEV__ **)(unaff_R14 + 0x18);

-        *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae29a;

-        iVar6 = MULTISURF::bLoadSource((MULTISURF *)(unaff_RBP + -0xc),pHVar2);

-        if (iVar6 == 0) {

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae2a7;

-          SPRITERANGELOCK::vUnlockShared((SPRITERANGELOCK *)(unaff_R15 + 0x78));

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae2b0;

-          SPRITERANGELOCK::vLockExclusive((SPRITERANGELOCK *)(unaff_R15 + 0x78));

-          p_Var15 = *(_SURFOBJ **)(unaff_RSI + 0x20);

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae2bc;

-          vSpDeleteSurface(p_Var15);

-          unaff_RSI[0x20] = 0;

-          unaff_RSI[0x21] = 0;

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae2cc;

-          SPRITERANGELOCK::vUnlockExclusive((SPRITERANGELOCK *)(unaff_R15 + 0x78));

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae2d8;

-          SURFREFVIEW::bUnMap((SURFREFVIEW *)((longlong)register0x00000020 + 0x70));

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae2e9;

-          SURFREFVIEW::bUnMap((SURFREFVIEW *)((longlong)register0x00000020 + 0x60));

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae2f7;

-          MULTISURF::~MULTISURF((MULTISURF *)(unaff_RBP + -0xc));

-          goto LAB_1;

-        }

-        pcVar14 = *(code **)(pHVar2 + 0xb10);

-      }

-      p_Var3 = (_SURFOBJ *)unaff_RBP[-1];

-      *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae333;

-      iVar6 = SURFREFVIEW::bMap((SURFREFVIEW *)((longlong)register0x00000020 + 0x60),p_Var3);

-      if (iVar6 == 0) {

-LAB_2:

-        *(undefined4 *)((longlong)register0x00000020 + 0x50) = 0;

-      }

-      else {

-        *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae34f;

-        iVar6 = SURFREFVIEW::bMap((SURFREFVIEW *)((longlong)register0x00000020 + 0x70),unaff_R14);

-        if (iVar6 == 0) goto LAB_2;

-        if (((*(uint *)(unaff_R14 + 0x58) & 0x80004000) != 0) &&

-           ((*(uint *)(unaff_R14 + 0x58) >> 9 & 1) == 0)) {

-          p_Var11 = unaff_R14 + -0x18;

-          uVar4 = *(undefined8 *)(unaff_R14 + 0x18);

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae37c;

-          GreLockDisplayDevice(uVar4);

-        }

-        lVar7 = unaff_RBP[-1];

-        lVar10 = 0;

-        if (((lVar7 != 0) && ((*(uint *)(lVar7 + 0x58) & 0x80004000) != 0)) &&

-           ((*(uint *)(lVar7 + 0x58) >> 9 & 1) == 0)) {

-          lVar10 = lVar7 + -0x18;

-          uVar4 = *(undefined8 *)(lVar7 + 0x18);

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae3ab;

-          GreLockDisplayDevice(uVar4);

-          lVar7 = unaff_RBP[-1];

-        }

-        uVar4 = *unaff_RBP;

-        *(undefined8 *)((longlong)register0x00000020 + 0x58) = 0;

-        *(undefined8 *)((longlong)register0x00000020 + 0x40) = uVar4;

-        *(undefined8 **)((longlong)register0x00000020 + 0x38) = unaff_RBP + 2;

-        *(undefined8 *)((longlong)register0x00000020 + 0x30) = unaff_RBP[-0xf];

-        *(undefined8 *)((longlong)register0x00000020 + 0x28) = 0;

-        *(longlong *)((longlong)register0x00000020 + 0x20) = lVar7;

-        *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae3f7;

-        OffCopyBitsInternal(pcVar14,(_POINTL *)(unaff_RSI + 0x22),unaff_R14,

-                            (_POINTL *)((longlong)register0x00000020 + 0x58),

-                            *(_SURFOBJ **)((longlong)register0x00000020 + 0x20),

-                            *(_CLIPOBJ **)((longlong)register0x00000020 + 0x28),

-                            *(_XLATEOBJ **)((longlong)register0x00000020 + 0x30),

-                            *(_RECTL **)((longlong)register0x00000020 + 0x38),

-                            *(_POINTL **)((longlong)register0x00000020 + 0x40));

-        if ((((*unaff_RSI >> 9 & 1) != 0) && (*(_SURFOBJ **)(unaff_RSI + 0x20) == unaff_R14)) &&

-           (*(longlong *)(unaff_R14 + 0x140) == *(longlong *)(p_Var15 + 8))) {

-          *unaff_RSI = *unaff_RSI | 0x80;

-        }

-        if (lVar10 != 0) {

-          uVar4 = *(undefined8 *)(lVar10 + 0x30);

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae42b;

-          GreUnlockDisplayDevice(uVar4);

-        }

-        if (p_Var11 != (_SURFOBJ *)0x0) {

-          uVar4 = *(undefined8 *)(p_Var11 + 0x30);

-          *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae440;

-          GreUnlockDisplayDevice(uVar4);

-        }

-      }

-      *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae457;

-      SURFREFVIEW::bUnMap((SURFREFVIEW *)((longlong)register0x00000020 + 0x70));

-      *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae468;

-      SURFREFVIEW::bUnMap((SURFREFVIEW *)((longlong)register0x00000020 + 0x60));

-      *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae476;

-      MULTISURF::~MULTISURF((MULTISURF *)(unaff_RBP + -0xc));

-    }

+    CleanEventMessage(ptVar15);

+    FreeQEntry(ptVar15);

   }

 LAB_0:

-  *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae156;

-  SPRITERANGELOCK::vUnlockShared((SPRITERANGELOCK *)(unaff_R15 + 0x78));

-LAB_1:

-  *(undefined8 *)((longlong)register0x00000020 + -8) = 0x1400ae166;

+  RedistributeDeferredMsgsOnQueue(param_2);

   return;

 }
```

## `ValidateChangeMessageFilter`  (modified)

```diff
--- ValidateChangeMessageFilter
+++ ValidateChangeMessageFilter
@@ -1,226 +1,29 @@
+

+/* int __cdecl ValidateChangeMessageFilter(struct tagPROCESSINFO * __ptr64,unsigned int) */

 

 int __cdecl ValidateChangeMessageFilter(tagPROCESSINFO *param_1,uint param_2)

 

 {

-  byte *pbVar1;

-  byte bVar2;

-  uint uVar3;

-  undefined4 uVar4;

-  byte bVar5;

-  uint uVar6;

-  longlong lVar7;

-  int iVar8;

-  char cVar9;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  int *unaff_RSI;

-  longlong *unaff_RDI;

-  longlong in_R8;

-  byte *pbVar10;

-  uint *puVar11;

-  undefined1 *in_R9;

-  int in_R10D;

-  uint uVar12;

-  longlong *in_R11;

-  int unaff_R12D;

-  int unaff_R13D;

-  byte unaff_R14B;

+  bool bVar1;

+  int iVar2;

   

-  iVar8 = (int)param_1 + param_2 * -4;

-  pbVar10 = (byte *)((in_R8 >> 3) + *unaff_RDI);

-  if (unaff_R14B == 0) {

-    if (in_R10D != 0) {

-      lVar7 = (longlong)(int)(unaff_R13D - param_2);

-      *(longlong *)(unaff_RBP + 0x60) = lVar7;

-      do {

-        in_R10D = in_R10D + -1;

-        pbVar1 = pbVar10 + (int)param_2;

-        if (pbVar10 != pbVar1) {

-          do {

-            bVar5 = *pbVar10;

-            pbVar10 = pbVar10 + 1;

-            *in_R9 = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 6));

-            in_R9[1] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 4 & 3));

-            in_R9[2] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 2 & 3));

-            in_R9[3] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 & 3));

-            in_R9 = in_R9 + 4;

-          } while (pbVar10 != pbVar1);

-          lVar7 = *(longlong *)(unaff_RBP + 0x60);

-        }

-        in_R9 = in_R9 + iVar8;

-        pbVar10 = pbVar10 + lVar7;

-      } while (in_R10D != 0);

-      unaff_RBX = *(longlong *)(unaff_RBP + 0x48);

+  iVar2 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 == 0) {

+    if (*(uint *)(param_1 + 0x358) < 0x1001) {

+LAB_0:

+      UserSetLastError(5);

+      EtwTraceUIPISystemError(param_1,0,3);

+      return 0;

     }

   }

-  else if (in_R10D != 0) {

-    uVar4 = *(undefined4 *)(unaff_RBP + -0x50);

-    lVar7 = (longlong)(int)param_2;

-    *(longlong *)(unaff_RBP + -0x20) = lVar7;

-    do {

-      pbVar1 = pbVar10 + lVar7;

-      in_R10D = in_R10D + -1;

-      bVar5 = *pbVar10 << (unaff_R14B & 0x1f);

-      if (pbVar10 != pbVar1) {

-        do {

-          pbVar10 = pbVar10 + 1;

-          bVar5 = *pbVar10 >> ((byte)uVar4 & 0x3f) | bVar5;

-          *in_R9 = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 6));

-          in_R9[1] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 4 & 3));

-          in_R9[2] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 2 & 3));

-          in_R9[3] = *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 & 3));

-          in_R9 = in_R9 + 4;

-          bVar5 = *pbVar10 << (unaff_R14B & 0x1f);

-        } while (pbVar10 != pbVar1);

-        lVar7 = *(longlong *)(unaff_RBP + -0x20);

-      }

-      in_R9 = in_R9 + iVar8;

-      pbVar10 = pbVar10 + (int)(unaff_R13D - param_2);

-    } while (in_R10D != 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 {

+    bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold((tagUIPI_INFO *)(param_1 + 0x358),0x2000);

+    if (!bVar1) goto LAB_0;

   }

-  cVar9 = *(char *)(unaff_RBP + 0x50);

-  uVar3 = *(uint *)(unaff_RBP + -0x44);

-  uVar6 = 0;

-  if (cVar9 != '\x01' || uVar3 != 0) {

-    uVar12 = *(uint *)(&DAT_0 + (ulonglong)uVar3 * 4);

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

-      uVar12 = uVar12 & *(uint *)(&DAT_1 + (ulonglong)(*(uint *)(unaff_RBP + -0x54) & 7) * 4

-                                 );

-    }

-    uVar6 = *(int *)(unaff_RBP + -0x3c) + *(uint *)(unaff_RBP + -0x40);

-    puVar11 = (uint *)(((longlong)*(int *)(unaff_RBX + 0x38) >> 1 & 0xfffffffffffffffcU) + *in_R11);

-    pbVar10 = (byte *)(((longlong)*(int *)(unaff_RBX + 0x30) >> 3) + *unaff_RDI);

-    iVar8 = *unaff_RSI;

-    if (iVar8 != 0) {

-      if (*(uint *)(unaff_RBP + -0x40) < uVar3) {

-        bVar5 = *(byte *)(unaff_RBP + -0x50);

-        do {

-          bVar2 = *pbVar10 >> (bVar5 & 0x3f);

-          pbVar10 = pbVar10 + unaff_R13D;

-          uVar3 = *puVar11;

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 2 & 3));

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 & 3));

-          uVar6 = *(uint *)(unaff_RBP + 0x60) & uVar12;

-          *(uint *)(unaff_RBP + 0x60) = uVar6;

-          *puVar11 = uVar3 & ~uVar12 | uVar6;

-          puVar11 = (uint *)((longlong)puVar11 + (longlong)unaff_R12D);

-          iVar8 = iVar8 + -1;

-        } while (iVar8 != 0);

-      }

-      else if ((int)uVar6 < 9) {

-        do {

-          bVar5 = *pbVar10 << (unaff_R14B & 0x1f);

-          pbVar10 = pbVar10 + unaff_R13D;

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 2 & 3));

-          uVar3 = *puVar11;

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 & 3));

-          uVar6 = *(uint *)(unaff_RBP + 0x60) & uVar12;

-          *(uint *)(unaff_RBP + 0x60) = uVar6;

-          *puVar11 = uVar3 & ~uVar12 | uVar6;

-          puVar11 = (uint *)((longlong)puVar11 + (longlong)unaff_R12D);

-          iVar8 = iVar8 + -1;

-        } while (iVar8 != 0);

-      }

-      else {

-        bVar5 = *(byte *)(unaff_RBP + -0x50);

-        do {

-          bVar2 = *pbVar10;

-          pbVar1 = pbVar10 + 1;

-          pbVar10 = pbVar10 + unaff_R13D;

-          bVar2 = *pbVar1 >> (bVar5 & 0x3f) | bVar2 << (unaff_R14B & 0x1f);

-          uVar3 = *puVar11;

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 2 & 3));

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 & 3));

-          uVar6 = *(uint *)(unaff_RBP + 0x60) & uVar12;

-          *(uint *)(unaff_RBP + 0x60) = uVar6;

-          *puVar11 = uVar3 & ~uVar12 | uVar6;

-          puVar11 = (uint *)((longlong)puVar11 + (longlong)unaff_R12D);

-          iVar8 = iVar8 + -1;

-        } while (iVar8 != 0);

-        unaff_RBX = *(longlong *)(unaff_RBP + 0x48);

-      }

-      cVar9 = *(char *)(unaff_RBP + 0x50);

-      unaff_R14B = (byte)*(undefined4 *)(unaff_RBP + -0x58);

-    }

+  if ((short)(param_2 >> 0x10) != 0) {

+    UserSetLastError(0x57);

+    return 0;

   }

-  uVar3 = *(uint *)(unaff_RBP + -0x54);

-  if ((((longlong)(int)uVar3 & 7U) != 0) && (cVar9 != '\0')) {

-    iVar8 = *(int *)(unaff_RBX + 0x20);

-    puVar11 = (uint *)(((longlong)(int)uVar3 >> 1 & 0xfffffffffffffffcU) +

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

-    uVar12 = *(uint *)(&DAT_1 + (ulonglong)(uVar3 & 7) * 4);

-    uVar6 = uVar3 - 1 & 7;

-    pbVar10 = (byte *)(((longlong)(*(int *)(unaff_RBX + 0x34) + -1) >> 3) +

-                      *(longlong *)(unaff_RBX + 8));

-    if (iVar8 != 0) {

-      if ((*(int *)(unaff_RBP + -0x38) - 1U & 7) < uVar6) {

-        bVar5 = *(byte *)(unaff_RBP + -0x50);

-        do {

-          pbVar1 = pbVar10 + -1;

-          bVar2 = *pbVar10;

-          pbVar10 = pbVar10 + unaff_R13D;

-          uVar3 = *puVar11;

-          bVar2 = *pbVar1 << (unaff_R14B & 0x1f) | bVar2 >> (bVar5 & 0x3f);

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 >> 2 & 3));

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar2 & 3));

-          uVar6 = *(uint *)(unaff_RBP + 0x60) & uVar12;

-          *(uint *)(unaff_RBP + 0x60) = uVar6;

-          *puVar11 = uVar3 & ~uVar12 | uVar6;

-          puVar11 = (uint *)((longlong)puVar11 + (longlong)unaff_R12D);

-          iVar8 = iVar8 + -1;

-        } while (iVar8 != 0);

-      }

-      else {

-        do {

-          bVar5 = *pbVar10 << (unaff_R14B & 0x1f);

-          pbVar10 = pbVar10 + unaff_R13D;

-          *(undefined1 *)(unaff_RBP + 0x60) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 6));

-          *(undefined1 *)(unaff_RBP + 0x61) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 4 & 3));

-          *(undefined1 *)(unaff_RBP + 0x62) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 >> 2 & 3));

-          uVar3 = *puVar11;

-          *(undefined1 *)(unaff_RBP + 99) =

-               *(undefined1 *)(unaff_RBP + 0x58 + (ulonglong)(bVar5 & 3));

-          uVar6 = *(uint *)(unaff_RBP + 0x60) & uVar12;

-          *(uint *)(unaff_RBP + 0x60) = uVar6;

-          *puVar11 = uVar3 & ~uVar12 | uVar6;

-          puVar11 = (uint *)((longlong)puVar11 + (longlong)unaff_R12D);

-          iVar8 = iVar8 + -1;

-        } while (iVar8 != 0);

-      }

-    }

-  }

-  return uVar6;

+  return 1;

 }
```

## `NtUserGetCurrentInputMessageSource`  (modified)

```diff
--- NtUserGetCurrentInputMessageSource
+++ NtUserGetCurrentInputMessageSource
@@ -1,275 +1,61 @@
 

-longlong NtUserGetCurrentInputMessageSource

-                   (undefined8 param_1,undefined8 param_2,_GUID *param_3,_GUID *param_4)

+longlong NtUserGetCurrentInputMessageSource(undefined1 *param_1)

 

 {

-  bool bVar1;

-  char cVar2;

-  int iVar3;

-  BOOL BVar4;

-  uint uVar5;

-  tagWND *hWndNewOwner;

-  tagTHREADINFO *ptVar6;

-  longlong lVar7;

-  longlong *plVar8;

-  ulonglong uVar9;

-  longlong lVar10;

-  _tlgProvider_t *p_Var11;

-  undefined8 uVar12;

-  char *pcVar13;

-  undefined4 *unaff_R12;

-  char *pcVar14;

-  bool in_ZF;

-  char *in_stack_00000040;

-  uchar uStack0000000000000048;

-  uchar uStack0000000000000049;

-  uchar uStack000000000000004a;

-  uchar uStack000000000000004b;

-  uchar uStack000000000000004c;

-  uchar uStack000000000000004d;

-  uchar uStack000000000000004e;

-  uchar uStack000000000000004f;

-  undefined4 uStack0000000000000090;

-  undefined4 uStack0000000000000094;

-  char *in_stack_000000a0;

-  char *in_stack_000000a8;

+  int iVar1;

+  int iVar2;

+  tagTHREADINFO *ptVar3;

+  longlong lVar4;

+  undefined1 *puVar5;

+  ulonglong uVar6;

+  int local_res8 [4];

+  EnterLeaveCritShared local_res18 [16];

   

-  if (in_ZF) {

-    hWndNewOwner = (tagWND *)0x0;

+                    /* 0x23c3f0  1681  NtUserGetCurrentInputMessageSource */

+  uVar6 = 0;

+  local_res8[0] = 0;

+  local_res8[1] = 0;

+  EnterLeaveCritShared::EnterLeaveCritShared(local_res18,1);

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

+    UserSetLastError(0x57);

+    iVar1 = 0;

+    goto LAB_0;

+  }

+  iVar1 = _GetCurrentInputMessageSource(0,(tagINPUT_MESSAGE_SOURCE *)local_res8);

+  if (iVar1 == 0) goto LAB_0;

+  if (local_res8[0] == 0x22) {

+LAB_1:

+    local_res8[0] = 2;

+  }

+  else if (local_res8[0] == 0x12) {

+    ptVar3 = PtiCurrent();

+    iVar2 = IsTouchpadCapable(ptVar3,0);

+    local_res8[0] = 0x10;

+    if (iVar2 == 0) goto LAB_1;

+  }

+  lVar4 = PsGetCurrentProcessWow64Process();

+  if (lVar4 == 0) {

+    local_res8[2] = 4;

+    local_res8[3] = 0;

+    uVar6 = 3;

   }

   else {

-    hWndNewOwner = (tagWND *)ValidateHwnd();

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

-      BVar4 = 0;

-      goto LAB_0;

-    }

+    local_res8[2] = 1;

+    local_res8[3] = 0;

   }

-  ptVar6 = PtiCurrent();

-  pcVar14 = (char *)(*(longlong *)(ptVar6 + 0x1d0) + 0x3c8);

-  in_stack_000000a0 = pcVar14;

-  lVar7 = W32GetUserSessionState();

-  if (*(int *)(lVar7 + 0x102b4) == 0) {

-    ptVar6 = PtiCurrent();

-    lVar7 = W32GetUserSessionState();

-    if (*(longlong *)(ptVar6 + 0x1f0) == *(longlong *)(lVar7 + 0xf688)) goto LAB_1;

-    plVar8 = (longlong *)PsGetCurrentProcessWin32Process();

-    uVar9 = 0;

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

-      uVar9 = (ulonglong)plVar8 & -(ulonglong)(*plVar8 != 0);

-    }

-    bVar1 = UIPrivilegeIsolation::IsInAppContainer((tagUIPI_INFO *)(uVar9 + 0x358));

-    if (bVar1) {

-      ptVar6 = PtiCurrent();

-      lVar7 = *(longlong *)(*(longlong *)(ptVar6 + 0x1f0) + 0x28);

-      lVar10 = W32GetUserSessionState();

-      if (((*(longlong *)(lVar10 + 0x4a50) != 0) &&

-          (iVar3 = ForegroundInputOwnerMatch(ptVar6,1), iVar3 != 0)) ||

-         ((lVar7 = *(longlong *)(lVar7 + 0x70), lVar7 != 0 &&

-          (*(tagTHREADINFO **)(lVar7 + 0x10) == ptVar6)))) goto LAB_2;

-      if (5 < DAT_3) {

-        p_Var11 = (_tlgProvider_t *)&DAT_3;

-        cVar2 = _tlgKeywordOn(&DAT_3,0x400000000000);

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

-          _uStack0000000000000090 = (char *)CONCAT44(uStack0000000000000094,0x80070005);

-          in_stack_000000a8 = "NoForeground";

-          in_stack_00000040 = (char *)0x1;

-          param_4 = (_GUID *)&stack0x00000040;

-          in_stack_000000a0 = 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_4,param_3,(_tlgWrapperByVal<8> *)param_4,

-                     (_tlgWrapSz<char> *)&stack0x000000a8,(_tlgWrapperByVal<4> *)&stack0x00000090,

-                     (_tlgWrapSz<unsigned_short> *)&stack0x000000a0);

-        }

-      }

-      pcVar13 = "NoForeground";

-      if (5 < DAT_5) {

-        p_Var11 = (_tlgProvider_t *)&DAT_5;

-        cVar2 = _tlgKeywordOn(&DAT_5,1);

-        if (cVar2 == '\0') goto LAB_6;

-        goto LAB_7;

-      }

-      goto LAB_6;

-    }

-LAB_2:

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

-LAB_8:

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

-                ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x00000048,hWndNewOwner);

-      BVar4 = _OpenClipboard((HWND)hWndNewOwner);

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

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

-      if (*(undefined4 **)MmUserProbeAddress_exref <= unaff_R12) {

-        unaff_R12 = *(undefined4 **)MmUserProbeAddress_exref;

-      }

-      *unaff_R12 = uStack0000000000000090;

-      if (5 < DAT_3) {

-        p_Var11 = (_tlgProvider_t *)&DAT_3;

-        cVar2 = _tlgKeywordOn(&DAT_3,0x400000000000);

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

-          in_stack_000000a8 = pcVar14;

-          if (BVar4 == 0) {

-            uVar5 = UserGetLastError();

-            if (0 < (int)uVar5) {

-              uVar5 = uVar5 & 0xffff | 0x80070000;

-            }

-          }

-          else {

-            uVar5 = 0;

-          }

-          _uStack0000000000000090 = (char *)CONCAT44(uStack0000000000000094,uVar5);

-          in_stack_00000040 = "FunctionExit";

-          uStack0000000000000048 = '\x01';

-          uStack0000000000000049 = '\0';

-          uStack000000000000004a = '\0';

-          uStack000000000000004b = '\0';

-          uStack000000000000004c = '\0';

-          uStack000000000000004d = '\0';

-          uStack000000000000004e = '\0';

-          uStack000000000000004f = '\0';

-          param_4 = (_GUID *)&stack0x00000048;

-          _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_4,param_3,(_tlgWrapperByVal<8> *)param_4,

-                     (_tlgWrapSz<char> *)&stack0x00000040,(_tlgWrapperByVal<4> *)&stack0x00000090,

-                     (_tlgWrapSz<unsigned_short> *)&stack0x000000a8);

-        }

-      }

-      if (BVar4 == 0) {

-        uVar5 = UserGetLastError();

-        if (0 < (int)uVar5) {

-          uVar5 = uVar5 & 0xffff | 0x80070000;

-        }

-        if (((int)uVar5 < 0) && (5 < DAT_5)) {

-          p_Var11 = (_tlgProvider_t *)&DAT_5;

-          cVar2 = _tlgKeywordOn(&DAT_5,1);

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

-            _uStack0000000000000090 = pcVar14;

-            uVar5 = UserGetLastError();

-            if (0 < (int)uVar5) {

-              uVar5 = uVar5 & 0xffff | 0x80070000;

-            }

-            in_stack_000000a0 = (char *)CONCAT44(in_stack_000000a0._4_4_,uVar5);

-            in_stack_000000a8 = "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_9,param_3,param_4,(_tlgWrapSz<char> *)&stack0x000000a8,

-                       (_tlgWrapperByVal<4> *)&stack0x000000a0,

-                       (_tlgWrapSz<unsigned_short> *)&stack0x00000090);

-          }

-        }

-      }

-      goto LAB_0;

-    }

-    plVar8 = (longlong *)PsGetCurrentProcessWin32Process();

-    param_3 = (_GUID *)0x0;

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

-      param_3 = (_GUID *)((ulonglong)plVar8 & -(ulonglong)(*plVar8 != 0));

-    }

-    lVar7._0_4_ = param_3[0x29].Data1;

-    lVar7._4_2_ = param_3[0x29].Data2;

-    lVar7._6_2_ = param_3[0x29].Data3;

-    if (*(longlong *)(*(longlong *)(*(longlong *)(hWndNewOwner + 0x10) + 0x1d0) + 0x290) == lVar7)

-    goto LAB_8;

-    plVar8 = (longlong *)PsGetCurrentProcessWin32Process();

-    uVar9 = 0;

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

-      uVar9 = (ulonglong)plVar8 & -(ulonglong)(*plVar8 != 0);

-    }

-    if (*(longlong *)(uVar9 + 0x290) == 0) goto LAB_8;

-    if (*(longlong *)(*(longlong *)(*(longlong *)(hWndNewOwner + 0x10) + 0x1d0) + 0x290) == 0) {

-      plVar8 = (longlong *)PsGetCurrentProcessWin32Process();

-      uVar9 = 0;

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

-        uVar9 = (ulonglong)plVar8 & -(ulonglong)(*plVar8 != 0);

-      }

-      if ((*(uint *)(*(longlong *)(uVar9 + 0x290) + 0x40) & 4) == 0) goto LAB_8;

-    }

-    UserSetLastError(0x57);

-    if (5 < DAT_3) {

-      p_Var11 = (_tlgProvider_t *)&DAT_3;

-      cVar2 = _tlgKeywordOn(&DAT_3,0x400000000000);

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

-        _uStack0000000000000090 = (char *)CONCAT44(uStack0000000000000094,0x80070057);

-        in_stack_000000a8 = "InvalidParameter";

-        in_stack_00000040 = (char *)0x1;

-        param_4 = (_GUID *)&stack0x00000040;

-        in_stack_000000a0 = 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_4,param_3,(_tlgWrapperByVal<8> *)param_4,

-                   (_tlgWrapSz<char> *)&stack0x000000a8,(_tlgWrapperByVal<4> *)&stack0x00000090,

-                   (_tlgWrapSz<unsigned_short> *)&stack0x000000a0);

-      }

-    }

-    if (5 < DAT_5) {

-      p_Var11 = (_tlgProvider_t *)&DAT_5;

-      cVar2 = _tlgKeywordOn(&DAT_5,1);

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

-        _uStack0000000000000090 = (char *)CONCAT44(uStack0000000000000094,0x80070057);

-        in_stack_000000a8 = "InvalidParameter";

-        in_stack_000000a0 = 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_9,param_3,param_4,(_tlgWrapSz<char> *)&stack0x000000a8,

-                   (_tlgWrapperByVal<4> *)&stack0x00000090,

-                   (_tlgWrapSz<unsigned_short> *)&stack0x000000a0);

-      }

-    }

-    uVar12 = 0;

+  if (((ulonglong)param_1 & uVar6) != 0) {

+                    /* WARNING: Subroutine does not return */

+    ExRaiseDatatypeMisalignment();

   }

-  else {

-LAB_1:

-    if (5 < DAT_3) {

-      p_Var11 = (_tlgProvider_t *)&DAT_3;

-      cVar2 = _tlgKeywordOn(&DAT_3,0x400000000000);

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

-        _uStack0000000000000090 = (char *)CONCAT44(uStack0000000000000094,0x80070005);

-        in_stack_000000a8 = "OnLockscreen";

-        uStack0000000000000048 = '\x01';

-        uStack0000000000000049 = '\0';

-        uStack000000000000004a = '\0';

-        uStack000000000000004b = '\0';

-        uStack000000000000004c = '\0';

-        uStack000000000000004d = '\0';

-        uStack000000000000004e = '\0';

-        uStack000000000000004f = '\0';

-        param_4 = (_GUID *)&stack0x00000048;

-        in_stack_000000a0 = 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_4,param_3,(_tlgWrapperByVal<8> *)param_4,

-                   (_tlgWrapSz<char> *)&stack0x000000a8,(_tlgWrapperByVal<4> *)&stack0x00000090,

-                   (_tlgWrapSz<unsigned_short> *)&stack0x000000a0);

-      }

-    }

-    pcVar13 = "OnLockscreen";

-    if (5 < DAT_5) {

-      p_Var11 = (_tlgProvider_t *)&DAT_5;

-      cVar2 = _tlgKeywordOn(&DAT_5,1);

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

-LAB_7:

-        _uStack0000000000000090 = (char *)CONCAT44(uStack0000000000000094,0x80070005);

-        in_stack_000000a0 = pcVar14;

-        in_stack_000000a8 = 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_9,param_3,param_4,(_tlgWrapSz<char> *)&stack0x000000a8,

-                   (_tlgWrapperByVal<4> *)&stack0x00000090,

-                   (_tlgWrapSz<unsigned_short> *)&stack0x000000a0);

-      }

-    }

-LAB_6:

-    uVar12 = 5;

+  puVar5 = param_1;

+  if (*(undefined1 **)MmUserProbeAddress_exref <= param_1) {

+    puVar5 = *(undefined1 **)MmUserProbeAddress_exref;

   }

-  BVar4 = 0;

-  UserSetLastError(uVar12);

+  *puVar5 = *puVar5;

+  puVar5[7] = puVar5[7];

+  RtlCopyVolatileMemory(param_1,local_res8,8);

 LAB_0:

   UserSessionSwitchLeaveCrit();

-  return (longlong)BVar4;

+  return (longlong)iVar1;

 }
```

## `NtUserGetResizeDCompositionSynchronizationObject`  (modified)

```diff
--- NtUserGetResizeDCompositionSynchronizationObject
+++ NtUserGetResizeDCompositionSynchronizationObject
@@ -1,52 +1,58 @@
 

-void NtUserGetResizeDCompositionSynchronizationObject

-               (ulonglong *param_1,byte *param_2,undefined1 *param_3,undefined1 *param_4)

+bool NtUserGetResizeDCompositionSynchronizationObject(HWND__ *param_1,longlong *param_2)

 

 {

-  ulonglong uVar1;

-  longlong in_RAX;

-  uint uVar2;

-  int iVar3;

-  undefined4 unaff_EBP;

-  undefined8 unaff_RSI;

-  undefined8 unaff_RDI;

-  int iVar4;

-  int iVar5;

+  int iVar1;

+  tagWND *ptVar2;

+  uint uVar3;

+  CompositionObject *pCVar4;

+  void *local_res10;

+  CompositionObject *local_res18 [2];

   

-  *(undefined4 *)(in_RAX + 0x10) = unaff_EBP;

-  *(undefined8 *)(in_RAX + 0x18) = unaff_RSI;

-  *(undefined8 *)(in_RAX + 0x20) = unaff_RDI;

-  do {

-    uVar1 = *param_1;

-    param_1 = param_1 + 1;

-    param_2 = param_2 + ((uVar1 & 0xffff) >> 0xf) * 3;

-    uVar2 = (uint)(ushort)(uVar1 >> 0x30);

-    iVar3 = param_2[2] * uVar2;

-    iVar4 = param_2[1] * uVar2;

-    iVar5 = *param_2 * uVar2;

-    uVar2 = (uint)(uVar1 >> 0x20) & 0xffff;

-    if ((uVar1 & 0xffff00000000) != 0) {

-      iVar3 = iVar3 + param_2[-1] * uVar2;

-      iVar4 = iVar4 + param_2[-2] * uVar2;

-      iVar5 = iVar5 + param_2[-3] * uVar2;

-      uVar2 = (uint)(uVar1 >> 0x10) & 0xffff;

-      if ((uVar1 & 0xffff0000) != 0) {

-        iVar3 = iVar3 + param_2[-4] * uVar2;

-        iVar4 = iVar4 + param_2[-5] * uVar2;

-        iVar5 = iVar5 + param_2[-6] * uVar2;

-        uVar2 = (uint)uVar1 & 0x3fff;

-        if ((uVar1 & 0x3fff) != 0) {

-          iVar3 = param_2[-7] * uVar2 + iVar3;

-          iVar4 = param_2[-8] * uVar2 + iVar4;

-          iVar5 = param_2[-9] * uVar2 + iVar5;

-        }

+                    /* 0x23d1f0  1748  NtUserGetResizeDCompositionSynchronizationObject */

+  local_res10 = (void *)0x0;

+  KeEnterCriticalRegion();

+  uVar3 = ~-(uint)(param_2 != (longlong *)0x0) & 0xc000000d;

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

+    iVar1 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+    local_res18[0] = (CompositionObject *)0x0;

+    if (iVar1 == 0) {

+      iVar1 = GetResizeDCompositionSynchronizationObject(param_1,local_res18);

+      pCVar4 = local_res18[0];

+      if ((iVar1 != 0) && (local_res18[0] != (CompositionObject *)0x0)) {

+        uVar3 = CompositionObject::CreateHandle(local_res18[0],1,false,'\0',&local_res10);

+        CompositionObject::Release(pCVar4);

       }

     }

-    param_3[2] = (char)(iVar3 + 0x1000U >> 0xd);

-    param_3[1] = (char)(iVar4 + 0x1000U >> 0xd);

-    *param_3 = (char)(iVar5 + 0x1000U >> 0xd);

-    param_3 = param_3 + 3;

-  } while (param_3 != param_4);

-  return;

+    else {

+      EnterCrit(0,0);

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

+      pCVar4 = (CompositionObject *)0x0;

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

+        GetResizeDCompositionSynchronizationObjectForWindow(ptVar2,local_res18);

+        pCVar4 = local_res18[0];

+      }

+      if (pCVar4 != (CompositionObject *)0x0) {

+        uVar3 = CompositionObject::CreateHandle(pCVar4,1,false,'\0',&local_res10);

+        CompositionObject::Release(pCVar4);

+      }

+      UserSessionSwitchLeaveCrit();

+    }

+  }

+  if (-1 < (int)uVar3) {

+    if (*(longlong **)MmUserProbeAddress_exref <= param_2) {

+      param_2 = *(longlong **)MmUserProbeAddress_exref;

+    }

+    *param_2 = (longlong)local_res10;

+    if (-1 < (int)uVar3) goto LAB_0;

+  }

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

+    ObCloseHandle(local_res10,1);

+  }

+  iVar1 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+  UserSetLastStatus(uVar3,iVar1 != 0);

+LAB_0:

+  KeLeaveCriticalRegion();

+  return -1 < (int)uVar3;

 }
```

## `xxxInitTerminal`  (modified)

```diff
--- xxxInitTerminal
+++ xxxReadPostMessage
@@ -1,142 +1,140 @@
 

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

-/* long __cdecl xxxInitTerminal(struct tagTERMINAL * __ptr64) */

+/* int __cdecl xxxReadPostMessage(struct tagTHREADINFO * __ptr64,struct tagMSG * __ptr64,struct

+   tagWND * __ptr64,unsigned int,unsigned int,int) */

 

-long __cdecl xxxInitTerminal(tagTERMINAL *param_1)

+int __cdecl

+xxxReadPostMessage(tagTHREADINFO *param_1,tagMSG *param_2,tagWND *param_3,uint param_4,uint param_5,

+                  int param_6)

 

 {

-  uint uVar1;

-  bool bVar2;

-  int iVar3;

-  longlong lVar4;

-  longlong lVar5;

+  undefined8 *puVar1;

+  tagMLIST *ptVar2;

+  ulonglong *puVar3;

+  undefined4 uVar4;

+  undefined4 uVar5;

   undefined8 uVar6;

-  undefined1 auStack_468 [32];

-  undefined8 *local_448;

-  undefined8 local_440;

-  undefined8 local_438;

-  undefined8 local_430;

-  undefined8 local_428;

-  undefined8 local_420;

-  undefined8 uStack_418;

-  undefined8 local_410;

-  undefined8 uStack_408;

-  undefined8 local_400;

-  undefined8 uStack_3f8;

-  undefined1 local_3e8 [52];

-  int local_3b4;

-  ulonglong local_28;

+  int iVar7;

+  uint uVar8;

+  long lVar9;

+  longlong lVar10;

+  longlong lVar11;

+  undefined4 uVar12;

   

-  local_28 = __security_cookie ^ (ulonglong)auStack_468;

-  local_430 = 0;

-  local_428 = 0;

-  memset(local_3e8,0,0x3b8);

-  local_420 = 0;

-  uStack_418 = 0;

-  local_410 = 0;

-  uStack_408 = 0;

-  local_400 = 0;

-  uStack_3f8 = 0;

-  if (*(longlong *)(param_1 + 0x38) == 0) {

-    local_420 = 0x30;

-    uStack_418 = 0;

-    uStack_408 = 0x200;

-    local_410 = 0;

-    bVar2 = false;

-    local_448 = (undefined8 *)((ulonglong)local_448 & 0xffffffffffffff00);

-    local_400 = 0;

-    uStack_3f8 = 0;

-    iVar3 = ZwCreateEvent(&local_430,0x1f0003,&local_420,0);

-    if (iVar3 < 0) {

-      return iVar3;

+  iVar7 = CheckQuitMessage(param_1,param_2,param_6);

+  if (iVar7 != 0) {

+    return 1;

+  }

+  ptVar2 = (tagMLIST *)(param_1 + 0x350);

+  lVar10 = FindQMsg(param_1,ptVar2,param_3,param_4,param_5,0);

+  if (lVar10 == 0) {

+    iVar7 = CheckQuitMessage(param_1,param_2,param_6);

+    if (iVar7 != 0) {

+      return 1;

     }

-    local_440 = 0;

-    local_438 = 0;

-    local_448 = &local_438;

-    iVar3 = ObReferenceObjectByHandle(local_430,0x1f0003,*(undefined8 *)ExEventObjectType_exref,0);

-    *(undefined8 *)(param_1 + 0x38) = local_438;

-    ZwClose(local_430);

-    if (iVar3 < 0) {

-      return iVar3;

+  }

+  else {

+    if (((*(int *)(lVar10 + 0x18) - 0x23bU < 2) &&

+        ((*(ulonglong *)(param_1 + 0x550) & 0x2000002000) == 0)) &&

+       (*(longlong *)(lVar10 + 0x28) == 1)) {

+      param_6 = 1;

     }

-    if (((*(uint *)param_1 & 2) == 0) && (iVar3 = xxxInitInput(param_1), iVar3 == 0)) {

-      iVar3 = -0x3fffffe9;

+    EtwTraceRetrievePostMessage(lVar10,param_6);

+    *(undefined4 *)(param_1 + 0x260) = *(undefined4 *)(lVar10 + 0x30);

+    if (*(longlong *)(param_1 + 0x31c) != *(longlong *)(lVar10 + 0x34)) {

+      LOCK();

+      *(uint *)(param_1 + 0x210) = *(uint *)(param_1 + 0x210) | 0x100000;

+      UNLOCK();

+    }

+    *(undefined4 *)(param_1 + 0x31c) = *(undefined4 *)(lVar10 + 0x34);

+    *(undefined4 *)(param_1 + 800) = *(undefined4 *)(lVar10 + 0x38);

+    puVar1 = (undefined8 *)(lVar10 + 0x10);

+    lVar11 = HMValidateHandleNoSecure(*puVar1,1);

+    if (lVar11 == 0) {

+      uVar12 = *(undefined4 *)(*(longlong *)(param_1 + 0x1d0) + 0x10c);

     }

     else {

-      local_448 = (undefined8 *)((ulonglong)local_448 & 0xffffffffffffff00);

-      iVar3 = ZwCreateEvent(&local_428,0x1f0003,&local_420,0);

-      if (-1 < iVar3) {

-        local_440 = 0;

-        local_438 = 0;

-        local_448 = &local_438;

-        iVar3 = ObReferenceObjectByHandle

-                          (local_428,0x1f0003,*(undefined8 *)ExEventObjectType_exref,0);

-        *(undefined8 *)(param_1 + 0x28) = local_438;

-        ZwClose(local_428);

-        if (-1 < iVar3) {

-          uVar6 = *(undefined8 *)(param_1 + 0x28);

-          iVar3 = InitCreateSystemThreadsMsg(local_3e8,1,param_1);

-          if (iVar3 != 0) {

-            UserSessionSwitchLeaveCrit();

-            lVar4 = W32GetUserGdiSessionState();

-            lVar4 = *(longlong *)(lVar4 + 0x28);

-            lVar5 = PsGetCurrentProcess();

-            if (lVar5 == lVar4) {

-              lVar4 = W32GetUserSessionState();

-              iVar3 = LpcRequestPort(*(undefined8 *)(lVar4 + 0x117d8),local_3e8);

-            }

-            else {

-              local_438 = 0x3b8;

-              lVar4 = W32GetUserSessionState();

-              local_440 = 0;

-              local_448 = &local_438;

-              iVar3 = LpcSendWaitReceivePort

-                                (*(undefined8 *)(lVar4 + 0x117d8),0x20000,local_3e8,local_3e8);

-            }

-            if (-1 < iVar3) {

-              lVar4 = W32GetUserGdiSessionState();

-              lVar4 = *(longlong *)(lVar4 + 0x28);

-              lVar5 = PsGetCurrentProcess();

-              if ((lVar5 == lVar4) || (-1 < local_3b4)) {

-                local_448 = (undefined8 *)0x0;

-                KeWaitForSingleObject(uVar6,0xd,0);

-                bVar2 = true;

-              }

-            }

-            EnterCrit(1);

-            if (bVar2) goto LAB_0;

-          }

-          ObfDereferenceObject(*(undefined8 *)(param_1 + 0x38));

-          ObfDereferenceObject(uVar6);

-          *(undefined8 *)(param_1 + 0x28) = 0;

-          goto LAB_1;

-        }

+      uVar12 = *(undefined4 *)(*(longlong *)(lVar11 + 0x28) + 0x120);

+    }

+    *(undefined4 *)(param_1 + 0x324) = uVar12;

+    *(undefined8 *)(param_1 + 0x328) = *(undefined8 *)(lVar10 + 0x50);

+    *(longlong *)(param_1 + 0x268) = lVar10;

+    *(undefined8 *)(*(longlong *)(param_1 + 0x1d8) + 0x208) = *(undefined8 *)(lVar10 + 0x48);

+    tagTHREADINFO::UpdateInputSource(param_1,(tagINPUT_MESSAGE_SOURCE *)(lVar10 + 0x7c));

+    uVar6 = *(undefined8 *)(lVar10 + 0x18);

+    *(undefined8 *)param_2 = *puVar1;

+    *(undefined8 *)(param_2 + 8) = uVar6;

+    uVar6 = *(undefined8 *)(lVar10 + 0x28);

+    *(undefined8 *)(param_2 + 0x10) = *(undefined8 *)(lVar10 + 0x20);

+    *(undefined8 *)(param_2 + 0x18) = uVar6;

+    uVar12 = *(undefined4 *)(lVar10 + 0x34);

+    uVar4 = *(undefined4 *)(lVar10 + 0x38);

+    uVar5 = *(undefined4 *)(lVar10 + 0x3c);

+    *(undefined4 *)(param_2 + 0x20) = *(undefined4 *)(lVar10 + 0x30);

+    *(undefined4 *)(param_2 + 0x24) = uVar12;

+    *(undefined4 *)(param_2 + 0x28) = uVar4;

+    *(undefined4 *)(param_2 + 0x2c) = uVar5;

+    if (param_6 == 0) {

+      *(undefined8 *)(param_1 + 0x268) = 1;

+    }

+    else {

+      puVar3 = *(ulonglong **)(param_1 + 0x208);

+      if ((*(uint *)(lVar10 + 100) & 1) == 0) {

+        *puVar3 = *puVar3 & 0xffffffffffffefff;

+      }

+      else {

+        *puVar3 = *puVar3 | 0x1000;

+      }

+      if (*(int *)(*(longlong *)ptVar2 + 0x18) == 0x312) {

+        CheckRemoveHotkeyBit(param_1,ptVar2);

+      }

+      LOCK();

+      uVar8 = *(uint *)(param_1 + 0x210);

+      if (uVar8 == 0) {

+        *(uint *)(param_1 + 0x210) = 0;

+        uVar8 = 0;

+      }

+      UNLOCK();

+      if (((uVar8 >> 10 & 1) != 0) && (lVar9 = CheckProcessForeground(param_1), lVar9 < 0)) {

+        return 0;

+      }

+      DelQEntry(ptVar2,lVar10,1);

+    }

+    if (*(uint *)(param_2 + 8) + 0x7ffffc1f < 8) {

+      *(uint *)(param_2 + 8) = *(uint *)(param_2 + 8) & 0x7fffffff;

+      xxxDDETrackGetMessageHook(param_2);

+      if ((param_6 == 0) &&

+         (lVar11 = FindQMsg(param_1,ptVar2,param_3,param_4,param_5,0), lVar10 == lVar11)) {

+        uVar6 = *(undefined8 *)(param_2 + 8);

+        *puVar1 = *(undefined8 *)param_2;

+        *(undefined8 *)(lVar10 + 0x18) = uVar6;

+        uVar6 = *(undefined8 *)(param_2 + 0x18);

+        *(undefined8 *)(lVar10 + 0x20) = *(undefined8 *)(param_2 + 0x10);

+        *(undefined8 *)(lVar10 + 0x28) = uVar6;

+        uVar6 = *(undefined8 *)(param_2 + 0x28);

+        *(undefined8 *)(lVar10 + 0x30) = *(undefined8 *)(param_2 + 0x20);

+        *(undefined8 *)(lVar10 + 0x38) = uVar6;

       }

     }

-    ObfDereferenceObject(*(undefined8 *)(param_1 + 0x38));

-    *(undefined8 *)(param_1 + 0x38) = 0;

   }

-  else {

-    uVar6 = *(undefined8 *)(param_1 + 0x28);

-    ObfReferenceObject(uVar6);

-    UserSessionSwitchLeaveCrit();

-    local_448 = (undefined8 *)0x0;

-    KeWaitForSingleObject(uVar6,0xd,0,0);

-    EnterCrit(1);

-LAB_0:

-    ObfDereferenceObject(uVar6);

-    uVar1 = *(uint *)param_1;

-    *(undefined8 *)(param_1 + 0x28) = 0;

-    if ((uVar1 & 8) == 0) {

-      *(uint *)param_1 = uVar1 | 1;

-      return 0;

+  if (*(int *)(param_1 + 0x360) == 0) {

+    LOCK();

+    uVar8 = *(uint *)(param_1 + 0x210);

+    if (uVar8 == 0) {

+      *(uint *)(param_1 + 0x210) = 0;

+      uVar8 = 0;

     }

-    *(uint *)param_1 = uVar1 & 0xfffffff7;

-    ObfDereferenceObject(*(undefined8 *)(param_1 + 0x38));

-LAB_1:

-    *(undefined8 *)(param_1 + 0x38) = 0;

-    iVar3 = -0x3fffffe9;

+    UNLOCK();

+    if ((uVar8 >> 0x1e & 1) == 0) {

+      LOCK();

+      *(uint *)(*(longlong *)(param_1 + 0x1e8) + 8) =

+           *(uint *)(*(longlong *)(param_1 + 0x1e8) + 8) & 0xfffffef7;

+      UNLOCK();

+      LOCK();

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

+           *(uint *)(*(longlong *)(param_1 + 0x1e8) + 4) & 0xfffffeff;

+      UNLOCK();

+    }

   }

-  return iVar3;

+  return (int)(lVar10 != 0);

 }
```

## `xxxEstablishWebviewHostComponentRelationship`  (modified)

```diff
--- xxxEstablishWebviewHostComponentRelationship
+++ xxxEstablishWebviewHostComponentRelationship
@@ -1,51 +1,17 @@
+

+/* void __cdecl xxxEstablishWebviewHostComponentRelationship(struct tagWND * __ptr64,struct tagWND *

+   __ptr64) */

 

 void __cdecl xxxEstablishWebviewHostComponentRelationship(tagWND *param_1,tagWND *param_2)

 

 {

-  uint in_EAX;

   int iVar1;

-  undefined4 in_register_00000004;

-  longlong lVar2;

-  tagWND *unaff_RBX;

   

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

-    *(undefined4 *)(CONCAT44(in_register_00000004,in_EAX) + 0x52a8) = 3;

-  }

-  iVar1 = *(int *)(CONCAT44(in_register_00000004,in_EAX) + 0x52a8);

-  if (iVar1 == 1) {

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

-              ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x00000030,unaff_RBX);

-    xxxFlashWindow();

-LAB_0:

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

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

-  }

-  else {

-    if (iVar1 == 2) {

-      iVar1 = IsWindowDesktopComposed();

-      if (iVar1 == 0) {

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

-                  ((Win32HMThreadLockBase<tagWND,1,0> *)&stack0x00000030,unaff_RBX);

-        xxxRedrawWindow();

-        goto LAB_0;

-      }

-      lVar2 = W32GetUserSessionState();

-      lVar2 = lVar2 + 0x52ac;

-    }

-    else {

-      if (iVar1 != 3) goto LAB_1;

-      lVar2 = 0;

-    }

-    xxxRedrawWindow(0,lVar2,0,0x10285);

-  }

-LAB_1:

-  *(undefined4 *)((ulonglong)in_EAX + 0x52a8) = 0;

-  lVar2 = W32GetUserSessionState();

-  *(undefined8 *)(lVar2 + 0x5298) = 0;

-  lVar2 = W32GetUserSessionState();

-  FindTimer(0,*(undefined8 *)(lVar2 + 0x52a0),4,1,0);

-  lVar2 = W32GetUserSessionState();

-  *(undefined8 *)(lVar2 + 0x52a0) = 0;

+  SetOrClrWF(0,param_1,0xf80,1);

+  SetOrClrWF(1,param_1,0xf40);

+  xxxSetWindowStyle(param_1,0xffffffec);

+  iVar1 = Feature_UIPIEliminateATIOverride__private_IsEnabledDeviceUsageNoInline();

+  xxxSetParentWorker(param_1,param_2,(tagWND *)0x0,(uint)(iVar1 == 0));

   return;

 }
```

## `InputCoreProviderCallbackWorker`  (modified)

```diff
--- InputCoreProviderCallbackWorker
+++ InputCoreProviderCallbackWorker
@@ -1,333 +1,42 @@
+

+/* void __cdecl InputCoreProviderCallbackWorker(void) */

 

 void __cdecl InputCoreProviderCallbackWorker(void)

 

 {

-  undefined4 uVar1;

-  CInputGlobals *this;

-  int iVar2;

-  int in_EAX;

+  longlong lVar1;

+  bool bVar2;

   int iVar3;

-  longlong lVar4;

-  void *pvVar5;

-  ulong *puVar6;

-  tagPROCESSINFO *ptVar7;

-  char cVar8;

-  uint unaff_EBX;

-  longlong unaff_RBP;

-  byte bVar9;

-  uint unaff_ESI;

-  byte bVar10;

-  uint unaff_EDI;

-  undefined8 in_R9;

-  uint unaff_R12D;

-  uint uVar11;

-  char unaff_R13B;

-  tagPROCESSINFO *unaff_R14;

-  uint uVar12;

-  bool bVar13;

-  undefined4 in_stack_00000028;

-  undefined4 in_stack_0000002c;

-  undefined4 uStack0000000000000048;

+  tagPROCESS_HID_TABLE *ptVar4;

+  CTempW32ThreadNonPaged local_c8 [192];

   

-  bVar13 = (int)WPP_RECORDER_INITIALIZED == in_EAX;

-code_r0x000140289be6:

-  cVar8 = (char)unaff_ESI;

-  if (((char)unaff_EBX != '\0') || (!bVar13)) {

-    lVar4 = W32GetUserSessionState();

-    in_R9 = *(undefined8 *)(lVar4 + 0x10f88);

-    in_stack_00000028 = 2;

-    WPP_RECORDER_AND_TRACE_SF_

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)unaff_EBX,!bVar13,in_R9,4);

+  lVar1 = W32GetUserSessionState();

+  if (*(int *)(lVar1 + 0x11248) != 0) {

+    iVar3 = UserIsDisconnectConnection();

+    if (iVar3 == 0) {

+      lVar1 = W32GetUserSessionState();

+      if (*(longlong *)(lVar1 + 0x8e68) != 0) {

+        CTempW32ThreadNonPaged::CTempW32ThreadNonPaged(local_c8);

+        lVar1 = W32GetUserSessionState();

+        InputTraceLogging::Cursor::SetCursorSuppression

+                  (*(CURSOR_SUPPRESSION_STATE *)(lVar1 + 0x8e8c));

+        lVar1 = W32GetUserSessionState();

+        CursorApiRouter::TraceCurrentState(*(CursorApiRouter **)(lVar1 + 0x8e68));

+        bVar2 = InputTraceLogging::Enabled(0x40000,'\0');

+        if (bVar2) {

+          EnterCrit(1);

+          lVar1 = W32GetUserSessionState();

+          for (ptVar4 = *(tagPROCESS_HID_TABLE **)(lVar1 + 0xd8);

+              ptVar4 != (tagPROCESS_HID_TABLE *)(lVar1 + 0xd8);

+              ptVar4 = *(tagPROCESS_HID_TABLE **)ptVar4) {

+            InputTraceLogging::RawInput::RawInputListener(ptVar4);

+          }

+          UserSessionSwitchLeaveCrit();

+        }

+        CTempW32ThreadNonPaged::~CTempW32ThreadNonPaged(local_c8);

+      }

+    }

   }

-  pvVar5 = (void *)PsGetProcessInheritedFromUniqueProcessId(*(undefined8 *)(unaff_RBP + -0x21));

-  *(void **)(unaff_RBP + 0x7f) = pvVar5;

-  bVar10 = (byte)unaff_EDI;

-  uVar11 = unaff_R12D;

-  if (unaff_R13B == '\0') goto LAB_0;

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-     (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    uVar11 = 0;

-  }

-  bVar13 = (undefined **)CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-           &WPP_RECORDER_INITIALIZED;

-  if (((char)uVar11 != '\0') || (bVar13)) {

-    lVar4 = W32GetUserSessionState();

-    in_R9 = *(undefined8 *)(lVar4 + 0x10f88);

-    in_stack_00000028 = 2;

-    WPP_RECORDER_AND_TRACE_SF_

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)uVar11,bVar13,in_R9,4);

-  }

-  bVar9 = 0;

-  unaff_R13B = '\0';

-  lVar4 = PsReferencePrimaryToken(*(undefined8 *)(unaff_RBP + -0x21));

-  if (lVar4 == 0) goto LAB_1;

-  *(undefined8 *)(unaff_RBP + -0x49) = 0;

-  iVar3 = SeQueryAuthenticationIdToken(lVar4,unaff_RBP + -0x49);

-  if (iVar3 < 0) goto LAB_1;

-  if ((*(int *)(unaff_RBP + -0x49) != *(int *)luidSystem_exref) ||

-     (*(int *)(unaff_RBP + -0x45) != *(int *)(luidSystem_exref + 4))) {

-    unaff_ESI = 0;

-    goto LAB_1;

-  }

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29])) {

-    bVar9 = bVar10;

-  }

-  bVar13 = (undefined **)CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-           &WPP_RECORDER_INITIALIZED;

-  if ((bVar9 != 0) || (bVar13)) {

-    lVar4 = W32GetUserSessionState();

-    in_R9 = *(undefined8 *)(lVar4 + 0x10f88);

-    in_stack_00000028 = 2;

-    WPP_RECORDER_AND_TRACE_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar9,bVar13,in_R9,4);

-  }

-  *(uint *)(unaff_R14 + 0xc) = *(uint *)(unaff_R14 + 0xc) | 0x80000;

-  unaff_R12D = *(uint *)(unaff_RBP + 0x77);

-  do {

-    unaff_ESI = unaff_EDI & 0xff;

-LAB_1:

-    do {

-      cVar8 = (char)unaff_ESI;

-      pvVar5 = *(void **)(unaff_RBP + 0x7f);

-      uVar11 = unaff_R12D;

-LAB_0:

-      uVar12 = 0;

-      CLockProcessByPid::~CLockProcessByPid((CLockProcessByPid *)(unaff_RBP + -0x39));

-      if (cVar8 != '\0') goto LAB_2;

-      unaff_R12D = uVar11 + unaff_EDI;

-      *(uint *)(unaff_RBP + 0x77) = unaff_R12D;

-      if (4 < uVar11) {

-LAB_3:

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

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-           (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-          uVar11 = uVar12;

-        }

-        bVar13 = (undefined **)

-                 CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                 &WPP_RECORDER_INITIALIZED;

-        if (((char)uVar11 != '\0') || (bVar13)) {

-          lVar4 = W32GetUserSessionState();

-          WPP_RECORDER_AND_TRACE_SF_

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)uVar11,bVar13,

-                     *(undefined8 *)(lVar4 + 0x10f88),4);

-        }

-        lVar4 = W32GetUserSessionState();

-        if (*(longlong *)(lVar4 + 0x4a60) != 0) {

-          lVar4 = W32GetUserSessionState();

-          if ((*(uint *)(*(longlong *)(lVar4 + 0x4a60) + 0x2a0) < 0x401) &&

-             ((*(uint *)(*(longlong *)(lVar4 + 0x4a60) + 0x2b0) & 0x40) != 0)) {

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

-               (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0 ||

-                (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)))) {

-              uVar11 = uVar12;

-            }

-            bVar13 = (undefined **)

-                     CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                     &WPP_RECORDER_INITIALIZED;

-            if (((char)uVar11 != '\0') || (bVar13)) {

-              lVar4 = W32GetUserSessionState();

-              WPP_RECORDER_AND_TRACE_SF_

-                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)uVar11,bVar13,

-                         *(undefined8 *)(lVar4 + 0x10f88),4);

-            }

-          }

-        }

-LAB_2:

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

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

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

-          unaff_EDI = 0;

-        }

-        bVar13 = (undefined **)

-                 CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                 &WPP_RECORDER_INITIALIZED;

-        if (((char)unaff_EDI != '\0') || (bVar13)) {

-          uVar1 = *(undefined4 *)(*(longlong *)(unaff_RBP + 0x6f) + 0x38);

-          lVar4 = W32GetUserSessionState();

-          uStack0000000000000048 = uVar1;

-          WPP_RECORDER_AND_TRACE_SF_sD

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)unaff_EDI,bVar13,

-                     *(undefined8 *)(lVar4 + 0x10f88));

-        }

-        return;

-      }

-      CLockProcessByPid::CLockProcessByPid

-                ((CLockProcessByPid *)(unaff_RBP + -0x39),pvVar5,0,(ulong)in_R9,0,

-                 CONCAT44(in_stack_0000002c,in_stack_00000028));

-      bVar9 = 0;

-      if (*(int *)(unaff_RBP + -0x31) < 0) {

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

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-           (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-          uVar11 = uVar12;

-        }

-        bVar13 = (undefined **)

-                 CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                 &WPP_RECORDER_INITIALIZED;

-        cVar8 = (char)uVar11;

-        if ((cVar8 != '\0') || (bVar13)) {

-          lVar4 = W32GetUserSessionState();

-LAB_4:

-          WPP_RECORDER_AND_TRACE_SF_

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar8,bVar13,

-                     *(undefined8 *)(lVar4 + 0x10f88),4);

-        }

-LAB_5:

-        bVar13 = CForegroundLaunch::_HasLegacyForegroundActivateRight

-                           (*(CForegroundLaunch **)(unaff_RBP + 0x67),

-                            (_EPROCESS *)**(undefined8 **)(unaff_RBP + 0x6f));

-        if (bVar13) {

-          bVar9 = bVar10;

-        }

-LAB_6:

-        CLockProcessByPid::~CLockProcessByPid((CLockProcessByPid *)(unaff_RBP + -0x39));

-        if (bVar9 != 0) goto LAB_2;

-        goto LAB_3;

-      }

-      iVar3 = *(int *)(unaff_RBP + -0x11);

-      iVar2 = W32GetCurrentWin32kSessionId();

-      if (iVar2 != iVar3) {

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

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-           (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-          uVar11 = uVar12;

-        }

-        bVar13 = (undefined **)

-                 CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                 &WPP_RECORDER_INITIALIZED;

-        if (((char)uVar11 != '\0') || (bVar13)) {

-          lVar4 = W32GetUserSessionState();

-          WPP_RECORDER_AND_TRACE_SF_

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)uVar11,bVar13,

-                     *(undefined8 *)(lVar4 + 0x10f88),4);

-        }

-        lVar4 = W32GetUserSessionState();

-        this = *(CInputGlobals **)(lVar4 + 0xbf0);

-        puVar6 = (ulong *)UPDWORDPointer(0x2000);

-        bVar13 = CInputGlobals::IsTimeFromLastInputEvent(this,*puVar6);

-        if (bVar13) {

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

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-             (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-            uVar11 = uVar12;

-          }

-          bVar13 = (undefined **)

-                   CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                   &WPP_RECORDER_INITIALIZED;

-          cVar8 = (char)uVar11;

-          if ((cVar8 != '\0') || (bVar9 = bVar10, bVar13)) {

-            lVar4 = W32GetUserSessionState();

-LAB_7:

-            WPP_RECORDER_AND_TRACE_SF_

-                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar8,bVar13,

-                       *(undefined8 *)(lVar4 + 0x10f88),4);

-            bVar9 = bVar10;

-          }

-        }

-        else if (unaff_R13B != '\0') {

-          if ((bVar10 & (byte)*(undefined4 *)(*(longlong *)(unaff_RBP + 0x6f) + 0xc)) == 0) {

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

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-               (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-              uVar11 = uVar12;

-            }

-            bVar13 = (undefined **)

-                     CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                     &WPP_RECORDER_INITIALIZED;

-            if (((char)uVar11 != '\0') || (bVar13)) {

-              lVar4 = W32GetUserSessionState();

-              WPP_RECORDER_AND_TRACE_SF_

-                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)uVar11,bVar13,

-                         *(undefined8 *)(lVar4 + 0x10f88),4);

-            }

-          }

-          else {

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

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-               (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-              uVar11 = uVar12;

-            }

-            bVar13 = (undefined **)

-                     CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                     &WPP_RECORDER_INITIALIZED;

-            cVar8 = (char)uVar11;

-            if ((cVar8 != '\0') || (bVar9 = bVar10, bVar13)) {

-              lVar4 = W32GetUserSessionState();

-              goto LAB_7;

-            }

-          }

-        }

-        goto LAB_6;

-      }

-      unaff_R14 = (tagPROCESSINFO *)PsGetProcessWin32Process(*(undefined8 *)(unaff_RBP + -0x21));

-      if ((unaff_R14 == (tagPROCESSINFO *)0x0) || (*(longlong *)unaff_R14 == 0)) {

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

-           (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0 ||

-            (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)))) {

-          uVar11 = uVar12;

-        }

-        bVar13 = (undefined **)

-                 CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                 &WPP_RECORDER_INITIALIZED;

-        cVar8 = (char)uVar11;

-        if ((cVar8 != '\0') || (bVar13)) {

-          lVar4 = W32GetUserSessionState();

-          goto LAB_4;

-        }

-        goto LAB_5;

-      }

-      if ((unaff_R13B == '\0') &&

-         ((ptVar7 = unaff_R14, iVar3 = IsShellProcess(), iVar3 != 0 ||

-          ((*(longlong *)(ptVar7 + 0x290) != 0 &&

-           ((*(uint *)(*(longlong *)(ptVar7 + 0x290) + 0x40) & 4) != 0)))))) {

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

-           (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0 ||

-            (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)))) {

-          uVar11 = uVar12;

-        }

-        bVar13 = (undefined **)

-                 CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-                 &WPP_RECORDER_INITIALIZED;

-        if (((char)uVar11 != '\0') || (bVar13)) {

-          lVar4 = W32GetUserSessionState();

-          WPP_RECORDER_AND_TRACE_SF_

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)uVar11,bVar13,

-                     *(undefined8 *)(lVar4 + 0x10f88),4);

-        }

-        CLockProcessByPid::~CLockProcessByPid((CLockProcessByPid *)(unaff_RBP + -0x39));

-        goto LAB_3;

-      }

-      bVar13 = CanForceForeground(unaff_R14);

-      unaff_ESI = (uint)bVar13;

-    } while (bVar13);

-    if ((*(tagTHREADINFO **)(unaff_R14 + 0x148) == (tagTHREADINFO *)0x0) ||

-       (bVar13 = tagTHREADINFO::ComputeAndTestForegroundActivate

-                           (*(tagTHREADINFO **)(unaff_R14 + 0x148)), !bVar13)) break;

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) ||

-       (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      uVar11 = uVar12;

-    }

-    bVar13 = (undefined **)CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) !=

-             &WPP_RECORDER_INITIALIZED;

-    if (((char)uVar11 != '\0') || (bVar13)) {

-      lVar4 = W32GetUserSessionState();

-      in_R9 = *(undefined8 *)(lVar4 + 0x10f88);

-      in_stack_00000028 = 2;

-      WPP_RECORDER_AND_TRACE_SF_d

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)uVar11,bVar13,in_R9,4);

-    }

-  } while( true );

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

-     (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0 ||

-      (uVar11 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)))) {

-    uVar11 = uVar12;

-  }

-  unaff_EBX = uVar11 & 0xff;

-  bVar13 = (undefined **)CONCAT44(WPP_RECORDER_INITIALIZED._4_4_,(int)WPP_RECORDER_INITIALIZED) ==

-           &WPP_RECORDER_INITIALIZED;

-  goto code_r0x000140289be6;

+  return;

 }
```

## `xxxSetBridgeWindowChild`  (modified)

```diff
--- xxxSetBridgeWindowChild
+++ xxxSetBridgeWindowChild
@@ -1,14 +1,38 @@
 

-int xxxSetBridgeWindowChild(byte param_1)

+undefined4 xxxSetBridgeWindowChild(tagWND *param_1,tagWND *param_2)

 

 {

-  byte *pbVar1;

-  byte bVar2;

-  longlong in_RAX;

+  int iVar1;

+  tagWND *ptVar2;

+  tagTHREADINFO *ptVar3;

+  undefined4 uVar4;

+  _Win32HMThreadLockItem local_18 [16];

   

-  pbVar1 = (byte *)(in_RAX + -1);

-  bVar2 = *pbVar1;

-  *pbVar1 = *pbVar1 + param_1;

-  return (int)in_RAX + 0x10f44e + (uint)CARRY1(bVar2,param_1);

+  uVar4 = 1;

+  SetOrClrWF(1,param_1,0xd908,1);

+  SetOrClrWF(0,param_2,0xf80,1);

+  SetOrClrWF(1,param_2,0xf40,1);

+  xxxSetWindowStyle(param_2,0xffffffec);

+  iVar1 = Feature_UIPIEliminateATIOverride__private_IsEnabledDeviceUsageNoInline();

+  xxxSetParentWorker(param_2,param_1,(tagWND *)0x0,(uint)(iVar1 == 0));

+  if ((*(tagWND **)(param_2 + 0x68) == param_1) &&

+     (*(longlong *)(*(longlong *)(param_2 + 0x10) + 0x1d8) ==

+      *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x1d8))) {

+    iVar1 = CoreWindowProp::IsHost(param_2);

+    if ((iVar1 != 0) &&

+       (ptVar2 = CoreWindowProp::GetNextComponentWindow(param_2,(tagWND *)0x0),

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

+      ptVar3 = PtiCurrent();

+      Win32HM_LockIntoThread<0>(ptVar3,(_HEAD *)ptVar2,local_18);

+      xxxEstablishWebviewHostComponentRelationship(ptVar2,param_2);

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

+                ((Win32HMThreadLockBase<tagWND,0,0> *)local_18);

+    }

+  }

+  else {

+    SetOrClrWF(0,param_1,0xd908,1);

+    uVar4 = 0;

+  }

+  return uVar4;

 }
```

## `DoesRequireResizeLayoutSynchronization`  (modified)

```diff
--- DoesRequireResizeLayoutSynchronization
+++ DoesRequireResizeLayoutSynchronization
@@ -1,10 +1,34 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* int __cdecl DoesRequireResizeLayoutSynchronization(struct tagWND * __ptr64) */

 

 int __cdecl DoesRequireResizeLayoutSynchronization(tagWND *param_1)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  int iVar1;

+  longlong lVar2;

+  int iVar3;

+  int iVar4;

+  

+  iVar3 = 0;

+  iVar1 = _IsTopLevelWindow();

+  iVar4 = 0;

+  if ((iVar1 != 0) && (iVar4 = iVar3, *(char *)(*(longlong *)(param_1 + 0x28) + 0x19) < '\0')) {

+    iVar1 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+    if (iVar1 == 0) {

+      for (lVar2 = *(longlong *)(param_1 + 0x70); lVar2 != 0; lVar2 = *(longlong *)(lVar2 + 0x58)) {

+        if (*(char *)(*(longlong *)(lVar2 + 0x28) + 0x19) < '\0') goto LAB_0;

+      }

+    }

+    else if (*(int *)(param_1 + 0x17c) < 0) {

+LAB_0:

+      iVar4 = 1;

+    }

+    else {

+      for (lVar2 = *(longlong *)(param_1 + 0x70); lVar2 != 0; lVar2 = *(longlong *)(lVar2 + 0x58)) {

+        if (*(char *)(*(longlong *)(lVar2 + 0x28) + 0x19) < '\0') goto LAB_0;

+      }

+    }

+  }

+  return iVar4;

 }
```

## `OnHideAppStartCursor`  (modified)

```diff
--- OnHideAppStartCursor
+++ OnHideAppStartCursor
@@ -1,136 +1,69 @@
+

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

+/* void __cdecl OnHideAppStartCursor(void) */

 

 void __cdecl OnHideAppStartCursor(void)

 

 {

-  longlong *plVar1;

-  int iVar2;

-  long lVar3;

-  longlong in_RAX;

-  longlong lVar4;

-  undefined8 in_RDX;

-  byte unaff_BPL;

-  char cVar5;

-  longlong unaff_RDI;

-  undefined8 in_R8;

-  longlong unaff_R12;

-  undefined4 unaff_R13D;

-  longlong unaff_R14;

-  bool bVar6;

-  undefined4 uStack0000000000000028;

-  undefined2 uStack0000000000000030;

+  int iVar1;

+  longlong lVar2;

+  tagTHREADINFO *ptVar3;

+  longlong *plVar4;

+  uint uVar5;

+  longlong lVar6;

+  AtomicExecutionCheck local_18 [8];

+  undefined8 local_10;

   

-  uStack0000000000000030 = 0x15;

-  uStack0000000000000028 = 0x14;

-  WPP_RECORDER_AND_TRACE_SF_

-            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),in_RDX,in_R8,

-             *(undefined8 *)(in_RAX + 0x10f88));

-  lVar4 = W32GetUserSessionState();

-  *(undefined4 *)(lVar4 + 0x8ecc) = unaff_R13D;

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

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

-     (cVar5 = (char)unaff_R13D, (byte)WPP_GLOBAL_Control[0x29] < unaff_BPL)) {

-    cVar5 = (char)unaff_R12;

-  }

-  bVar6 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar5 != '\0') || (bVar6)) {

-    lVar4 = W32GetUserSessionState();

-    uStack0000000000000030 = 0x16;

-    uStack0000000000000028 = 0x14;

-    WPP_RECORDER_AND_TRACE_SF_qd

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar6,

-               *(undefined8 *)(lVar4 + 0x10f88),4);

-  }

-  lVar4 = W32GetUserSessionState();

-  *(longlong *)(lVar4 + 0x4b78) = unaff_R12;

-  ForceCapture(3);

-  FreeScancodeMap();

-  lVar4 = W32GetUserSessionState();

-  if (*(longlong *)(lVar4 + 0xdf10) != unaff_R12) {

-    FreeAllSpbs();

-  }

-  if (*(longlong *)(unaff_RDI + 0x10e80) != 0) {

-    ZwClose();

-    *(longlong *)(unaff_RDI + 0x10e80) = unaff_R12;

-  }

-  if (*(longlong *)(unaff_RDI + 0x10e78) != 0) {

-    ObCloseHandle(*(longlong *)(unaff_RDI + 0x10e78),0);

-    *(longlong *)(unaff_RDI + 0x10e78) = unaff_R12;

-  }

-  lVar4 = W32GetUserSessionState();

-  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar4 + 0xf688));

-  lVar4 = W32GetUserSessionState();

-  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar4 + 0xf690));

-  lVar4 = W32GetUserSessionState();

-  while (plVar1 = *(longlong **)(lVar4 + 0xe150), plVar1 != (longlong *)(lVar4 + 0xe150)) {

-    FreeTimer(plVar1 + -9);

-  }

-  TerminateDesktopThreads();

-  lVar4 = W32GetUserSessionState();

-  if (*(int *)(lVar4 + 0x10df4) != (int)unaff_R12) {

-    if (*(int *)(unaff_RDI + 0x10dfc) == (int)unaff_R12) {

-      GreDrvDisconnect();

+  lVar6 = (ulonglong)_DAT_0 * _DAT_fffff78000000320;

+  lVar2 = W32GetUserSessionState();

+  uVar5 = (uint)((ulonglong)lVar6 >> 0x18);

+  if (*(uint *)(lVar2 + 0x8e28) <= uVar5) {

+    ptVar3 = PtiCurrent();

+    lVar2 = W32GetUserSessionState();

+    if (ptVar3 != *(tagTHREADINFO **)(lVar2 + 0x4970)) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xa74);

+    }

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

+    local_10 = 0;

+    AtomicExecutionCheck::Arm(local_18);

+    iVar1 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+    if (iVar1 == 0) {

+      zzzCalcStartCursorHide(0,0);

     }

     else {

-      bDrvDisconnect(*(undefined8 *)(unaff_RDI + 0x10e28),*(undefined8 *)(unaff_RDI + 0x10e20),

-                     *(undefined8 *)(unaff_RDI + 0x10e40));

+      lVar2 = W32GetUserSessionState();

+      *(undefined4 *)(lVar2 + 0x8e28) = 0;

+      lVar2 = W32GetUserSessionState();

+      plVar4 = (longlong *)(lVar2 + 0x8e18);

+      while (lVar2 = *plVar4, lVar2 != 0) {

+        if ((*(uint *)(lVar2 + 0xc) & 4) == 0) {

+                    /* WARNING: Subroutine does not return */

+          KeBugCheckEx(0x164,0x12,0,0,0);

+        }

+        if ((int)(uVar5 - *(int *)(lVar2 + 0x18)) < 1) {

+          lVar6 = W32GetUserSessionState();

+          iVar1 = *(int *)(lVar2 + 0x18);

+          if (0 < iVar1 - *(int *)(lVar6 + 0x8e28)) {

+            lVar6 = W32GetUserSessionState();

+            *(int *)(lVar6 + 0x8e28) = iVar1;

+          }

+          plVar4 = (longlong *)(lVar2 + 0x20);

+        }

+        else {

+          *(uint *)(lVar2 + 0xc) = *(uint *)(lVar2 + 0xc) & 0xfffffffb;

+          *plVar4 = *(longlong *)(lVar2 + 0x20);

+          *(undefined8 *)(lVar2 + 0x20) = 0;

+        }

+      }

+      lVar2 = W32GetUserSessionState();

+      if (-1 < (int)(uVar5 - *(int *)(lVar2 + 0x8e28))) {

+        lVar2 = W32GetUserSessionState();

+        *(undefined4 *)(lVar2 + 0x8e28) = 0;

+      }

+      zzzUpdateCursorImage();

     }

-  }

-  lVar4 = W32GetUserSessionState();

-  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar4 + 0x4b58));

-  lVar4 = W32GetUserSessionState();

-  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar4 + 0xf600));

-  lVar4 = W32GetUserSessionState();

-  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar4 + 0x4b60));

-  lVar4 = W32GetUserSessionState();

-  if (*(longlong *)(lVar4 + 0x117d8) != unaff_R12) {

-    lVar4 = W32GetUserSessionState();

-    ObfDereferenceObject(*(undefined8 *)(lVar4 + 0x117d8));

-    lVar4 = W32GetUserSessionState();

-    *(longlong *)(lVar4 + 0x117d8) = unaff_R12;

-  }

-  lVar4 = W32GetUserSessionState();

-  HMAssignmentUnlock(lVar4 + 0x8e30);

-  lVar4 = W32GetUserSessionState();

-  HMAssignmentUnlock(lVar4 + 0x8e38);

-  LOCK();

-  *(uint *)(unaff_R14 + 0x210) = *(uint *)(unaff_R14 + 0x210) & 0xfffff7ff;

-  UNLOCK();

-  lVar4 = W32GetUserSessionState();

-  *(longlong *)(lVar4 + 0x4970) = unaff_R12;

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

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

-     (cVar5 = (char)unaff_R13D, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar5 = (char)unaff_R12;

-  }

-  bVar6 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar5 != '\0') || (bVar6)) {

-    lVar4 = W32GetUserSessionState();

-    uStack0000000000000030 = 0x17;

-    uStack0000000000000028 = 0x14;

-    WPP_RECORDER_AND_TRACE_SF_

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar6,

-               *(undefined8 *)(lVar4 + 0x10f88),4);

-  }

-  UserSessionSwitchLeaveCrit();

-  iVar2 = IsCurrentSessionHostServiceSession();

-  if (iVar2 == 0) {

-    lVar3 = CreateShutdownEvent((ushort *)L"EventRitExited",0x80,(void **)&stack0x00000098);

-    if (-1 < lVar3) {

-      ZwSetEvent(unaff_R12,0);

-      ZwClose(unaff_R12);

-    }

-  }

-  HYDRA_HINT(0x1000);

-  lVar4 = W32GetUserSessionState();

-  if (*(longlong *)(lVar4 + 0x10c80) != unaff_R12) {

-    lVar4 = W32GetUserSessionState();

-    KeSetEvent(*(undefined8 *)(lVar4 + 0x10c80),unaff_R13D,0);

-  }

-  lVar4 = W32GetUserSessionState();

-  if (*(longlong *)(lVar4 + 0x10c88) != unaff_R12) {

-    lVar4 = W32GetUserSessionState();

-    KeSetEvent(*(undefined8 *)(lVar4 + 0x10c88),unaff_R13D,0);

+    AtomicExecutionCheck::Disarm(local_18);

   }

   return;

 }
```

## `xxxCreateWindowStation`  (modified)

```diff
--- xxxCreateWindowStation
+++ xxxCreateWindowStation
@@ -1,23 +1,352 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* long __cdecl xxxCreateWindowStation(struct _OBJECT_ATTRIBUTES * __ptr64,char,unsigned long,void *

+   __ptr64,unsigned long,unsigned long,struct tagKBDTABLE_MULT_INTERNAL * __ptr64,unsigned short

+   const * __ptr64,unsigned int,enum tagWINDOWSTATIONFLAGS,unsigned long,struct HWINSTA__ * __ptr64

+   * __ptr64) */

 

 long __cdecl

 xxxCreateWindowStation

           (_OBJECT_ATTRIBUTES *param_1,char param_2,ulong param_3,void *param_4,ulong param_5,

           ulong param_6,tagKBDTABLE_MULT_INTERNAL *param_7,ushort *param_8,uint param_9,

           tagWINDOWSTATIONFLAGS param_10,ulong param_11,HWINSTA__ **param_12)

 

 {

-  _OBJECT_ATTRIBUTES *p_Var1;

+  tagTERMINAL *ptVar1;

   code *pcVar2;

-  byte bVar3;

+  char cVar3;

+  int iVar4;

+  undefined4 uVar5;

+  int iVar6;

+  uint uVar7;

+  longlong lVar8;

+  tagWINDOWSTATION *ptVar9;

+  longlong *plVar10;

+  ulonglong uVar11;

+  undefined2 *puVar12;

+  tagTHREADINFO *ptVar13;

+  WindowStationPolicy WVar14;

+  tagTHREADINFO *ptVar15;

+  tagTHREADINFO *ptVar16;

+  tagTERMINAL *ptVar17;

+  tagTHREADINFO *ptVar18;

+  bool bVar19;

+  undefined8 in_stack_fffffffffffffed0;

+  undefined4 uVar21;

+  undefined8 uVar20;

+  undefined4 uVar22;

+  undefined8 in_stack_fffffffffffffed8;

+  undefined4 uVar23;

+  tagWINDOWSTATION **pptVar24;

+  undefined4 uVar25;

+  tagWINDOWSTATION *local_c8;

+  int local_c0;

+  AtomicExecutionCheck local_b8 [8];

+  undefined8 local_b0;

+  undefined8 local_a8;

+  HWINSTA__ *local_a0;

+  undefined8 local_98;

+  ulonglong local_90 [3];

+  tagWINDOWSTATION *local_78;

+  code *local_70;

+  tagTERMINAL *local_68;

+  longlong local_60;

+  SmartObjStackRef<tagMENU> local_58 [32];

   

-  p_Var1 = param_1 + -0x75;

-  bVar3 = (byte)param_1 & 7;

-  *p_Var1 = (_OBJECT_ATTRIBUTES)((byte)*p_Var1 >> bVar3 | (char)*p_Var1 << 8 - bVar3);

-  pcVar2 = (code *)swi(0xe8);

-  (*pcVar2)();

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

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

+  uVar7 = (uint)((ulonglong)in_stack_fffffffffffffed8 >> 0x20);

+  local_90[0] = *(ulonglong *)(param_1 + 0x20);

+  ptVar13 = (tagTHREADINFO *)0x0;

+  local_c8 = (tagWINDOWSTATION *)0x0;

+  ptVar15 = (tagTHREADINFO *)0x0;

+  ptVar18 = (tagTHREADINFO *)0x0;

+  local_a0 = (HWINSTA__ *)0x0;

+  ptVar16 = (tagTHREADINFO *)0x0;

+  local_c0 = 0;

+  lVar8 = W32GetUserSessionState();

+  if (*(longlong *)(lVar8 + 0xf8a8) == 0) {

+    lVar8 = W32GetUserSessionState();

+    ptVar17 = (tagTERMINAL *)(lVar8 + 0x10cd0);

+  }

+  else {

+    lVar8 = W32GetUserSessionState();

+    ptVar17 = (tagTERMINAL *)(lVar8 + 0x10d18);

+    *(uint *)ptVar17 = *(uint *)ptVar17 | 2;

+  }

+  pptVar24 = &local_c8;

+  lVar8 = (ulonglong)uVar7 << 0x20;

+  uVar20 = CONCAT44(uVar21,0x108);

+  uVar21 = 0;

+  iVar4 = ObCreateObject(0,*(undefined8 *)ExWindowStationObjectType_exref,param_1,param_2,0,uVar20,

+                         lVar8,0,pptVar24);

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

+  uVar23 = (undefined4)((ulonglong)lVar8 >> 0x20);

+  uVar25 = (undefined4)((ulonglong)pptVar24 >> 0x20);

+  if (iVar4 < 0) {

+    SetLastNtError(iVar4);

+    return iVar4;

+  }

+  lVar8 = W32GetUserSessionState();

+  cVar3 = ExAcquireRundownProtection(lVar8 + 0xf8b0);

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

+    iVar6 = -0x3fffffde;

+    ptVar15 = ptVar13;

+    ptVar18 = ptVar13;

+    iVar4 = 0;

+    goto LAB_0;

+  }

+  memset(local_c8,0,0x108);

+  ptVar9 = local_c8 + 0xe8;

+  *(tagWINDOWSTATION **)(local_c8 + 0xf0) = ptVar9;

+  *(tagWINDOWSTATION **)ptVar9 = ptVar9;

+  uVar5 = W32GetCurrentWin32kSessionId();

+  *(undefined4 *)local_c8 = uVar5;

+  *(ulong *)(local_c8 + 0xd8) = param_11;

+  *(tagTERMINAL **)(local_c8 + 0x38) = ptVar17;

+  if ((*(uint *)ptVar17 & 2) == 0) {

+    if ((param_10 & 0x800) != 0) {

+      *(uint *)(local_c8 + 0x40) = *(uint *)(local_c8 + 0x40) | 0x800;

+    }

+  }

+  else {

+    *(undefined4 *)(local_c8 + 0x40) = 4;

+  }

+  iVar6 = CreateGlobalAtomTable(local_c8 + 0xa8);

+  iVar4 = 0;

+  if ((-1 < iVar6) &&

+     (((*(uint *)ptVar17 & 1) != 0 || (iVar6 = xxxInitTerminal(ptVar17), -1 < iVar6)))) {

+    if (((*(uint *)(local_c8 + 0x40) & 4) != 0) || (iVar6 = xxxInitWindowStation(), iVar6 != 0)) {

+      ptVar1 = ptVar17 + 8;

+      ptVar15 = ptVar13;

+      ptVar18 = ptVar13;

+      if (*(longlong *)ptVar1 == 0) {

+        ptVar15 = PtiCurrent();

+        uVar20 = *(undefined8 *)(ptVar15 + 0x1d0);

+        ptVar18 = *(tagTHREADINFO **)(ptVar15 + 0x1f0);

+        *(undefined8 *)(ptVar15 + 0x1d0) = *(undefined8 *)(*(longlong *)(ptVar17 + 0x10) + 0x1d0);

+        local_a8 = *(undefined8 *)(ptVar15 + 0x278);

+        local_98 = uVar20;

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

+          if (*(tagTHREADINFO **)(ptVar15 + 0x308) != ptVar15 + 0x308) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x227);

+          }

+        }

+        else {

+          ObfReferenceObject(ptVar18);

+        }

+        lVar8 = W32GetUserSessionState();

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

+        local_b0 = 0;

+        *(int *)(lVar8 + 0x11528) = *(int *)(lVar8 + 0x11528) + 1;

+        AtomicExecutionCheck::Arm(local_b8);

+        iVar6 = zzzSetDesktop(ptVar15,0,0);

+        if (iVar6 < 0) {

+          if ((*(longlong *)(ptVar15 + 0x1f0) == 0) && (ptVar18 != (tagTHREADINFO *)0x0)) {

+            zzzSetDesktop(ptVar15,ptVar18,local_a8);

+          }

+          AtomicExecutionCheck::Disarm(local_b8);

+          zzzEndDeferWinEventNotify();

+          *(undefined8 *)(ptVar15 + 0x1d0) = uVar20;

+        }

+        else {

+          LOCK();

+          uVar7 = *(uint *)(ptVar15 + 0x210);

+          if (uVar7 == 0) {

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

+            uVar7 = 0;

+          }

+          UNLOCK();

+          bVar19 = (uVar7 & 0x10000000) == 0;

+          if (bVar19) {

+            LOCK();

+            *(uint *)(ptVar15 + 0x210) = *(uint *)(ptVar15 + 0x210) | 0x10000000;

+            UNLOCK();

+          }

+          plVar10 = (longlong *)PsGetCurrentProcessWin32Process();

+          if ((plVar10 == (longlong *)0x0) || (*plVar10 == 0)) {

+LAB_1:

+            uVar5 = 0;

+          }

+          else {

+            plVar10 = (longlong *)PsGetCurrentProcessWin32Process();

+            uVar11 = 0;

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

+              uVar11 = (ulonglong)plVar10 & -(ulonglong)(*plVar10 != 0);

+            }

+            iVar6 = IsImmersiveAppRestricted(uVar11);

+            uVar5 = 1;

+            if (iVar6 == 0) goto LAB_1;

+          }

+          uVar20 = *(undefined8 *)hModuleWin_exref;

+          SmartObjStackRef<tagMENU>::SmartObjStackRef<tagMENU>(local_58,0);

+          lVar8 = xxxCreateWindowEx(0,0x8001,0x8001,0,CONCAT44(uVar21,0x82000000),

+                                    CONCAT44(uVar22,0xffff8000),CONCAT44(uVar23,0xffff8000),0xffff,

+                                    CONCAT44(uVar25,0xffff),0,local_58,uVar20,0,1,0x30a,uVar5,0);

+          SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>(local_58);

+          if (lVar8 != 0) {

+            local_68 = ptVar1;

+            local_60 = lVar8;

+            HMAssignmentLock(&local_68,0);

+            if (bVar19) {

+              LOCK();

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

+              UNLOCK();

+            }

+            SetVisible(*(tagWND **)ptVar1,1);

+            HMChangeOwnerThread(*(longlong *)ptVar1,*(undefined8 *)(ptVar17 + 0x10));

+            *(undefined8 *)(ptVar15 + 0x1d0) = local_98;

+            local_c0 = 1;

+            iVar6 = zzzSetDesktop(ptVar15,ptVar18,local_a8);

+            if (iVar6 < 0) {

+              AtomicExecutionCheck::Disarm(local_b8);

+              zzzEndDeferWinEventNotify();

+              AtomicExecutionCheck::Disarm(local_b8);

+              ptVar13 = ptVar16;

+              iVar4 = 1;

+              goto LAB_0;

+            }

+            AtomicExecutionCheck::Disarm(local_b8);

+            zzzEndDeferWinEventNotify();

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

+              ObfDereferenceObject(ptVar18);

+              ptVar18 = (tagTHREADINFO *)0x0;

+            }

+            goto LAB_2;

+          }

+          iVar6 = -0x3fffffe9;

+          AtomicExecutionCheck::Disarm(local_b8);

+          zzzEndDeferWinEventNotify();

+          *(undefined8 *)(ptVar15 + 0x1d0) = local_98;

+          zzzSetDesktop(ptVar15,ptVar18,local_a8);

+        }

+        AtomicExecutionCheck::Disarm(local_b8);

+        ptVar13 = ptVar16;

+        goto LAB_0;

+      }

+LAB_2:

+      if ((*(uint *)(local_c8 + 0x40) & 4) == 0) {

+        iVar4 = RtlLengthSid(*(undefined8 *)(*(longlong *)SeExports_exref + 0xc0));

+        iVar6 = iVar4 + 8;

+        puVar12 = (undefined2 *)Win32AllocPoolWithQuotaZInit(iVar6,0x65737355);

+        if (puVar12 != (undefined2 *)0x0) {

+          *puVar12 = 0;

+          pcVar2 = SeExports_exref;

+          puVar12[1] = (short)iVar6;

+          *(undefined4 *)(puVar12 + 2) = 0x100000;

+          RtlCopySid(iVar4,puVar12 + 4,*(undefined8 *)(*(longlong *)pcVar2 + 0xc0));

+          ptVar13 = (tagTHREADINFO *)CreateSecurityDescriptor(puVar12,iVar6,0);

+          Win32FreePool(puVar12);

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

+            iVar6 = CreateDesktopNotificationEvent(ptVar13);

+            iVar4 = local_c0;

+            if (iVar6 < 0) goto LAB_0;

+            Win32FreePool(ptVar13);

+            goto LAB_3;

+          }

+        }

+        iVar6 = -0x3fffffe9;

+        iVar4 = local_c0;

+      }

+      else {

+LAB_3:

+        iVar6 = ObInsertObject(local_c8,0,param_3,1,&local_c8,&local_a0);

+        ptVar13 = (tagTHREADINFO *)0x0;

+        if (-1 < iVar6) {

+          if (iVar6 != 0x40000000) {

+            iVar6 = ApplySecurityAttributesToWinsta(local_c8,local_90[0]);

+            if (-1 < iVar6) {

+              lVar8 = W32GetUserSessionState();

+              for (plVar10 = (longlong *)(lVar8 + 0xf8a8); *plVar10 != 0;

+                  plVar10 = (longlong *)(*plVar10 + 8)) {

+              }

+              LockObjectAssignment(plVar10,local_c8);

+              ptVar9 = local_c8;

+              if (((*(uint *)(local_c8 + 0x40) & 4) == 0) && (param_8 != (ushort *)0x0)) {

+                ptVar16 = PtiCurrent();

+                local_90[2] = *(ulonglong *)(ptVar16 + 0x180);

+                *(ulonglong **)(ptVar16 + 0x180) = local_90 + 2;

+                local_70 = UserDereferenceObject_exref;

+                local_78 = ptVar9;

+                lVar8 = xxxSafeLoadKeyboardLayoutEx

+                                  (local_c8,param_4,0,param_5,param_6,param_7,param_8,param_9,

+                                   0x80000001);

+                if (lVar8 == 0) {

+                  iVar6 = -0x3fffffff;

+                }

+                ptVar16 = PtiCurrent();

+                *(ulonglong *)(ptVar16 + 0x180) = local_90[2];

+              }

+            }

+            iVar4 = local_c0;

+            if (iVar6 < 0) goto LAB_0;

+          }

+          iVar4 = IsCurrentSessionServiceSession();

+          if ((iVar4 == 0) && ((*(uint *)(local_c8 + 0x40) & 0x804) == 0)) {

+            iVar4 = Feature_LowLatencyProfile__private_IsEnabledDeviceUsageNoInline();

+            WVar14 = 3;

+            if (iVar4 != 0) {

+              WVar14 = 7;

+            }

+            tagWINDOWSTATION::SetPolicy(local_c8,WVar14);

+          }

+          ObfDereferenceObject(local_c8);

+          *param_12 = local_a0;

+          return 0;

+        }

+        local_c8 = (tagWINDOWSTATION *)0x0;

+        iVar4 = local_c0;

+      }

+      goto LAB_0;

+    }

+    iVar6 = -0x3fffffe9;

+  }

+  SetLastNtError(iVar6);

+  ptVar13 = ptVar16;

+LAB_0:

+  SetLastNtError(iVar6);

+  if (local_c8 != (tagWINDOWSTATION *)0x0) {

+    ObfDereferenceObject();

+  }

+  if (iVar4 != 0) {

+    lVar8 = W32GetUserSessionState();

+    *(int *)(lVar8 + 0x11528) = *(int *)(lVar8 + 0x11528) + 1;

+    LOCK();

+    uVar7 = *(uint *)(ptVar15 + 0x210);

+    if (uVar7 == 0) {

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

+      uVar7 = 0;

+    }

+    UNLOCK();

+    bVar19 = (uVar7 >> 0x1c & 1) == 0;

+    if (bVar19) {

+      LOCK();

+      *(uint *)(ptVar15 + 0x210) = *(uint *)(ptVar15 + 0x210) | 0x10000000;

+      UNLOCK();

+    }

+    uVar20 = *(undefined8 *)(ptVar15 + 0x1d0);

+    *(undefined8 *)(ptVar15 + 0x1d0) = *(undefined8 *)(*(longlong *)(ptVar17 + 0x10) + 0x1d0);

+    HMChangeOwnerThread(*(undefined8 *)(ptVar17 + 8),ptVar15);

+    local_90[0] = local_90[0] & 0xffffffffffffff00;

+    local_90[1] = 0;

+    AtomicExecutionCheck::Arm((AtomicExecutionCheck *)local_90);

+    xxxCleanupMotherDesktopWindow(ptVar17);

+    AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)local_90);

+    *(undefined8 *)(ptVar15 + 0x1d0) = uVar20;

+    if (bVar19) {

+      LOCK();

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

+      UNLOCK();

+    }

+    zzzEndDeferWinEventNotify();

+  }

+  if (local_a0 != (HWINSTA__ *)0x0) {

+    ObCloseHandle(local_a0,1);

+  }

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

+    Win32FreePool(ptVar13);

+  }

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

+    ObfDereferenceObject(ptVar18);

+  }

+  return iVar6;

 }
```

## `EditionIsRIMInjectionBlocked`  (modified)

```diff
--- EditionIsRIMInjectionBlocked
+++ EditionIsRIMInjectionBlocked
@@ -1,24 +1,16 @@
 

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

-

-void EditionIsRIMInjectionBlocked(undefined8 param_1,__uint64 param_2)

+bool EditionIsRIMInjectionBlocked(longlong param_1)

 

 {

-  longlong in_RAX;

-  tagTHREADINFO *ptVar1;

-  undefined8 unaff_RBX;

-  longlong unaff_RBP;

-  longlong unaff_RDI;

+  InputCheckResult IVar1;

+  longlong lVar2;

   

-  *(byte *)(in_RAX + 0x329) = *(byte *)(in_RAX + 0x329) & (byte)((ulonglong)unaff_RBX >> 8);

-  if (*(int *)(unaff_RDI + 0x18) == (int)in_RAX) {

-    _PostThreadMessage();

+                    /* 0x236580  200  EditionIsRIMInjectionBlocked */

+  if (((*(uint *)(param_1 + 0xa8) & 0x4000) == 0) &&

+     (lVar2 = W32GetUserSessionState(), *(longlong *)(lVar2 + 0x4b58) != 0)) {

+    IVar1 = DoInputCheck(0x66);

+    return IVar1 != 0;

   }

-  else {

-    xxxSendShutdownData(*(HWND__ **)(unaff_RDI + 0x28),param_2);

-  }

-  ptVar1 = PtiCurrent();

-  *(undefined8 *)(ptVar1 + 0x180) = *(undefined8 *)(unaff_RBP + -0x59);

-  return;

+  return false;

 }
```

## `MagSetLensContextInformation`  (modified)

```diff
--- MagSetLensContextInformation
+++ MagSetLensContextInformation
@@ -1,25 +1,573 @@
 

-undefined2 MagSetLensContextInformation(byte param_1)

+uint MagSetLensContextInformation

+               (undefined8 param_1,undefined8 param_2,tagWND *param_3,int param_4,double *param_5)

 

 {

-  byte *pbVar1;

-  byte bVar2;

-  int iVar3;

-  int *in_RAX;

-  ulonglong uVar4;

-  undefined2 unaff_BX;

+  double dVar1;

+  double dVar2;

+  undefined8 uVar3;

+  longlong *plVar4;

+  code *pcVar5;

+  uint uVar6;

+  int iVar7;

+  uint uVar8;

+  _MAG_THREAD_CONTEXT *p_Var9;

+  _MAG_LENS_CONTEXT *p_Var10;

+  undefined8 uVar11;

+  longlong lVar12;

+  undefined8 uVar13;

+  double *pdVar14;

+  _MAG_LENS_CONTEXT *p_Var15;

+  _MAG_LENS_CONTEXT *p_Var16;

+  tagWND *ptVar17;

+  ulonglong uVar18;

+  _MAG_THREAD_CONTEXT *p_Var19;

+  _MAG_LENS_CONTEXT *local_48;

+  _MAG_LENS_CONTEXT *local_40;

+  _MAG_LENS_CONTEXT *local_38;

   

-  *(byte *)((longlong)in_RAX + -0x75) = *(byte *)((longlong)in_RAX + -0x75) & param_1;

-  iVar3 = (int)in_RAX;

-  *in_RAX = iVar3;

-  *in_RAX = *in_RAX + iVar3;

-  pbVar1 = (byte *)((longlong)in_RAX + -1);

-  bVar2 = *pbVar1;

-  *pbVar1 = *pbVar1 + param_1;

-  uVar4 = (ulonglong)(iVar3 + 0x214945 + (uint)CARRY1(bVar2,param_1));

-  if (uVar4 != 0) {

-    unaff_BX = *(undefined2 *)(*(longlong *)(uVar4 + 0x28) + 0x3c);

-  }

-  return unaff_BX;

+  p_Var15 = (_MAG_LENS_CONTEXT *)0x0;

+  p_Var10 = (_MAG_LENS_CONTEXT *)0x0;

+  ptVar17 = param_3;

+  p_Var9 = (_MAG_THREAD_CONTEXT *)MagpFindThreadContext();

+  if (p_Var9 == (_MAG_THREAD_CONTEXT *)0x0) {

+    return 0xc00000a3;

+  }

+  if (5 < param_4) {

+    if (param_4 == 6) {

+      uVar6 = *(uint *)((longlong)param_5 + 4) + *(uint *)param_5;

+      if (0x19 < uVar6) {

+        return 0xc000000d;

+      }

+      if ((tagWND *)0xfffffffffffffffd < ptVar17 + -1) {

+        return 0xc000000d;

+      }

+      p_Var16 = MagpFindLensContext(p_Var9,param_3);

+      if (p_Var16 == (_MAG_LENS_CONTEXT *)0x0) {

+        return 0xc000000d;

+      }

+      if ((uVar6 != 0) &&

+         (p_Var15 = (_MAG_LENS_CONTEXT *)Win32AllocPoolZInit((ulonglong)uVar6 << 3,0x676d7355),

+         p_Var15 == (_MAG_LENS_CONTEXT *)0x0)) {

+        return 0xc0000017;

+      }

+      local_48 = (_MAG_LENS_CONTEXT *)*param_5;

+      if (uVar6 != 0) {

+        uVar18 = (ulonglong)uVar6;

+        p_Var10 = p_Var15;

+        do {

+          *(undefined8 *)p_Var10 =

+               *(undefined8 *)(p_Var10 + (longlong)param_5 + (8 - (longlong)p_Var15));

+          p_Var10 = p_Var10 + 8;

+          uVar18 = uVar18 - 1;

+        } while (uVar18 != 0);

+      }

+      local_40 = p_Var15;

+      if ((*(uint *)(p_Var16 + 0x10) & 0x20) != 0) {

+LAB_0:

+        if (*(longlong *)(p_Var16 + 0xe8) != 0) {

+          Win32FreePool();

+          *(undefined8 *)(p_Var16 + 0xe8) = 0;

+        }

+        *(uint *)(p_Var16 + 0xe0) = *(uint *)param_5;

+        *(uint *)(p_Var16 + 0xe4) = *(uint *)((longlong)param_5 + 4);

+        *(_MAG_LENS_CONTEXT **)(p_Var16 + 0xe8) = p_Var15;

+        uVar8 = *(uint *)(p_Var16 + 0x10) | 8;

+        if (uVar6 == 0) {

+          uVar8 = *(uint *)(p_Var16 + 0x10) & 0xfffffff7;

+        }

+        *(uint *)(p_Var16 + 0x10) = uVar8;

+        return 0;

+      }

+      uVar3 = *(undefined8 *)

+               **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+      uVar11 = 0;

+      if (*(undefined8 **)(p_Var16 + 0x18) != (undefined8 *)0x0) {

+        uVar11 = **(undefined8 **)(p_Var16 + 0x18);

+      }

+      uVar13 = ReferenceDwmApiPort();

+      uVar8 = DwmAsyncMagnSetWindowFilterList(uVar13,uVar11,uVar3,&local_48);

+      p_Var10 = p_Var15;

+      if (-1 < (int)uVar8) goto LAB_0;

+    }

+    else {

+      if (param_4 != 7) {

+        if (param_4 == 9) {

+          uVar6 = *(uint *)param_5;

+          if ((uVar6 & 0xfffffffe) != 0) {

+            return 0xc000000d;

+          }

+          if ((tagWND *)0xfffffffffffffffd < ptVar17 + -1) {

+            return 0xc000000d;

+          }

+          p_Var10 = MagpFindLensContext(p_Var9,param_3);

+          if (p_Var10 == (_MAG_LENS_CONTEXT *)0x0) {

+            return 0xc000000d;

+          }

+          if ((*(uint *)(p_Var10 + 0x10) >> 6 & 1) == (uVar6 & 1)) {

+            return 0;

+          }

+          iVar7 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+          if (iVar7 == 0) {

+            ChangeComposableCursor(uVar6 & 1);

+          }

+          else {

+            ChangeCursorSynchronization();

+          }

+          *(uint *)(p_Var10 + 0x10) =

+               (uVar6 << 6 ^ *(uint *)(p_Var10 + 0x10)) & 0x40 ^ *(uint *)(p_Var10 + 0x10);

+          return 0;

+        }

+        if (param_4 != 10) {

+          return 0xc000000d;

+        }

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

+          return 0xc000000d;

+        }

+        p_Var10 = MagpFindLensContext(p_Var9,param_3);

+        if (p_Var10 == (_MAG_LENS_CONTEXT *)0x0) {

+          return 0xc000000d;

+        }

+        if (param_3 == (tagWND *)0xffffffffffffffff) {

+          uVar3 = *(undefined8 *)

+                   **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+          uVar11 = ReferenceDwmApiPort();

+          uVar6 = DwmAsyncMagnSetDesktopSamplingMode(uVar11,uVar3,param_5);

+        }

+        else {

+          if ((*(uint *)(p_Var10 + 0x10) & 0x20) != 0) goto LAB_1;

+          uVar3 = *(undefined8 *)ptVar17;

+          uVar11 = *(undefined8 *)

+                    **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+          uVar13 = ReferenceDwmApiPort();

+          uVar6 = DwmAsyncMagnSetSamplingMode(uVar13,uVar3,uVar11,param_5);

+        }

+        if ((int)uVar6 < 0) {

+          return uVar6;

+        }

+LAB_1:

+        *(uint *)(p_Var10 + 0x108) = *(uint *)param_5;

+        return 0;

+      }

+      uVar18 = (ulonglong)*(uint *)param_5;

+      if (6 < *(uint *)param_5) {

+        return 0xc000000d;

+      }

+      if ((tagWND *)0xfffffffffffffffd < param_3 + -1) {

+        return 0xc000000d;

+      }

+      p_Var15 = MagpFindLensContext(p_Var9,param_3);

+      if (p_Var15 == (_MAG_LENS_CONTEXT *)0x0) {

+        return 0xc000000d;

+      }

+      if (((int)uVar18 != 0) &&

+         (p_Var10 = (_MAG_LENS_CONTEXT *)Win32AllocPoolZInit(uVar18 * 0x18),

+         p_Var10 == (_MAG_LENS_CONTEXT *)0x0)) {

+        return 0xc0000017;

+      }

+      local_48 = (_MAG_LENS_CONTEXT *)*param_5;

+      local_40 = (_MAG_LENS_CONTEXT *)param_5[1];

+      uVar18 = 0;

+      if (*(uint *)param_5 != 0) {

+        do {

+          uVar6 = (int)uVar18 + 1;

+          dVar1 = (param_5 + uVar18 * 3 + 2)[1];

+          *(double *)(p_Var10 + uVar18 * 0x18) = param_5[uVar18 * 3 + 2];

+          *(double *)(p_Var10 + uVar18 * 0x18 + 8) = dVar1;

+          *(double *)(p_Var10 + uVar18 * 0x18 + 0x10) = param_5[uVar18 * 3 + 4];

+          uVar18 = (ulonglong)uVar6;

+        } while (uVar6 < *(uint *)param_5);

+      }

+      local_38 = p_Var10;

+      if ((*(uint *)(p_Var15 + 0x10) & 0x20) != 0) {

+LAB_2:

+        if (*(longlong *)(p_Var15 + 0x100) != 0) {

+          Win32FreePool();

+          *(undefined8 *)(p_Var15 + 0x100) = 0;

+        }

+        *(uint *)(p_Var15 + 0xf0) = *(uint *)param_5;

+        *(uint *)(p_Var15 + 0xf4) = *(uint *)((longlong)param_5 + 4);

+        *(uint *)(p_Var15 + 0xf8) = *(uint *)(param_5 + 1);

+        *(uint *)(p_Var15 + 0xfc) = *(uint *)((longlong)param_5 + 0xc);

+        *(_MAG_LENS_CONTEXT **)(p_Var15 + 0x100) = p_Var10;

+        uVar6 = *(uint *)(p_Var15 + 0x10) | 0x10;

+        if (*(uint *)param_5 == 0) {

+          uVar6 = *(uint *)(p_Var15 + 0x10) & 0xffffffef;

+        }

+        *(uint *)(p_Var15 + 0x10) = uVar6;

+        return 0;

+      }

+      uVar3 = *(undefined8 *)

+               **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+      uVar11 = 0;

+      if (*(undefined8 **)(p_Var15 + 0x18) != (undefined8 *)0x0) {

+        uVar11 = **(undefined8 **)(p_Var15 + 0x18);

+      }

+      uVar13 = ReferenceDwmApiPort();

+      uVar8 = DwmAsyncMagnSetWindowSharedTextures(uVar13,uVar11,uVar3,&local_48);

+      if (-1 < (int)uVar8) goto LAB_2;

+    }

+    if (p_Var10 == (_MAG_LENS_CONTEXT *)0x0) {

+      return uVar8;

+    }

+LAB_3:

+    Win32FreePool(p_Var10);

+    return uVar8;

+  }

+  if (param_4 != 5) {

+    if (param_4 == 0) {

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

+        return 0xc000000d;

+      }

+      p_Var10 = MagpFindLensContext(p_Var9,param_3);

+      if (p_Var10 != (_MAG_LENS_CONTEXT *)0x0) {

+        return 0xc000000d;

+      }

+      p_Var10 = (_MAG_LENS_CONTEXT *)Win32AllocPoolZInit(0x110);

+      if (p_Var10 == (_MAG_LENS_CONTEXT *)0x0) {

+        return 0xc0000017;

+      }

+      if (param_3 != (tagWND *)0xffffffffffffffff) {

+        uVar3 = *(undefined8 *)param_3;

+        uVar6 = *(uint *)(*(longlong *)(param_3 + 0x28) + 0x120);

+        uVar11 = *(undefined8 *)

+                  **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+        uVar13 = ReferenceDwmApiPort();

+        uVar8 = DwmAsyncMagnCreate(uVar13,uVar3,uVar11,(uVar6 & 0xf) != 0);

+        if ((uVar8 != 0xc0000001) && ((int)uVar8 < 0)) goto LAB_3;

+      }

+      memset(p_Var10 + 0x10,0,0x100);

+      *(double *)(p_Var10 + 0x28) = 1.0;

+      *(double *)(p_Var10 + 0x30) = 1.0;

+      if (param_3 == (tagWND *)0xffffffffffffffff) {

+        *(double *)(p_Var10 + 0x18) = -NAN;

+      }

+      else {

+        local_48 = p_Var10 + 0x18;

+        local_40 = (_MAG_LENS_CONTEXT *)param_3;

+        HMAssignmentLock(&local_48,0);

+      }

+      *(undefined4 *)(p_Var10 + 0x108) = 0;

+      p_Var19 = p_Var9 + 0x28;

+      pdVar14 = *(double **)(p_Var9 + 0x30);

+      if ((_MAG_THREAD_CONTEXT *)*pdVar14 == p_Var19) goto LAB_4;

+    }

+    else {

+      if (param_4 != 1) {

+        if (param_4 != 2) {

+          if (param_4 != 3) {

+            if (param_4 != 4) {

+              return 0xc000000d;

+            }

+            if (*(uint *)(param_5 + 4) != 3) {

+              iVar7 = _SetMagnificationInputTransform(param_5);

+              return ~-(uint)(iVar7 != 0) & 0xc0000001;

+            }

+            uVar6 = MagpRevokeInputTransfrom();

+            return uVar6;

+          }

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

+            return 0xc000000d;

+          }

+          p_Var10 = MagpFindLensContext(p_Var9,param_3);

+          if (p_Var10 != (_MAG_LENS_CONTEXT *)0x0) {

+            if (param_3 == (tagWND *)0xffffffffffffffff) {

+              if (*param_5 != param_5[1]) {

+                return 0xc000000d;

+              }

+              iVar7 = memcmp(param_5,&DAT_5,0x20);

+              lVar12 = *(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0);

+              p_Var15 = *(_MAG_LENS_CONTEXT **)(lVar12 + 0xe8);

+              if (iVar7 == 0) {

+                if (p_Var15 == (_MAG_LENS_CONTEXT *)0x0) {

+                  uVar6 = 0;

+                }

+                else {

+                  if (p_Var10 != p_Var15) {

+                    return 0xc000000d;

+                  }

+                  dVar1 = param_5[3];

+                  uVar3 = *(undefined8 *)**(undefined8 **)(lVar12 + 8);

+                  dVar2 = param_5[2];

+                  uVar11 = ReferenceDwmApiPort();

+                  uVar6 = DwmAsyncMagnSetDesktopTransform

+                                    (uVar11,uVar3,param_5,(int)dVar2,(int)dVar1);

+                  if ((int)uVar6 < 0) {

+                    return uVar6;

+                  }

+                  *(undefined8 *)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 0xe8) = 0;

+                }

+              }

+              else if (p_Var15 == (_MAG_LENS_CONTEXT *)0x0) {

+                dVar1 = param_5[3];

+                uVar3 = *(undefined8 *)**(undefined8 **)(lVar12 + 8);

+                dVar2 = param_5[2];

+                uVar11 = ReferenceDwmApiPort();

+                uVar6 = DwmAsyncMagnSetDesktopTransform(uVar11,uVar3,param_5,(int)dVar2,(int)dVar1);

+                if ((int)uVar6 < 0) {

+                  return uVar6;

+                }

+                *(_MAG_LENS_CONTEXT **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 0xe8)

+                     = p_Var10;

+              }

+              else {

+                if (p_Var10 != p_Var15) {

+                  return 0xc000000d;

+                }

+                dVar1 = param_5[3];

+                uVar3 = *(undefined8 *)**(undefined8 **)(lVar12 + 8);

+                dVar2 = param_5[2];

+                uVar11 = ReferenceDwmApiPort();

+                uVar6 = DwmAsyncMagnSetDesktopTransform(uVar11,uVar3,param_5,(int)dVar2,(int)dVar1);

+              }

+              if ((int)uVar6 < 0) {

+                return uVar6;

+              }

+            }

+            else {

+              *(double *)(p_Var10 + 0x28) = *param_5;

+              *(double *)(p_Var10 + 0x30) = param_5[1];

+              *(double *)(p_Var10 + 0x38) = param_5[2];

+              *(double *)(p_Var10 + 0x40) = param_5[3];

+              if (((*(uint *)(*(longlong *)(*(longlong *)(p_Var10 + 0x18) + 0x28) + 0x120) & 0xf) ==

+                   0) && (lVar12 = W32GetUserSessionState(),

+                         0x60 < *(ushort *)(*(longlong *)(lVar12 + 0x4e30) + 0x1b56))) {

+                lVar12 = W32GetUserSessionState();

+                *(double *)(p_Var10 + 0x38) =

+                     ((double)*(ushort *)(*(longlong *)(lVar12 + 0x4e30) + 0x1b56) *

+                     *(double *)(p_Var10 + 0x38)) / 96.0;

+                lVar12 = W32GetUserSessionState();

+                *(double *)(p_Var10 + 0x40) =

+                     ((double)*(ushort *)(*(longlong *)(lVar12 + 0x4e30) + 0x1b56) *

+                     *(double *)(p_Var10 + 0x40)) / 96.0;

+                lVar12 = W32GetUserSessionState();

+                *(double *)(p_Var10 + 0x28) =

+                     (*param_5 * 96.0) /

+                     (double)*(ushort *)(*(longlong *)(lVar12 + 0x4e30) + 0x1b56);

+                lVar12 = W32GetUserSessionState();

+                *(double *)(p_Var10 + 0x30) =

+                     (param_5[1] * 96.0) /

+                     (double)*(ushort *)(*(longlong *)(lVar12 + 0x4e30) + 0x1b56);

+              }

+            }

+            dVar1 = param_5[1];

+            *(double *)(p_Var10 + 0x58) = *param_5;

+            *(double *)(p_Var10 + 0x60) = dVar1;

+            dVar1 = param_5[2];

+            dVar2 = param_5[3];

+            *(uint *)(p_Var10 + 0x10) = *(uint *)(p_Var10 + 0x10) | 2;

+            *(double *)(p_Var10 + 0x68) = dVar1;

+            *(double *)(p_Var10 + 0x70) = dVar2;

+            return 0;

+          }

+          return 0xc000000d;

+        }

+        if ((tagWND *)0xfffffffffffffffd < ptVar17 + -1) {

+          return 0xc000000d;

+        }

+        p_Var10 = MagpFindLensContext(p_Var9,param_3);

+        if (p_Var10 == (_MAG_LENS_CONTEXT *)0x0) {

+          return 0xc000000d;

+        }

+        if (((*(uint *)(*(longlong *)(*(longlong *)(p_Var10 + 0x18) + 0x28) + 0x120) & 0xf) == 0) &&

+           (lVar12 = W32GetUserSessionState(),

+           0x60 < *(ushort *)(*(longlong *)(lVar12 + 0x4e30) + 0x1b56))) {

+          if ((*(uint *)(p_Var10 + 0x10) & 2) == 0) {

+            lVar12 = W32GetUserSessionState();

+            iVar7 = EngMulDiv(*(uint *)param_5,

+                              *(undefined2 *)(*(longlong *)(lVar12 + 0x4e30) + 0x1b56),0x60);

+            *(int *)(p_Var10 + 0x20) = -iVar7;

+            lVar12 = W32GetUserSessionState();

+            uVar6 = EngMulDiv(*(uint *)((longlong)param_5 + 4),

+                              *(undefined2 *)(*(longlong *)(lVar12 + 0x4e30) + 0x1b56),0x60);

+            goto LAB_6;

+          }

+          uVar6 = *(uint *)param_5;

+        }

+        else {

+          uVar6 = *(uint *)param_5;

+          if ((*(uint *)(p_Var10 + 0x10) & 2) == 0) {

+            *(uint *)(p_Var10 + 0x20) = -uVar6;

+            uVar6 = *(uint *)((longlong)param_5 + 4);

+            goto LAB_6;

+          }

+        }

+        *(int *)(p_Var10 + 0x20) = -(int)((double)(int)uVar6 * *(double *)(p_Var10 + 0x58));

+        uVar6 = (uint)((double)(int)*(uint *)((longlong)param_5 + 4) * *(double *)(p_Var10 + 0x60));

+LAB_6:

+        *(uint *)(p_Var10 + 0x24) = -uVar6;

+        dVar1 = *param_5;

+        dVar2 = param_5[1];

+        *(uint *)(p_Var10 + 0x10) = *(uint *)(p_Var10 + 0x10) | 1;

+        *(double *)(p_Var10 + 0x48) = dVar1;

+        *(double *)(p_Var10 + 0x50) = dVar2;

+        return 0;

+      }

+      MagpRevokeInputTransfrom();

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

+        return 0xc000000d;

+      }

+      p_Var10 = MagpFindLensContext(p_Var9,param_3);

+      if (p_Var10 == (_MAG_LENS_CONTEXT *)0x0) {

+        return 0xc000000d;

+      }

+      lVar12 = *(longlong *)p_Var10;

+      p_Var19 = p_Var9;

+      if ((*(_MAG_LENS_CONTEXT **)(lVar12 + 8) == p_Var10) &&

+         (plVar4 = *(longlong **)(p_Var10 + 8), (_MAG_LENS_CONTEXT *)*plVar4 == p_Var10)) {

+        *plVar4 = lVar12;

+        *(longlong **)(lVar12 + 8) = plVar4;

+        if (param_3 == (tagWND *)0xffffffffffffffff) {

+          if (*(_MAG_LENS_CONTEXT **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 0xf0) ==

+              p_Var10) {

+            uVar3 = *(undefined8 *)

+                     **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+            uVar11 = ReferenceDwmApiPort();

+            uVar8 = DwmAsyncMagnSetDesktopColorTransform(uVar11,uVar3,&DAT_7);

+            *(undefined8 *)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 0xf0) = 0;

+          }

+          else {

+            uVar8 = 0;

+          }

+          if (*(_MAG_LENS_CONTEXT **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 0xe8) ==

+              p_Var10) {

+            uVar3 = *(undefined8 *)

+                     **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+            uVar11 = ReferenceDwmApiPort();

+            uVar6 = DwmAsyncMagnSetDesktopTransform(uVar11,uVar3,&DAT_8,0,0);

+            *(undefined8 *)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 0xe8) = 0;

+          }

+          else {

+            uVar6 = 0;

+          }

+          if ((int)uVar8 < 0) goto LAB_3;

+        }

+        else {

+          uVar6 = *(uint *)(p_Var10 + 0x10);

+          if ((uVar6 & 0x40) != 0) {

+            iVar7 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+            if (iVar7 == 0) {

+              ChangeComposableCursor(0);

+            }

+            else {

+              ChangeCursorSynchronization();

+            }

+            *(uint *)(p_Var10 + 0x10) = *(uint *)(p_Var10 + 0x10) & 0xffffffbf;

+            uVar6 = *(uint *)(p_Var10 + 0x10);

+          }

+          if ((uVar6 & 0x20) == 0) {

+            uVar3 = *(undefined8 *)param_3;

+            uVar11 = *(undefined8 *)

+                      **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+            uVar13 = ReferenceDwmApiPort();

+            uVar6 = DwmAsyncMagnDestroy(uVar13,uVar3,uVar11);

+          }

+          else {

+            uVar6 = 0;

+          }

+          HMAssignmentUnlock(p_Var10 + 0x18);

+          if (*(longlong *)(p_Var10 + 0xe8) != 0) {

+            Win32FreePool();

+          }

+          if (*(longlong *)(p_Var10 + 0x100) != 0) {

+            Win32FreePool();

+          }

+        }

+        uVar8 = uVar6;

+        if (-1 < (int)uVar8) {

+          uVar8 = 0;

+        }

+        goto LAB_3;

+      }

+    }

+    pcVar5 = (code *)swi(0x29);

+    pdVar14 = (double *)(*pcVar5)(3);

+LAB_4:

+    *(_MAG_THREAD_CONTEXT **)p_Var10 = p_Var19;

+    *(double **)(p_Var10 + 8) = pdVar14;

+    *pdVar14 = (double)p_Var10;

+    *(_MAG_LENS_CONTEXT **)(p_Var19 + 8) = p_Var10;

+    return 0;

+  }

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

+    return 0xc000000d;

+  }

+  p_Var10 = MagpFindLensContext(p_Var9,param_3);

+  if (p_Var10 == (_MAG_LENS_CONTEXT *)0x0) {

+    return 0xc000000d;

+  }

+  if (param_3 == (tagWND *)0xffffffffffffffff) {

+    iVar7 = memcmp(param_5,&DAT_7,100);

+    lVar12 = *(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0);

+    p_Var15 = *(_MAG_LENS_CONTEXT **)(lVar12 + 0xf0);

+    if (iVar7 == 0) {

+      if (p_Var15 == (_MAG_LENS_CONTEXT *)0x0) {

+        uVar6 = 0;

+      }

+      else {

+        if (p_Var15 != p_Var10) {

+          return 0xc000000d;

+        }

+        uVar3 = *(undefined8 *)**(undefined8 **)(lVar12 + 8);

+        uVar11 = ReferenceDwmApiPort();

+        uVar6 = DwmAsyncMagnSetDesktopColorTransform(uVar11,uVar3,param_5);

+        if ((int)uVar6 < 0) {

+          return uVar6;

+        }

+        *(undefined8 *)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 0xf0) = 0;

+      }

+    }

+    else if (p_Var15 == (_MAG_LENS_CONTEXT *)0x0) {

+      uVar3 = *(undefined8 *)**(undefined8 **)(lVar12 + 8);

+      uVar11 = ReferenceDwmApiPort();

+      uVar6 = DwmAsyncMagnSetDesktopColorTransform(uVar11,uVar3,param_5);

+      if ((int)uVar6 < 0) {

+        return uVar6;

+      }

+      *(_MAG_LENS_CONTEXT **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 0xf0) = p_Var10;

+    }

+    else {

+      if (p_Var15 != p_Var10) {

+        return 0xc000000d;

+      }

+      uVar3 = *(undefined8 *)**(undefined8 **)(lVar12 + 8);

+      uVar11 = ReferenceDwmApiPort();

+      uVar6 = DwmAsyncMagnSetDesktopColorTransform(uVar11,uVar3,param_5);

+    }

+  }

+  else {

+    if ((*(uint *)(p_Var10 + 0x10) & 0x20) != 0) goto LAB_9;

+    uVar3 = *(undefined8 *)ptVar17;

+    uVar11 = *(undefined8 *)

+              **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var9 + 0x10) + 0x1f0) + 8);

+    uVar13 = ReferenceDwmApiPort();

+    uVar6 = DwmAsyncMagnSetWindowColorTransform(uVar13,uVar3,uVar11,param_5);

+  }

+  if ((int)uVar6 < 0) {

+    return uVar6;

+  }

+LAB_9:

+  dVar1 = param_5[1];

+  *(double *)(p_Var10 + 0x78) = *param_5;

+  *(double *)(p_Var10 + 0x80) = dVar1;

+  dVar1 = param_5[3];

+  *(double *)(p_Var10 + 0x88) = param_5[2];

+  *(double *)(p_Var10 + 0x90) = dVar1;

+  dVar1 = param_5[5];

+  *(double *)(p_Var10 + 0x98) = param_5[4];

+  *(double *)(p_Var10 + 0xa0) = dVar1;

+  dVar1 = param_5[7];

+  *(double *)(p_Var10 + 0xa8) = param_5[6];

+  *(double *)(p_Var10 + 0xb0) = dVar1;

+  dVar1 = param_5[9];

+  *(double *)(p_Var10 + 0xb8) = param_5[8];

+  *(double *)(p_Var10 + 0xc0) = dVar1;

+  dVar1 = param_5[0xb];

+  *(double *)(p_Var10 + 200) = param_5[10];

+  *(double *)(p_Var10 + 0xd0) = dVar1;

+  uVar6 = *(uint *)(param_5 + 0xc);

+  *(uint *)(p_Var10 + 0x10) = *(uint *)(p_Var10 + 0x10) | 4;

+  *(uint *)(p_Var10 + 0xd8) = uVar6;

+  return 0;

 }
```

## `xxxSendInput`  (modified)

```diff
--- xxxSendInput
+++ xxxSendInput
@@ -1,75 +1,195 @@
+

+/* unsigned int __cdecl xxxSendInput(unsigned int,struct tagINPUT * __ptr64) */

 

 uint __cdecl xxxSendInput(uint param_1,tagINPUT *param_2)

 

 {

-  byte *pbVar1;

-  byte bVar2;

-  bool bVar3;

-  char cVar4;

-  int in_EAX;

-  int iVar5;

-  uint extraout_EAX;

+  int iVar1;

+  uint uVar2;

+  undefined1 auVar3 [16];

+  undefined *puVar4;

+  InputCheckResult IVar5;

   longlong lVar6;

-  tagTHREADINFO *ptVar7;

-  byte bVar8;

-  undefined4 in_register_0000000c;

-  tagWND *unaff_RBX;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  tagWND *unaff_RDI;

-  int unaff_R14D;

-  undefined4 unaff_R15D;

+  __uint64 _Var7;

+  tagINPUT tVar8;

+  InputCheckRequest IVar9;

+  ushort uVar10;

+  bool bVar11;

+  bool bVar12;

+  tagINPUT *ptVar13;

+  uint uVar14;

+  bool bVar15;

+  bool bVar16;

+  ulonglong in_stack_ffffffffffffffb0;

+  undefined4 uVar17;

+  undefined8 uVar18;

   

-  pbVar1 = (byte *)(CONCAT44(in_register_0000000c,param_1) + -0x17dfdb94);

-  bVar2 = *pbVar1;

-  bVar8 = (byte)param_1;

-  *pbVar1 = *pbVar1 - bVar8;

-  pbVar1 = (byte *)(CONCAT44(in_register_0000000c,param_1) + -0xb70024);

-  *pbVar1 = *pbVar1 >> (bVar8 & 7) | *pbVar1 << 8 - (bVar8 & 7);

-  bVar3 = (param_1 & 0x1f) != 0;

-  if ((**(uint **)((ulonglong)

-                   (in_EAX + 0x143317 +

-                   (uint)(!bVar3 && bVar2 < bVar8 || bVar3 && (char)*pbVar1 < '\0')) + 0x4e30) & 4)

-      != 0) {

-    xxxFocusSetInputContext(unaff_RBX,0,0);

-  }

-  if (unaff_RDI != *(tagWND **)(*(longlong *)(unaff_RSI + 0x1d8) + 0x78)) goto LAB_0;

+  uVar14 = 0;

+  bVar16 = false;

   lVar6 = W32GetUserSessionState();

-  if ((**(uint **)(lVar6 + 0x4e30) & 4) != 0) {

-    xxxFocusSetInputContext(unaff_RDI,unaff_R14D,0);

-  }

-  xxxWindowEvent(0x8005);

-  if ((*(uint *)(*(longlong *)(unaff_RDI + 0x10) + 0x550) >> 0x12 & 1) == 0) {

+  iVar1 = *(int *)(lVar6 + 0x49d0);

+  if (param_1 != 0) {

+    ptVar13 = param_2 + 0x18;

+    bVar11 = true;

+    uVar14 = 0;

+    do {

+      puVar4 = WPP_RECORDER_INITIALIZED;

+      uVar17 = (undefined4)(in_stack_ffffffffffffffb0 >> 0x20);

+      if (*(int *)(ptVar13 + -0x18) == 2) {

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

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

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

+          bVar11 = false;

+        }

+        if ((bVar11 == false) &&

+           ((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED)) {

+          return uVar14;

+        }

+        lVar6 = W32GetUserSessionState();

+        uVar18 = 0x19;

+LAB_0:

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar11,

+                   (undefined **)puVar4 != &WPP_RECORDER_INITIALIZED,

+                   *(undefined8 *)(lVar6 + 0x10f88),2,CONCAT44(uVar17,0x14),uVar18,

+                   &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+        return uVar14;

+      }

+      IVar9 = 0x77;

+      if (*(int *)(ptVar13 + -0x18) == 0) {

+        if ((*(uint *)(ptVar13 + -4) & 0x50000) == 0x50000) {

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

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

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

+            bVar11 = false;

+          }

+          if ((bVar11 == false) &&

+             ((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED)) {

+            return uVar14;

+          }

+          lVar6 = W32GetUserSessionState();

+          uVar18 = 0x1a;

+          goto LAB_0;

+        }

+        IVar9 = 0x7f;

+      }

+      IVar5 = DoInputCheck(IVar9);

+      uVar17 = (undefined4)(in_stack_ffffffffffffffb0 >> 0x20);

+      if (IVar5 == 1) {

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

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

+           (bVar12 = true, (byte)WPP_GLOBAL_Control[0x29] < 3)) {

+          bVar12 = false;

+        }

+        bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((bVar12 != false) || (bVar15)) {

+          lVar6 = W32GetUserSessionState();

+          uVar18 = 0x1b;

 LAB_1:

-    xxxSendTransformableMessageTimeout();

-  }

-  else {

-    ptVar7 = PtiCurrent();

-    LOCK();

-    iVar5 = *(int *)(ptVar7 + 0x210);

-    if (iVar5 == 0) {

-      *(int *)(ptVar7 + 0x210) = (int)unaff_RBP;

-      iVar5 = 0;

-    }

-    UNLOCK();

-    if ((byte)((byte)unaff_R14D & (byte)iVar5) == 0) goto LAB_1;

-    xxxSendNotifyMessage();

-  }

-  lVar6 = W32GetUserSessionState();

-  if ((*(longlong *)(lVar6 + 0x4a50) == unaff_RBP) ||

-     (lVar6 = W32GetUserSessionState(),

-     *(tagWND **)(*(longlong *)(lVar6 + 0x4a50) + 0x78) != unaff_RDI)) {

-    cVar4 = IsKeyboardDelegationTarget();

-    if ((cVar4 != '\0') && (unaff_RDI == *(tagWND **)(*(longlong *)(unaff_RSI + 0x1d8) + 0x78))) {

-      zzzDelegateInputFocusReceivedWindowEvent(0xf);

+          in_stack_ffffffffffffffb0 = CONCAT44(uVar17,0x14);

+          WPP_RECORDER_AND_TRACE_SF_

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar12,bVar15,

+                     *(undefined8 *)(lVar6 + 0x10f88),3,in_stack_ffffffffffffffb0,uVar18,

+                     &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+        }

+      }

+      else {

+        bVar12 = bVar11;

+        if (IVar5 == 4) {

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

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

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

+            bVar12 = false;

+          }

+          bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((bVar12 != false) || (bVar15)) {

+            lVar6 = W32GetUserSessionState();

+            uVar18 = 0x1c;

+            goto LAB_1;

+          }

+        }

+        else if (IVar5 == 5) {

+          MSGLUA_GPQFOREGROUND();

+          uVar17 = (undefined4)(in_stack_ffffffffffffffb0 >> 0x20);

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

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

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

+            bVar12 = false;

+          }

+          bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((bVar12 != false) || (bVar15)) {

+            lVar6 = W32GetUserSessionState();

+            uVar18 = 0x1d;

+            goto LAB_1;

+          }

+        }

+        else {

+          if (IVar5 != 0) {

+            UserSetLastError(5);

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

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

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

+              bVar11 = false;

+            }

+            bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+            if ((bVar11 == false) && (!bVar16)) {

+              return uVar14;

+            }

+            lVar6 = W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_d

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar11,bVar16,

+                       *(undefined8 *)(lVar6 + 0x10f88),2,CONCAT44(uVar17,0x14),0x1e,

+                       &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids,IVar5);

+            return uVar14;

+          }

+          if (*(int *)(ptVar13 + -0x18) == 0) {

+            if (((*(uint *)(ptVar13 + -4) & 0xaa) != 0) &&

+               (lVar6 = ReferenceDwmApiPort(), lVar6 != 0)) {

+              UserSessionSwitchLeaveCrit();

+              DwmSyncFlushWindowChanges(lVar6);

+              EnterCrit(1,0);

+            }

+            if (iVar1 != 0) {

+              bVar16 = bVar11;

+            }

+            _Var7 = UpconvertTime(*(undefined4 *)ptVar13);

+            auVar3._8_8_ = 0;

+            auVar3._0_8_ = _Var7 * *(longlong *)gliQpcFreq_exref;

+            lVar6 = SUB168(ZEXT816(0x624dd2f1a9fbe77) * auVar3,8);

+            in_stack_ffffffffffffffb0 =

+                 (_Var7 * *(longlong *)gliQpcFreq_exref - lVar6 >> 1) + lVar6 >> 9;

+            xxxMouseEventDirect(*(ulong *)(ptVar13 + -0x10),*(ulong *)(ptVar13 + -0xc),

+                                *(ulong *)(ptVar13 + -8),*(ulong *)(ptVar13 + -4),_Var7,

+                                in_stack_ffffffffffffffb0,*(__uint64 *)(ptVar13 + 8),

+                                (uint)(iVar1 == 0));

+          }

+          else if (*(int *)(ptVar13 + -0x18) == 1) {

+            if (bVar16 != false) {

+              bVar16 = false;

+              xxxWaitForDITMouseInjectionFlush();

+            }

+            uVar2 = *(uint *)(ptVar13 + -0xc);

+            if ((((uVar2 & 4) == 0) || (*(short *)(ptVar13 + -0x10) != 0)) ||

+               ((uVar2 & 0xfffffff9) != 0)) {

+              tVar8 = ptVar13[-0x10];

+              uVar10 = (ushort)(byte)ptVar13[-0xe];

+            }

+            else {

+              uVar10 = *(ushort *)(ptVar13 + -0xe);

+              tVar8 = (tagINPUT)0xe7;

+            }

+            xxxInternalKeyEventDirect

+                      ((uchar)tVar8,uVar10,uVar2,*(ulong *)(ptVar13 + -8),*(__uint64 *)ptVar13);

+          }

+        }

+      }

+      uVar14 = uVar14 + 1;

+      ptVar13 = ptVar13 + 0x28;

+    } while (uVar14 < param_1);

+    if (bVar16) {

+      xxxWaitForDITMouseInjectionFlush();

     }

   }

-  else {

-    zzzInputFocusReceivedWindowEvent(unaff_R15D);

-  }

-LAB_0:

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

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

-  return extraout_EAX;

+  return uVar14;

 }
```

## `xxxGetNextSysMsg`  (modified)

```diff
--- xxxGetNextSysMsg
+++ xxxGetNextSysMsg
@@ -1,162 +1,195 @@
 

-/* WARNING: Control flow encountered bad instruction data */

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

+/* struct tagQMSG * __ptr64 __cdecl xxxGetNextSysMsg(struct tagTHREADINFO * __ptr64,struct tagQMSG *

+   __ptr64,struct tagQMSG * __ptr64) */

 

 tagQMSG * __cdecl xxxGetNextSysMsg(tagTHREADINFO *param_1,tagQMSG *param_2,tagQMSG *param_3)

 

 {

-  byte bVar1;

-  short sVar2;

-  undefined8 uVar3;

-  undefined4 uVar4;

-  undefined4 uVar5;

-  undefined4 uVar6;

-  undefined *puVar7;

-  char cVar8;

+  longlong *plVar1;

+  int *piVar2;

+  uint *puVar3;

+  longlong lVar4;

+  tagTHREADINFO *ptVar5;

+  bool bVar6;

+  char cVar7;

+  int iVar8;

   uint uVar9;

-  int iVar10;

-  uint uVar11;

-  longlong lVar12;

-  undefined4 extraout_var;

-  undefined4 extraout_var_00;

-  undefined4 extraout_var_01;

-  undefined4 extraout_var_02;

-  uint unaff_EBX;

-  undefined8 *puVar13;

-  longlong unaff_RBP;

-  short unaff_DI;

-  longlong in_R9;

-  char cVar14;

-  longlong unaff_R13;

-  char in_SF;

-  char in_OF;

+  longlong lVar10;

+  tagQMSG *ptVar11;

+  tagQMSG *ptVar12;

   

-  if (in_OF == in_SF) {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-    halt_baddata();

+  lVar4 = *(longlong *)(param_1 + 0x1d8);

+  plVar1 = (longlong *)(lVar4 + 0x18);

+  if ((*(uint *)(lVar4 + 0x1fc) & 0x20) != 0) {

+    PostPendingMouseMove();

   }

-  uVar9 = *(uint *)(in_R9 + 0x120) & 0xf;

-  if ((char)uVar9 == '\x03') {

-    *(undefined1 *)(unaff_RBP + -0x19) = 1;

+  iVar8 = Feature_YieldInputQueue3__private_IsEnabledDeviceUsageNoInline();

+  piVar2 = (int *)(lVar4 + 0x28);

+  if (iVar8 == 0) {

+    if (*piVar2 == 0) {

+      return (tagQMSG *)0x0;

+    }

+    bVar6 = ShouldYieldInputQueue(param_1);

+    if (bVar6) {

+      InputTraceLogging::Mouse::YieldInputQueue((tagQMSG *)*plVar1,*(tagQ **)(param_1 + 0x1d8));

+      WakeSomeoneAfterUnlockingOrUndeferring((tagQMSG *)*plVar1);

+      if ((*(uint *)(*(longlong *)(param_1 + 0x1e8) + 4) & 0x402) != 0) {

+        return (tagQMSG *)0x0;

+      }

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x1b6a);

+      return (tagQMSG *)0x0;

+    }

   }

   else {

-    *(char *)(unaff_RBP + -0x19) = (char)unaff_EBX;

-    if ((*(short *)(in_R9 + 0x11e) != (short)unaff_EBX) ||

-       (uVar9 = *(uint *)(param_1 + 0x17c), (uVar9 >> 0x12 & 1) == 0)) {

-      return (tagQMSG *)((ulonglong)uVar9 & 0xffffffffffffff00);

+    if (*piVar2 == 0) {

+      return (tagQMSG *)0x0;

     }

-    *(uint *)(param_1 + 0x17c) = uVar9 & 0xfffbffff;

+    if ((*(tagTHREADINFO **)(*plVar1 + 0x68) == param_1) &&

+       (bVar6 = ShouldYieldInputQueue(param_1), bVar6)) {

+      InputTraceLogging::Mouse::YieldInputQueue((tagQMSG *)*plVar1,*(tagQ **)(param_1 + 0x1d8));

+      WakeSomeoneAfterUnlockingOrUndeferring((tagQMSG *)*plVar1);

+      if ((*(uint *)(*(longlong *)(param_1 + 0x1e8) + 4) & 0x402) != 0) {

+        return (tagQMSG *)0x0;

+      }

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x1b5b);

+      return (tagQMSG *)0x0;

+    }

   }

-  *(undefined8 *)(unaff_RBP + -1) = 0;

-  *(undefined8 *)(unaff_RBP + 7) = 0;

-  iVar10 = _IsTopLevelWindow();

-  uVar9 = unaff_EBX;

-  if (iVar10 == 0) {

-    *(char *)(unaff_RBP + -0x18) = (char)unaff_EBX;

+  if (*piVar2 == 0) {

+    return (tagQMSG *)0x0;

+  }

+  if ((param_2 == (tagQMSG *)0x0) ||

+     (*(undefined8 **)(*(longlong *)(param_1 + 0x1d8) + 0x58) == (undefined8 *)0x0)) {

+    ptVar11 = (tagQMSG *)*plVar1;

   }

   else {

-    bVar1 = *(byte *)(in_R9 + 0x1f);

-    *(undefined1 *)(unaff_RBP + -0x18) = 1;

-    if ((bVar1 & 1) == 0) {

-      if (param_2 == (tagQMSG *)0x0) {

-        GetRect(param_1,unaff_RBP + -1,0x42);

-        if ((unaff_DI != 0) &&

-           (sVar2 = *(short *)(*(longlong *)(param_1 + 0x28) + 0x11c), unaff_DI != sVar2)) {

-          uVar3 = *(undefined8 *)(unaff_RBP + -1);

-          *(int *)(unaff_RBP + -0x11) = (int)uVar3;

-          iVar10 = (int)((ulonglong)uVar3 >> 0x20);

-          *(int *)(unaff_RBP + -0xd) = iVar10;

-          *(int *)(unaff_RBP + -5) = (iVar10 - *(int *)(unaff_RBP + 3)) + *(int *)(unaff_RBP + 0xb);

-          *(undefined4 *)(unaff_RBP + -9) = *(undefined4 *)(unaff_RBP + 7);

-          iVar10 = func_0x000140233ac0(param_1,sVar2,unaff_RBP + -0x11,unaff_RBP + -1);

-          if (iVar10 == 0) {

-            ScaleDPIRect(unaff_RBP + -1,unaff_RBP + -1,

-                         *(undefined2 *)(*(longlong *)(param_1 + 0x28) + 0x11c),unaff_DI,uVar3);

-          }

+    ptVar11 = (tagQMSG *)**(undefined8 **)(*(longlong *)(param_1 + 0x1d8) + 0x58);

+  }

+  if (((*(ulonglong *)(param_1 + 0x550) >> 0xd & 1) != 0) ||

+     ((*(ulonglong *)(param_1 + 0x550) >> 0x25 & 1) != 0)) {

+    while( true ) {

+      if (ptVar11 == (tagQMSG *)0x0) {

+        return (tagQMSG *)0x0;

+      }

+      uVar9 = *(uint *)(ptVar11 + 100);

+      if ((((uVar9 & 0x20) == 0) && ((uVar9 >> 0x1b & 1) == 0)) || ((uVar9 & 0x10) == 0)) break;

+      ptVar11 = *(tagQMSG **)ptVar11;

+    }

+  }

+  if (ptVar11 == (tagQMSG *)0x0) {

+    return (tagQMSG *)0x0;

+  }

+  ptVar5 = *(tagTHREADINFO **)(ptVar11 + 0x68);

+  ptVar12 = ptVar11;

+  if ((ptVar5 != (tagTHREADINFO *)0x0) && (ptVar5 != param_1)) {

+    iVar8 = 0;

+    LOCK();

+    uVar9 = *(uint *)(ptVar5 + 0x210);

+    if (uVar9 == 0) {

+      *(uint *)(ptVar5 + 0x210) = 0;

+      uVar9 = 0;

+    }

+    UNLOCK();

+    if ((uVar9 >> 0x10 & 1) != 0) {

+      do {

+        ptVar12 = ptVar11;

+        if (*(longlong *)(ptVar11 + 0x68) == 0) break;

+        puVar3 = (uint *)(*(longlong *)(ptVar11 + 0x68) + 0x210);

+        LOCK();

+        uVar9 = *puVar3;

+        if (uVar9 == 0) {

+          *puVar3 = 0;

           uVar9 = 0;

         }

-      }

-      else {

-        uVar4 = *(undefined4 *)(param_2 + 4);

-        uVar5 = *(undefined4 *)(param_2 + 8);

-        uVar6 = *(undefined4 *)(param_2 + 0xc);

-        *(undefined4 *)(unaff_RBP + -1) = *(undefined4 *)param_2;

-        *(undefined4 *)(unaff_RBP + 3) = uVar4;

-        *(undefined4 *)(unaff_RBP + 7) = uVar5;

-        *(undefined4 *)(unaff_RBP + 0xb) = uVar6;

-      }

-    }

-    else {

-      GetRect(param_1,unaff_RBP + -1,0x42);

-    }

-  }

-  puVar7 = WPP_GLOBAL_Control;

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) ||

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

-    cVar8 = (char)uVar9;

-  }

-  *(char *)(unaff_RBP + -0x17) = cVar8;

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

-     (cVar14 = '\x01', *(short *)(puVar7 + 0x48) == (short)uVar9)) {

-    cVar14 = (char)uVar9;

-  }

-  if ((cVar8 != '\0') || (cVar14 != '\0')) {

-    lVar12 = W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_qddddddd

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

-               CONCAT31((int3)((uint)(*(int *)(unaff_RBP + 0xb) - *(int *)(unaff_RBP + 3)) >> 8),

-                        *(undefined1 *)(unaff_RBP + -0x17)),cVar14,*(undefined8 *)(lVar12 + 0x10f88)

-               ,5);

-    uVar9 = 0;

-  }

-  lVar12 = *(longlong *)(param_1 + 0x28);

-  if ((((byte)*(undefined4 *)(lVar12 + 0x120) & 0xf) == 2) || (*(char *)(unaff_RBP + -0x19) != '\0')

-     ) {

-    if (((*(uint *)(param_1 + 0x17c) & 0x100000) == 0) && (*(char *)(unaff_RBP + -0x19) == '\0')) {

-      if (*(char *)(unaff_RBP + -0x18) != (char)uVar9) {

-        unaff_EBX = xxxSendDpiChangedMessageToTopLevelWindow

-                              ((tagWND *)param_1,(tagRECT *)(unaff_RBP + -1));

-        lVar12 = CONCAT44(extraout_var,unaff_EBX);

-      }

-    }

-    else {

-      uVar9 = unaff_EBX;

-      if (unaff_R13 == 0) {

-        unaff_R13 = BuildHwndList(param_1,1,0,1);

-        uVar9 = 1;

-        lVar12 = 0;

-        if (unaff_R13 == 0) goto LAB_0;

-      }

-      puVar13 = *(undefined8 **)(unaff_R13 + 8);

-      while (puVar13 = puVar13 + -1, (undefined8 *)(unaff_R13 + 0x20U) < puVar13) {

-        uVar11 = xxxSendDpiChangedMessageToChildWindow((HWND__ *)*puVar13,1);

-        unaff_EBX = unaff_EBX | uVar11;

-      }

-      if (*(char *)(unaff_RBP + -0x18) == '\0') {

-        uVar11 = xxxSendDpiChangedMessageToChildWindow(*(HWND__ **)param_1,1);

-        unaff_EBX = unaff_EBX | uVar11;

-        iVar10 = xxxSendDpiChangedMessageToChildWindow(*(HWND__ **)param_1,0);

-        lVar12 = CONCAT44(extraout_var_01,iVar10);

-      }

-      else {

-        iVar10 = xxxSendDpiChangedMessageToTopLevelWindow

-                           ((tagWND *)param_1,(tagRECT *)(unaff_RBP + -1));

-        lVar12 = CONCAT44(extraout_var_00,iVar10);

-      }

-      unaff_EBX = unaff_EBX | (uint)lVar12;

-      for (puVar13 = (undefined8 *)(unaff_R13 + 0x28); puVar13 < *(undefined8 **)(unaff_R13 + 8);

-          puVar13 = puVar13 + 1) {

-        uVar11 = xxxSendDpiChangedMessageToChildWindow((HWND__ *)*puVar13,0);

-        lVar12 = CONCAT44(extraout_var_02,uVar11);

-        unaff_EBX = unaff_EBX | uVar11;

-      }

-      if (uVar9 != 0) {

-        lVar12 = FreeHwndList(unaff_R13);

+        UNLOCK();

+        if ((uVar9 >> 0x10 & 1) == 0) break;

+        ptVar12 = *(tagQMSG **)ptVar11;

+        if (*(undefined8 **)(ptVar11 + 8) == (undefined8 *)0x0) {

+          *plVar1 = (longlong)ptVar12;

+        }

+        else {

+          **(undefined8 **)(ptVar11 + 8) = ptVar12;

+        }

+        if (*(longlong *)ptVar11 == 0) {

+          *(longlong *)(lVar4 + 0x20) = *(longlong *)(ptVar11 + 8);

+        }

+        else {

+          *(longlong *)(*(longlong *)ptVar11 + 8) = *(longlong *)(ptVar11 + 8);

+        }

+        if (ptVar11 == *(tagQMSG **)(lVar4 + 0x38)) {

+          *(undefined8 *)(lVar4 + 0x38) = 0;

+        }

+        *(longlong *)(ptVar11 + 8) = 0;

+        *(longlong *)ptVar11 = 0;

+        if (*(undefined8 **)(lVar4 + 0x30) == (undefined8 *)0x0) {

+          *(tagQMSG **)(lVar4 + 0x30) = ptVar11;

+          *(longlong *)(ptVar11 + 8) = 0;

+        }

+        else {

+          **(undefined8 **)(lVar4 + 0x30) = ptVar11;

+          *(longlong *)(ptVar11 + 8) = *(longlong *)(lVar4 + 0x30);

+          *(tagQMSG **)(lVar4 + 0x30) = ptVar11;

+        }

+        uVar9 = *(uint *)(ptVar11 + 100);

+        *(longlong *)ptVar11 = 0;

+        if ((((uVar9 >> 0xd & 1) == 0) && ((uVar9 >> 0xe & 1) == 0)) && ((uVar9 >> 0x10 & 1) == 0))

+        {

+          iVar8 = iVar8 + 1;

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

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

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

+            cVar7 = '\0';

+          }

+          else {

+            cVar7 = '\x01';

+          }

+          bVar6 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar7 != '\0') || (bVar6)) {

+            lVar10 = W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_qiqdd

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

+                       *(undefined8 *)(lVar10 + 0x10f88));

+          }

+        }

+        ptVar11 = ptVar12;

+      } while (ptVar12 != (tagQMSG *)0x0);

+      *piVar2 = *piVar2 - iVar8;

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

+        return (tagQMSG *)0x0;

       }

     }

   }

-LAB_0:

-  return (tagQMSG *)CONCAT71((int7)((ulonglong)lVar12 >> 8),unaff_EBX != 0);

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

+  *(longlong *)param_3 = *(longlong *)ptVar12;

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

+  lVar4 = *(longlong *)(ptVar12 + 0x18);

+  *(longlong *)(param_3 + 0x10) = *(longlong *)(ptVar12 + 0x10);

+  *(longlong *)(param_3 + 0x18) = lVar4;

+  lVar4 = *(longlong *)(ptVar12 + 0x28);

+  *(longlong *)(param_3 + 0x20) = *(longlong *)(ptVar12 + 0x20);

+  *(longlong *)(param_3 + 0x28) = lVar4;

+  lVar4 = *(longlong *)(ptVar12 + 0x38);

+  *(longlong *)(param_3 + 0x30) = *(longlong *)(ptVar12 + 0x30);

+  *(longlong *)(param_3 + 0x38) = lVar4;

+  lVar4 = *(longlong *)(ptVar12 + 0x48);

+  *(longlong *)(param_3 + 0x40) = *(longlong *)(ptVar12 + 0x40);

+  *(longlong *)(param_3 + 0x48) = lVar4;

+  lVar4 = *(longlong *)(ptVar12 + 0x58);

+  *(longlong *)(param_3 + 0x50) = *(longlong *)(ptVar12 + 0x50);

+  *(longlong *)(param_3 + 0x58) = lVar4;

+  lVar4 = *(longlong *)(ptVar12 + 0x68);

+  *(longlong *)(param_3 + 0x60) = *(longlong *)(ptVar12 + 0x60);

+  *(longlong *)(param_3 + 0x68) = lVar4;

+  lVar4 = *(longlong *)(ptVar12 + 0x78);

+  *(longlong *)(param_3 + 0x70) = *(longlong *)(ptVar12 + 0x70);

+  *(longlong *)(param_3 + 0x78) = lVar4;

+  lVar4 = *(longlong *)(ptVar12 + 0x88);

+  *(longlong *)(param_3 + 0x80) = *(longlong *)(ptVar12 + 0x80);

+  *(longlong *)(param_3 + 0x88) = lVar4;

+  lVar4 = *(longlong *)(ptVar12 + 0x98);

+  *(longlong *)(param_3 + 0x90) = *(longlong *)(ptVar12 + 0x90);

+  *(longlong *)(param_3 + 0x98) = lVar4;

+  *(longlong *)(param_3 + 0xa0) = *(longlong *)(ptVar12 + 0xa0);

+  return ptVar12;

 }
```

## `EditionActivateMitInput`  (modified)

```diff
--- EditionActivateMitInput
+++ EditionActivateMitInput
@@ -1,111 +1,35 @@
 

-/* WARNING: Removing unreachable block (ram,0x00014023c2b7) */

-

-undefined8

-EditionActivateMitInput(undefined8 param_1,undefined8 param_2,_GUID *param_3,_GUID *param_4)

+uint EditionActivateMitInput(void)

 

 {

-  char cVar1;

+  int iVar1;

   uint uVar2;

-  char *in_RAX;

-  _tlgProvider_t *p_Var3;

-  char *pcVar4;

-  char *in_stack_00000040;

-  uint uStack0000000000000048;

-  undefined4 uStack000000000000004c;

-  char *in_stack_00000050;

-  char *in_stack_00000060;

-  ulong uStack0000000000000070;

-  ushort uStack0000000000000074;

-  ushort uStack0000000000000076;

-  char *in_stack_000000f0;

-  char *in_stack_000000f8;

+  longlong lVar3;

   

-  verw();

-  *in_RAX = *in_RAX + '\x01';

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

-  if (5 < DAT_0) {

-    p_Var3 = (_tlgProvider_t *)&DAT_0;

-    cVar1 = _tlgKeywordOn(&DAT_0,0x400000000000);

-    if (cVar1 != '\0') {

-      pcVar4 = (char *)CONCAT44(uStack000000000000004c,uStack0000000000000048);

-      in_stack_000000f0 = (char *)CONCAT44(in_stack_000000f0._4_4_,0x80004005);

-      in_stack_00000060 = "StubException";

-      in_stack_00000050 = (char *)0x1;

-      param_4 = (_GUID *)&stack0x00000050;

-      in_stack_00000040 = pcVar4;

-      _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_Var3,&DAT_1,param_3,(_tlgWrapperByVal<8> *)param_4,

-                 (_tlgWrapSz<char> *)&stack0x00000060,(_tlgWrapperByVal<4> *)&stack0x000000f0,

-                 (_tlgWrapSz<unsigned_short> *)&stack0x00000040);

-      goto code_r0x00014023c1fe;

-    }

+                    /* 0x239fd0  106  EditionActivateMitInput */

+  iVar1 = Feature_NoBugcheckForSetupIOCP__private_IsEnabledDeviceUsageNoInline();

+  if (iVar1 == 0) {

+    AddThreadWakeEventDispatcherToIOCP();

   }

-  pcVar4 = (char *)CONCAT44(uStack000000000000004c,uStack0000000000000048);

-code_r0x00014023c1fe:

-  if (5 < DAT_2) {

-    p_Var3 = (_tlgProvider_t *)&DAT_2;

-    cVar1 = _tlgKeywordOn(&DAT_2,1);

-    if (cVar1 != '\0') {

-      in_stack_000000f0 = (char *)CONCAT44(in_stack_000000f0._4_4_,0x80004005);

-      in_stack_00000060 = "StubException";

-      in_stack_00000050 = pcVar4;

-      _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_Var3,&DAT_3,param_3,param_4,(_tlgWrapSz<char> *)&stack0x00000060,

-                 (_tlgWrapperByVal<4> *)&stack0x000000f0,

-                 (_tlgWrapSz<unsigned_short> *)&stack0x00000050);

-    }

+  else {

+    uVar2 = AddThreadWakeEventDispatcherToIOCP();

+    if ((int)uVar2 < 0) goto LAB_0;

   }

-  Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>::

-  ~Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-            ((Win32RawOptionalLockedItem<tagRAWINPUTDEVICE,&void___cdecl_Win32FreePool(void*___ptr64)>

-              *)&stack0x00000090);

-  if (5 < DAT_0) {

-    p_Var3 = (_tlgProvider_t *)&DAT_0;

-    cVar1 = _tlgKeywordOn(&DAT_0,0x400000000000);

-    if (cVar1 != '\0') {

-      in_stack_000000f0 = pcVar4;

-      uVar2 = UserGetLastError();

-      if (0 < (int)uVar2) {

-        uVar2 = uVar2 & 0xffff | 0x80070000;

-      }

-      in_stack_000000f8 = (char *)CONCAT44(in_stack_000000f8._4_4_,uVar2);

-      in_stack_00000050 = "FunctionExit";

-      uStack0000000000000070 = 1;

-      uStack0000000000000074 = 0;

-      uStack0000000000000076 = 0;

-      param_4 = (_GUID *)&stack0x00000070;

-      _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_Var3,&DAT_1,param_3,(_tlgWrapperByVal<8> *)param_4,

-                 (_tlgWrapSz<char> *)&stack0x00000050,(_tlgWrapperByVal<4> *)&stack0x000000f8,

-                 (_tlgWrapSz<unsigned_short> *)&stack0x000000f0);

-    }

+  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::ForceSetCurrentCursorShape(*(CursorApiRouter **)(lVar3 + 0x8e68));

   }

-  uVar2 = UserGetLastError();

-  if (0 < (int)uVar2) {

-    uVar2 = uVar2 & 0xffff | 0x80070000;

-  }

-  if (((int)uVar2 < 0) && (5 < DAT_2)) {

-    p_Var3 = (_tlgProvider_t *)&DAT_2;

-    cVar1 = _tlgKeywordOn(&DAT_2,1);

-    if (cVar1 != '\0') {

-      in_stack_000000f0 = pcVar4;

-      uStack0000000000000048 = UserGetLastError();

-      if (0 < (int)uStack0000000000000048) {

-        uStack0000000000000048 = uStack0000000000000048 & 0xffff | 0x80070000;

-      }

-      in_stack_000000f8 = "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_Var3,&DAT_3,param_3,param_4,(_tlgWrapSz<char> *)&stack0x000000f8,

-                 (_tlgWrapperByVal<4> *)&stack0x00000048,

-                 (_tlgWrapSz<unsigned_short> *)&stack0x000000f0);

-    }

-  }

-  UserSessionSwitchLeaveCrit();

-  return 0;

+  return ~uVar2 >> 0x1f;

 }
```

## `NtUserCreateLayoutSyncForHwnd`  (modified)

```diff
--- NtUserCreateLayoutSyncForHwnd
+++ EditionEnableSoftwareCursorForDCompk
@@ -1,45 +1,28 @@
 

-longlong NtUserCreateLayoutSyncForHwnd(undefined8 param_1,undefined8 *param_2)

+void EditionEnableSoftwareCursorForDCompk(undefined4 param_1)

 

 {

   int iVar1;

-  tagTHREADINFO *ptVar2;

-  tagWND *ptVar3;

-  longlong lVar4;

-  void *local_res18 [2];

-  Win32HMThreadLockAlways<tagHOOK> local_20 [24];

   

-                    /* 0x28e5f0  1570  NtUserCreateLayoutSyncForHwnd */

-  iVar1 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+                    /* 0x28d230  144  EditionEnableSoftwareCursorForDCompk */

+  iVar1 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

   if (iVar1 == 0) {

-    UserSetLastError(0x32);

-    lVar4 = 0;

+    iVar1 = Feature_CompositionMagnifier__private_IsEnabledDeviceUsageNoInline();

+    if (iVar1 == 0) {

+      return;

+    }

+    EnterCrit(0,0);

+    ChangeComposableCursor(param_1);

   }

   else {

-    ptVar2 = (tagTHREADINFO *)EnterCrit(0,0);

-    ptVar3 = (tagWND *)ValidateHwnd(param_1);

-    if ((ptVar3 == (tagWND *)0x0) ||

-       (((*(ushort *)(*(longlong *)(ptVar3 + 0x28) + 0x2a) & 0xffff2fff) - 0x29d & 0xfffffffd) == 0)

-       ) {

-      iVar1 = 0;

+    iVar1 = Feature_CompositionMagnifier__private_IsEnabledDeviceUsageNoInline();

+    if (iVar1 == 0) {

+      return;

     }

-    else {

-      Win32HMThreadLockAlways<tagHOOK>::Win32HMThreadLockAlways<tagHOOK>

-                (local_20,ptVar2,(tagHOOK *)ptVar3);

-      local_res18[0] = (void *)0x0;

-      iVar1 = CreateLayoutSyncObjectForWindow(ptVar3,local_res18);

-      if (iVar1 != 0) {

-        if (*(undefined8 **)MmUserProbeAddress_exref <= param_2) {

-          param_2 = *(undefined8 **)MmUserProbeAddress_exref;

-        }

-        *param_2 = local_res18[0];

-      }

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

-                ((Win32HMThreadLockBase<tagWND,0,0> *)local_20);

-    }

-    UserSessionSwitchLeaveCrit();

-    lVar4 = (longlong)iVar1;

+    EnterCrit(0,0);

+    ChangeCursorSynchronization(param_1);

   }

-  return lVar4;

+  UserSessionSwitchLeaveCrit();

+  return;

 }
```

## `MagpDestroyLensContext`  (modified)

```diff
--- MagpDestroyLensContext
+++ MagpDestroyLensContext
@@ -1,16 +1,67 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-/* WARNING: Instruction at (ram,0x0001401a29b7) overlaps instruction at (ram,0x0001401a29b6)

-    */

-

-void MagpDestroyLensContext(undefined8 param_1)

+void MagpDestroyLensContext(undefined8 param_1,undefined8 param_2,tagWND *param_3)

 

 {

-  if ((char)param_1 == '\0' && (char)((ulonglong)param_1 >> 8) == '\0') {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-    halt_baddata();

+  longlong lVar1;

+  longlong *plVar2;

+  undefined8 uVar3;

+  code *pcVar4;

+  int iVar5;

+  uint uVar6;

+  _MAG_THREAD_CONTEXT *p_Var7;

+  _MAG_LENS_CONTEXT *p_Var8;

+  undefined8 uVar9;

+  undefined8 uVar10;

+  

+  p_Var7 = (_MAG_THREAD_CONTEXT *)MagpFindThreadContext();

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

+    p_Var8 = MagpFindLensContext(p_Var7,param_3);

+    if (p_Var8 != (_MAG_LENS_CONTEXT *)0x0) {

+      lVar1 = *(longlong *)p_Var8;

+      if ((*(_MAG_LENS_CONTEXT **)(lVar1 + 8) != p_Var8) ||

+         (plVar2 = *(longlong **)(p_Var8 + 8), (_MAG_LENS_CONTEXT *)*plVar2 != p_Var8)) {

+        pcVar4 = (code *)swi(0x29);

+        (*pcVar4)(3);

+        pcVar4 = (code *)swi(3);

+        (*pcVar4)();

+        return;

+      }

+      *plVar2 = lVar1;

+      *(longlong **)(lVar1 + 8) = plVar2;

+      uVar6 = *(uint *)(p_Var8 + 0x10);

+      if ((uVar6 & 0x40) != 0) {

+        iVar5 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+        if (iVar5 == 0) {

+          ChangeComposableCursor(0);

+        }

+        else {

+          ChangeCursorSynchronization();

+        }

+        *(uint *)(p_Var8 + 0x10) = *(uint *)(p_Var8 + 0x10) & 0xffffffbf;

+        uVar6 = *(uint *)(p_Var8 + 0x10);

+      }

+      if ((uVar6 & 0x20) == 0) {

+        uVar3 = *(undefined8 *)

+                 **(undefined8 **)(*(longlong *)(*(longlong *)(p_Var7 + 0x10) + 0x1f0) + 8);

+        uVar10 = 0;

+        if (*(undefined8 **)(p_Var8 + 0x18) != (undefined8 *)0x0) {

+          uVar10 = **(undefined8 **)(p_Var8 + 0x18);

+        }

+        uVar9 = ReferenceDwmApiPort();

+        DwmAsyncMagnDestroy(uVar9,uVar10,uVar3);

+      }

+      if (*(longlong *)(p_Var8 + 0x18) - 1U < 0xfffffffffffffffe) {

+        HMAssignmentUnlock();

+      }

+      if (*(longlong *)(p_Var8 + 0xe8) != 0) {

+        Win32FreePool();

+      }

+      if (*(longlong *)(p_Var8 + 0x100) != 0) {

+        Win32FreePool();

+      }

+      Win32FreePool(p_Var8);

+    }

   }

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  return;

 }
```

## `NtUserInjectTouchpadAction`  (modified)

```diff
--- NtUserInjectTouchpadAction
+++ NtUserInjectTouchpadAction
@@ -1,10 +1,160 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void NtUserInjectTouchpadAction(void)

+char NtUserInjectTouchpadAction(undefined8 param_1,tagTOUCHPAD_ACTION param_2)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  undefined *puVar1;

+  int iVar2;

+  long lVar3;

+  undefined4 uVar4;

+  longlong lVar5;

+  char cVar6;

+  char cVar7;

+  char cVar8;

+  bool bVar9;

+  RawInputManagerDeviceObject *local_res18;

+  ThreadLockedPerfRegion local_res20 [8];

+  undefined2 uVar10;

+  undefined8 in_stack_ffffffffffffffb8;

+  undefined8 uVar11;

+  

+                    /* 0x293e30  1798  NtUserInjectTouchpadAction */

+  uVar4 = (undefined4)((ulonglong)in_stack_ffffffffffffffb8 >> 0x20);

+  cVar7 = '\x01';

+  cVar6 = '\x01';

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

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0x13 & 1) == 0)) ||

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

+    cVar8 = '\0';

+  }

+  else {

+    cVar8 = '\x01';

+  }

+  bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((cVar8 != '\0') || (bVar9)) {

+    lVar5 = W32GetUserSessionState();

+    uVar11 = param_1;

+    WPP_RECORDER_AND_TRACE_SF_qd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar8,bVar9,

+               *(undefined8 *)(lVar5 + 0x10f88),4,0x14,0x23,

+               &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids,param_1,param_2);

+    uVar4 = (undefined4)((ulonglong)uVar11 >> 0x20);

+  }

+  InputTraceLogging::ThreadLockedPerfRegion::ThreadLockedPerfRegion

+            (local_res20,"InjectTouchpadAction",(ThreadLockedPerfRegion *)0x0);

+  local_res18 = (RawInputManagerDeviceObject *)0x0;

+  EnterCrit(0,0);

+  iVar2 = RawInputManagerDeviceObjectResolveHandle(param_1,3,1,&local_res18);

+  puVar1 = WPP_RECORDER_INITIALIZED;

+  if (iVar2 < 0) {

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0x13 & 1) == 0)) ||

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

+      cVar6 = '\0';

+    }

+    bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar9)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_d

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar9,

+                 *(undefined8 *)(lVar5 + 0x10f88),2,0x14,0x24,

+                 &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids,CONCAT44(uVar4,iVar2));

+    }

+    uVar4 = 6;

+  }

+  else {

+    if ((*(uint *)(local_res18 + 0xf0) & 0x2000) == 0) {

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

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0x13 & 1) == 0)) ||

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

+        cVar7 = '\0';

+      }

+      if ((cVar7 != '\0') || ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED))

+      {

+        lVar5 = W32GetUserSessionState();

+        uVar10 = 0x25;

+LAB_0:

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,

+                   (undefined **)puVar1 != &WPP_RECORDER_INITIALIZED,

+                   *(undefined8 *)(lVar5 + 0x10f88),2,0x14,uVar10,

+                   &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids);

+      }

+    }

+    else if ((char)*(undefined4 *)(local_res18 + 0x100) < '\0') {

+      if (*(int *)(*(longlong *)(local_res18 + 0x210) + 0x18) == 7) {

+        iVar2 = EditionIsRIMInjectionBlocked(local_res18 + 0x48);

+        if (iVar2 == 0) {

+          lVar3 = CPTPProcessor::InjectTouchpadAction(local_res18,param_2);

+          if (-1 < lVar3) goto LAB_1;

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

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0x13 & 1) == 0)) ||

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

+            cVar7 = '\0';

+          }

+          bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar7 != '\0') || (bVar9)) {

+            lVar5 = W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_d

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,bVar9,

+                       *(undefined8 *)(lVar5 + 0x10f88),2,0x14,0x29,

+                       &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids,CONCAT44(uVar4,lVar3));

+          }

+          uVar4 = RtlNtStatusToDosError(lVar3);

+        }

+        else {

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

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0x13 & 1) == 0)) ||

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

+            cVar7 = '\0';

+          }

+          bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar7 != '\0') || (bVar9)) {

+            lVar5 = W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,bVar9,

+                       *(undefined8 *)(lVar5 + 0x10f88),2,0x14,0x28,

+                       &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids);

+          }

+          uVar4 = 5;

+        }

+        goto LAB_2;

+      }

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

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0x13 & 1) == 0)) ||

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

+        cVar7 = '\0';

+      }

+      if ((cVar7 != '\0') || ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED))

+      {

+        lVar5 = W32GetUserSessionState();

+        uVar10 = 0x27;

+        goto LAB_0;

+      }

+    }

+    else {

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

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0x13 & 1) == 0)) ||

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

+        cVar7 = '\0';

+      }

+      if ((cVar7 != '\0') || ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED))

+      {

+        lVar5 = W32GetUserSessionState();

+        uVar10 = 0x26;

+        goto LAB_0;

+      }

+    }

+    uVar4 = 0x57;

+  }

+LAB_2:

+  UserSetLastError(uVar4);

+  cVar7 = '\0';

+LAB_1:

+  if (local_res18 != (RawInputManagerDeviceObject *)0x0) {

+    RawInputManagerDeviceObjectDereference();

+  }

+  UserSessionSwitchLeaveCrit();

+  InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion(local_res20);

+  return cVar7;

 }
```

## `ShouldReceiveTouchpadMessages`  (modified)

```diff
--- ShouldReceiveTouchpadMessages
+++ ShouldReceiveTouchpadMessages
@@ -1,47 +1,13 @@
+

+/* bool __cdecl ShouldReceiveTouchpadMessages(struct tagTHREADINFO const * __ptr64,struct HWND__ *

+   __ptr64) */

 

 bool __cdecl ShouldReceiveTouchpadMessages(tagTHREADINFO *param_1,HWND__ *param_2)

 

 {

-  char cVar1;

-  undefined4 in_EAX;

-  uint uVar2;

-  _tlgProvider_t *p_Var3;

-  longlong unaff_RBX;

-  _GUID *in_R8;

-  _GUID *p_Var4;

-  undefined8 in_stack_00000020;

-  _tlgWrapperByVal<4> *in_stack_00000028;

-  _tlgWrapSz<unsigned_short> *in_stack_00000030;

-  uint in_stack_00000048;

+  int iVar1;

   

-  p_Var4 = (_GUID *)&stack0x00000070;

-  _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 *)param_1,&DAT_0,in_R8,(_tlgWrapperByVal<8> *)p_Var4,

-             (_tlgWrapSz<char> *)CONCAT44((int)((ulonglong)in_stack_00000020 >> 0x20),in_EAX),

-             in_stack_00000028,in_stack_00000030);

-  if (unaff_RBX == 0) {

-    uVar2 = UserGetLastError();

-    if (0 < (int)uVar2) {

-      uVar2 = uVar2 & 0xffff | 0x80070000;

-    }

-    if (((int)uVar2 < 0) && (5 < DAT_1)) {

-      p_Var3 = (_tlgProvider_t *)&DAT_1;

-      cVar1 = _tlgKeywordOn(&DAT_1,1);

-      if (cVar1 != '\0') {

-        in_stack_00000048 = UserGetLastError();

-        if (0 < (int)in_stack_00000048) {

-          in_stack_00000048 = in_stack_00000048 & 0xffff | 0x80070000;

-        }

-        _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_Var3,&DAT_2,in_R8,p_Var4,(_tlgWrapSz<char> *)&stack0x000000f8,

-                   (_tlgWrapperByVal<4> *)&stack0x00000048,

-                   (_tlgWrapSz<unsigned_short> *)&stack0x000000f0);

-      }

-    }

-  }

-  UserSessionSwitchLeaveCrit();

-  return SUB81(unaff_RBX,0);

+  iVar1 = IsTouchpadCapable();

+  return iVar1 != 0;

 }
```

## `xxxInternalKeyEventDirect`  (modified)

```diff
--- xxxInternalKeyEventDirect
+++ xxxInternalKeyEventDirect
@@ -1,37 +1,129 @@
+

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

+/* bool __cdecl xxxInternalKeyEventDirect(unsigned char,unsigned short,unsigned long,unsigned

+   long,unsigned __int64) */

 

 bool __cdecl

 xxxInternalKeyEventDirect(uchar param_1,ushort param_2,ulong param_3,ulong param_4,__uint64 param_5)

 

 {

-  undefined1 uVar1;

-  longlong lVar2;

+  code *pcVar1;

+  short sVar2;

+  undefined8 uVar3;

+  uint3 uVar4;

+  undefined8 uVar5;

+  int iVar6;

+  byte bVar7;

+  tagTHREADINFO *ptVar8;

+  longlong lVar9;

+  ushort uVar10;

+  InjectionSource IVar11;

   undefined7 in_register_00000009;

   undefined6 in_register_00000012;

-  longlong unaff_RBX;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  byte unaff_R12B;

-  byte unaff_R15B;

+  undefined8 uVar12;

+  code cVar13;

+  ushort uVar14;

+  ushort uVar15;

+  uint uVar16;

+  undefined1 auStack_98 [32];

+  undefined8 local_78;

+  undefined8 local_70;

+  undefined8 local_60;

+  undefined8 uStack_58;

+  ulonglong local_50;

+  undefined8 uStack_48;

+  ulonglong local_40;

   

-  in(0xff);

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

-    lVar2 = W32GetUserSessionState

-                      (CONCAT71(in_register_00000009,param_1),CONCAT62(in_register_00000012,param_2)

-                      );

-    *(longlong *)(lVar2 + 0x4a58) = unaff_RDI;

+  uVar12 = CONCAT62(in_register_00000012,param_2);

+  IVar11 = (InjectionSource)CONCAT71(in_register_00000009,param_1);

+  local_40 = __security_cookie ^ (ulonglong)auStack_98;

+  uVar14 = (ushort)param_1;

+  ptVar8 = PtiCurrent();

+  local_60 = 0;

+  uStack_58 = 0;

+  local_50 = 0;

+  uStack_48 = 0;

+  InputTraceLogging::Keyboard::InjectInput(IVar11);

+  uVar3 = local_60;

+  local_60 = CONCAT71(local_60._1_7_,(byte)param_2);

+  uVar5 = local_60;

+  uStack_58 = 0;

+  if ((param_3 & 8) == 0) {

+    if (param_1 == '\x10') {

+      uVar14 = (ushort)(byte)((((byte)param_2 & 0x7f) == 0x36) + 0xa0);

+    }

+    else if (param_1 == '\x11') {

+      uVar14 = (ushort)(byte)(((param_3 & 1) != 0) + 0xa2);

+    }

+    else if (param_1 == '\x12') {

+      uVar14 = (ushort)(byte)(((param_3 & 1) != 0) + 0xa4);

+    }

+    uVar15 = uVar14 | 0x2000;

+    local_60._4_4_ = SUB84(uVar3,4);

+    local_60._0_2_ = (undefined2)uVar5;

+    local_60 = CONCAT44(local_60._4_4_,CONCAT22(uVar14,(undefined2)local_60)) | 0x20000000;

   }

-  lVar2 = W32GetUserSessionState();

-  *(longlong *)(lVar2 + 0x4a50) = unaff_RSI;

-  uVar1 = EditionUpdateRawMouseMode();

-  if ((unaff_R12B & unaff_R15B) != 0) {

-    *(uint *)(unaff_RDI + 0x1fc) = *(uint *)(unaff_RDI + 0x1fc) | 1;

+  else {

+    bVar7 = VKFromVSC(&local_60,

+                      CONCAT71((int7)((ulonglong)uVar12 >> 8),-((param_3 & 1) != 0)) &

+                      0xffffffffffffffe0);

+    uVar15 = (ushort)bVar7;

+    uVar14 = (ushort)bVar7;

+    local_60._0_4_ = (uint)CONCAT12(bVar7,(undefined2)local_60);

   }

-  if (unaff_RDI != 0) {

-    unaff_RBX = *(longlong *)(unaff_RDI + 0x80);

+  lVar9 = 0;

+  cVar13 = SUB21(uVar14,0);

+  uVar14 = 0x100;

+  uVar10 = uVar15;

+  if (cVar13 == (code)0xa1) {

+    uVar10 = uVar15 | 0x100;

+    local_60 = CONCAT44(local_60._4_4_,CONCAT22(uVar15,(undefined2)local_60)) | 0x1000000;

   }

-  if (unaff_RBX != *(longlong *)(unaff_RSI + 0x80)) {

-    uVar1 = `anonymous_namespace'::OnForegroundWindowChanged(unaff_RBX);

+  uVar16 = param_3 & 2;

+  uVar15 = uVar10;

+  if (uVar16 != 0) {

+    uVar15 = uVar10 | 0x8000;

+    local_60 = CONCAT44(local_60._4_4_,CONCAT22(uVar10,(undefined2)local_60)) | 0x80000000;

   }

-  return (bool)uVar1;

+  if ((param_3 & 4) == 0) {

+    if ((param_3 & 1) == 0) {

+      if ((9 < (byte)((char)cVar13 + 0xa0U)) && (cVar13 != (code)0x6e)) {

+        sVar2 = *(short *)ausNumPadCvt_exref;

+        pcVar1 = ausNumPadCvt_exref;

+        while (sVar2 != 0) {

+          if (cVar13 == *pcVar1) goto LAB_0;

+          lVar9 = lVar9 + 1;

+          pcVar1 = ausNumPadCvt_exref + lVar9 * 2;

+          sVar2 = *(short *)pcVar1;

+        }

+        goto LAB_1;

+      }

+LAB_0:

+      uVar14 = 0x800;

+    }

+  }

+  else {

+    uVar14 = 0x1000;

+    local_60 = CONCAT62(local_60._2_6_,param_2);

+  }

+  local_60._0_4_ = CONCAT22(uVar15 | uVar14,(undefined2)local_60);

+LAB_1:

+  uVar4 = CONCAT12(uVar16 != 0,param_2) & 0xff00ff;

+  local_50._0_4_ = (uint)uVar4 << 0x10;

+  iVar6 = (int)local_50;

+  local_50 = (ulonglong)uVar4 << 0x10;

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

+    local_50 = (ulonglong)((uint6)CONCAT14(uVar16 != 0,iVar6) | 0x200000000);

+  }

+  local_50 = CONCAT62(local_50._2_6_,0xfffe);

+  uStack_48 = CONCAT44(uStack_48._4_4_,(int)param_5);

+  uVar3 = *(undefined8 *)(ptVar8 + 0x1d0);

+  lVar9 = W32GetUserSessionState();

+  local_70 = 0;

+  local_78 = 0;

+  *(undefined8 *)(lVar9 + 0x4a18) = uVar3;

+  local_60 = CONCAT44(param_4,(uint)local_60);

+  xxxProcessKeyEvent(&local_60,param_5,1,0);

+  return true;

 }
```

## `NtUserRegisterTouchpadCapableWindow`  (modified)

```diff
--- NtUserRegisterTouchpadCapableWindow
+++ NtUserRegisterTouchpadCapableWindow
@@ -1,156 +1,36 @@
 

-bool NtUserRegisterTouchpadCapableWindow(void)

+undefined8 NtUserRegisterTouchpadCapableWindow(undefined8 param_1,int param_2)

 

 {

-  int iVar1;

-  undefined4 uVar2;

-  ulonglong in_RAX;

-  longlong lVar3;

-  char cVar4;

-  int iVar5;

-  ulonglong unaff_RBX;

-  longlong *unaff_RSI;

-  longlong *unaff_RDI;

-  uint uVar6;

-  longlong unaff_R14;

-  uint unaff_R15D;

-  bool bVar7;

-  longlong *in_stack_00000050;

-  undefined8 in_stack_00000060;

-  ulonglong in_stack_00000068;

-  ulonglong in_stack_00000070;

-  undefined8 in_stack_00000080;

-  int iStack0000000000000088;

-  int iStack000000000000008c;

-  int iStack0000000000000090;

-  int iStack0000000000000094;

-  longlong in_stack_000000f8;

+  longlong lVar1;

+  longlong lVar2;

+  undefined8 uVar3;

+  AtomicExecutionCheck local_18 [8];

+  undefined8 local_10;

   

-  do {

-    if ((((in_RAX >> 0x20 & 0xfffffff8) != 0) || ((in_stack_00000070 & 0xfffffffe) != 0)) ||

-       ((in_stack_00000070 >> 0x20 & 0xfffffffe) != 0)) break;

-    in_stack_000000f8 = 0;

-    iVar1 = ObReferenceObjectByHandle

-                      (in_stack_00000060,0x200,*(undefined8 *)PsProcessType_exref,1,&stack0x000000f8

-                      );

-    *unaff_RSI = in_stack_000000f8;

-    if (iVar1 < 0) {

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

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) {

-        cVar4 = '\0';

+                    /* 0x296550  1906  NtUserRegisterTouchpadCapableWindow */

+  lVar1 = EnterCrit(0,0);

+  uVar3 = 0;

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

+  local_10 = 0;

+  AtomicExecutionCheck::Arm(local_18);

+  lVar2 = ValidateHwndStrict(param_1);

+  if (lVar2 != 0) {

+    if (*(longlong *)(lVar2 + 0x10) == lVar1) {

+      if (param_2 == 0) {

+        *(uint *)(lVar2 + 0x17c) = *(uint *)(lVar2 + 0x17c) & 0xfffff7ff;

       }

       else {

-        cVar4 = '\x01';

+        *(uint *)(lVar2 + 0x17c) = *(uint *)(lVar2 + 0x17c) | 0x800;

       }

-      bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar4 != '\0') || (bVar7)) {

-        lVar3 = W32GetUserSessionState();

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar7,

-                   *(undefined8 *)(lVar3 + 0x10f88),2);

-      }

-      *unaff_RSI = 0;

-      bVar7 = false;

-      uVar2 = RtlNtStatusToDosError(iVar1);

-      UserSetLastError(uVar2);

-      goto LAB_0;

+      uVar3 = 1;

     }

-    iVar1 = PsGetProcessSessionIdEx();

-    *(int *)(unaff_RSI + 1) = iVar1;

-    if (iVar1 == -1) {

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

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) {

-        cVar4 = '\0';

-      }

-      else {

-        cVar4 = '\x01';

-      }

-      bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar4 != '\0') || (bVar7)) {

-        lVar3 = W32GetUserSessionState();

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar7,

-                   *(undefined8 *)(lVar3 + 0x10f88),2);

-      }

-      bVar7 = false;

-      uVar2 = RtlNtStatusToDosError(0xc0000455);

-      UserSetLastError(uVar2);

-      goto LAB_0;

+    else {

+      UserSetLastError(0x57);

     }

-    iVar5 = (int)unaff_RBX;

-    if ((iVar5 != 0) && (iVar1 != (int)unaff_RDI[(ulonglong)(iVar5 - 1) * 4 + 1])) {

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

-         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0 || ((byte)WPP_GLOBAL_Control[0x29] < 2)))

-         ) {

-        cVar4 = '\0';

-      }

-      else {

-        cVar4 = '\x01';

-      }

-      bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar4 != '\0') || (bVar7)) {

-        lVar3 = W32GetUserSessionState();

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar7,

-                   *(undefined8 *)(lVar3 + 0x10f88),2);

-      }

-      bVar7 = false;

-      UserSetLastError(0x57);

-      goto LAB_0;

-    }

-    unaff_RSI[2] = (longlong)iStack0000000000000090 << 0x20 | (longlong)iStack0000000000000088;

-    unaff_RSI[3] = (longlong)iStack0000000000000094 << 0x20 | (longlong)iStack000000000000008c;

-    unaff_RBX = (ulonglong)(iVar5 + 1U);

-    if (unaff_R15D <= iVar5 + 1U) {

-      in_stack_00000050 = unaff_RDI;

-      iVar1 = W32AttachToSessionAndExecute<<lambda_e69bc3e064b06eccacaab7fc72a1e15e>_>

-                        ((int)unaff_RDI[1],&stack0x00000050);

-      bVar7 = iVar1 != 0;

-      goto LAB_0;

-    }

-    unaff_RSI = unaff_RDI + unaff_RBX * 4;

-    in_stack_00000060 = 0;

-    in_stack_00000068 = 0;

-    in_stack_00000070 = 0;

-    RtlCopyFromUser(&stack0x00000060,unaff_R14 + unaff_RBX * 0x18,0x18);

-    in_stack_00000080 = in_stack_00000060;

-    _iStack0000000000000088 = in_stack_00000068;

-    _iStack0000000000000090 = in_stack_00000070;

-    in_RAX = in_stack_00000068;

-  } while ((in_stack_00000068 & 0xfffffff8) == 0);

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)) {

-    cVar4 = '\0';

   }

-  else {

-    cVar4 = '\x01';

-  }

-  bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar4 != '\0') || (bVar7)) {

-    lVar3 = W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar7,

-               *(undefined8 *)(lVar3 + 0x10f88),2);

-  }

-  bVar7 = false;

-  UserSetLastError(0x57);

-LAB_0:

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

-    uVar6 = 0;

-    if (unaff_R15D != 0) {

-      do {

-        if (*unaff_RDI == 0) break;

-        ObfDereferenceObject();

-        uVar6 = uVar6 + 1;

-        unaff_RDI = unaff_RDI + 4;

-      } while (uVar6 < unaff_R15D);

-    }

-    Win32FreePool();

-  }

-  AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)&stack0x000000a0);

+  AtomicExecutionCheck::Disarm(local_18);

   UserSessionSwitchLeaveCrit();

-  return bVar7;

+  return uVar3;

 }
```

## `UserDisableImeForProcess`  (modified)

```diff
--- UserDisableImeForProcess
+++ UserDisableImeForProcess
@@ -1,26 +1,18 @@
+

+/* void __cdecl UserDisableImeForProcess(struct tagPROCESSINFO * __ptr64) */

 

 void __cdecl UserDisableImeForProcess(tagPROCESSINFO *param_1)

 

 {

-  uint *puVar1;

-  byte bVar2;

-  byte *in_RAX;

-  byte in_DH;

-  longlong unaff_RBP;

-  longlong unaff_RDI;

+  tagTHREADINFO *ptVar1;

   

-  bVar2 = (byte)in_RAX;

-  *in_RAX = *in_RAX + bVar2;

-  *in_RAX = *in_RAX + bVar2;

-  in_RAX[-0x46] = in_RAX[-0x46] & in_DH;

-  *in_RAX = *in_RAX | bVar2;

-  *in_RAX = *in_RAX + bVar2;

-  UnsetRedirectedWindow();

-  puVar1 = (uint *)(*(longlong *)(unaff_RDI + 0x28) + 0xe8);

-  *puVar1 = *puVar1 & 0xfffffffe;

-  *(uint *)(unaff_RDI + 0x17c) = *(uint *)(unaff_RDI + 0x17c) & 0xdfffffff;

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

-            ((Win32HMThreadLockBase<tagWND,0,0> *)(unaff_RBP + 0xf));

+  if ((*(uint *)(param_1 + 0xc) & 0x800000) == 0) {

+    *(uint *)(param_1 + 0xc) = *(uint *)(param_1 + 0xc) | 0x800000;

+    for (ptVar1 = *(tagTHREADINFO **)(param_1 + 0x148); ptVar1 != (tagTHREADINFO *)0x0;

+        ptVar1 = *(tagTHREADINFO **)(ptVar1 + 0x2c0)) {

+      UserDisableImeForThread(ptVar1,false);

+    }

+  }

   return;

 }
```

## `EnableDwmSwCursorMoveSize`  (modified)

```diff
--- EnableDwmSwCursorMoveSize
+++ EnableDwmSwCursorMoveSize
@@ -1,116 +1,35 @@
 

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

+/* void __cdecl EnableDwmSwCursorMoveSize(int * __ptr64) */

 

 void __cdecl EnableDwmSwCursorMoveSize(int *param_1)

 

 {

-  int iVar1;

-  bool bVar2;

-  uint uVar3;

-  undefined4 uVar4;

-  longlong lVar5;

-  ushort uVar6;

-  int iVar7;

-  byte bVar8;

-  int iVar9;

-  int unaff_EBX;

-  ulonglong uVar10;

-  longlong unaff_RBP;

-  int unaff_EDI;

-  int unaff_R12D;

-  int unaff_R14D;

-  MOVESIZEDATA *unaff_R15;

+  longlong lVar1;

+  int iVar2;

+  int iVar3;

   

-  if (unaff_EBX == 0x26) {

-    unaff_EDI = -unaff_EDI;

-  }

-  iVar7 = 9;

-  if (*(int *)(unaff_R15 + 0xb0) == 9) {

-    uVar3 = CONCAT22(*(undefined2 *)(unaff_R15 + 0x1c),*(undefined2 *)(unaff_R15 + 0x18));

+  iVar2 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+  iVar3 = 0;

+  if (iVar2 == 0) {

+    iVar2 = IsRemoteConnection();

+    if (iVar2 == 0) {

+      lVar1 = W32GetUserSessionState();

+      if (*(int *)(lVar1 + 0x10d68) == 0) {

+        iVar3 = 1;

+        ChangeComposableCursor(1);

+      }

+    }

   }

   else {

-    uVar3 = _GetMessagePos();

-    iVar7 = *(int *)(unaff_R15 + 0xb0);

+    iVar2 = IsRemoteConnection();

+    iVar3 = 0;

+    if (iVar2 == 0) {

+      lVar1 = W32GetUserSessionState();

+      iVar3 = 1;

+      *(undefined4 *)(lVar1 + 0x8e5c) = 1;

+    }

   }

-  uVar10 = (ulonglong)uVar3;

-  iVar9 = *(int *)(unaff_R15 + 0xb4);

-  *(ulonglong *)(unaff_RBP + -0x19) = uVar10;

-  if (iVar9 == 0) {

-    *(ulonglong *)(unaff_RBP + -9) = uVar10;

-  }

-  else {

-    uVar6 = (short)unaff_R14D +

-            *(short *)(unaff_R15 +

-                      (longlong)*(int *)(&DAT_0 + (longlong)iVar9 * 4) * 4 + 0x28);

-    *(ushort *)(unaff_RBP + -0x19) = uVar6;

-    uVar10 = *(ulonglong *)(unaff_RBP + -0x19);

-    *(ulonglong *)(unaff_RBP + -9) = (ulonglong)uVar6;

-  }

-  iVar1 = *(int *)(unaff_R15 + 0xb8);

-  if (iVar1 != 0) {

-    *(short *)(unaff_RBP + -0x17) =

-         (short)unaff_EDI +

-         *(short *)(unaff_R15 + (longlong)*(int *)(&DAT_1 + (longlong)iVar1 * 4) * 4 + 0x28)

-    ;

-    uVar10 = *(ulonglong *)(unaff_RBP + -0x19);

-  }

-  if (iVar7 != 9) {

-    *(int *)(unaff_R15 + 0xb0) = iVar9 + iVar1;

-    xxxSendTransformableMessageTimeout();

-  }

-  *(int *)(unaff_RBP + -0x11) = (int)*(short *)(unaff_RBP + -9) - *(int *)(unaff_R15 + 0xa8);

-  *(int *)(unaff_RBP + -0xd) = (int)(short)(uVar10 >> 0x10) - *(int *)(unaff_R15 + 0xac);

-  bVar2 = MOVESIZEDATA::PtInClipRegion(unaff_R15,(tagPOINT *)(unaff_RBP + -0x11));

-  if (bVar2) {

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

-        (bVar8 = (byte)unaff_R12D, (bVar8 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0))

-       || ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      bVar8 = 0;

-    }

-    bVar2 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((bVar8 != 0) || (bVar2)) {

-      lVar5 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_Dd

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar8,bVar2,

-                 *(undefined8 *)(lVar5 + 0x10f88),4);

-    }

-    *(undefined8 *)(unaff_RBP + -9) = *(undefined8 *)(unaff_R15 + 0xd8);

-    *(undefined8 *)(unaff_RBP + -0x19) = *(undefined8 *)(unaff_RBP + -0x11);

-    uVar4 = W32GetCurrentThreadDpiAwarenessContext();

-    LogicalToPhysicalDPIPoint(unaff_RBP + -0x19,unaff_RBP + -0x11,uVar4);

-    lVar5 = W32GetUserSessionState();

-    if ((*(longlong *)(unaff_RBP + -1) - 0x26U & 0xfffffffffffffffd) == 0) {

-      iVar7 = *(int *)(lVar5 + 0x4b80);

-      iVar9 = *(int *)(unaff_RBP + -0x15);

-      *(int *)(unaff_RBP + -0x19) = iVar7;

-      if (iVar9 == *(int *)(lVar5 + 0x4b84)) {

-        if (unaff_EDI < 1) {

-          unaff_R12D = -1;

-        }

-        iVar9 = iVar9 + unaff_R12D;

-        *(int *)(unaff_RBP + -0x15) = iVar9;

-      }

-    }

-    else {

-      iVar7 = *(int *)(unaff_RBP + -0x19);

-      if ((*(longlong *)(unaff_RBP + -1) - 0x25U & 0xfffffffffffffffd) == 0) {

-        iVar9 = *(int *)(lVar5 + 0x4b84);

-        *(int *)(unaff_RBP + -0x15) = iVar9;

-        if (iVar7 == *(int *)(lVar5 + 0x4b80)) {

-          if (unaff_R14D < 1) {

-            unaff_R12D = -1;

-          }

-          iVar7 = iVar7 + unaff_R12D;

-          *(int *)(unaff_RBP + -0x19) = iVar7;

-        }

-      }

-      else {

-        iVar9 = *(int *)(unaff_RBP + -0x15);

-      }

-    }

-    zzzInternalSetCursorPos(iVar7,iVar9,2,0);

-  }

-  xxxTM_MoveDragRect(unaff_R15,uVar10);

+  *param_1 = iVar3;

   return;

 }
```

## `xxxTrackMouseMove`  (modified)

```diff
--- xxxTrackMouseMove
+++ xxxTrackMouseMove
@@ -1,10 +1,168 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void xxxTrackMouseMove(void)

+void xxxTrackMouseMove(tagWND *param_1,uint param_2,int param_3,tagINPUT_MESSAGE_SOURCE *param_4)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  tagDESKTOP *ptVar1;

+  bool bVar2;

+  int iVar3;

+  tagTHREADINFO *ptVar4;

+  longlong lVar5;

+  tagWND *ptVar6;

+  tagTHREADINFO *ptVar7;

+  undefined8 uVar8;

+  int *piVar9;

+  undefined4 *puVar10;

+  tagWND *ptVar11;

+  uint uVar12;

+  undefined8 in_stack_ffffffffffffff68;

+  undefined4 uVar13;

+  Win32HMThreadLockBase<tagMENU,0,0> local_78 [8];

+  tagWND *local_70;

+  tagDESKTOP *local_68;

+  tagWND *local_60;

+  undefined8 local_58;

+  undefined8 local_48;

+  undefined8 uStack_40;

+  longlong local_38;

+  

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

+  local_58 = 0;

+  local_48 = 0;

+  uStack_40 = 0;

+  uVar12 = 0;

+  local_38 = -1;

+  ptVar4 = PtiCurrent();

+  ptVar1 = *(tagDESKTOP **)(ptVar4 + 0x1f0);

+  Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+            (local_78,(tagMENU *)param_1);

+  if (param_3 == 0x200) {

+    lVar5 = W32GetUserSessionState();

+    if ((*(uint *)(lVar5 + 0x10654) & 1) != 0) {

+      ptVar11 = param_1;

+      iVar3 = IsIndependentInputWindow(param_1);

+      if (iVar3 != 0) {

+        ptVar6 = GetCompositionInputWindowUIOwner(ptVar11);

+        ptVar11 = local_70;

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

+          local_70 = ptVar6;

+          HMLockObject(ptVar6);

+          param_1 = ptVar6;

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

+            HMUnlockObject(ptVar11);

+          }

+        }

+      }

+    }

+  }

+  ptVar11 = *(tagWND **)(ptVar1 + 0xc0);

+  if (((*(uint *)(ptVar1 + 0x30) & 0x3c0) == 0) || (ptVar11 == (tagWND *)0x0)) {

+    Win32RawLockedNtObject<tagDESKTOP>::ManualLock

+              ((Win32RawLockedNtObject<tagDESKTOP> *)&local_48,ptVar1);

+  }

+  else {

+    ptVar4 = *(tagTHREADINFO **)(ptVar11 + 0x10);

+    ptVar7 = PtiCurrent();

+    if (*(tagQ **)(ptVar7 + 0x1d8) == *(tagQ **)(ptVar4 + 0x1d8)) {

+      uVar12 = 0x200;

+      ptVar7 = PtiCurrent();

+      if ((ptVar4 != ptVar7) && ((*(uint *)(ptVar1 + 0x30) & 0x100) != 0)) {

+        PostEventMessageWindow(*(tagWND **)(ptVar1 + 0xc0),0x1a,(longlong)*(int *)(ptVar1 + 200),1);

+        *(uint *)(ptVar1 + 0x30) = *(uint *)(ptVar1 + 0x30) & 0xfffffeff;

+      }

+    }

+    else if ((*(uint *)(ptVar1 + 0x30) >> 9 & 1) != 0) {

+      PostEventMessageEx(ptVar4,*(tagQ **)(ptVar4 + 0x1d8),0xb,*(tagWND **)(ptVar1 + 0xc0),

+                         *(uint *)(ptVar1 + 0x30),(longlong)*(int *)(ptVar1 + 200),0x200,

+                         (tagINPUT_MESSAGE_SOURCE *)0x0);

+      *(uint *)(ptVar1 + 0x30) = *(uint *)(ptVar1 + 0x30) & 0xfffffdff;

+    }

+    if ((param_2 == 1) || (param_3 != 0x200)) {

+      uVar12 = uVar12 | 0x100;

+    }

+    if ((ptVar11 != param_1) || ((param_2 == 1) != (*(int *)(ptVar1 + 200) == 1))) {

+      uVar12 = uVar12 | 0xc0;

+    }

+    Win32RawLockedNtObject<tagDESKTOP>::ManualLock

+              ((Win32RawLockedNtObject<tagDESKTOP> *)&local_48,ptVar1);

+    Win32HMThreadLockBase<tagMENU,0,0>::Win32HMThreadLockBase<tagMENU,0,0>

+              ((Win32HMThreadLockBase<tagMENU,0,0> *)&local_68,*(tagMENU **)(ptVar1 + 0xc0));

+    xxxCancelMouseMoveTracking

+              (*(undefined4 *)(ptVar1 + 0x30),*(undefined8 *)(ptVar1 + 0xc0),

+               *(undefined4 *)(ptVar1 + 200),uVar12);

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

+              ((Win32HMThreadLockBase<tagWND,0,0> *)&local_68);

+    *(uint *)(ptVar1 + 0x30) = *(uint *)(ptVar1 + 0x30) & ~uVar12;

+  }

+  if ((param_2 != 1) && (param_3 == 0x200)) {

+    lVar5 = W32GetUserSessionState();

+    if ((*(uint *)(lVar5 + 0x10654) & 0x80000080) == 0x80000080) {

+      iVar3 = xxxHotTrack(param_1,param_2);

+      if (iVar3 != 0) {

+        *(uint *)(ptVar1 + 0x30) = *(uint *)(ptVar1 + 0x30) | 0x200;

+      }

+      bVar2 = IsTooltipHittest(param_1,param_2 & 0xffff);

+      if (bVar2) {

+        if ((*(uint *)(ptVar1 + 0x30) & 0x100) == 0) {

+          lVar5 = W32GetUserSessionState();

+          uVar8 = SetRITTimer(*(undefined8 *)(ptVar1 + 0x78),*(int *)(lVar5 + 0x3978) * 3,

+                              TooltipRitShowTimerCallback,1);

+          *(undefined8 *)(ptVar1 + 0x78) = uVar8;

+        }

+        else {

+          xxxTooltipCallback(0,(HFONT__ *)0x0,(HWND__ *)0x0);

+          xxxCreateTooltip(ptVar1,param_1,param_2);

+        }

+      }

+      else {

+        if (*(longlong *)(ptVar1 + 0x78) != 0) {

+          uVar13 = 0;

+          FindTimer();

+          *(undefined8 *)(ptVar1 + 0x78) = 0;

+        }

+        if ((*(uint *)(ptVar1 + 0x30) >> 8 & 1) != 0) {

+          *(uint *)(ptVar1 + 0x30) = *(uint *)(ptVar1 + 0x30) & 0xfffffeff;

+          xxxTooltipCallback(0,(HFONT__ *)0x0,(HWND__ *)0x0);

+        }

+      }

+    }

+  }

+  NotifyShell::HitTestPartUpdate(ptVar1,param_1,param_2,param_4);

+  iVar3 = Feature_DisableCloseButtonHaptics__private_IsEnabledDeviceUsageNoInline();

+  if (((iVar3 == 0) && (param_2 == 0x14)) && (*(int *)(ptVar1 + 200) != 0x14)) {

+    iVar3 = Feature_HapticsCloseButtonSourceCheck__private_IsEnabledDeviceUsageNoInline();

+    if ((iVar3 == 0) || (*(int *)(param_4 + 4) - 1U < 2)) {

+      InputHapticsTrigger(2);

+    }

+  }

+  if (ptVar11 != param_1) {

+    local_68 = ptVar1 + 0xc0;

+    local_60 = param_1;

+    HMAssignmentLock(&local_68,1);

+    if (param_3 == 0x200) {

+      lVar5 = W32GetUserSessionState();

+      if ((*(uint *)(lVar5 + 0x10654) & 1) != 0) {

+        piVar9 = (int *)UPDWORDPointer(0x2002);

+        if (*piVar9 == 0) {

+          ptVar4 = PtiCurrent();

+          *(uint *)(*(longlong *)(ptVar4 + 0x1d8) + 0x1fc) =

+               *(uint *)(*(longlong *)(ptVar4 + 0x1d8) + 0x1fc) | 0x200000;

+        }

+        else {

+          lVar5 = GetActiveTrackPwnd(param_1);

+          if (lVar5 != 0) {

+            puVar10 = (undefined4 *)UPDWORDPointer(0x2002);

+            _SetSystemTimer(lVar5,0xfff7,*puVar10,xxxSystemTimerProc,CONCAT44(uVar13,1));

+          }

+        }

+      }

+    }

+  }

+  *(uint *)(ptVar1 + 200) = param_2;

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

+            ((Win32HMThreadLockBase<tagWND,0,0> *)local_78);

+  if (local_38 != -1) {

+    PopAndFreeW32ThreadLock(&local_48);

+  }

+  return;

 }
```

## `Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline`  (modified)

```diff
--- Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline
+++ xxxSendInputEx
@@ -1,10 +1,15 @@
 

 /* WARNING: Control flow encountered bad instruction data */

 

-void Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline(void)

+uint __cdecl xxxSendInputEx(uint param_1,tagINPUT *param_2)

 

 {

+  uint *puVar1;

+  longlong in_R8;

+  

+  puVar1 = (uint *)(in_R8 + -0x75);

+  *puVar1 = *puVar1 >> 0xd | *puVar1 << 0x13;

                     /* WARNING: Bad instruction - Truncating control flow here */

   halt_baddata();

 }
```

## `InitiateWin32kCleanup`  (modified)

```diff
--- InitiateWin32kCleanup
+++ InitiateWin32kCleanup
@@ -1,55 +1,242 @@
+

+/* void __cdecl InitiateWin32kCleanup(void) */

 

 void __cdecl InitiateWin32kCleanup(void)

 

 {

   undefined4 uVar1;

-  int iVar2;

-  longlong in_RAX;

-  longlong lVar3;

-  byte unaff_BPL;

-  char unaff_SIL;

-  longlong unaff_RDI;

-  char unaff_R12B;

+  InkProcessor *this;

+  longlong *plVar2;

+  bool bVar3;

   bool bVar4;

-  undefined2 uStack0000000000000030;

-  undefined *puStack0000000000000038;

-  undefined4 uStack0000000000000040;

+  int iVar5;

+  ulong uVar6;

+  long lVar7;

+  undefined8 uVar8;

+  longlong lVar9;

+  tagTHREADINFO *ptVar10;

+  longlong lVar11;

+  longlong lVar12;

+  longlong lVar13;

+  undefined8 *puVar14;

+  tagMOUSE_PROMOTION_QUEUE *ptVar15;

+  bool bVar16;

+  bool bVar17;

+  void *local_res10;

+  undefined8 local_res18;

   

-  iVar2 = IsImmersiveBand(*(undefined8 *)(*(longlong *)(in_RAX + 0x4a50) + 0x80));

-  if (iVar2 == 0) {

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

-        ((unaff_BPL & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

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

-      unaff_SIL = unaff_R12B;

-    }

-    bVar4 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((unaff_SIL != '\0') || (bVar4)) {

-      lVar3 = W32GetUserSessionState();

-      puStack0000000000000038 = &WPP_2fba9bb74906360b123a4690c98434c6_Traceguids;

-      uStack0000000000000030 = 0x14;

-      WPP_RECORDER_AND_TRACE_SF_

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_SIL,bVar4,

-                 *(undefined8 *)(lVar3 + 0x10f88),4);

-    }

-  }

-  else {

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

-        ((unaff_BPL & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

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

-      unaff_SIL = unaff_R12B;

-    }

-    bVar4 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((unaff_SIL != '\0') || (bVar4)) {

-      uVar1 = *(undefined4 *)(unaff_RDI + 0x38);

-      lVar3 = W32GetUserSessionState();

-      puStack0000000000000038 = &WPP_2fba9bb74906360b123a4690c98434c6_Traceguids;

-      uStack0000000000000030 = 0x13;

-      uStack0000000000000040 = uVar1;

-      WPP_RECORDER_AND_TRACE_SF_d

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_SIL,bVar4,

-                 *(undefined8 *)(lVar3 + 0x10f88),4);

-    }

+  uVar8 = GreGetRemoteContext();

+  bVar17 = false;

+  bVar4 = true;

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

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

+     (bVar3 = bVar4, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    bVar3 = bVar17;

+  }

+  bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((bVar3) || (bVar16)) {

+    lVar9 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar3,bVar16,

+               *(undefined8 *)(lVar9 + 0x10f88),4,3,0x14,

+               &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+  }

+  SetWaitForWinstaRundown();

+  DrvNotifySessionStateChange(2);

+  lVar9 = W32GetUserSessionState();

+  *(undefined4 *)(lVar9 + 0xaa0) = 0;

+  LOCK();

+  UNLOCK();

+  EnterCrit(1,0);

+  CleanupPowerRequestList();

+  UserSessionSwitchLeaveCrit();

+  iVar5 = IsRemoteConnection();

+  if (iVar5 == 0) {

+    UnregisterDeviceClassNotifications();

+  }

+  EnterCrit(1,0);

+  InitializePointerDevicesPresenceState(0);

+  lVar9 = W32GetUserSessionState();

+  *(undefined4 *)(lVar9 + 0x10cb4) = 1;

+  HYDRA_HINT(0x400);

+  lVar9 = W32GetUserSessionState();

+  puVar14 = *(undefined8 **)(lVar9 + 0x10f20);

+  *(undefined4 *)(lVar9 + 0x10f34) = 1;

+  for (; puVar14 != (undefined8 *)(lVar9 + 0x10f20); puVar14 = (undefined8 *)*puVar14) {

+    if (puVar14[0xe] != 0) {

+      HMAssignmentUnlock();

+    }

+  }

+  *(undefined4 *)(lVar9 + 0x10f34) = 0;

+  lVar9 = W32GetUserSessionState();

+  CTouchProcessor::CancelActivePointers(*(CTouchProcessor **)(lVar9 + 0xcb8));

+  lVar9 = W32GetUserSessionState();

+  EmptyMousePromotionQueue((tagMOUSE_PROMOTION_QUEUE *)(lVar9 + 0x4098));

+  ptVar15 = (tagMOUSE_PROMOTION_QUEUE *)(lVar9 + 0x4028);

+  lVar9 = 5;

+  do {

+    EmptyMousePromotionQueue(ptVar15);

+    ptVar15 = ptVar15 + 0x18;

+    lVar9 = lVar9 + -1;

+  } while (lVar9 != 0);

+  lVar9 = W32GetUserSessionState();

+  if (*(InteractiveControlManager **)(lVar9 + 0x42e0) != (InteractiveControlManager *)0x0) {

+    InteractiveControlManager::Deinitialize(*(InteractiveControlManager **)(lVar9 + 0x42e0));

+    Win32FreePool(*(undefined8 *)(lVar9 + 0x42e0));

+    *(undefined8 *)(lVar9 + 0x42e0) = 0;

+  }

+  lVar9 = W32GetUserSessionState();

+  if (*(longlong *)(lVar9 + 0xcc8) != 0) {

+    lVar9 = W32GetUserSessionState();

+    this = *(InkProcessor **)(lVar9 + 0xcc8);

+    if (this != (InkProcessor *)0x0) {

+      InkProcessor::~InkProcessor(this);

+      Win32FreePool(this);

+    }

+    lVar9 = W32GetUserSessionState();

+    *(undefined8 *)(lVar9 + 0xcc8) = 0;

+  }

+  ptVar10 = PtiCurrent();

+  if ((*(int *)gbIgnoreStressedOutStuff_exref == 0) && (*(int *)(ptVar10 + 0x3b0) != 0)) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x7e7);

+  }

+  lVar9 = *(longlong *)(ptVar10 + 0x290);

+  local_res18 = 0xfffffffe9a5f4400;

+  lVar11 = W32GetUserSessionState();

+  if (lVar9 != 0) {

+    while (lVar13 = *(longlong *)(lVar9 + 0x10), lVar13 != 0) {

+      lVar12 = W32GetUserSessionState();

+      if (((lVar13 == *(longlong *)(lVar12 + 0xf690)) && (*(longlong *)(lVar13 + 0x20) == 0)) &&

+         (*(longlong *)(*(longlong *)(lVar9 + 0x38) + 0x30) == 0)) {

+        uVar6 = NumHandles(*(void **)(lVar11 + 0x10e78));

+        if (uVar6 < 2) break;

+      }

+      UserSessionSwitchLeaveCrit();

+      lVar13 = W32GetUserSessionState();

+      KeWaitForSingleObject(*(undefined8 *)(lVar13 + 0xf668));

+      EnterCrit(1);

+    }

+  }

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

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

+     (bVar3 = bVar4, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    bVar3 = bVar17;

+  }

+  bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((bVar3 != false) || (bVar16)) {

+    lVar9 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar3,bVar16,

+               *(undefined8 *)(lVar9 + 0x10f88),4,0x14,0x15,

+               &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+  }

+  lVar9 = W32GetUserSessionState();

+  *(undefined4 *)(lVar9 + 0x8ecc) = 1;

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

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

+     (bVar3 = bVar4, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    bVar3 = bVar17;

+  }

+  bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((bVar3 != false) || (bVar16)) {

+    uVar1 = *(undefined4 *)(ptVar10 + 0x3b0);

+    lVar9 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_qd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar3,bVar16,

+               *(undefined8 *)(lVar9 + 0x10f88),4,0x14,0x16,

+               &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids,ptVar10,uVar1);

+  }

+  lVar9 = W32GetUserSessionState();

+  *(undefined8 *)(lVar9 + 0x4b78) = 0;

+  ForceCapture(3);

+  FreeScancodeMap();

+  lVar9 = W32GetUserSessionState();

+  if (*(longlong *)(lVar9 + 0xdf10) != 0) {

+    FreeAllSpbs();

+  }

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

+    ZwClose();

+    *(undefined8 *)(lVar11 + 0x10e80) = 0;

+  }

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

+    ObCloseHandle(*(longlong *)(lVar11 + 0x10e78),0);

+    *(undefined8 *)(lVar11 + 0x10e78) = 0;

+  }

+  lVar9 = W32GetUserSessionState();

+  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar9 + 0xf688));

+  lVar9 = W32GetUserSessionState();

+  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar9 + 0xf690));

+  lVar9 = W32GetUserSessionState();

+  while (plVar2 = *(longlong **)(lVar9 + 0xe150), plVar2 != (longlong *)(lVar9 + 0xe150)) {

+    FreeTimer(plVar2 + -9);

+  }

+  TerminateDesktopThreads();

+  lVar9 = W32GetUserSessionState();

+  if (*(int *)(lVar9 + 0x10df4) != 0) {

+    if (*(int *)(lVar11 + 0x10dfc) == 0) {

+      GreDrvDisconnect(uVar8);

+    }

+    else {

+      bDrvDisconnect(*(undefined8 *)(lVar11 + 0x10e28),*(undefined8 *)(lVar11 + 0x10e20),

+                     *(undefined8 *)(lVar11 + 0x10e40));

+    }

+  }

+  lVar9 = W32GetUserSessionState();

+  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar9 + 0x4b58));

+  lVar9 = W32GetUserSessionState();

+  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar9 + 0xf600));

+  lVar9 = W32GetUserSessionState();

+  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(lVar9 + 0x4b60));

+  lVar9 = W32GetUserSessionState();

+  if (*(longlong *)(lVar9 + 0x117d8) != 0) {

+    lVar9 = W32GetUserSessionState();

+    ObfDereferenceObject(*(undefined8 *)(lVar9 + 0x117d8));

+    lVar9 = W32GetUserSessionState();

+    *(undefined8 *)(lVar9 + 0x117d8) = 0;

+  }

+  lVar9 = W32GetUserSessionState();

+  HMAssignmentUnlock(lVar9 + 0x8e30);

+  lVar9 = W32GetUserSessionState();

+  HMAssignmentUnlock(lVar9 + 0x8e38);

+  LOCK();

+  *(uint *)(ptVar10 + 0x210) = *(uint *)(ptVar10 + 0x210) & 0xfffff7ff;

+  UNLOCK();

+  lVar9 = W32GetUserSessionState();

+  *(undefined8 *)(lVar9 + 0x4970) = 0;

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

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

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

+    bVar4 = bVar17;

+  }

+  bVar17 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+  if ((bVar4 != false) || (bVar17)) {

+    lVar9 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar4,bVar17,

+               *(undefined8 *)(lVar9 + 0x10f88),4,0x14,0x17,

+               &WPP_66f053759d2b30ec18f8ad4fef027472_Traceguids);

+  }

+  UserSessionSwitchLeaveCrit();

+  iVar5 = IsCurrentSessionHostServiceSession();

+  if (iVar5 == 0) {

+    local_res10 = (void *)0x0;

+    lVar7 = CreateShutdownEvent((ushort *)L"EventRitExited",0x80,&local_res10);

+    if (-1 < lVar7) {

+      ZwSetEvent(local_res10,0);

+      ZwClose(local_res10);

+    }

+  }

+  HYDRA_HINT(0x1000);

+  lVar9 = W32GetUserSessionState();

+  if (*(longlong *)(lVar9 + 0x10c80) != 0) {

+    lVar9 = W32GetUserSessionState();

+    KeSetEvent(*(undefined8 *)(lVar9 + 0x10c80),1,0);

+  }

+  lVar9 = W32GetUserSessionState();

+  if (*(longlong *)(lVar9 + 0x10c88) != 0) {

+    lVar9 = W32GetUserSessionState();

+    KeSetEvent(*(undefined8 *)(lVar9 + 0x10c88),1,0);

   }

   return;

 }
```

## `NtUserUserHandleGrantAccess`  (modified)

```diff
--- NtUserUserHandleGrantAccess
+++ NtUserUserHandleGrantAccess
@@ -1,537 +1,93 @@
 

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

-

-void NtUserUserHandleGrantAccess(longlong param_1)

+bool NtUserUserHandleGrantAccess(void *param_1,undefined8 param_2,int param_3)

 

 {

-  LPRECT lprcDst;

-  uint uVar1;

-  LONG LVar2;

-  LONG LVar3;

-  LONG LVar4;

-  LONG LVar5;

-  undefined8 uVar6;

-  char cVar7;

-  char cVar8;

-  int iVar9;

-  BOOL BVar10;

-  uint uVar11;

-  int iVar12;

-  ulonglong in_RAX;

-  int *piVar13;

-  HWND pHVar14;

-  longlong lVar15;

-  undefined4 *puVar16;

-  HMONITOR pHVar17;

-  CHECKPOINT *pCVar18;

-  undefined8 uVar19;

-  uint uVar20;

-  uint uVar21;

-  HWND pHVar22;

-  undefined **ppuVar23;

-  tagRECT *ptVar24;

-  POINT pt;

-  longlong unaff_RBP;

-  tagWND *unaff_R12;

-  char unaff_R13B;

-  uint uVar25;

-  ulonglong uVar26;

-  RECT *unaff_R14;

-  MOVESIZEDATA *unaff_R15;

-  bool bVar27;

-  undefined4 extraout_XMM0_Da;

-  undefined4 uVar28;

-  undefined4 uVar29;

-  undefined4 uVar30;

-  undefined4 uVar31;

-  undefined4 uStack0000000000000030;

+  undefined8 uVar1;

+  byte bVar2;

+  int iVar3;

+  ulong uVar4;

+  longlong lVar5;

+  char cVar6;

+  undefined8 uVar7;

+  bool bVar8;

+  bool bVar9;

+  undefined8 local_res20;

+  undefined4 uVar10;

+  undefined2 uVar11;

+  AtomicExecutionCheck local_28 [8];

+  undefined8 local_20;

   

-  uStack0000000000000030 = 0x44c70053;

-  piVar13 = (int *)(in_RAX & 0xffffffffffffff28);

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

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

-  WPP_RECORDER_AND_TRACE_SF_s(*(undefined8 *)(param_1 + 0x18));

-  *(undefined4 *)(unaff_R15 + 0x118) = *(undefined4 *)(*(longlong *)(unaff_R12 + 0x28) + 0x120);

-  pHVar22 = *(HWND *)(unaff_R12 + 0x68);

-  pHVar14 = _GetDesktopWindow();

-  if (pHVar22 == pHVar14) {

-    if ((((*(byte *)(*(longlong *)(unaff_R12 + 0x28) + 0x18) & 8) == 0) &&

-        (-1 < (char)*(byte *)(*(longlong *)(unaff_R12 + 0x28) + 0x18))) &&

-       (lVar15 = W32GetUserSessionState(), *(uint *)**(undefined8 **)(lVar15 + 0xdf10) < 2)) {

-      lVar15 = GetDispInfo();

-      puVar16 = (undefined4 *)

-                GetMonitorWorkRectForWindow(unaff_RBP + -0x19,*(undefined8 *)(lVar15 + 0x68));

-      uVar28 = puVar16[1];

-      uVar29 = puVar16[2];

-      uVar30 = puVar16[3];

-      *(undefined4 *)(unaff_R15 + 0x58) = *puVar16;

-      *(undefined4 *)(unaff_R15 + 0x5c) = uVar28;

-      *(undefined4 *)(unaff_R15 + 0x60) = uVar29;

-      *(undefined4 *)(unaff_R15 + 100) = uVar30;

-      lVar15 = GetDispInfo();

-      lVar15 = *(longlong *)(*(longlong *)(lVar15 + 0x68) + 0x28);

-      uVar28 = *(undefined4 *)(lVar15 + 0x2c);

-      uVar29 = *(undefined4 *)(lVar15 + 0x30);

-      uVar30 = *(undefined4 *)(lVar15 + 0x34);

-      uVar31 = *(undefined4 *)(lVar15 + 0x38);

+                    /* 0x2428a0  2113  NtUserUserHandleGrantAccess */

+  bVar8 = false;

+  uVar10 = 0;

+  local_res20 = 0;

+  cVar6 = '\x01';

+  iVar3 = ObReferenceObjectByHandle(param_2,2,*(undefined8 *)PsJobType_exref,1,&local_res20,0);

+  uVar1 = local_res20;

+  if (iVar3 < 0) {

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

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

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

+      cVar6 = '\0';

     }

-    else {

-      puVar16 = (undefined4 *)GetScreenRectForWindow(unaff_RBP + -0x19);

-      uVar28 = puVar16[1];

-      uVar29 = puVar16[2];

-      uVar30 = puVar16[3];

-      *(undefined4 *)(unaff_R15 + 0x58) = *puVar16;

-      *(undefined4 *)(unaff_R15 + 0x5c) = uVar28;

-      *(undefined4 *)(unaff_R15 + 0x60) = uVar29;

-      *(undefined4 *)(unaff_R15 + 100) = uVar30;

-      puVar16 = (undefined4 *)GetPhysicalScreenRect(unaff_RBP + -0x19);

-      uVar28 = *puVar16;

-      uVar29 = puVar16[1];

-      uVar30 = puVar16[2];

-      uVar31 = puVar16[3];

+    bVar8 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar8)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

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

+                 *(undefined8 *)(lVar5 + 0x10f88),3,CONCAT44(uVar10,3),0x12,

+                 &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids);

     }

-    *(undefined4 *)(unaff_RBP + -9) = uVar28;

-    *(undefined4 *)(unaff_RBP + -5) = uVar29;

-    *(undefined4 *)(unaff_RBP + -1) = uVar30;

-    *(undefined4 *)(unaff_RBP + 3) = uVar31;

+    UserSetLastError(0x57);

+    return false;

   }

-  else {

-    lVar15 = *(longlong *)(pHVar22 + 10);

-    lprcDst = (LPRECT)(unaff_R15 + 0x58);

-    uVar28 = *(undefined4 *)(lVar15 + 0x6c);

-    uVar29 = *(undefined4 *)(lVar15 + 0x70);

-    uVar30 = *(undefined4 *)(lVar15 + 0x74);

-    lprcDst->left = *(LONG *)(lVar15 + 0x68);

-    *(undefined4 *)(unaff_R15 + 0x5c) = uVar28;

-    *(undefined4 *)(unaff_R15 + 0x60) = uVar29;

-    *(undefined4 *)(unaff_R15 + 100) = uVar30;

-    TransformRectBetweenCoordinateSpaces(lprcDst,lprcDst);

-    lVar15 = _GetTopLevelWindow();

-    if ((lVar15 != 0) && (lVar15 = *(longlong *)(*(longlong *)(lVar15 + 0x28) + 0xa8), lVar15 != 0))

-    {

-      *(undefined8 *)(unaff_RBP + -0x19) = 0;

-      *(undefined8 *)(unaff_RBP + -0x11) = 0;

-      iVar9 = GreGetRgnBox(lVar15,unaff_RBP + -0x19);

-      if (iVar9 != 0) {

-        IntersectRect(lprcDst,lprcDst,(RECT *)(unaff_RBP + -0x19));

-      }

+  EnterCrit(0,0);

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

+  local_20 = 0;

+  AtomicExecutionCheck::Arm(local_28);

+  bVar2 = PsGetJobUIRestrictionsClass(uVar1);

+  if ((bVar2 & 1) == 0) {

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

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

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

+      cVar6 = '\0';

     }

-    uVar28 = *(undefined4 *)(unaff_R15 + 0x5c);

-    uVar29 = *(undefined4 *)(unaff_R15 + 0x60);

-    uVar30 = *(undefined4 *)(unaff_R15 + 100);

-    *(LONG *)(unaff_RBP + -9) = lprcDst->left;

-    *(undefined4 *)(unaff_RBP + -5) = uVar28;

-    *(undefined4 *)(unaff_RBP + -1) = uVar29;

-    *(undefined4 *)(unaff_RBP + 3) = uVar30;

-    iVar9 = IsWindowDesktopComposed();

-    if ((iVar9 != 0) &&

-       (((byte)*(undefined4 *)(*(longlong *)(unaff_R12 + 0x28) + 0x120) & 0xf) != 2)) {

-      LogicalToPhysicalDPIRect(unaff_RBP + -9,unaff_RBP + -9);

-    }

-  }

-  lVar15 = *(longlong *)(unaff_R12 + 0x68);

-  *(int *)(unaff_RBP + -0x3d) = (int)(short)((uint)*(undefined4 *)(unaff_RBP + -0x39) >> 0x10);

-  lVar15 = *(longlong *)(lVar15 + 0x28);

-  *(int *)(unaff_RBP + -0x41) = (int)(short)*(undefined4 *)(unaff_RBP + -0x39);

-  lVar15 = *(longlong *)(lVar15 + 0xa8);

-  if (lVar15 == 0) {

-    BVar10 = IntersectRect((LPRECT)(unaff_RBP + -0x31),unaff_R14,(RECT *)(unaff_R15 + 0x58));

-    pt = *(POINT *)(unaff_RBP + -0x41);

-    uVar20 = ~-(uint)(BVar10 != 0) & 0x40 | *(uint *)(unaff_R15 + 200) & 0xffffffbf;

-    *(uint *)(unaff_R15 + 200) = uVar20;

-    ppuVar23 = (undefined **)pt;

-    BVar10 = PtInRect((RECT *)(unaff_R15 + 0x58),pt);

-    uVar20 = ~-(uint)(BVar10 != 0) & 0x10000 | uVar20 & 0xfffeffff;

-  }

-  else {

-    LVar2 = unaff_R14->left;

-    LVar3 = unaff_R14->top;

-    LVar4 = unaff_R14->right;

-    LVar5 = unaff_R14->bottom;

-    pt = *(POINT *)(unaff_RBP + -0x41);

-    *(POINT *)(unaff_RBP + -0x31) = pt;

-    *(LONG *)(unaff_RBP + -0x19) = LVar2;

-    *(LONG *)(unaff_RBP + -0x15) = LVar3;

-    *(LONG *)(unaff_RBP + -0x11) = LVar4;

-    *(LONG *)(unaff_RBP + -0xd) = LVar5;

-    TransformRectBetweenCoordinateSpaces(unaff_RBP + -0x19,unaff_RBP + -0x19);

-    TransformPointBetweenCoordinateSpaces

-              (unaff_RBP + -0x31,unaff_RBP + -0x31,*(undefined8 *)(unaff_R12 + 0x68));

-    iVar9 = GreRectInRegion(lVar15,unaff_RBP + -0x19);

-    uVar28 = *(undefined4 *)(unaff_RBP + -0x2d);

-    ppuVar23._4_4_ = 0;

-    ppuVar23._0_4_ = *(uint *)(unaff_RBP + -0x31);

-    *(uint *)(unaff_R15 + 200) =

-         ~-(uint)(iVar9 != 0) & 0x40 | *(uint *)(unaff_R15 + 200) & 0xffffffbf;

-    iVar9 = GrePtInRegion(lVar15,ppuVar23,uVar28);

-    uVar20 = ~-(uint)(iVar9 != 0) & 0x10000 | *(uint *)(unaff_R15 + 200) & 0xfffeffff;

-  }

-  *(uint *)(unaff_R15 + 200) = uVar20;

-  if ((uVar20 & 0x40) != 0) {

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-       (cVar7 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 3)) {

-      cVar7 = unaff_R13B;

-    }

-    ppuVar23 = &WPP_RECORDER_INITIALIZED;

-    bVar27 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((cVar7 != '\0') || (bVar27)) {

-      lVar15 = W32GetUserSessionState();

-      ppuVar23._1_7_ = (undefined7)((ulonglong)ppuVar23 >> 8);

-      ppuVar23._0_1_ = cVar7;

-      uStack0000000000000030 = CONCAT22(uStack0000000000000030._2_2_,0x54);

+    bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar9)) {

+      lVar5 = W32GetUserSessionState();

+      uVar7 = *(undefined8 *)(lVar5 + 0x10f88);

+      uVar11 = 0x13;

+LAB_0:

       WPP_RECORDER_AND_TRACE_SF_

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),ppuVar23,bVar27,

-                 *(undefined8 *)(lVar15 + 0x10f88),3);

-    }

-  }

-  iVar9 = (int)ppuVar23;

-  if ((*(uint *)(unaff_R15 + 200) & 0x10000) != 0) {

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-       (cVar7 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 3)) {

-      cVar7 = unaff_R13B;

-    }

-    bVar27 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((cVar7 != '\0') || (bVar27)) {

-      lVar15 = W32GetUserSessionState();

-      uVar19 = CONCAT71(SUB87(ppuVar23,1),cVar7);

-      iVar9 = (int)uVar19;

-      uStack0000000000000030 = CONCAT22(uStack0000000000000030._2_2_,0x55);

-      WPP_RECORDER_AND_TRACE_SF_

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar19,bVar27,

-                 *(undefined8 *)(lVar15 + 0x10f88),3);

-    }

-  }

-  if ((*(uint *)(unaff_R15 + 200) & 0x8000) != 0) {

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      unaff_R13B = '\x01';

-    }

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

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

-      cVar7 = '\0';

-    }

-    if ((unaff_R13B != '\0') || (cVar7 != '\0')) {

-      lVar15 = W32GetUserSessionState();

-      uStack0000000000000030 = CONCAT22(uStack0000000000000030._2_2_,0x56);

-      WPP_RECORDER_AND_TRACE_SF_dddddd

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_R13B,cVar7,

-                 *(undefined8 *)(lVar15 + 0x10f88),5);

-    }

-    lVar15 = W32GetUserSessionState();

-    ptVar24 = (tagRECT *)(unaff_RBP + -0x19);

-    *(undefined8 *)(unaff_RBP + -0x19) = *(undefined8 *)(unaff_RBP + -9);

-    *(undefined8 *)(unaff_RBP + -0x11) = *(undefined8 *)(unaff_RBP + -1);

-    CCursorClip::SetClip(*(CCursorClip **)(lVar15 + 0x8e20),ptVar24);

-    iVar9 = (int)ptVar24;

-    unaff_R13B = '\0';

-  }

-  if ((*(byte *)(*(longlong *)(unaff_R12 + 0x28) + 0x1f) & 0x20) == 0) {

-    xxxGetMinMaxTrackInfo(unaff_R15,iVar9);

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      unaff_R13B = '\x01';

-    }

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

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

-      cVar7 = '\0';

-    }

-    if ((unaff_R13B != '\0') || (cVar7 != '\0')) {

-      lVar15 = W32GetUserSessionState();

-      uStack0000000000000030 = CONCAT22(uStack0000000000000030._2_2_,0x57);

-      WPP_RECORDER_AND_TRACE_SF_Dd

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_R13B,cVar7,

-                 *(undefined8 *)(lVar15 + 0x10f88),5);

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar9,uVar7,3,CONCAT44(uVar10,3),

+                 uVar11,&WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids);

     }

   }

   else {

-    lVar15 = W32GetUserSessionState();

-    uVar28 = *(undefined4 *)(*(longlong *)(lVar15 + 0x4e30) + 0x84c);

-    *(undefined4 *)(unaff_R15 + 0x70) = uVar28;

-    *(undefined4 *)(unaff_R15 + 0x68) = uVar28;

-    lVar15 = W32GetUserSessionState();

-    uVar28 = *(undefined4 *)(*(longlong *)(lVar15 + 0x4e30) + 0x850);

-    *(undefined4 *)(unaff_R15 + 0x74) = uVar28;

-    *(undefined4 *)(unaff_R15 + 0x6c) = uVar28;

-  }

-  uVar19 = *(undefined8 *)(unaff_R15 + 0x78);

-  uVar6 = *(undefined8 *)(unaff_R15 + 0x80);

-  *(undefined4 *)(unaff_R15 + 0xf8) = 4;

-  *(uint *)(unaff_R15 + 200) = *(uint *)(unaff_R15 + 200) & 0xff77ff7c;

-  *(undefined8 *)(unaff_R15 + 0x18) = uVar19;

-  *(undefined8 *)(unaff_R15 + 0x20) = uVar6;

-  *(undefined8 *)(unaff_R15 + 0x28) = uVar19;

-  *(undefined8 *)(unaff_R15 + 0x30) = uVar6;

-  *(undefined8 *)(unaff_R15 + 0x38) = uVar19;

-  *(undefined8 *)(unaff_R15 + 0x40) = uVar6;

-  *(undefined8 *)(unaff_R15 + 0x48) = uVar19;

-  *(undefined8 *)(unaff_R15 + 0x50) = uVar6;

-  bVar27 = WindowArrangement::SizeWithSnapAllowed(unaff_R12);

-  cVar7 = '\0';

-  if ((((((bVar27) && ((*(uint *)(unaff_R15 + 200) & 0x8000) != 0)) &&

-        (bVar27 = WindowArrangement::AreDockTargetActiveForSnapMoveSize(), bVar27)) &&

-       ((lVar15 = *(longlong *)(unaff_R12 + 0x28), (*(byte *)(lVar15 + 0x1e) & 4) != 0 &&

-        ((*(byte *)(lVar15 + 0x18) & 0x40) == 0)))) && ((*(byte *)(lVar15 + 0x1f) & 0x40) == 0)) &&

-     ((*(byte *)(*(longlong *)(*(longlong *)(unaff_R15 + 0x10) + 0x28) + 0x1e) & 1) != 0)) {

-    bVar27 = IsGhostWindowClass(unaff_R12);

-    uVar20 = 0x100;

-    if (bVar27) goto LAB_0;

-  }

-  else {

-LAB_0:

-    uVar20 = 0;

-  }

-  *(uint *)(unaff_R15 + 200) = *(uint *)(unaff_R15 + 200) & 0xfffffeff | uVar20;

-  bVar27 = WindowArrangement::MoveWithArrangementAllowed(unaff_R12);

-  uVar20 = 0;

-  if ((((bVar27) && ((*(uint *)(unaff_R15 + 200) & 0x8000) != 0)) &&

-      ((bVar27 = WindowArrangement::AreDockTargetActiveForSnapMoveSize(), bVar27 &&

-       (((lVar15 = *(longlong *)(unaff_R12 + 0x28), (*(byte *)(lVar15 + 0x1e) & 4) != 0 &&

-         ((*(byte *)(lVar15 + 0x18) & 0x40) == 0)) && ((*(byte *)(lVar15 + 0x1f) & 0x40) == 0))))))

-     && ((*(byte *)(*(longlong *)(*(longlong *)(unaff_R15 + 0x10) + 0x28) + 0x1e) & 1) != 0)) {

-    bVar27 = IsGhostWindowClass(unaff_R12);

-    uVar11 = 0x200;

-    if (bVar27) goto LAB_1;

-  }

-  else {

-LAB_1:

-    uVar11 = uVar20;

-  }

-  uVar1 = *(uint *)(unaff_R15 + 200);

-  *(uint *)(unaff_R15 + 200) = uVar1 & 0xfffffdff | uVar11;

-  if (((uVar1 & 0x100 | uVar11) != 0x300) &&

-     ((bVar27 = IsArranged(unaff_R12), bVar27 ||

-      ((bVar27 = WindowArrangement::IsSupported(unaff_R12), bVar27 &&

-       ((*(byte *)(*(longlong *)(unaff_R12 + 0x28) + 0x1f) & 1) != 0)))))) {

-    uVar11 = *(uint *)(unaff_R15 + 200);

-    if ((uVar11 & 0x200) == 0) {

-      uVar11 = uVar11 | 0x40200;

-      *(uint *)(unaff_R15 + 200) = uVar11;

+    lVar5 = HMValidateHandleWithDescriptor(param_1,0xff);

+    if (lVar5 != 0) {

+      uVar4 = KfGetJobIdentity(uVar1);

+      bVar8 = Win32JobObject::GrantAccessHandle(uVar4,param_1,param_3 != 0);

+      goto LAB_1;

     }

-    if ((uVar11 & 0x100) == 0) {

-      *(uint *)(unaff_R15 + 200) = uVar11 | 0x20100;

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3))

+    {

+      cVar6 = '\0';

+    }

+    bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar9)) {

+      lVar5 = W32GetUserSessionState();

+      uVar7 = *(undefined8 *)(lVar5 + 0x10f88);

+      uVar11 = 0x14;

+      goto LAB_0;

     }

   }

-  lVar15 = W32GetUserSessionState();

-  lVar15 = _GetProp(extraout_XMM0_Da,*(undefined2 *)(lVar15 + 0xa216),1);

-  bVar27 = IsArranged(unaff_R12);

-  if ((bVar27) || (uVar11 = uVar20, (*(byte *)(*(longlong *)(unaff_R12 + 0x28) + 0x1f) & 1) != 0)) {

-    uVar11 = 0x400;

-  }

-  uVar1 = *(uint *)(unaff_R15 + 200);

-  *(uint *)(unaff_R15 + 200) = uVar1 & 0xfffffbff | uVar11;

-  if ((lVar15 == 0) || (uVar11 == 0)) {

-    uVar28 = *(undefined4 *)(unaff_R15 + 0x78);

-    uVar29 = *(undefined4 *)(unaff_R15 + 0x7c);

-    uVar30 = *(undefined4 *)(unaff_R15 + 0x80);

-    uVar31 = *(undefined4 *)(unaff_R15 + 0x84);

-  }

-  else {

-    uVar28 = *(undefined4 *)(lVar15 + 0x14);

-    uVar29 = *(undefined4 *)(lVar15 + 0x18);

-    uVar30 = *(undefined4 *)(lVar15 + 0x1c);

-    uVar31 = *(undefined4 *)(lVar15 + 0x20);

-  }

-  *(undefined4 *)(unaff_R15 + 0x98) = uVar28;

-  *(undefined4 *)(unaff_R15 + 0x9c) = uVar29;

-  *(undefined4 *)(unaff_R15 + 0xa0) = uVar30;

-  *(undefined4 *)(unaff_R15 + 0xa4) = uVar31;

-  if ((uVar1 & 0x300) == 0) {

-    pHVar17 = _MonitorFromPoint(pt,2);

-    uVar25 = *(uint *)(unaff_RBP + -0x45);

-    *(HMONITOR *)(unaff_R15 + 0xf0) = pHVar17;

-  }

-  else {

-    uVar25 = *(uint *)(unaff_RBP + -0x45);

-    if ((uVar11 == 0) || (uVar21 = 0x80, uVar25 != 9)) {

-      uVar21 = uVar20;

-    }

-    *(uint *)(unaff_R15 + 200) = uVar1 & 0xfffffb7f | uVar11 | uVar21;

-    if (lVar15 == 0) {

-      if (uVar11 != 0) {

-        *(undefined4 *)(unaff_RBP + -0x31) = 0x20000;

-        MicrosoftTelemetryAssertTriggeredArgsKM

-                  ("IXPTelAssert",*(undefined4 *)(unaff_RBP + -0x31),0x183f);

-      }

-      pCVar18 = CHECKPOINT::Restore(*(tagWND **)(unaff_R15 + 0x10),(tagRECT *)(unaff_R15 + 0x78));

-      if (pCVar18 == (CHECKPOINT *)0x0) {

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

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-           (cVar8 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 2)) {

-          cVar8 = '\0';

-        }

-        bVar27 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-        if ((cVar8 != '\0') || (bVar27)) {

-          lVar15 = W32GetUserSessionState();

-          uStack0000000000000030 = CONCAT22(uStack0000000000000030._2_2_,0x58);

-          WPP_RECORDER_AND_TRACE_SF_

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar8,bVar27,

-                     *(undefined8 *)(lVar15 + 0x10f88),2);

-        }

-      }

-    }

-    HitTargetAndMonitorFromPoint

-              (uVar25,pt,*(uint *)(unaff_R15 + 200) >> 0xb & 7,(tagMONITOR **)(unaff_R15 + 0xf0),

-               (THRESHOLD_MARGIN_DIRECTION *)(unaff_R15 + 0xf8));

-    bVar27 = IsArranged(unaff_R12);

-    if (bVar27) {

-      *(undefined4 *)(unaff_R15 + 0xf8) = 0;

-      if (((*(uint *)(unaff_R15 + 200) & 0x3800) == 0) && (uVar25 == 9)) {

-        *(uint *)(unaff_R15 + 200) = *(uint *)(unaff_R15 + 200) & 0xffffe7ff | 0x2000;

-      }

-    }

-  }

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29])) {

-    cVar7 = '\x01';

-  }

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

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

-    cVar8 = '\0';

-  }

-  else {

-    cVar8 = '\x01';

-  }

-  if ((cVar7 != '\0') || (cVar8 != '\0')) {

-    lVar15 = W32GetUserSessionState();

-    uStack0000000000000030 = CONCAT22(uStack0000000000000030._2_2_,0x59);

-    WPP_RECORDER_AND_TRACE_SF_d

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,cVar8,

-               *(undefined8 *)(lVar15 + 0x10f88),5);

-  }

-  *(uint *)(unaff_R15 + 200) = *(uint *)(unaff_R15 + 200) & 0xf7ffffff;

-  iVar9 = 0;

-  if (uVar25 != 0) {

-    if (uVar25 != 10) goto LAB_2;

-    iVar9 = 9;

-    *(undefined4 *)(unaff_RBP + -0x45) = 9;

-  }

-  lVar15 = W32GetUserSessionState();

-  zzzSetCursor(*(tagCURSOR **)(lVar15 + 0x6970));

-  if ((*(byte *)(*(longlong *)(unaff_R12 + 0x28) + 0x1f) & 0x20) == 0) {

-    *(uint *)(unaff_R15 + 200) = *(uint *)(unaff_R15 + 200) | 1;

-  }

-  uVar28 = *(undefined4 *)(unaff_RBP + -0x39);

-  *(uint *)(unaff_R15 + 200) = *(uint *)(unaff_R15 + 200) | 2;

-  *(int *)(unaff_R15 + 0xbc) = (int)(short)uVar28;

-  *(int *)(unaff_R15 + 0xc0) = (int)(short)((uint)uVar28 >> 0x10);

-  lVar15 = *(longlong *)(unaff_R12 + 0x28);

-  iVar12 = (*(int *)(unaff_R15 + 0x20) + *(int *)(unaff_R15 + 0x18)) / 2;

-  *(int *)(unaff_RBP + -0x41) = iVar12;

-  if (((*(byte *)(lVar15 + 0x1f) & 0x20) == 0) && (iVar9 == 9)) {

-    iVar9 = GetCaptionHeight();

-    *(int *)(unaff_RBP + -0x3d) = *(int *)(unaff_R15 + 0x1c) + 3 + iVar9 / 2;

-  }

-  else {

-    *(int *)(unaff_RBP + -0x3d) = (*(int *)(unaff_R15 + 0x24) + *(int *)(unaff_R15 + 0x1c)) / 2;

-  }

-  pt = *(POINT *)(unaff_RBP + -0x41);

-  zzzInternalSetCursorPos(iVar12,pt.y,1,0);

-  xxxMS_FlushWigglies();

-  if ((*(uint *)(unaff_R15 + 200) >> 8 & 1) == 0) {

-    *(undefined4 *)(unaff_R15 + 0xf8) = 4;

-  }

-  *(uint *)(unaff_R15 + 200) = *(uint *)(unaff_R15 + 200) & 0xffffff7f;

-LAB_2:

-  lVar15 = W32GetUserSessionState();

-  *(uint *)(unaff_R15 + 200) =

-       -(uint)((*(uint *)(lVar15 + 0x10650) & 0x100000) != 0) & 0x20 |

-       *(uint *)(unaff_R15 + 200) & 0xffffffdf;

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 5)) {

-    cVar7 = '\0';

-  }

-  else {

-    cVar7 = '\x01';

-  }

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

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

-    cVar8 = '\0';

-  }

-  if ((cVar7 != '\0') || (cVar8 != '\0')) {

-    lVar15 = W32GetUserSessionState();

-    uStack0000000000000030 = CONCAT22(uStack0000000000000030._2_2_,0x5a);

-    WPP_RECORDER_AND_TRACE_SF_s

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,cVar8,

-               *(undefined8 *)(lVar15 + 0x10f88),5);

-  }

-  *(undefined8 *)(unaff_R15 + 0xe0) = *(undefined8 *)(unaff_R15 + 0xf0);

-  *(undefined4 *)(unaff_R15 + 0xe8) = *(undefined4 *)(unaff_R15 + 0xf8);

-  uVar19 = ValidateHmonitorNoRip(*(undefined8 *)(*(longlong *)(unaff_R12 + 0x28) + 0x100));

-  *(undefined8 *)(unaff_R15 + 0xd8) = uVar19;

-  bVar27 = IsArranged(unaff_R12);

-  uVar20 = *(uint *)(unaff_R15 + 200) & 0xdfffffff | (uint)bVar27 << 0x1d;

-  uVar20 = (uVar20 >> 1 ^ uVar20) & 0x10000000 ^ uVar20;

-  *(uint *)(unaff_R15 + 200) = uVar20 & 0xffdfbfff;

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

-    *(uint *)(unaff_R15 + 200) = uVar20 & 0xffdfbcff;

-    bVar27 = IsArranged(unaff_R12);

-    if (bVar27) {

-      *(uint *)(unaff_R15 + 200) = *(uint *)(unaff_R15 + 200) | 0x60300;

-    }

-  }

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

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

-    cVar7 = '\0';

-  }

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

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

-    cVar8 = '\0';

-  }

-  if ((cVar7 != '\0') || (cVar8 != '\0')) {

-    lVar15 = W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_ss

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,cVar8,

-               *(undefined8 *)(lVar15 + 0x10f88));

-  }

-  uVar20 = *(uint *)(unaff_RBP + -0x45);

-  uVar26 = (ulonglong)uVar20;

-  *(undefined4 *)(unaff_R15 + 0xb4) = *(undefined4 *)(&UNK_3 + uVar26 * 4);

-  *(undefined4 *)(unaff_R15 + 0xb8) = *(undefined4 *)(&UNK_4 + uVar26 * 4);

-  if (*(int *)(&DAT_5 + uVar26 * 4) != -1) {

-    *(int *)(unaff_R15 + 0xa8) =

-         *(int *)(unaff_R15 + (longlong)(short)*(int *)(&DAT_5 + uVar26 * 4) * 4 + 0x78) -

-         *(int *)(unaff_RBP + -0x41);

-  }

-  if (*(int *)(&DAT_6 + uVar26 * 4) != -1) {

-    *(int *)(unaff_R15 + 0xac) =

-         *(int *)(unaff_R15 + (longlong)(short)*(int *)(&DAT_6 + uVar26 * 4) * 4 + 0x78) -

-         *(int *)(unaff_RBP + -0x3d);

-  }

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

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

-    cVar7 = '\0';

-  }

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

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

-    cVar8 = '\0';

-  }

-  if ((cVar7 != '\0') || (cVar8 != '\0')) {

-    lVar15 = W32GetUserSessionState();

-    uStack0000000000000030 = CONCAT22(uStack0000000000000030._2_2_,0x5c);

-    WPP_RECORDER_AND_TRACE_SF_Dd

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,cVar8,

-               *(undefined8 *)(lVar15 + 0x10f88),5);

-  }

-  *(POINT *)(unaff_R15 + 0xfc) = pt;

-  *(uint *)(unaff_R15 + 0xb0) = uVar20;

-  *(undefined8 *)(unaff_R15 + 0x164) = 0;

-  *(undefined8 *)(unaff_R15 + 0x16c) = 0;

-  *(undefined8 *)(unaff_R15 + 0x178) = 0;

-  *(undefined2 *)(unaff_R15 + 0x174) = 0;

-  *(uint *)(unaff_R15 + 0x128) = *(uint *)(unaff_R15 + 0x128) | 0xf;

-  *(undefined4 *)(unaff_R15 + 0x160) = 0;

-  unaff_R15[0x188] = (MOVESIZEDATA)0x0;

-  *(undefined4 *)(unaff_R15 + 400) = 0;

-  *(undefined8 *)(unaff_R15 + 0x198) = 0;

-  *(MOVESIZEDATA **)(unaff_R15 + 0x120) = unaff_R15;

-  MoveSizeReadAndClearMouseMoveBoundHitFlags();

-  MoveSizeHaptic::ResetStateForNewRound((MoveSizeHaptic *)(unaff_R15 + 0x120));

-  return;

+  UserSetLastError(0x57);

+LAB_1:

+  ObfDereferenceObject(uVar1);

+  AtomicExecutionCheck::Disarm(local_28);

+  UserSessionSwitchLeaveCrit();

+  return bVar8;

 }
```

## `DisableDwmSwCursorMoveSize`  (modified)

```diff
--- DisableDwmSwCursorMoveSize
+++ DisableDwmSwCursorMoveSize
@@ -1,126 +1,22 @@
 

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

+/* int __cdecl DisableDwmSwCursorMoveSize(int) */

 

 int __cdecl DisableDwmSwCursorMoveSize(int param_1)

 

 {

   int iVar1;

-  bool bVar2;

-  int extraout_EAX;

-  undefined4 uVar3;

-  int iVar4;

-  uint uVar5;

-  longlong lVar6;

-  ushort uVar7;

-  int iVar8;

-  undefined4 in_register_0000000c;

-  byte bVar9;

-  int iVar10;

-  longlong unaff_RBX;

-  ulonglong uVar11;

-  longlong unaff_RBP;

-  int unaff_R12D;

-  int unaff_R14D;

-  MOVESIZEDATA *unaff_R15;

-  char in_SF;

-  char in_OF;

+  longlong lVar2;

   

-  iVar4 = unaff_R12D;

-  if (in_OF == in_SF) {

-    uVar3 = GetDpiForSystem(CONCAT44(in_register_0000000c,param_1));

-    iVar4 = GetDpiDependentMetric(0xd,uVar3);

-    iVar4 = iVar4 / 2;

-  }

-  if (unaff_RBX == 0x26) {

-    iVar4 = -iVar4;

-  }

-  iVar8 = 9;

-  if (*(int *)(unaff_R15 + 0xb0) == 9) {

-    uVar5 = CONCAT22(*(undefined2 *)(unaff_R15 + 0x1c),*(undefined2 *)(unaff_R15 + 0x18));

+  iVar1 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+  if (iVar1 == 0) {

+    if (param_1 != 0) {

+      ChangeComposableCursor(0);

+    }

   }

   else {

-    uVar5 = _GetMessagePos();

-    iVar8 = *(int *)(unaff_R15 + 0xb0);

+    lVar2 = W32GetUserSessionState();

+    *(undefined4 *)(lVar2 + 0x8e5c) = 0;

   }

-  uVar11 = (ulonglong)uVar5;

-  iVar10 = *(int *)(unaff_R15 + 0xb4);

-  *(ulonglong *)(unaff_RBP + -0x19) = uVar11;

-  if (iVar10 == 0) {

-    *(ulonglong *)(unaff_RBP + -9) = uVar11;

-  }

-  else {

-    uVar7 = (short)unaff_R14D +

-            *(short *)(unaff_R15 +

-                      (longlong)*(int *)(&DAT_0 + (longlong)iVar10 * 4) * 4 + 0x28);

-    *(ushort *)(unaff_RBP + -0x19) = uVar7;

-    uVar11 = *(ulonglong *)(unaff_RBP + -0x19);

-    *(ulonglong *)(unaff_RBP + -9) = (ulonglong)uVar7;

-  }

-  iVar1 = *(int *)(unaff_R15 + 0xb8);

-  if (iVar1 != 0) {

-    *(short *)(unaff_RBP + -0x17) =

-         (short)iVar4 +

-         *(short *)(unaff_R15 + (longlong)*(int *)(&DAT_1 + (longlong)iVar1 * 4) * 4 + 0x28)

-    ;

-    uVar11 = *(ulonglong *)(unaff_RBP + -0x19);

-  }

-  if (iVar8 != 9) {

-    *(int *)(unaff_R15 + 0xb0) = iVar10 + iVar1;

-    xxxSendTransformableMessageTimeout();

-  }

-  *(int *)(unaff_RBP + -0x11) = (int)*(short *)(unaff_RBP + -9) - *(int *)(unaff_R15 + 0xa8);

-  *(int *)(unaff_RBP + -0xd) = (int)(short)(uVar11 >> 0x10) - *(int *)(unaff_R15 + 0xac);

-  bVar2 = MOVESIZEDATA::PtInClipRegion(unaff_R15,(tagPOINT *)(unaff_RBP + -0x11));

-  if (bVar2) {

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

-        (bVar9 = (byte)unaff_R12D, (bVar9 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0))

-       || ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      bVar9 = 0;

-    }

-    bVar2 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((bVar9 != 0) || (bVar2)) {

-      lVar6 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_Dd

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar9,bVar2,

-                 *(undefined8 *)(lVar6 + 0x10f88),4);

-    }

-    *(undefined8 *)(unaff_RBP + -9) = *(undefined8 *)(unaff_R15 + 0xd8);

-    *(undefined8 *)(unaff_RBP + -0x19) = *(undefined8 *)(unaff_RBP + -0x11);

-    uVar3 = W32GetCurrentThreadDpiAwarenessContext();

-    LogicalToPhysicalDPIPoint(unaff_RBP + -0x19,unaff_RBP + -0x11,uVar3);

-    lVar6 = W32GetUserSessionState();

-    if ((*(longlong *)(unaff_RBP + -1) - 0x26U & 0xfffffffffffffffd) == 0) {

-      iVar8 = *(int *)(lVar6 + 0x4b80);

-      iVar10 = *(int *)(unaff_RBP + -0x15);

-      *(int *)(unaff_RBP + -0x19) = iVar8;

-      if (iVar10 == *(int *)(lVar6 + 0x4b84)) {

-        if (iVar4 < 1) {

-          unaff_R12D = -1;

-        }

-        iVar10 = iVar10 + unaff_R12D;

-        *(int *)(unaff_RBP + -0x15) = iVar10;

-      }

-    }

-    else {

-      iVar8 = *(int *)(unaff_RBP + -0x19);

-      if ((*(longlong *)(unaff_RBP + -1) - 0x25U & 0xfffffffffffffffd) == 0) {

-        iVar10 = *(int *)(lVar6 + 0x4b84);

-        *(int *)(unaff_RBP + -0x15) = iVar10;

-        if (iVar8 == *(int *)(lVar6 + 0x4b80)) {

-          if (unaff_R14D < 1) {

-            unaff_R12D = -1;

-          }

-          iVar8 = iVar8 + unaff_R12D;

-          *(int *)(unaff_RBP + -0x19) = iVar8;

-        }

-      }

-      else {

-        iVar10 = *(int *)(unaff_RBP + -0x15);

-      }

-    }

-    zzzInternalSetCursorPos(iVar8,iVar10,2,0);

-  }

-  xxxTM_MoveDragRect(unaff_R15,uVar11);

-  return extraout_EAX;

+  return 1;

 }
```

## `xxxDrawDragRectEx`  (modified)

```diff
--- xxxDrawDragRectEx
+++ xxxDrawDragRectEx
@@ -1,21 +1,510 @@
+

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

+/* void __cdecl xxxDrawDragRectEx(struct MOVESIZEDATA * __ptr64,struct tagRECT * __ptr64,unsigned

+   int,struct tagRECT * __ptr64) */

 

 void __cdecl xxxDrawDragRectEx(MOVESIZEDATA *param_1,tagRECT *param_2,uint param_3,tagRECT *param_4)

 

 {

-  byte *pbVar1;

-  code *pcVar2;

-  longlong in_RAX;

-  byte unaff_BL;

-  undefined7 unaff_00000019;

+  undefined4 uVar1;

+  _W32THREAD *p_Var2;

+  tagWND *ptVar3;

+  undefined8 uVar4;

+  tagRECT tVar5;

+  tagRECT tVar6;

+  undefined4 uVar7;

+  BOOL BVar8;

+  tagTHREADINFO *ptVar10;

+  longlong lVar11;

+  undefined8 uVar12;

+  _LAYOUT_SYNCHRONIZATION_TYPE _Var9;

+  HRGN__ *pHVar13;

+  longlong lVar14;

+  HWND pHVar15;

+  undefined8 *puVar16;

+  tagRECT *ptVar17;

+  char cVar18;

+  int iVar19;

+  LONG LVar20;

+  uint *puVar21;

+  LONG LVar22;

+  int iVar23;

+  uint uVar24;

+  undefined1 uVar25;

+  ulonglong uVar26;

+  HRGN__ *pHVar27;

+  uint uVar28;

+  bool bVar29;

+  LONG LVar30;

+  LONG LVar31;

+  LONG LVar32;

+  LONG LVar33;

+  undefined1 auStack_1b8 [32];

+  uint *local_198;

+  undefined4 local_190;

+  undefined2 local_188;

+  undefined *local_180;

+  char *local_178;

+  int local_170;

+  LONG local_168;

+  LONG local_160;

+  LONG local_158;

+  int local_150;

+  int local_148;

+  char local_138;

+  char local_137;

+  _LAYOUT_SYNCHRONIZATION_TYPE local_134;

+  uint local_130;

+  int local_12c;

+  undefined8 local_128;

+  uint local_120;

+  int local_11c;

+  _LAYOUT_SYNCHRONIZATION_TYPE local_118;

+  tagTHREADINFO *local_110;

+  undefined1 local_108 [12];

+  LONG LStack_fc;

+  undefined8 local_f8;

+  undefined8 uStack_f0;

+  undefined8 local_e8;

+  undefined8 uStack_e0;

+  undefined8 local_d8;

+  RECT local_d0;

+  tagRECT local_c0;

+  undefined8 local_b0;

+  tagRECT local_a8;

+  Win32HMThreadLockBase<tagWND,1,0> local_98 [16];

+  Win32HMThreadLockBase<tagWND,1,0> local_88 [16];

+  tagRECT local_78;

+  tagRECT local_68;

+  ulonglong local_58;

   

-  pbVar1 = (byte *)((longlong)param_1 * 2 + 0x33);

-  *pbVar1 = *pbVar1 | (byte)((ulonglong)param_2 >> 8);

-  pbVar1 = (byte *)(in_RAX + -0x7d);

-  *pbVar1 = *pbVar1 >> 4 | *pbVar1 << 4;

-  pbVar1 = (byte *)(CONCAT71(unaff_00000019,unaff_BL) + -0x3d);

-  *pbVar1 = *pbVar1 & unaff_BL;

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

-  (*pcVar2)();

+  local_58 = __security_cookie ^ (ulonglong)auStack_1b8;

+  local_128 = param_4;

+  ptVar10 = PtiCurrent();

+  if (*(longlong *)(ptVar10 + 0x1f0) == 0) {

+LAB_0:

+    local_134 = 4;

+  }

+  else {

+    ptVar10 = PtiCurrent();

+    local_134 = 5;

+    if ((*(uint *)(**(longlong **)(*(longlong *)(ptVar10 + 0x1f0) + 8) + 0x40) & 1) == 0)

+    goto LAB_0;

+  }

+  uVar28 = param_3 & 0xfffffff;

+  if (((*(uint *)(param_1 + 200) & 0x10) == 0) &&

+     ((*(byte *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x1b) & 8) == 0)) {

+    if (param_2 == (tagRECT *)0x0) {

+      return;

+    }

+    LVar30 = param_2->top;

+    LVar31 = param_2->right;

+    LVar32 = param_2->bottom;

+    param_4->left = param_2->left;

+    param_4->top = LVar30;

+    param_4->right = LVar31;

+    param_4->bottom = LVar32;

+    return;

+  }

+  if (((param_2 != (tagRECT *)0x0) &&

+      (lVar11._0_4_ = param_2->left, lVar11._4_4_ = param_2->top,

+      *(longlong *)(param_1 + 0x18) == lVar11)) &&

+     (lVar14._0_4_ = param_2->right, lVar14._4_4_ = param_2->bottom,

+     *(longlong *)(param_1 + 0x20) == lVar14)) {

+    return;

+  }

+  local_130 = 0;

+  ptVar17 = param_2;

+  if (param_2 == (tagRECT *)0x0) {

+    ptVar17 = param_4;

+  }

+  uVar12._0_4_ = ptVar17->left;

+  uVar12._4_4_ = ptVar17->top;

+  local_68.right = ptVar17->right;

+  local_68.bottom = ptVar17->bottom;

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

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

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

+    local_137 = '\0';

+  }

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

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

+    local_138 = '\0';

+  }

+  local_68._0_8_ = uVar12;

+  if ((local_137 != '\0') || (local_138 != '\0')) {

+    iVar23 = local_68.right - (LONG)uVar12;

+    iVar19 = local_68.bottom - uVar12._4_4_;

+    lVar11 = W32GetUserSessionState();

+    local_178 = "Preview";

+    if (-1 < (int)param_3) {

+      local_178 = "Drag";

+    }

+    local_158 = local_68.bottom;

+    local_160 = local_68.right;

+    local_168 = local_68.top;

+    local_180 = &WPP_a4942bb3c27731613b7ebe66d62ba7d5_Traceguids;

+    local_188 = 0x10;

+    local_190 = 1;

+    local_198 = (uint *)CONCAT71(local_198._1_7_,5);

+    local_170 = (LONG)uVar12;

+    local_150 = iVar23;

+    local_148 = iVar19;

+    WPP_RECORDER_AND_TRACE_SF_sdddddd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),local_137,local_138,

+               *(undefined8 *)(lVar11 + 0x10f88));

+    param_4 = local_128;

+  }

+  uVar24 = local_130;

+  if (((-1 < (int)param_3) && (uVar28 == 3)) &&

+     (iVar19 = xxxDetectNewMonitor(param_1,&local_68), iVar19 != 0)) {

+    uVar1 = *(undefined4 *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x120);

+    param_4->left = local_68.left;

+    param_4->top = local_68.top;

+    param_4->right = local_68.right;

+    param_4->bottom = local_68.bottom;

+    uVar24 = (uint)(((byte)uVar1 & 0xf) != 2);

+    if (param_2 != (tagRECT *)0x0) {

+      param_2->left = local_68.left;

+      param_2->top = local_68.top;

+      param_2->right = local_68.right;

+      param_2->bottom = local_68.bottom;

+    }

+    local_130 = uVar24;

+    if (uVar24 != 0) {

+      xxxMS_FlushWigglies();

+      GenerateMouseMove();

+    }

+  }

+  if (((*(uint *)(param_1 + 200) & 0x20) == 0) || (uVar28 < 2)) {

+    ptVar17 = param_2;

+    if (param_2 == (tagRECT *)0x0) {

+      ptVar17 = param_4;

+    }

+    local_78.left = ptVar17->left;

+    local_78.top = ptVar17->top;

+    local_78.right = ptVar17->right;

+    local_78.bottom = ptVar17->bottom;

+    puVar16 = (undefined8 *)GetPhysicalScreenRect(&local_f8);

+    local_f8 = *puVar16;

+    uStack_f0 = puVar16[1];

+    if ((int)param_3 < 0) {

+      local_110 = *(tagTHREADINFO **)(param_1 + 0xf0);

+    }

+    else {

+      local_110 = *(tagTHREADINFO **)(param_1 + 0xd8);

+    }

+    ptVar17 = WindowMargins::ReduceRect

+                        (&local_c0,*(tagWND **)(param_1 + 0x10),&local_78,

+                         (uint)*(ushort *)(*(longlong *)(local_110 + 0x28) + 0x3c));

+    local_78.left = ptVar17->left;

+    local_78.top = ptVar17->top;

+    local_78.right = ptVar17->right;

+    local_78.bottom = ptVar17->bottom;

+    LogicalToPhysicalDPIRect

+              (&local_78,&local_78,

+               *(undefined4 *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x120),

+               &local_110);

+    _Var9 = local_134;

+    if (uVar24 != 0) {

+      lVar11 = W32GetUserSessionState();

+      _Var9 = local_134;

+      bSetDevDragRect(*(undefined8 *)(*(longlong *)(lVar11 + 0xdf10) + 0x30),&local_78,&local_f8,

+                      local_134);

+    }

+    if (param_2 == (tagRECT *)0x0) {

+      if (uVar28 == 0) {

+        lVar11 = W32GetUserSessionState();

+        if (-1 < (int)param_3) {

+          bSetDevDragRect(*(undefined8 *)(*(longlong *)(lVar11 + 0xdf10) + 0x30),&local_78,&local_f8

+                          ,_Var9);

+          goto LAB_1;

+        }

+        puVar21 = *(uint **)(*(longlong *)(lVar11 + 0x4e30) + 0x1360);

+        uVar12 = **(undefined8 **)(param_1 + 0x10);

+        lVar11 = W32GetUserSessionState();

+        ptVar17 = &local_78;

+      }

+      else {

+        if ((uVar28 != 1) || (-1 < (int)param_3)) goto LAB_1;

+        lVar11 = W32GetUserSessionState();

+        puVar21 = *(uint **)(*(longlong *)(lVar11 + 0x4e30) + 0x1360);

+        uVar12 = **(undefined8 **)(param_1 + 0x10);

+        lVar11 = W32GetUserSessionState();

+        _Var9 = 0;

+        ptVar17 = (tagRECT *)0x0;

+      }

+      local_198 = puVar21;

+      bSetDevPreviewRect(*(undefined8 *)(*(longlong *)(lVar11 + 0xdf10) + 0x30),ptVar17,_Var9,uVar12

+                        );

+    }

+    else {

+      if (((int)param_3 < 0) && ((*(uint *)(param_1 + 200) & 0x20) != 0)) {

+        lVar11 = W32GetUserSessionState();

+        puVar21 = *(uint **)(*(longlong *)(lVar11 + 0x4e30) + 0x1360);

+        uVar12 = **(undefined8 **)(param_1 + 0x10);

+        lVar11 = W32GetUserSessionState();

+        local_198 = puVar21;

+        bMoveDevPreviewRect(*(undefined8 *)(*(longlong *)(lVar11 + 0xdf10) + 0x30),&local_78,_Var9,

+                            uVar12);

+      }

+      else {

+        ptVar10 = PtiCurrent();

+        if ((*(longlong *)(ptVar10 + 0x1f0) == 0) ||

+           (ptVar10 = PtiCurrent(),

+           (*(uint *)(**(longlong **)(*(longlong *)(ptVar10 + 0x1f0) + 8) + 0x40) & 1) == 0)) {

+          uVar12 = 0;

+        }

+        else {

+          uVar12 = 1;

+        }

+        lVar11 = W32GetUserSessionState();

+        bMoveDevDragRect(*(undefined8 *)(*(longlong *)(lVar11 + 0xdf10) + 0x30),&local_78,&local_f8,

+                         uVar12);

+      }

+      LVar30 = param_2->top;

+      LVar31 = param_2->right;

+      LVar32 = param_2->bottom;

+      local_128->left = param_2->left;

+      local_128->top = LVar30;

+      local_128->right = LVar31;

+      local_128->bottom = LVar32;

+    }

+  }

+  else {

+    p_Var2 = *(_W32THREAD **)(*(longlong *)(param_1 + 0x10) + 0x10);

+    local_110 = PtiCurrent();

+    local_11c = 0;

+    local_c0.left = 0;

+    local_c0.top = 0;

+    local_c0.right = 0;

+    local_c0.bottom = 0;

+    local_b0 = 0;

+    local_e8 = 0;

+    uStack_e0 = 0;

+    local_118 = 0;

+    local_d8 = 0xffffffffffffffff;

+    local_134 = 0;

+    local_12c = 0;

+    if (p_Var2 != (_W32THREAD *)local_110) {

+      Win32RawLockedW32Thread::ManualLock((Win32RawLockedW32Thread *)&local_e8,p_Var2);

+    }

+    LOCK();

+    *(uint *)(p_Var2 + 0x210) = *(uint *)(p_Var2 + 0x210) | 0x8000;

+    UNLOCK();

+    if (param_2 != (tagRECT *)0x0) {

+      LVar30 = param_2->top;

+      LVar31 = param_2->right;

+      LVar32 = param_2->bottom;

+      param_4->left = param_2->left;

+      param_4->top = LVar30;

+      param_4->right = LVar31;

+      param_4->bottom = LVar32;

+    }

+    lVar11 = *(longlong *)(param_1 + 0x10);

+    _local_108 = *param_4;

+    LVar30 = local_108._0_4_;

+    LVar31 = local_108._4_4_;

+    LVar32 = local_108._8_4_;

+    LVar33 = local_108._12_4_;

+    pHVar15 = *(HWND *)(lVar11 + 0x68);

+    LVar20 = LVar32;

+    LVar22 = LVar30;

+    if ((pHVar15 != (HWND)0x0) && (iVar19 = _IsTopLevelWindow(lVar11), iVar19 == 0)) {

+      _ScreenToClient(pHVar15,(LPPOINT)local_108);

+      _ScreenToClient(pHVar15,(LPPOINT)(local_108 + 8));

+      tVar5 = _local_108;

+      uVar1 = local_108._0_4_;

+      uVar7 = local_108._8_4_;

+      LVar20 = local_108._8_4_;

+      LVar22 = local_108._0_4_;

+      if ((*(byte *)(*(longlong *)(pHVar15 + 10) + 0x1a) & 0x40) != 0) {

+        local_108._0_4_ = uVar7;

+        tVar6 = _local_108;

+        LStack_fc = tVar5.bottom;

+        local_108._0_8_ = tVar6._0_8_;

+        local_108._8_4_ = uVar1;

+        LVar20 = uVar1;

+        LVar22 = uVar7;

+      }

+      LVar30 = local_108._0_4_;

+      LVar31 = local_108._4_4_;

+      LVar32 = local_108._8_4_;

+      LVar33 = LStack_fc;

+    }

+    if (*(char *)(*(longlong *)(lVar11 + 0x28) + 0x10) < '\0') {

+      uVar12 = FindSpb(lVar11);

+      local_d0._0_8_ = *(undefined8 *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x58);

+      local_d0._8_8_ = *(undefined8 *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x60);

+      if ((param_2 != (tagRECT *)0x0) &&

+         (BVar8 = IntersectRect(&local_d0,&local_d0,param_2), BVar8 != 0)) {

+        FreeSpb(uVar12);

+      }

+    }

+    pHVar13 = (HRGN__ *)

+              GreCreateRectRgnIndirect(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x58);

+    lVar11 = *(longlong *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0xa8);

+    if (lVar11 != 0) {

+      GreCombineRgn(pHVar13,pHVar13,lVar11,1);

+    }

+    uVar25 = (undefined1)lVar11;

+    Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>

+              (local_98,*(tagWND **)(param_1 + 0x10));

+    lVar11 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28);

+    if (((*(int *)(lVar11 + 0x60) - *(int *)(lVar11 + 0x58) != LVar20 - LVar22) ||

+        (iVar19 = local_12c, *(int *)(lVar11 + 100) - *(int *)(lVar11 + 0x5c) != LVar33 - LVar31))

+       && (iVar23 = DoesQualifyForResizeOptimization(param_1), iVar19 = local_12c, iVar23 != 0)) {

+      local_120 = 0;

+      iVar19 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+      if (iVar19 == 0) {

+        local_118 = DoesRequireResizeLayoutSynchronization(*(tagWND **)(param_1 + 0x10));

+        _Var9 = (_LAYOUT_SYNCHRONIZATION_TYPE)(local_118 != 0);

+      }

+      else {

+        _Var9 = GetResizeLayoutSynchronizationType(*(tagWND **)(param_1 + 0x10));

+      }

+      uVar12 = **(undefined8 **)(param_1 + 0x10);

+      local_134 = _Var9;

+      lVar11 = W32GetUserSessionState();

+      uVar26 = (ulonglong)_Var9;

+      local_198 = &local_120;

+      iVar23 = GreWindowResizeStarted

+                         (*(undefined8 *)(*(longlong *)(lVar11 + 0xdf10) + 0x30),uVar12,uVar26,

+                          &local_12c);

+      iVar19 = local_12c;

+      uVar25 = (undefined1)uVar26;

+      if ((iVar23 != 0) && (local_12c != 0)) {

+        uVar26 = (ulonglong)local_120;

+        local_198 = (uint *)CONCAT44(local_198._4_4_,1);

+        _SetSystemTimer(*(undefined8 *)(param_1 + 0x10),0xfff2,uVar26,ResizeTimerFunc);

+        uVar25 = (undefined1)uVar26;

+      }

+      local_11c = 1;

+    }

+    iVar23 = Feature_ApplyWindowActionConvergence__private_IsEnabledDeviceUsageNoInline();

+    if (iVar23 == 0) {

+      local_a8.left = LVar30;

+      local_a8.top = LVar31;

+      local_a8.right = LVar32;

+      local_a8.bottom = LVar33;

+      xxxMoveSizeSetWindowPosOld(param_1,&local_a8);

+      if ((*(uint *)(param_1 + 200) & 0x200000) != 0) {

+        uVar12 = ValidateHmonitor(*(undefined8 *)

+                                   (*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x100));

+        lVar11 = *(longlong *)(param_1 + 0x10);

+        *(undefined8 *)(param_1 + 0xd8) = uVar12;

+        iVar23 = _IsTopLevelWindow(lVar11);

+        if (((iVar23 != 0) &&

+            (lVar14 = *(longlong *)(lVar11 + 0x28),

+            ((byte)*(undefined4 *)(lVar14 + 0x120) & 0xf) == 2)) &&

+           ((*(uint *)(*(longlong *)(lVar11 + 0x10) + 0x2b0) & 0x2000000) == 0)) {

+          if (param_2 != (tagRECT *)0x0) {

+            uVar12 = *(undefined8 *)(lVar14 + 0x58);

+            uVar4 = *(undefined8 *)(lVar14 + 0x60);

+            param_2->left = (int)uVar12;

+            param_2->top = (int)((ulonglong)uVar12 >> 0x20);

+            param_2->right = (int)uVar4;

+            param_2->bottom = (int)((ulonglong)uVar4 >> 0x20);

+            lVar11 = *(longlong *)(param_1 + 0x10);

+          }

+          uVar12 = *(undefined8 *)(*(longlong *)(lVar11 + 0x28) + 0x58);

+          uVar4 = *(undefined8 *)(*(longlong *)(lVar11 + 0x28) + 0x60);

+          local_128->left = (int)uVar12;

+          local_128->top = (int)((ulonglong)uVar12 >> 0x20);

+          local_128->right = (int)uVar4;

+          local_128->bottom = (int)((ulonglong)uVar4 >> 0x20);

+          uVar12 = *(undefined8 *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x60);

+          *(undefined8 *)(param_1 + 0x78) =

+               *(undefined8 *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x58);

+          *(undefined8 *)(param_1 + 0x80) = uVar12;

+        }

+        *(uint *)(param_1 + 200) = *(uint *)(param_1 + 200) & 0xffdfffff;

+      }

+    }

+    else {

+      xxxMoveSizeSetWindowPos(param_1,(tagRECT *)local_108);

+    }

+    Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>(local_98);

+    if (*(MOVESIZEDATA **)(p_Var2 + 0x2c8) == param_1) {

+      lVar14 = GreCreateRectRgnIndirect(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x58);

+      lVar11 = *(longlong *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0xa8);

+      if (lVar11 != 0) {

+        GreCombineRgn(lVar14,lVar14,lVar11,1);

+      }

+      if (pHVar13 != (HRGN__ *)0x0) {

+        if (lVar14 == 0) {

+          GreDeleteObject();

+          pHVar13 = (HRGN__ *)0x0;

+        }

+        else {

+          GreCombineRgn(pHVar13,pHVar13,lVar14,4);

+        }

+      }

+      pHVar15 = _GetDesktopWindow();

+      ptVar3 = *(tagWND **)(pHVar15 + 0x1c);

+      Win32HMThreadLockBase<tagWND,1,0>::Win32HMThreadLockBase<tagWND,1,0>(local_88,ptVar3);

+      pHVar27 = pHVar13;

+      xxxUpdateThreadsWindows(local_110,ptVar3,pHVar13);

+      uVar25 = SUB81(pHVar27,0);

+      Win32HMThreadLockBase<tagWND,1,0>::~Win32HMThreadLockBase<tagWND,1,0>(local_88);

+      if (local_11c != 0) {

+        uVar12 = **(undefined8 **)(param_1 + 0x10);

+        lVar11 = W32GetUserSessionState();

+        GreWindowResizeComplete(*(undefined8 *)(*(longlong *)(lVar11 + 0xdf10) + 0x30),uVar12);

+        iVar23 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+        _Var9 = local_118;

+        if (iVar23 != 0) {

+          _Var9 = local_134;

+        }

+        if ((iVar19 != 0) && (_Var9 == 0)) {

+          local_198 = (uint *)0x0;

+          uVar25 = 2;

+          FindTimer(*(undefined8 *)(param_1 + 0x10),0xfff2);

+        }

+      }

+      GreDeleteObject(lVar14);

+    }

+    GreDeleteObject(pHVar13);

+    LOCK();

+    *(uint *)(p_Var2 + 0x210) = *(uint *)(p_Var2 + 0x210) & 0xffff7fff;

+    UNLOCK();

+    Win32RawLockedItemBase<_W32THREAD,0,1,1,1>::UnlockWorker

+              ((Win32RawLockedItemBase<_W32THREAD,0,1,1,1> *)&local_e8,true,(bool)uVar25);

+  }

+LAB_1:

+  if ((local_130 != 0) && (*(int *)(param_1 + 0xb0) == 9)) {

+    local_110 = *(tagTHREADINFO **)(param_1 + 0xd8);

+    local_128 = (tagRECT *)0x0;

+    PhysicalToLogicalDPIPoint

+              (&local_128,param_1 + 0x104,

+               *(undefined4 *)(*(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28) + 0x120),

+               &local_110);

+    iVar23 = local_68.left - (int)local_128;

+    iVar19 = local_68.top - local_128._4_4_;

+    *(int *)(param_1 + 0xac) = iVar19;

+    *(int *)(param_1 + 0xa8) = iVar23;

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

+       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0 || ((byte)WPP_GLOBAL_Control[0x29] < 4))))

+    {

+      cVar18 = '\0';

+    }

+    else {

+      cVar18 = '\x01';

+    }

+    bVar29 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar18 != '\0') || (bVar29)) {

+      lVar11 = W32GetUserSessionState();

+      local_178 = (char *)CONCAT44(local_178._4_4_,iVar23);

+      local_180 = &WPP_a4942bb3c27731613b7ebe66d62ba7d5_Traceguids;

+      local_188 = 0x11;

+      local_190 = 1;

+      local_198 = (uint *)CONCAT71(local_198._1_7_,4);

+      local_170 = iVar19;

+      WPP_RECORDER_AND_TRACE_SF_Dd

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar18,bVar29,

+                 *(undefined8 *)(lVar11 + 0x10f88));

+    }

+  }

   return;

 }
```

## `xxxInjectTouchInput`  (modified)

```diff
--- xxxInjectTouchInput
+++ xxxInjectTouchInput
@@ -1,10 +1,670 @@
 

-/* WARNING: Control flow encountered bad instruction data */

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

 

-void xxxInjectTouchInput(void)

+undefined8 xxxInjectTouchInput(uint param_1,tagPOINTER_TOUCH_INFO *param_2,ulong param_3)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  undefined2 uVar1;

+  ulong uVar2;

+  ulong uVar3;

+  __uint64 _Var4;

+  DEVICEINFO *pDVar5;

+  byte bVar6;

+  InputCheckResult IVar7;

+  int iVar8;

+  ulong uVar9;

+  undefined4 uVar10;

+  tagTHREADINFO *ptVar11;

+  longlong lVar12;

+  undefined8 uVar13;

+  longlong lVar14;

+  tagPOINTER_TOUCH_INFO *ptVar15;

+  undefined8 *puVar16;

+  uint uVar17;

+  tagINJECTED_CONTACT *ptVar18;

+  InputTracing_RimInjectionSource IVar19;

+  ulonglong uVar20;

+  ulonglong uVar21;

+  uint uVar22;

+  char cVar23;

+  undefined4 uVar24;

+  ulong uVar25;

+  undefined7 uVar26;

+  ulonglong uVar27;

+  tagINJECTED_CONTACT *ptVar28;

+  ulonglong uVar29;

+  ulong uVar30;

+  ulong uVar31;

+  bool bVar32;

+  undefined1 auStackY_108 [32];

+  tagINJECTED_CONTACT *local_90;

+  uint local_88;

+  DEVICEINFO *local_80;

+  __uint64 local_78;

+  undefined8 local_70;

+  undefined8 uStack_68;

+  longlong local_60 [2];

+  tagRECT local_50;

+  ulonglong local_40;

+  

+  local_40 = __security_cookie ^ (ulonglong)auStackY_108;

+  uVar29 = (ulonglong)param_1;

+  ptVar15 = param_2;

+  local_88 = param_1;

+  local_70 = param_2;

+  ptVar11 = PtiCurrent();

+  IVar19 = (InputTracing_RimInjectionSource)ptVar15;

+  uVar27 = 0;

+  uVar24 = 0;

+  bVar6 = 0;

+  lVar12 = *(longlong *)(ptVar11 + 0x1d0);

+  CheckCurrentInjectionConfiguration();

+  IVar7 = DoInputCheck(0x7f);

+  if (IVar7 == 0) {

+    if (*(longlong *)(lVar12 + 0x368) == 0) {

+      SetLastNtError(0xc0000022);

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

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

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

+        cVar23 = '\0';

+      }

+      else {

+        cVar23 = '\x01';

+      }

+      bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar23 != '\0') || (bVar32)) {

+        lVar12 = W32GetUserSessionState();

+        uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+        goto LAB_0;

+      }

+    }

+    else {

+      InputTraceLogging::RIM::InjectInput

+                (*(RIMDEV **)(*(longlong *)(lVar12 + 0x368) + 0x10),IVar19,param_3);

+      lVar14 = W32GetUserSessionState();

+      *(longlong *)(lVar14 + 0x4a18) = lVar12;

+      lVar14 = *(longlong *)(lVar12 + 0x368);

+      uVar22 = *(uint *)(lVar14 + 0x1c);

+      uVar21 = (ulonglong)uVar22;

+      if (uVar22 < param_1) {

+        UserSetLastError(0x57);

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

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

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

+          cVar23 = '\0';

+        }

+        else {

+          cVar23 = '\x01';

+        }

+        bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar23 != '\0') || (bVar32)) {

+          lVar12 = W32GetUserSessionState();

+          uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+LAB_1:

+          WPP_RECORDER_AND_TRACE_SF_Dd

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar23,bVar32,uVar13);

+        }

+      }

+      else {

+        uVar2 = *(ulong *)(param_2 + 0x40);

+        _Var4 = *(__uint64 *)(param_2 + 0x50);

+        uVar3 = *(ulong *)(lVar14 + 0x28);

+        local_78 = *(__uint64 *)(lVar14 + 0x40);

+        iVar8 = SortTouchContacts(param_2,param_1);

+        if (iVar8 == 0) {

+          UserSetLastError(0x57);

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

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

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

+            cVar23 = '\0';

+          }

+          else {

+            cVar23 = '\x01';

+          }

+          bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar23 != '\0') || (bVar32)) {

+            lVar12 = W32GetUserSessionState();

+            uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+            goto LAB_0;

+          }

+        }

+        else {

+          cVar23 = '\x01';

+          uVar30 = 0;

+          if (param_1 != 0) {

+            ptVar15 = param_2 + 0xc;

+            uVar20 = uVar27;

+            do {

+              if (uVar22 <= *(uint *)(ptVar15 + -8)) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_1;

+              }

+              if (*(uint *)(ptVar15 + -0xc) != 2) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 != '\0') || (bVar32)) {

+                  lVar12 = W32GetUserSessionState();

+                  uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+LAB_3:

+                  WPP_RECORDER_AND_TRACE_SF_d

+                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar23,bVar32,uVar13);

+                }

+                goto LAB_2;

+              }

+              uVar17 = *(uint *)ptVar15 & 0xffff7fff;

+              if ((((6 < uVar17 - 0x20000) || ((0x45U >> (uVar17 - 0x20000 & 0x1f) & 1) == 0)) &&

+                  (uVar17 != 0x10006)) && ((uVar17 != 0x40002 && (uVar17 != 0x40000)))) {

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 != '\0') || (bVar32)) {

+                  lVar12 = W32GetUserSessionState();

+                  WPP_RECORDER_AND_TRACE_SF_d

+                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar23,bVar32,

+                             *(undefined8 *)(lVar12 + 0x10f88));

+                }

+                iVar8 = 0x57;

+                goto LAB_4;

+              }

+              if (((*(uint *)(ptVar15 + 0x58) & 2) != 0) && (0x167 < *(uint *)(ptVar15 + 0x7c))) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 != '\0') || (bVar32)) {

+                  lVar12 = W32GetUserSessionState();

+                  uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                  goto LAB_3;

+                }

+                goto LAB_2;

+              }

+              if (((*(uint *)(ptVar15 + 0x58) & 4) != 0) && (65000 < *(uint *)(ptVar15 + 0x80))) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 != '\0') || (bVar32)) {

+                  lVar12 = W32GetUserSessionState();

+                  uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                  goto LAB_3;

+                }

+                goto LAB_2;

+              }

+              if (*(uint *)(ptVar15 + 0x54) != 0) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if (((*(uint *)(ptVar15 + 0x70) != 0) || (*(uint *)(ptVar15 + 0x78) != 0)) ||

+                 ((*(uint *)(ptVar15 + 0x6c) != 0 || (*(uint *)(ptVar15 + 0x74) != 0)))) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if (*(uint *)(ptVar15 + -4) != 0) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if (*(longlong *)(ptVar15 + 4) != 0) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if (*(longlong *)(ptVar15 + 0xc) != 0) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if ((*(uint *)(ptVar15 + 0x1c) != 0) || (*(uint *)(ptVar15 + 0x20) != 0)) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if ((*(uint *)(ptVar15 + 0x24) != 0) || (*(uint *)(ptVar15 + 0x28) != 0)) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if ((*(uint *)(ptVar15 + 0x2c) != 0) || (*(uint *)(ptVar15 + 0x30) != 0)) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if (*(uint *)(ptVar15 + 0x38) != 0) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if (*(uint *)(ptVar15 + 0x3c) != 0) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if (*(uint *)(ptVar15 + 0x40) != 0) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              if (*(uint *)(ptVar15 + 0x4c) != 0) {

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 == '\0') && (!bVar32)) goto LAB_2;

+                lVar12 = W32GetUserSessionState();

+                uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                goto LAB_0;

+              }

+              uVar17 = (int)uVar20 + 1;

+              uVar20 = (ulonglong)uVar17;

+              ptVar15 = ptVar15 + 0x90;

+            } while (uVar17 < param_1);

+          }

+          pDVar5 = *(DEVICEINFO **)(*(longlong *)(lVar12 + 0x368) + 0x10);

+          if (*(int *)(*(longlong *)(pDVar5 + 0x1c8) + 0x400) == 0) {

+            *(undefined4 *)(*(longlong *)(lVar12 + 0x368) + 0x20) = 0;

+            *(undefined4 *)(*(longlong *)(lVar12 + 0x368) + 0x24) = 0;

+            *(undefined4 *)(*(longlong *)(lVar12 + 0x368) + 0x28) = 0;

+            *(undefined4 *)(*(longlong *)(lVar12 + 0x368) + 0x30) = 0;

+            *(undefined8 *)(*(longlong *)(lVar12 + 0x368) + 0x38) = 0;

+            *(undefined8 *)(*(longlong *)(lVar12 + 0x368) + 0x40) = 0;

+            *(undefined4 *)(*(longlong *)(lVar12 + 0x368) + 0x48) = 0;

+          }

+          lVar14 = *(longlong *)(lVar12 + 0x368);

+          ptVar28 = *(tagINJECTED_CONTACT **)(lVar14 + 0x50);

+          uVar26 = (undefined7)(_Var4 >> 8);

+          local_90 = ptVar28;

+          local_80 = pDVar5;

+          if (((uVar2 == 0) || (_Var4 == 0)) &&

+             (((*(int *)(lVar14 + 0x20) == 0 || (_Var4 == 0)) &&

+              ((*(longlong *)(lVar14 + 0x38) == 0 || (uVar2 == 0)))))) {

+            if ((_Var4 != 0) || (uVar25 = 1, *(longlong *)(lVar14 + 0x38) != 0)) {

+              uVar25 = uVar30;

+            }

+            if ((*(int *)(*(longlong *)(pDVar5 + 0x1c8) + 0x400) == 0) && (uVar22 != 0)) {

+              ptVar18 = ptVar28 + 8;

+              uVar20 = uVar21;

+              do {

+                if ((*(int *)ptVar18 - 0x20000U & 0xfffdffff) != 0) {

+                  *(int *)ptVar18 = 0x40000;

+                  bVar6 = 1;

+                }

+                ptVar18 = ptVar18 + 0xc;

+                uVar20 = uVar20 - 1;

+              } while (uVar20 != 0);

+            }

+            lVar14 = *(longlong *)(pDVar5 + 0x1c8);

+            if (uVar25 == 0) {

+              iVar8 = _ValidateInjectionQpcCount

+                                (_Var4,local_78,*(__uint64 *)(lVar14 + 0x330),

+                                 (uint)(*(int *)(lVar14 + 0x400) == 0),

+                                 *(int *)(*(longlong *)(lVar12 + 0x368) + 0x48));

+              if (iVar8 != 0) goto LAB_5;

+              xxxSendLastFrameTouchUp

+                        (local_90,pDVar5,uVar22,

+                         (ulong)((ulonglong)

+                                 (*(longlong *)(*(longlong *)(lVar12 + 0x368) + 0x38) * 10000) /

+                                *(ulonglong *)gliQpcFreq_exref));

+              UserSetLastError(0x57);

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

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

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

+                cVar23 = '\0';

+              }

+              bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+              if ((cVar23 != '\0') || (bVar32)) {

+                lVar12 = W32GetUserSessionState();

+                WPP_RECORDER_AND_TRACE_SF_ii

+                          (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar23,CONCAT71(uVar26,bVar32)

+                           ,*(undefined8 *)(lVar12 + 0x10f88));

+              }

+            }

+            else {

+              iVar8 = _ValidateInjectionTime

+                                (uVar2,uVar3,*(ulong *)(lVar14 + 0x328),

+                                 (uint)(*(int *)(lVar14 + 0x400) == 0),

+                                 *(int *)(*(longlong *)(lVar12 + 0x368) + 0x30));

+              if (iVar8 == 0) {

+                xxxSendLastFrameTouchUp

+                          (ptVar28,pDVar5,uVar22,*(ulong *)(*(longlong *)(lVar12 + 0x368) + 0x24));

+                UserSetLastError(0x57);

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 != '\0') || (bVar32)) {

+                  lVar12 = W32GetUserSessionState();

+                  uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                  goto LAB_1;

+                }

+              }

+              else {

+LAB_5:

+                puVar16 = (undefined8 *)GetScreenRect(local_60);

+                local_50._0_8_ = *puVar16;

+                local_50._8_8_ = puVar16[1];

+                iVar8 = ValidateInjectedTouchFrame(param_1,param_2,local_90,&local_50,uVar22);

+                lVar12 = *(longlong *)(lVar12 + 0x368);

+                local_60[0] = lVar12;

+                if (iVar8 != 0) {

+                  if (uVar25 == 0) {

+                    uVar20 = (_Var4 - *(longlong *)(lVar12 + 0x38)) * 10000;

+                    uVar31 = (ulong)(uVar20 / *(ulonglong *)gliQpcFreq_exref);

+                    if (*(int *)(*(longlong *)(local_80 + 0x1c8) + 0x400) == 0) {

+                      *(__uint64 *)(lVar12 + 0x38) = _Var4;

+                    }

+                    else {

+                      uVar30 = uVar31;

+                      if (uVar31 == *(ulong *)(lVar12 + 0x2c)) {

+                        UserSetLastError(0x15,uVar20 % *(ulonglong *)gliQpcFreq_exref);

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

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

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

+                          cVar23 = '\0';

+                        }

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

+                        ;

+                        if ((cVar23 != '\0') || (bVar32)) {

+                          lVar12 = W32GetUserSessionState();

+                          uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+LAB_0:

+                          WPP_RECORDER_AND_TRACE_SF_

+                                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar23,bVar32,uVar13

+                                    );

+                        }

+                        goto LAB_2;

+                      }

+                    }

+                  }

+                  else {

+                    uVar31 = (uVar2 - *(int *)(lVar12 + 0x20)) * 10;

+                    uVar9 = _GetQpcBasedTouchStackTime();

+                    if (*(int *)(*(longlong *)(local_80 + 0x1c8) + 0x400) == 0) {

+                      *(ulong *)(lVar12 + 0x20) = uVar2;

+                      *(ulong *)(lVar12 + 0x24) = uVar9;

+                    }

+                    else {

+                      uVar30 = uVar31;

+                      if (uVar31 == 0) {

+                        uVar17 = *(uint *)(lVar12 + 0x2c);

+                        uVar30 = uVar9 - *(int *)(lVar12 + 0x24);

+                        if (uVar30 <= uVar17) {

+                          if (4 < uVar17 - uVar30) {

+                            UserSetLastError(0x15);

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

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

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

+                              cVar23 = '\0';

+                            }

+                            bVar32 = (undefined **)WPP_RECORDER_INITIALIZED !=

+                                     &WPP_RECORDER_INITIALIZED;

+                            if ((cVar23 != '\0') || (bVar32)) {

+                              lVar12 = W32GetUserSessionState();

+                              uVar13 = *(undefined8 *)(lVar12 + 0x10f88);

+                              goto LAB_0;

+                            }

+                            goto LAB_2;

+                          }

+                          uVar30 = uVar17 + 1;

+                        }

+                      }

+                    }

+                  }

+                  if (uVar22 != 0) {

+                    do {

+                      *(undefined4 *)(uVar27 + 8 + *(longlong *)(lVar12 + 0x50)) = 0x40000;

+                      uVar21 = uVar21 - 1;

+                      uVar27 = uVar27 + 0xc;

+                    } while (uVar21 != 0);

+                  }

+                  if (param_1 != 0) {

+                    ptVar15 = param_2 + 4;

+                    uVar27 = uVar29;

+                    do {

+                      uVar22 = *(uint *)ptVar15;

+                      *(uint *)(*(longlong *)(lVar12 + 0x50) + 8 + (ulonglong)uVar22 * 0xc) =

+                           *(uint *)(ptVar15 + 8) & 0xffff7fff;

+                      *(undefined8 *)(*(longlong *)(lVar12 + 0x50) + (ulonglong)uVar22 * 0xc) =

+                           *(undefined8 *)(ptVar15 + 0x1c);

+                      uVar27 = uVar27 - 1;

+                      ptVar15 = ptVar15 + 0x90;

+                    } while (uVar27 != 0);

+                  }

+                  bVar6 = W32GetCurrentThreadDpiAwarenessContext();

+                  if (((bVar6 & 0xf) != 2) && (param_1 != 0)) {

+                    ptVar15 = param_2 + 0x74;

+                    param_2 = param_2 + 0x20;

+                    do {

+                      local_90 = (tagINJECTED_CONTACT *)0x0;

+                      uVar10 = W32GetCurrentThreadDpiAwarenessContext();

+                      LogicalToPhysicalDPIPoint(param_2,param_2,uVar10,&local_90);

+                      uVar10 = GetDpiForSystem();

+                      uVar1 = *(undefined2 *)(*(longlong *)(local_90 + 0x28) + 0x3c);

+                      iVar8 = EngMulDiv(*(int *)(ptVar15 + -4) - *(int *)(ptVar15 + -0xc),uVar1,

+                                        uVar10);

+                      *(int *)(ptVar15 + -4) = iVar8;

+                      iVar8 = EngMulDiv(*(int *)ptVar15 - *(int *)(ptVar15 + -8),uVar1,uVar10);

+                      param_2 = param_2 + 0x90;

+                      *(undefined8 *)(ptVar15 + -0xc) = 0;

+                      *(int *)ptVar15 = iVar8;

+                      ptVar15 = ptVar15 + 0x90;

+                      uVar29 = uVar29 - 1;

+                    } while (uVar29 != 0);

+                    uVar29 = (ulonglong)local_88;

+                    param_2 = local_70;

+                    lVar12 = local_60[0];

+                  }

+                  uVar13 = *(undefined8 *)(*(longlong *)(local_80 + 0x1c8) + 0xa0);

+                  uStack_68 = *(undefined8 *)(*(longlong *)(local_80 + 0x1c8) + 0xa8);

+                  uVar22 = (uint)uVar29;

+                  if (uVar22 != 0) {

+                    local_70._4_4_ = (int)((ulonglong)uVar13 >> 0x20);

+                    ptVar15 = param_2 + 0x24;

+                    local_70._0_4_ = (int)uVar13;

+                    do {

+                      *(int *)(ptVar15 + -4) = *(int *)(ptVar15 + -4) - (int)local_70;

+                      *(int *)ptVar15 = *(int *)ptVar15 - local_70._4_4_;

+                      ptVar15 = ptVar15 + 0x90;

+                      uVar29 = uVar29 - 1;

+                    } while (uVar29 != 0);

+                  }

+                  *(ulong *)(lVar12 + 0x2c) = uVar30;

+                  if (uVar25 == 0) {

+                    if ((local_78 != 0) && (_Var4 == 0)) {

+                      uVar24 = 1;

+                    }

+                    *(undefined4 *)(lVar12 + 0x48) = uVar24;

+                    *(__uint64 *)(lVar12 + 0x40) = _Var4;

+                  }

+                  else {

+                    if ((uVar3 != 0) && (uVar2 == 0)) {

+                      uVar24 = 1;

+                    }

+                    *(undefined4 *)(lVar12 + 0x30) = uVar24;

+                    *(ulong *)(lVar12 + 0x28) = uVar2;

+                  }

+                  local_70 = (tagPOINTER_TOUCH_INFO *)uVar13;

+                  xxxSendToTouchStack(local_80,uVar22,param_2,uVar30);

+                  goto LAB_6;

+                }

+                xxxSendLastFrameTouchUp(local_90,pDVar5,uVar22,*(ulong *)(lVar12 + 0x24));

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

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

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

+                  cVar23 = '\0';

+                }

+                bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+                if ((cVar23 != '\0') || (bVar32)) {

+                  lVar12 = W32GetUserSessionState();

+                  WPP_RECORDER_AND_TRACE_SF_d

+                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar23,bVar32,

+                             *(undefined8 *)(lVar12 + 0x10f88));

+                }

+                iVar8 = (-(uint)bVar6 & 0x55d) + 0x57;

+LAB_4:

+                UserSetLastError(iVar8);

+              }

+            }

+          }

+          else {

+            xxxSendLastFrameTouchUp(ptVar28,pDVar5,uVar22,*(ulong *)(lVar14 + 0x24));

+            UserSetLastError(0x57);

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

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

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

+              cVar23 = '\0';

+            }

+            bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+            if ((cVar23 != '\0') || (bVar32)) {

+              lVar12 = W32GetUserSessionState();

+              WPP_RECORDER_AND_TRACE_SF_didi

+                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar23,CONCAT71(uVar26,bVar32),

+                         *(undefined8 *)(lVar12 + 0x10f88));

+            }

+          }

+        }

+      }

+    }

+LAB_2:

+    uVar13 = 0;

+  }

+  else {

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

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

+       (uVar29 = 1, (byte)WPP_GLOBAL_Control[0x29] < 2)) {

+      uVar29 = uVar27;

+    }

+    bVar32 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if (((char)uVar29 != '\0') || (bVar32)) {

+      lVar12 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_d

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar29,bVar32,

+                 *(undefined8 *)(lVar12 + 0x10f88));

+    }

+    if (1 < IVar7 - 4) {

+      RtlNtStatusToDosError(0xc0000022);

+      goto LAB_2;

+    }

+LAB_6:

+    uVar13 = 1;

+  }

+  return uVar13;

 }
```

## `EditionQueryInertiaWorker`  (modified)

```diff
--- EditionQueryInertiaWorker
+++ EditionQueryInertiaWorker
@@ -1,118 +1,51 @@
 

-void EditionQueryInertiaWorker(void)

+bool EditionQueryInertiaWorker(tagPOINT param_1,longlong param_2)

 

 {

-  _HEAD *p_Var1;

-  longlong lVar2;

-  int iVar3;

-  tagTHREADINFO *ptVar4;

-  ulonglong uVar5;

-  longlong lVar6;

-  undefined8 uVar7;

-  tagXSTATE *ptVar8;

-  tagMONITOR *ptVar9;

-  longlong unaff_RBP;

-  ulonglong unaff_RDI;

-  __uint64 _Var10;

-  longlong unaff_R12;

-  bool bVar11;

+  longlong lVar1;

+  tagRECT *ptVar2;

+  bool bVar3;

+  tagPOINT local_res10;

   

-  ptVar9 = (tagMONITOR *)(unaff_RDI & 0xffffffff);

-  do {

-    UnlinkConv((tagDDECONV *)ptVar9);

-    Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

-              ((Win32HMThreadLockBase<tagXSTATE,0,1> *)(unaff_RBP + -0x29));

-    while( true ) {

-      ptVar9 = 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;

+                    /* 0x2a97a0  250  EditionQueryInertiaWorker */

+  lVar1 = ValidateHwnd(*(undefined8 *)(param_2 + 0x78));

+  if ((*(uint *)(param_2 + 0xb8) & 0x20) == 0) {

+    if (((*(uint *)(param_2 + 0xb8) & 4) != 0) &&

+       (local_res10 = param_1,

+       bVar3 = DCEHitTestWindow((tagRECT *)(param_2 + 0x28),(_D3DMATRIX *)(param_2 + 0x38),

+                                &local_res10,(_SUBPIXELS *)0x0), !bVar3)) {

+      return false;

+    }

+    if ((lVar1 == 0) || ((*(uint *)(lVar1 + 0x17c) & 0x40000000) != 0)) {

+      if ((*(uint *)(param_2 + 0xb8) & 4) == 0) {

+        local_res10.x = 0x20000;

+        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x9b);

       }

-      if (*(longlong *)(unaff_RBP + 0x1f) != unaff_R12) {

-        PopAndFreeW32ThreadLock(unaff_RBP + 0xf);

-        *(longlong *)(unaff_RBP + 0x1f) = unaff_R12;

+      if ((lVar1 != 0) && ((*(uint *)(lVar1 + 0x17c) & 0x40000000) == 0)) goto LAB_0;

+    }

+    else {

+LAB_0:

+      ptVar2 = (tagRECT *)(*(longlong *)(lVar1 + 0x28) + 0x58);

+      if (*(_D3DMATRIX **)(lVar1 + 0xd8) == (_D3DMATRIX *)0x0) {

+        local_res10 = param_1;

+        bVar3 = DCEPtInRect(ptVar2,param_1);

+        bVar3 = !bVar3;

+        goto LAB_1;

       }

-      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 (ptVar9 == (tagMONITOR *)0x0) {

-        return;

-      }

-      p_Var1 = *(_HEAD **)(ptVar9 + 0x18);

-      lVar6 = 0;

-      ptVar4 = PtiCurrent();

-      Win32HM_LockIntoThread<1>(ptVar4,p_Var1,(_Win32HMThreadLockItem *)(unaff_RBP + -0x19));

-      ptVar4 = PtiCurrent();

-      Win32HM_LockIntoThread<0>

-                (ptVar4,(_HEAD *)ptVar9,(_Win32HMThreadLockItem *)(unaff_RBP + -0x29));

-      if (((*(uint *)(ptVar9 + 0x50) & 2) == 0) &&

-         ((((uVar5 = GetAppCompatFlags2(0x400), (uVar5 & 0x20) == 0 ||

-            (*(longlong *)(ptVar9 + 0x30) == 0)) ||

-           (lVar2 = *(longlong *)(*(longlong *)(ptVar9 + 0x30) + 0x10),

-           0x400 < *(uint *)(lVar2 + 0x2a0))) || ((*(uint *)(lVar2 + 0x2b0) & 0x20) == 0)))) {

-        iVar3 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

-        if (iVar3 != 0) {

-          *(uint *)(ptVar9 + 0x50) = *(uint *)(ptVar9 + 0x50) | 2;

-        }

-        if (*(__uint64 **)(ptVar9 + 0x28) == (__uint64 *)0x0) {

-          _Var10 = 0;

-        }

-        else {

-          _Var10 = **(__uint64 **)(ptVar9 + 0x28);

-        }

-        _PostTransformableMessageExtended

-                  (*(tagWND **)(ptVar9 + 0x30),0x3e1,_Var10,0,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

-      }

-      lVar2 = *(longlong *)(ptVar9 + 0x20);

-      if (lVar2 == 0) {

-        bVar11 = true;

-      }

-      else {

-        bVar11 = (*(uint *)(lVar2 + 0x50) & 10) != 0;

-        if (bVar11) {

-          lVar6 = *(longlong *)(lVar2 + 0x48);

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

-        }

-        *(uint *)(*(longlong *)(ptVar9 + 0x20) + 0x50) =

-             *(uint *)(*(longlong *)(ptVar9 + 0x20) + 0x50) | 6;

-      }

-      lVar2 = *(longlong *)(ptVar9 + 0x48);

-      *(undefined8 *)(ptVar9 + 0x48) = 0;

-      *(longlong *)(unaff_RBP + 0x1f) = unaff_R12;

-      *(undefined8 *)(unaff_RBP + 0xf) = 0;

-      *(undefined8 *)(unaff_RBP + 0x17) = 0;

-      if (lVar2 != 0) {

-        ptVar4 = PtiCurrent();

-        *(undefined8 *)(unaff_RBP + 0xf) = *(undefined8 *)(ptVar4 + 0x180);

-        *(longlong *)(ptVar4 + 0x180) = unaff_RBP + 0xf;

-        *(longlong *)(unaff_RBP + 0x17) = lVar2;

-        *(code **)(unaff_RBP + 0x1f) = xxxFreeListFree;

-      }

-      *(longlong *)(unaff_RBP + 7) = unaff_R12;

-      *(undefined8 *)(unaff_RBP + -9) = 0;

-      *(undefined8 *)(unaff_RBP + -1) = 0;

-      if (lVar6 != 0) {

-        ptVar4 = PtiCurrent();

-        *(undefined8 *)(unaff_RBP + -9) = *(undefined8 *)(ptVar4 + 0x180);

-        *(longlong *)(ptVar4 + 0x180) = unaff_RBP + -9;

-        *(longlong *)(unaff_RBP + -1) = lVar6;

-        *(code **)(unaff_RBP + 7) = xxxFreeListFree;

-      }

-      if ((((*(uint *)(ptVar9 + 0x50) & 2) == 0) || (!bVar11)) &&

-         ((*(uint *)(ptVar9 + 0x50) & 4) == 0)) break;

-      lVar6 = _HMPheFromObject(ptVar9);

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

-        uVar7 = func_0x0001402ac464(*(undefined8 *)(ptVar9 + 0x20));

-        *(undefined8 *)(ptVar9 + 0x20) = uVar7;

-      }

-      ptVar8 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

-                         ((Win32HMThreadLockBase<tagXSTATE,0,1> *)(unaff_RBP + -0x29));

-      if (ptVar8 != (tagXSTATE *)0x0) {

-        func_0x0001402ac464(ptVar8);

+      local_res10 = param_1;

+      bVar3 = DCEHitTestWindow(ptVar2,*(_D3DMATRIX **)(lVar1 + 0xd8),&local_res10,(_SUBPIXELS *)0x0)

+      ;

+      if (!bVar3) {

+        return false;

       }

     }

-  } while( true );

+    bVar3 = true;

+  }

+  else {

+    bVar3 = lVar1 == 0;

+LAB_1:

+    bVar3 = !bVar3;

+  }

+  return bVar3;

 }
```

## `xxxCleanupDdeConv`  (modified)

```diff
--- xxxCleanupDdeConv
+++ xxxCleanupDdeConv
@@ -1,82 +1,84 @@
 

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

+/* void __cdecl xxxCleanupDdeConv(struct tagWND * __ptr64) */

 

 void __cdecl xxxCleanupDdeConv(tagWND *param_1)

 

 {

-  uint uVar1;

-  uint in_EAX;

-  int iVar2;

-  longlong lVar3;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  undefined4 unaff_ESI;

-  ulonglong uVar4;

-  longlong unaff_RDI;

-  char cVar5;

-  int unaff_R12D;

-  uint uVar6;

-  uint uVar7;

-  bool bVar8;

+  tagFREELIST *ptVar1;

+  byte bVar2;

+  int iVar3;

+  longlong lVar4;

+  tagDDECONV *ptVar5;

+  longlong lVar6;

+  undefined8 uVar7;

+  Win32HMThreadLockBase<tagDDECONV,0,1> *this;

+  undefined8 local_28;

+  undefined8 local_20;

+  undefined8 local_18;

+  undefined8 local_10;

   

-  if ((in_EAX < 5) && (uVar6 = *(int *)(unaff_RBX + 0x24) + 0x10, 0xf < uVar6)) {

-    unaff_RDI = Win32AllocPoolZInit(uVar6,unaff_ESI);

-    if (unaff_RDI == 0) goto LAB_0;

-    for (uVar7 = 0; iVar2 = unaff_R12D, uVar7 < *(uint *)(unaff_RBX + 0x20);

-        uVar7 = uVar7 + unaff_R12D) {

-      iVar2 = ZwEnumerateValueKey(*(undefined8 *)(unaff_RBP + 0x48),uVar7,0,unaff_RDI,uVar6);

-      if (iVar2 < 0) goto LAB_0;

-      if (*(int *)(unaff_RDI + 4) == unaff_R12D) {

-        uVar1 = *(uint *)(unaff_RDI + 8);

-        for (uVar4 = 0; (uint)uVar4 < 5; uVar4 = (ulonglong)((uint)uVar4 + 1)) {

-          iVar2 = _wcsnicmp((wchar_t *)(&gaClipILDef)[uVar4 * 4],(wchar_t *)(unaff_RDI + 0xc),

-                            (ulonglong)(uVar1 >> 1));

-          if (iVar2 == 0) {

-            unaff_R12D = 1;

-            (&DAT_1)[uVar4 * 8] = 1;

-            goto LAB_2;

-          }

+LAB_0:

+  lVar4 = W32GetUserSessionState();

+  ptVar5 = (tagDDECONV *)_GetProp(param_1,*(undefined2 *)(lVar4 + 0xa218),1);

+  do {

+    if (ptVar5 == (tagDDECONV *)0x0) {

+      return;

+    }

+    iVar3 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

+    bVar2 = (byte)*(uint *)(ptVar5 + 0x50);

+    if (iVar3 == 0) {

+      if (((bVar2 & 7) == 7) && ((*(uint *)(*(longlong *)(ptVar5 + 0x20) + 0x50) & 2) != 0)) {

+        local_10 = 0;

+        local_18 = 0xffffffffffffffff;

+        lVar4 = *(longlong *)(ptVar5 + 0x48);

+        if (lVar4 != 0) {

+          Win32HMThreadLockBase<tagDDECONV,0,1>::ManualLock<void>

+                    ((Win32HMThreadLockBase<tagDDECONV,0,1> *)&local_18,ptVar5);

+          ptVar1 = *(tagFREELIST **)(ptVar5 + 0x48);

+          *(undefined8 *)(ptVar5 + 0x48) = 0;

+          xxxFreeListFree(ptVar1);

         }

-        unaff_R12D = 1;

+        lVar6 = _HMPheFromObject(ptVar5);

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

+          uVar7 = xxxFreeDdeConv(*(undefined8 *)(ptVar5 + 0x20));

+          *(undefined8 *)(ptVar5 + 0x20) = uVar7;

+          xxxFreeDdeConv(ptVar5);

+        }

+        if (lVar4 != 0) {

+          Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                    ((Win32HMThreadLockBase<tagXSTATE,0,1> *)&local_18);

+        }

+        this = (Win32HMThreadLockBase<tagDDECONV,0,1> *)&local_18;

+        goto LAB_1;

       }

-LAB_2:

     }

+    else if (((*(uint *)(ptVar5 + 0x50) & 10) != 0 && (bVar2 & 5) == 5) &&

+            ((*(uint *)(*(longlong *)(ptVar5 + 0x20) + 0x50) & 10) != 0)) break;

+    ptVar5 = *(tagDDECONV **)(ptVar5 + 0x18);

+  } while( true );

+  local_20 = 0;

+  local_28 = 0xffffffffffffffff;

+  lVar4 = *(longlong *)(ptVar5 + 0x48);

+  if (lVar4 != 0) {

+    Win32HMThreadLockBase<tagDDECONV,0,1>::ManualLock<void>

+              ((Win32HMThreadLockBase<tagDDECONV,0,1> *)&local_28,ptVar5);

+    ptVar1 = *(tagFREELIST **)(ptVar5 + 0x48);

+    *(undefined8 *)(ptVar5 + 0x48) = 0;

+    xxxFreeListFree(ptVar1);

   }

-  else {

-LAB_0:

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4))

-    {

-      cVar5 = '\0';

-    }

-    else {

-      cVar5 = (char)unaff_R12D;

-    }

-    bVar8 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((cVar5 != '\0') || (bVar8)) {

-      lVar3 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar8,

-                 *(undefined8 *)(lVar3 + 0x10f88),4);

-    }

-    DAT_3 = 0;

-    DAT_4 = 0;

-    DAT_1 = 0;

-    _DAT_5 = unaff_R12D;

-    DAT_6 = unaff_R12D;

-    iVar2 = unaff_R12D;

-    _DAT_7 = unaff_R12D;

-    if (unaff_RDI == 0) goto LAB_8;

+  lVar6 = _HMPheFromObject(ptVar5);

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

+    uVar7 = xxxFreeDdeConv(*(undefined8 *)(ptVar5 + 0x20));

+    *(undefined8 *)(ptVar5 + 0x20) = uVar7;

+    xxxFreeDdeConv(ptVar5);

   }

-  _DAT_7 = iVar2;

-  Win32FreePool(unaff_RDI);

-LAB_8:

-  if (unaff_RBX != 0) {

-    Win32FreePool();

+  if (lVar4 != 0) {

+    Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+              ((Win32HMThreadLockBase<tagXSTATE,0,1> *)&local_28);

   }

-  if (*(longlong *)(unaff_RBP + 0x48) != 0) {

-    ZwClose();

-  }

-  return;

+  this = (Win32HMThreadLockBase<tagDDECONV,0,1> *)&local_28;

+LAB_1:

+  Win32HMThreadLockBase<tagDDECONV,0,1>::~Win32HMThreadLockBase<tagDDECONV,0,1>(this);

+  goto LAB_0;

 }
```

## `DisableDwmSwCursorMoveSize`  (modified)

```diff
--- DisableDwmSwCursorMoveSize
+++ NtUserSwitchDesktop
@@ -1,22 +1,45 @@
 

-/* int __cdecl DisableDwmSwCursorMoveSize(int) */

-

-int __cdecl DisableDwmSwCursorMoveSize(int param_1)

+uint NtUserSwitchDesktop(undefined8 param_1,int param_2,undefined4 param_3)

 

 {

-  int iVar1;

-  longlong lVar2;

+  bool bVar1;

+  int iVar2;

+  uint uVar3;

+  longlong lVar4;

+  tagWINDOWSTATION *local_res20;

+  Win32RawLockedNtObject<tagWINDOWSTATION> local_38 [16];

+  longlong local_28;

   

-  iVar1 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

-  if (iVar1 == 0) {

-    if (param_1 != 0) {

-      ChangeComposableCursor(0);

+                    /* 0x242580  2080  NtUserSwitchDesktop */

+  uVar3 = 0;

+  local_res20 = (tagWINDOWSTATION *)0x0;

+  lVar4 = EnterCrit(0,0);

+  PtiCurrent();

+  bVar1 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(lVar4 + 0x1d0),0x40);

+  if (bVar1) {

+    iVar2 = ValidateHdesk(param_1,1,0x100,&local_res20);

+    if (iVar2 < 0) goto LAB_0;

+    if ((*(uint *)(*(longlong *)(local_res20 + 0x28) + 0x40) & 4) == 0) {

+      Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

+                (local_38,local_res20);

+      ObfDereferenceObject(local_res20);

+      if (param_2 == 0) {

+        uVar3 = xxxSwitchDesktop(*(undefined8 *)(local_res20 + 0x28),local_res20,0,param_3);

+      }

+      else {

+        uVar3 = xxxSwitchDesktopWithFade(*(undefined8 *)(local_res20 + 0x28),local_res20);

+      }

+      uVar3 = ~uVar3 >> 0x1f;

+      if (local_28 != -1) {

+        PopAndFreeW32ThreadLock(local_38);

+      }

+      goto LAB_0;

     }

+    ObfDereferenceObject();

   }

-  else {

-    lVar2 = W32GetUserSessionState();

-    *(undefined4 *)(lVar2 + 0x8e5c) = 0;

-  }

-  return 1;

+  UserSetLastError(5);

+LAB_0:

+  UserSessionSwitchLeaveCrit();

+  return uVar3;

 }
```

## `xxxRealInternalGetMessage`  (modified)

```diff
--- xxxRealInternalGetMessage
+++ xxxRealInternalGetMessage
@@ -1,283 +1,939 @@
 

-void xxxRealInternalGetMessage(tagMENU *param_1)

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

+

+int xxxRealInternalGetMessage

+              (_GUID *param_1,_GUID *param_2,uint param_3,uint param_4,uint param_5,int param_6)

 

 {

-  int *piVar1;

-  uint *puVar2;

-  undefined4 uVar3;

-  undefined4 uVar4;

-  int iVar5;

-  int iVar6;

-  longlong lVar7;

-  longlong lVar8;

-  undefined8 uVar9;

-  undefined4 *puVar10;

-  undefined8 uVar11;

-  HWINSTA pHVar12;

-  tagXSTATE *ptVar13;

-  longlong lVar14;

-  longlong *plVar15;

-  undefined8 *puVar16;

-  SharedMixedObjectPointerFieldpcls<tagCLS> *this;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  ulonglong uVar17;

-  tagWND *unaff_RDI;

-  longlong unaff_R12;

-  longlong unaff_R13;

-  longlong unaff_R14;

-  char cVar18;

-  Win32HMThreadLockBase<tagXSTATE,0,1> *unaff_R15;

-  bool bVar19;

-  undefined4 extraout_XMM0_Da;

-  undefined4 extraout_XMM0_Da_00;

-  undefined4 uVar20;

+  uint uVar1;

+  uint uVar2;

+  tagQMSG *ptVar3;

+  void *pvVar4;

+  undefined8 uVar5;

+  bool bVar6;

+  bool bVar7;

+  char cVar8;

+  uint uVar9;

+  int iVar10;

+  _SCANSYSQUEUERESULT _Var11;

+  uint uVar12;

+  ulong uVar13;

+  int iVar14;

+  tagTHREADINFO *this;

+  _GUID *p_Var15;

+  longlong lVar16;

+  longlong lVar17;

+  tagHIDDATA *ptVar18;

+  _GUID *p_Var19;

+  CEResourceLock *pCVar20;

+  tagWND *ptVar21;

+  uint uVar23;

+  tagTHREADINFO *ptVar22;

+  ThreadLockedPerfRegion *this_00;

+  ulong uVar24;

+  ushort uVar25;

+  ulonglong uVar26;

+  undefined **ppuVar27;

+  _GUID *p_Var28;

+  longlong *plVar29;

+  uint uVar30;

+  uint uVar31;

+  undefined8 uVar32;

+  undefined8 uVar33;

+  bool bVar34;

+  bool bVar35;

+  undefined2 local_res10 [4];

+  uint local_res18;

+  uint local_218;

+  _GUID *local_200;

+  uint local_1f8;

+  ulong local_1f4;

+  int local_1f0;

+  uint local_1ec;

+  uint local_1e8;

+  uint local_1e4;

+  int local_1e0;

+  undefined2 local_1dc [2];

+  uint local_1d8;

+  _GUID *local_1d0;

+  undefined4 local_1c0;

+  undefined4 local_1bc;

+  undefined4 local_1b8 [4];

+  Win32HMOptionalThreadLockAlways<tagMENU> local_1a8 [16];

+  tagHIDDATA **local_198;

+  ThreadLockedPerfRegion local_190 [8];

+  ThreadLockedPerfRegion local_188 [8];

+  uint local_180;

+  ulonglong local_178;

+  ulonglong local_170;

+  ulonglong local_168;

+  undefined8 local_160 [2];

+  ThreadLockedPerfRegion local_150 [8];

+  ThreadLockedPerfRegion local_148 [8];

+  ThreadLockedPerfRegion local_140 [24];

+  _GUID local_128;

+  undefined8 local_118;

+  undefined8 uStack_110;

+  undefined8 local_108;

+  undefined8 uStack_100;

+  undefined8 local_f8;

+  undefined8 uStack_f0;

+  undefined8 local_e8;

+  undefined8 uStack_e0;

+  undefined8 local_d8;

+  undefined8 uStack_d0;

+  undefined8 local_c8;

+  undefined8 uStack_c0;

+  undefined8 local_b8;

+  undefined8 uStack_b0;

+  undefined8 local_a8;

+  undefined8 uStack_a0;

+  CInpLockGuardExclusive local_98 [48];

+  CInpLockGuardExclusive local_68 [48];

   

-  if (((int)param_1 != 0) && (unaff_RDI == *(tagWND **)(param_1 + 0x50))) {

-    UnlockNotifyWindow(param_1);

-  }

-  lVar7 = W32GetUserSessionState();

-  if (*(int *)(lVar7 + 0xa990) != (int)unaff_R12) {

-    lVar7 = W32GetUserSessionState();

-    lVar7 = InternalRemoveProp(extraout_XMM0_Da,*(undefined2 *)(lVar7 + 0xa21e),1);

-    if (lVar7 != 0) {

-      lVar8 = W32GetUserSessionState();

-      GreLockVisRgn(*(undefined8 *)(*(longlong *)(lVar8 + 0xdf10) + 0x30));

-      GreDeleteWnd(lVar7);

-      lVar7 = W32GetUserSessionState();

-      *(int *)(lVar7 + 0xa990) = *(int *)(lVar7 + 0xa990) + -1;

-      lVar7 = W32GetUserSessionState();

-      GreUnlockVisRgn(*(undefined8 *)(*(longlong *)(lVar7 + 0xdf10) + 0x30));

-    }

-  }

-  lVar7 = W32GetUserSessionState();

-  GreLockSprite(*(undefined8 *)(*(longlong *)(lVar7 + 0xdf10) + 0x30));

-  uVar9 = *(undefined8 *)unaff_RDI;

-  lVar7 = W32GetUserSessionState();

-  GreDeleteSpriteOverlapPresent(*(undefined8 *)(*(longlong *)(lVar7 + 0xdf10) + 0x30),uVar9);

-  lVar7 = W32GetUserSessionState();

-  GreUnlockSprite(*(undefined8 *)(*(longlong *)(lVar7 + 0xdf10) + 0x30));

-  ClearPwndDceLists();

-  lVar7 = W32GetUserSessionState();

-  if (unaff_RDI == *(tagWND **)(lVar7 + 0xdf18)) {

-    uVar9 = FindSpb();

-    FreeSpb(uVar9);

-    lVar7 = W32GetUserSessionState();

-    HMAssignmentUnlock(lVar7 + 0xdf18);

-    lVar7 = W32GetUserSessionState();

-    *(longlong *)(lVar7 + 0xf790) = unaff_R12;

-  }

-  if (*(char *)(*(longlong *)(unaff_RDI + 0x28) + 0x10) < (char)unaff_R12) {

-    uVar9 = FindSpb();

-    FreeSpb(uVar9);

-  }

-  if ((*(ushort *)(*(longlong *)(unaff_RDI + 0x28) + 0x2a) & 0x2fff) != 0x29d) {

-    tagWND::ClearClipRgnOrMaxClip(unaff_RDI);

-  }

-  iVar5 = Feature_UserModeNonClientScrollBars2__private_IsEnabledDeviceUsageNoInline();

-  uVar20 = extraout_XMM0_Da_00;

-  if ((iVar5 == 0) && (*(longlong *)(unaff_RDI + 0x98) != unaff_R12)) {

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

-       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0 ||

-        (cVar18 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)))) {

-      cVar18 = (char)unaff_R12;

-    }

-    bVar19 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((cVar18 != '\0') || (bVar19)) {

-      lVar7 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_q

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar18,bVar19,

-                 *(undefined8 *)(lVar7 + 0x10f88),4);

-    }

-    uVar20 = RtlFreeHeap(*(undefined8 *)(*(longlong *)(unaff_RSI + unaff_R14) + 0x88),0,

-                         *(undefined8 *)(unaff_RDI + 0x98));

-    unaff_R12 = 0;

-    unaff_R15 = *(Win32HMThreadLockBase<tagXSTATE,0,1> **)(unaff_RBP + 0x77);

-    *(undefined8 *)(*(longlong *)(unaff_RDI + 0x28) + 0x90) = 0;

-    *(undefined8 *)(unaff_RDI + 0x98) = 0;

-  }

-  if ((*(uint *)(unaff_RDI + 0x17c) & 0x10000) != 0) {

-    _NotifyOverlayWindow(uVar20,0);

-  }

-  iVar5 = (int)unaff_R12;

-  if (*(longlong *)(unaff_RDI + 0xb8) != 0) {

-    RtlFreeHeap(*(undefined8 *)(*(longlong *)(unaff_RSI + unaff_R14) + 0x88),0);

-    *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0xc0) = unaff_R12;

-    *(longlong *)(unaff_RDI + 0xb8) = unaff_R12;

-    *(int *)(*(longlong *)(unaff_RDI + 0x28) + 0xb8) = iVar5;

-  }

-  ResetWindowTransform();

-  if ((*(longlong *)(unaff_RSI + unaff_R14) == 0) ||

-     (unaff_RDI == *(tagWND **)(*(longlong *)(*(longlong *)(unaff_RSI + unaff_R14) + 8) + 0x18))) {

-    *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0x30) = unaff_R12;

-    HMAssignmentUnlock();

+  local_res18 = param_3;

+  Win32HMOptionalThreadLockAlways<tagMENU>::Win32HMOptionalThreadLockAlways<tagMENU>(local_1a8);

+  local_1f0 = 0;

+  local_1ec = 0;

+  local_1f8 = 0;

+  local_1f4 = 0;

+  local_218 = 0;

+  this = PtiCurrent();

+  EtwTraceEndAppMessageProcessing(param_6);

+  if (((ulonglong)((longlong)&param_2->Data1 + 1U) & 0xfffffffffffeffff) == 0) {

+    param_2 = (_GUID *)0x1;

+  }

+  if (param_2 < (_GUID *)0x2) {

+    local_1e0 = 0;

+    p_Var15 = param_2;

+    local_1d0 = param_2;

   }

   else {

-    puVar10 = (undefined4 *)

-              LockPointer((SharedUserObjPointerFieldspwndParent<tagWND> *)(unaff_RBP + 7),

-                          (_HEAD *)(unaff_RDI + 0x68));

-    uVar20 = puVar10[1];

-    uVar3 = puVar10[2];

-    uVar4 = puVar10[3];

-    *(undefined4 *)(unaff_RBP + -0x19) = *puVar10;

-    *(undefined4 *)(unaff_RBP + -0x15) = uVar20;

-    *(undefined4 *)(unaff_RBP + -0x11) = uVar3;

-    *(undefined4 *)(unaff_RBP + -0xd) = uVar4;

-    HMAssignmentLock(unaff_RBP + -0x19,1);

-  }

-  *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0x38) = unaff_R12;

-  HMAssignmentUnlock();

-  *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0x40) = unaff_R12;

-  HMAssignmentUnlock();

-  *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0xb0) = unaff_R12;

-  HMAssignmentUnlock();

-  iVar6 = IsWindowDesktopComposed();

-  if (iVar6 != 0) {

-    uVar9 = *(undefined8 *)unaff_RDI;

-    uVar11 = ReferenceDwmApiPort();

-    DwmAsyncOwnerChange(uVar11,uVar9,0);

-  }

-  DereferenceClass(*(undefined8 *)(unaff_R13 + 0x1d0));

-  HMMarkObjectDestroy();

-  lVar7 = _HMPheFromObject();

-  *(byte *)(lVar7 + 0x19) = *(byte *)(lVar7 + 0x19) | 2;

-  tagWND::ComputeDominantState(unaff_RDI);

-  if ((*(uint *)(unaff_RDI + 0x17c) & 0x8000000) != 0) {

-    tagWND::DwsUnlinkAllProcesses(unaff_RDI,3);

-  }

-  pHVar12 = _GetProcessWindowStation();

-  if (pHVar12 != (HWINSTA)0x0) {

-    if (*(tagWND **)(pHVar12 + 0x18) == unaff_RDI) {

-      HMAssignmentUnlock();

-      *(longlong *)(pHVar12 + 0x14) = unaff_R12;

-    }

-    if (*(tagWND **)(pHVar12 + 0x1c) == unaff_RDI) {

-      HMAssignmentUnlock();

-    }

-    if (*(tagWND **)(pHVar12 + 0x1a) == unaff_RDI) {

-      HMAssignmentUnlock();

-    }

-  }

-  if ((*(uint *)(unaff_RDI + 0x17c) & 0x800000) != 0) {

-    _RemoveClipboardFormatListener(unaff_RDI);

-  }

-  ptVar13 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>(unaff_R15);

-  if (ptVar13 != (tagXSTATE *)0x0) {

-    FreeClientOnWindowDestruction();

-    iVar6 = HMMarkObjectDestroy();

-    if (iVar6 == 0) {

-      *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0x78) = unaff_R12;

-      if (*(longlong *)(unaff_RSI + unaff_R14) == 0) {

-        plVar15 = (longlong *)PsGetCurrentProcessWin32Process();

-        uVar17 = 0;

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

-          uVar17 = (ulonglong)plVar15 & -(ulonglong)(*plVar15 != 0);

-        }

+    p_Var15 = (_GUID *)ValidateHwnd(param_2);

+    local_1d0 = p_Var15;

+    if (p_Var15 == (_GUID *)0x0) {

+      iVar10 = 0;

+      param_1->Data1 = 0;

+      param_1->Data2 = 0;

+      param_1->Data3 = 0;

+      param_1->Data4[0] = '\0';

+      param_1->Data4[1] = '\0';

+      param_1->Data4[2] = '\0';

+      param_1->Data4[3] = '\0';

+      EtwTraceBeginAppMessageProcessing(param_6,0x10,param_1);

+      if (param_6 != 0) {

+        iVar10 = -1;

+      }

+      goto LAB_0;

+    }

+    Win32HM_LockIntoThread<0>(this,(_HEAD *)p_Var15,(_Win32HMThreadLockItem *)local_1a8);

+    local_1e0 = 1;

+  }

+  *(longlong *)(*(longlong *)(this + 0x208) + 8) =

+       *(longlong *)(*(longlong *)(this + 0x208) + 8) + 1;

+  local_1e8 = 0xffffffff;

+  if (param_4 != 0) {

+    local_1e8 = param_4;

+  }

+  plVar29 = (longlong *)&DAT_1;

+  LOCK();

+  *(int *)(*(longlong *)(this + 0x1e8) + 0x14) =

+       (int)((ulonglong)_DAT_2 * _DAT_fffff78000000320 >> 0x18);

+  UNLOCK();

+  ppuVar27 = (undefined **)(ulonglong)(param_5 >> 0x10);

+  uVar9 = CalcWakeMask(local_res18);

+  if ((uVar9 & 0x1c07) != 0) {

+    *(int *)(this + 0x640) = (int)((ulonglong)_DAT_2 * *plVar29 >> 0x18);

+  }

+  local_1e4 = uVar9;

+  bVar7 = WaitMaskIncludesUserInput(uVar9);

+  if (bVar7) {

+    if (local_1e0 == 0) {

+      if (param_2 == (_GUID *)0x0) {

+        p_Var15 = (_GUID *)0x0;

+        goto LAB_3;

+      }

+    }

+    else if (*(tagTHREADINFO **)(p_Var15 + 1) == this) {

+LAB_3:

+      xxxUpdateInputHangInfo((tagWND *)p_Var15,1);

+    }

+  }

+  plVar29 = (longlong *)PsGetCurrentProcessWin32Process();

+  uVar26 = 0;

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

+    uVar26 = (ulonglong)plVar29 & -(ulonglong)(*plVar29 != 0);

+  }

+  if ((*(uint *)(uVar26 + 0xc) & 4) != 0) {

+    iVar10 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+    if (iVar10 == 0) {

+      *(uint *)(uVar26 + 0xc) = *(uint *)(uVar26 + 0xc) & 0xfffffffb;

+      zzzCalcStartCursorHide(0,0);

+    }

+    else {

+      zzzClearStartGlass(uVar26);

+    }

+  }

+  xxxDoSysExpungeIfNeeded(this);

+  uVar31 = param_5 & 1;

+  if ((((uVar31 != 0) && ((uVar9 & 0x1cbf) != 0)) && ((*(uint *)(this + 0x550) >> 0x13 & 1) != 0))

+     && ((uVar9 & *(uint *)(*(longlong *)(this + 0x1e8) + 8)) != 0)) {

+    TryAttachShellFrame(this,1);

+  }

+  lVar16 = *(longlong *)(this + 0x1d8);

+  if (*(longlong *)(this + 0x228) == 0) {

+    ptVar22 = *(tagTHREADINFO **)(lVar16 + 0x48);

+    if (ptVar22 == this) {

+      if (*(longlong *)(lVar16 + 0x50) == *(longlong *)(this + 0x268)) goto LAB_4;

+      goto LAB_5;

+    }

+LAB_6:

+    **(uint **)(this + 0x1e8) = **(uint **)(this + 0x1e8) & 0xfffffffe;

+  }

+  else {

+LAB_4:

+    ppuVar27 = &WPP_GLOBAL_Control;

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

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

+       (bVar7 = true, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+      bVar7 = false;

+    }

+    bVar34 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((bVar7) || (bVar34)) {

+      W32GetUserSessionState();

+      ppuVar27 = (undefined **)CONCAT71((int7)((ulonglong)ppuVar27 >> 8),bVar34);

+      WPP_RECORDER_AND_TRACE_SF_qqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+    }

+    ptVar22 = (tagTHREADINFO *)0x0;

+    *(undefined8 *)(lVar16 + 0x48) = 0;

+LAB_5:

+    if (ptVar22 != this) goto LAB_6;

+  }

+  *(undefined2 *)(this + 0x398) = 0;

+  if ((param_5 & 2) == 0) {

+    LOCK();

+    uVar12 = *(uint *)(this + 0x210);

+    if (uVar12 == 0) {

+      *(uint *)(this + 0x210) = 0;

+      uVar12 = 0;

+    }

+    UNLOCK();

+    if ((uVar12 >> 0x13 & 1) != 0) {

+      LOCK();

+      local_180 = *(uint *)(this + 0x210);

+      if (local_180 == 0) {

+        *(uint *)(this + 0x210) = 0;

+        local_180 = 0;

+      }

+      UNLOCK();

+      *(uint *)(*(longlong *)(this + 0x208) + 0x1c) = local_180 & 0xfff7ffff;

+      LOCK();

+      *(uint *)(*(longlong *)(this + 0x1e8) + 8) =

+           *(uint *)(*(longlong *)(this + 0x1e8) + 8) | 0x2000;

+      UNLOCK();

+      LOCK();

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

+           *(uint *)(*(longlong *)(this + 0x1e8) + 4) | 0x2000;

+      UNLOCK();

+      LOCK();

+      *(uint *)(this + 0x210) = *(uint *)(this + 0x210) & 0xfff7ffff;

+      UNLOCK();

+    }

+  }

+  local_1d8 = param_5 & 2;

+  p_Var15 = (_GUID *)0x0;

+  uVar12 = uVar9;

+LAB_7:

+  p_Var28 = (_GUID *)0x0;

+  local_200 = (_GUID *)0x0;

+  lVar16 = W32GetUserSessionState();

+  if (*(longlong *)(this + 0x1f0) == *(longlong *)(lVar16 + 0x4210)) {

+    lVar16 = W32GetUserSessionState();

+    *(undefined8 *)(lVar16 + 0x4210) = 0;

+    if (*(longlong *)(this + 0x1f0) != 0) {

+      ppuVar27 = (undefined **)0x0;

+      zzzReattachThreads(2,(tagTHREADINFO *)0x0,(tagTHREADINFO *)0x0);

+    }

+  }

+  *(ushort *)(this + 0x398) =

+       *(ushort *)(this + 0x398) |

+       (ushort)(uVar9 & 0xffffffbf) & (ushort)*(undefined4 *)(*(longlong *)(this + 0x1e8) + 4);

+  LOCK();

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

+       *(uint *)(*(longlong *)(this + 0x1e8) + 4) & ~(uVar9 & 0xffffffbf);

+  UNLOCK();

+  uVar30 = (uint)p_Var15;

+  if ((*(uint *)(*(longlong *)(this + 0x1e8) + 8) & uVar12 & 0x40) == 0) {

+    if ((*(uint *)(*(longlong *)(this + 0x1e8) + 8) & 0x40) == 0) goto LAB_8;

+    local_218 = uVar30 | 0x80;

+  }

+  else {

+    xxxReceiveMessages(this);

+LAB_8:

+    if ((uVar12 & 0x40) != 0 && (uVar9 & 0x1c07) != 0) {

+      xxxProcessDelegateCapturedPointers(this);

+    }

+    bVar7 = tagTHREADINFO::HasCoreMessagingWindow(this);

+    if ((bVar7) && ((uVar12 & 8) != 0)) {

+      xxxDrainQueueCompletions(0x80000000);

+    }

+    lVar16 = *(longlong *)(this + 0x1d8);

+    uVar23 = *(uint *)(lVar16 + 0x1fc);

+    if ((((uVar23 >> 0xc & 1) != 0) && (*(int *)(lVar16 + 0x28) == 0)) && ((uVar23 & 0x20) == 0)) {

+      *(uint *)(lVar16 + 0x1fc) = uVar23 & 0xffffefff;

+      iVar10 = Feature_YieldInputQueue3__private_IsEnabledDeviceUsageNoInline();

+      if (((iVar10 == 0) && (1 < *(ushort *)(*(tagQ **)(this + 0x1d8) + 0x26c))) &&

+         ((InputTraceLogging::Mouse::StrugglingInputQueueStop(*(tagQ **)(this + 0x1d8)),

+          DAT_9 != 0 && (cVar8 = _tlgKeywordOn(&DAT_9), cVar8 != '\0')))) {

+        lVar16 = KeQueryPerformanceCounter(0);

+        lVar17 = W32GetUserSessionState();

+        if (*(int *)(lVar17 + 0x10f9c) == 0) {

+          *(longlong *)(lVar17 + 0x10fa0) = lVar16;

+        }

+        *(int *)(lVar17 + 0x10f9c) = *(int *)(lVar17 + 0x10f9c) + 1;

+        uVar26 = lVar16 - *(longlong *)(*(longlong *)(this + 0x1d8) + 0x270);

+        *(longlong *)(lVar17 + 0x10fa8) = uVar26 + *(longlong *)(lVar17 + 0x10fa8);

+        if (*(ulonglong *)(lVar17 + 0x10fb0) < uVar26) {

+          *(ulonglong *)(lVar17 + 0x10fb0) = uVar26;

+          *(undefined4 *)(lVar17 + 0x10fb8) = *(undefined4 *)(*(longlong *)(this + 0x1d0) + 0x38);

+          *(undefined4 *)(lVar17 + 0x10fbc) = *(undefined4 *)(*(longlong *)(this + 0x1d8) + 0x268);

+          *(undefined2 *)(lVar17 + 0x10fc0) = *(undefined2 *)(*(longlong *)(this + 0x1d8) + 0x26e);

+          *(undefined2 *)(lVar17 + 0x10fc2) = *(undefined2 *)(*(longlong *)(this + 0x1d8) + 0x26c);

+        }

+        iVar10 = (int)((ulonglong)_DAT_2 * _DAT_fffff78000000320 >> 0x18);

+        if (59999 < (uint)(iVar10 - *(int *)(lVar17 + 0x10f98))) {

+          if ((5 < DAT_9) && (cVar8 = _tlgKeywordOn(&DAT_9), cVar8 != '\0')) {

+            local_178 = (ulonglong)(*(longlong *)(lVar17 + 0x10fb0) * 1000) /

+                        *(ulonglong *)gliQpcFreq_exref;

+            local_res10[0] = *(undefined2 *)(lVar17 + 0x10fc2);

+            local_1dc[0] = *(undefined2 *)(lVar17 + 0x10fc0);

+            local_1c0 = *(undefined4 *)(lVar17 + 0x10fbc);

+            local_170 = (ulonglong)(*(longlong *)(lVar17 + 0x10fa8) * 1000) /

+                        *(ulonglong *)gliQpcFreq_exref;

+            local_168 = (ulonglong)((lVar16 - *(longlong *)(lVar17 + 0x10fa0)) * 1000) /

+                        *(ulonglong *)gliQpcFreq_exref;

+            local_1bc = *(undefined4 *)(lVar17 + 0x10f9c);

+            local_1b8[0] = *(undefined4 *)(lVar17 + 0x10fb8);

+            local_160[0] = 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<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<2>,_tlgWrapperByVal<2>,_tlgWrapperByVal<8>_>

+                      ((_tlgProvider_t *)gliQpcFreq_exref,&DAT_10,(_GUID *)ppuVar27,p_Var28,

+                       (_tlgWrapperByVal<8> *)local_160,(_tlgWrapperByVal<4> *)local_1b8,

+                       (_tlgWrapperByVal<4> *)&local_1bc,(_tlgWrapperByVal<8> *)&local_168,

+                       (_tlgWrapperByVal<8> *)&local_170,(_tlgWrapperByVal<4> *)&local_1c0,

+                       (_tlgWrapperByVal<2> *)local_1dc,(_tlgWrapperByVal<2> *)local_res10,

+                       (_tlgWrapperByVal<8> *)&local_178);

+          }

+          *(int *)(lVar17 + 0x10f98) = iVar10;

+          *(undefined8 *)(lVar17 + 0x10fb0) = 0;

+          *(undefined4 *)(lVar17 + 0x10f9c) = 0;

+          *(undefined8 *)(lVar17 + 0x10fa8) = 0;

+        }

+      }

+    }

+    if ((uVar12 & *(uint *)(*(longlong *)(this + 0x1e8) + 8)) == 0) {

+      local_218 = uVar30 | 0x100;

+      goto LAB_11;

+    }

+    uVar23 = *(uint *)(*(longlong *)(this + 0x1e8) + 8);

+    p_Var19 = local_1d0;

+    if ((*(tagTHREADINFO **)(*(longlong *)(this + 0x1d8) + 0x48) == this) &&

+       ((*(uint *)(*(longlong *)(this + 0x1d8) + 0x1fc) & 0x400) != 0)) {

+      EtwTraceInputQueueNoRemoveLocker();

+      p_Var19 = local_1d0;

+      if ((uVar12 & uVar23 & 0x3c07) == 0) {

+        if ((uVar23 >> 0xd & 1) != 0) {

+          local_218 = uVar30 | 0x200;

+          goto LAB_11;

+        }

+        goto LAB_12;

+      }

+      p_Var28 = (_GUID *)(ulonglong)local_res18;

+      ppuVar27 = (undefined **)local_1d0;

+      _Var11 = xxxScanSysQueue(this,(tagMSG *)param_1,(tagWND *)local_1d0,local_res18,local_1e8,

+                               param_5,uVar12 & uVar23 & 0x3c07,(tagQMSG **)&local_200);

+      if (_Var11 != 1) {

+        if (_Var11 == 0) {

+          UnblockDeferredInput(this);

+        }

+        goto LAB_12;

+      }

+      uVar30 = uVar30 | 2;

+LAB_13:

+      p_Var15 = (_GUID *)(ulonglong)uVar30;

+LAB_14:

+      p_Var19 = (_GUID *)0x0;

+      local_218 = (uint)p_Var15;

+      iVar10 = *(int *)param_1->Data4;

+      if ((iVar10 != 0x253) ||

+         (p_Var28 = (_GUID *)0xffffffffffffffff, *(longlong *)param_1[1].Data4 != -1)) {

+        p_Var28 = p_Var19;

+      }

+      bVar34 = false;

+      bVar7 = true;

+      if (iVar10 - 0x23bU < 2) {

+        if ((*(ulonglong *)(this + 0x550) & 0x2000002000) != 0) goto LAB_15;

+        bVar35 = *(longlong *)param_1[1].Data4 == 1;

+LAB_16:

+        bVar6 = bVar7;

+        if (!bVar35) goto LAB_15;

       }

       else {

-        uVar17 = *(ulonglong *)

-                  (*(longlong *)

-                    (*(longlong *)

-                      (*(longlong *)(*(longlong *)(unaff_RSI + unaff_R14) + 0x28) + 0x38) + 0x10) +

-                  0x1d0);

-      }

-      uVar9 = *(undefined8 *)hModuleWin_exref;

-      lVar7 = W32GetUserSessionState();

-      puVar16 = (undefined8 *)

-                GetClassPtr(*(undefined2 *)(*(longlong *)(lVar7 + 0x4e30) + 0x38e),uVar17,uVar9);

-      this = (SharedMixedObjectPointerFieldpcls<tagCLS> *)(unaff_RDI + 0x88);

-      tagWND::SharedMixedObjectPointerFieldpcls<tagCLS>::operator=(this,(tagCLS *)*puVar16);

-      *(int *)(*(longlong *)this + 0x48) = *(int *)(*(longlong *)this + 0x48) + 1;

-      SetOrClrWF(1);

-      SetOrClrWF(0);

-      SetOrClrWF(0);

-      SetOrClrWF(1);

-      *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0x98) = unaff_R12;

-      *(longlong *)(unaff_RDI + 0xa8) = unaff_R12;

-    }

-    else {

-      piVar1 = *(int **)(unaff_RDI + 0x120);

-      if (piVar1 != (int *)0x0) {

-        *piVar1 = *piVar1 + -1;

-        if (**(int **)(unaff_RDI + 0x120) == iVar5) {

-          Win32FreePool();

-        }

-        *(longlong *)(unaff_RDI + 0x120) = unaff_R12;

-      }

-      piVar1 = *(int **)(unaff_RDI + 0x128);

-      if (piVar1 != (int *)0x0) {

-        *piVar1 = *piVar1 + -1;

-        if (**(int **)(unaff_RDI + 0x128) == iVar5) {

-          Win32FreePool();

-        }

-        *(longlong *)(unaff_RDI + 0x128) = unaff_R12;

-      }

-      UpdateWindowMonitorAndDpiInfoHelper(unaff_RDI,(tagMONITOR *)0x0);

-      Win32FreePool(*(undefined8 *)(unaff_RDI + 0x170));

-      *(longlong *)(unaff_RDI + 0x170) = unaff_R12;

-      if (*(longlong *)(unaff_RDI + 0x90) != unaff_R12) {

-        DeleteProperties();

-        Win32FreePool(*(undefined8 *)(unaff_RDI + 0x90));

-        *(longlong *)(unaff_RDI + 0x90) = unaff_R12;

-      }

-      if ((*(ushort *)(*(longlong *)(unaff_RDI + 0x28) + 0x2a) & 0x2fff) == 0x2a0) {

-        *(undefined4 *)(unaff_RBP + 0x67) = 0x20000;

-        MicrosoftTelemetryAssertTriggeredArgsKM

-                  ("IXPTelAssert",*(undefined4 *)(unaff_RBP + 0x67),0x150a);

-      }

-      lVar7 = safe_cast_fnid_to_PMENUWND();

-      if ((lVar7 != 0) && (*(tagPOPUPMENU **)(lVar7 + 0x10) != (tagPOPUPMENU *)0x0)) {

-        SmartObjStackRefBase<tagPOPUPMENU>::Init

-                  ((SmartObjStackRefBase<tagPOPUPMENU> *)(unaff_RBP + -0x19),

-                   *(tagPOPUPMENU **)(lVar7 + 0x10));

-        if ((*(uint *)**(undefined8 **)(unaff_RBP + -0x19) & 0x20000000) == 0) {

-          lVar8 = **(longlong **)(unaff_RBP + -0x19);

-          lVar14 = W32GetUserSessionState();

-          if (lVar8 == lVar14 + 0x10188) {

-            lVar7 = W32GetUserSessionState();

-            *(uint *)(lVar7 + 0x10650) = *(uint *)(lVar7 + 0x10650) & 0xff7fffff;

-            lVar7 = W32GetUserSessionState();

-            NullifyLookasideRef(*(undefined8 *)(lVar7 + 0x101e0));

+        if (((iVar10 - 0x241U < 4) || (iVar10 - 0x245U < 6)) ||

+           (bVar35 = bVar34, iVar10 - 0x251U < 3)) {

+          bVar35 = bVar7;

+        }

+        if ((!bVar35) ||

+           (iVar10 = IsPointerMessageTouchpad(this,(__uint64)p_Var28,(ushort)param_1[1].Data1),

+           bVar35 = bVar7, iVar10 == 0)) {

+          bVar35 = bVar34;

+        }

+        if (bVar35) {

+          bVar35 = ShouldReceiveTouchpadMessages(this,*(HWND__ **)param_1);

+          bVar35 = !bVar35;

+          goto LAB_16;

+        }

+LAB_15:

+        bVar6 = bVar34;

+      }

+      iVar10 = *(int *)param_1->Data4;

+      if (((iVar10 == 0x34a) || (iVar10 == 0x219)) || (iVar10 == 0x238)) {

+        Feature_MTestAbSh1__private_ReportDeviceUsage();

+        bVar34 = bVar7;

+      }

+      if (uVar31 == 0) {

+LAB_17:

+        if ((!bVar6) &&

+           (uVar12 = *(uint *)(**(longlong **)(this + 0x1f8) + 0x10) | *(uint *)(this + 0x2d0),

+           (uVar12 & 0x10) != 0)) {

+          iVar10 = *(int *)param_1->Data4;

+          pvVar4 = *(void **)param_1[1].Data4;

+          uVar32 = 0;

+          local_198 = (tagHIDDATA **)0x0;

+          uVar33 = 0;

+          if ((iVar10 == 0xff) && (uVar33 = uVar32, pvVar4 != (void *)0x0)) {

+            ptVar18 = (tagHIDDATA *)

+                      HMValidateHandleNoSecure(pvVar4,CONCAT71((uint7)(uint3)(uVar12 >> 8),0x12));

+            p_Var19 = (_GUID *)0x0;

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

+              FlushPostedRawInput(this);

+              p_Var19 = (_GUID *)UnlinkHidData(this,ptVar18,&local_198);

+              if (p_Var19 != (_GUID *)0x0) {

+                uVar33 = *(undefined8 *)(this + 0x478);

+                *(_GUID **)(this + 0x478) = p_Var19;

+              }

+            }

+          }

+          p_Var28 = (_GUID *)0x3;

+          xxxCallHook(0,(ulonglong)param_5,(__int64)param_1,3);

+          if (((p_Var19 != (_GUID *)0x0) &&

+              (*(undefined8 *)(this + 0x478) = uVar33, *(int *)param_1->Data4 == 0xff)) &&

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

+             ptVar18 != (tagHIDDATA *)0x0)) {

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

+            *(tagHIDDATA **)(ptVar18 + 0x20) = *local_198;

+            *local_198 = ptVar18;

+          }

+          if (((iVar10 == 0xff) && (pvVar4 != (void *)0x0)) && (*(int *)param_1->Data4 == 0)) {

+            InputTraceLogging::RawInput::HijackHidData(pvVar4);

+          }

+        }

+      }

+      else {

+        if (((*(int *)param_1->Data4 == 0x102) ||

+            ((((uVar12 = *(int *)param_1->Data4 - 0x242, uVar12 < 6 &&

+               ((0x33U >> (uVar12 & 0x1f) & 1) != 0)) || (bVar34)) ||

+             (0xbfff < *(ushort *)param_1->Data4)))) &&

+           (p_Var28 = param_1, iVar10 = xxxCallCtfHook(3), iVar10 != 0)) {

+          if (*(int *)param_1->Data4 == 0x102) {

+            param_1->Data4[0] = '\0';

+            param_1->Data4[1] = '\0';

+            param_1->Data4[2] = '\0';

+            param_1->Data4[3] = '\0';

+          }

+          else if (*(int *)param_1->Data4 != 0x34a) goto LAB_18;

+          param_1[1].Data4[0] = '\0';

+          param_1[1].Data4[1] = '\0';

+          param_1[1].Data4[2] = '\0';

+          param_1[1].Data4[3] = '\0';

+          param_1[1].Data4[4] = '\0';

+          param_1[1].Data4[5] = '\0';

+          param_1[1].Data4[6] = '\0';

+          param_1[1].Data4[7] = '\0';

+          param_1[1].Data1 = 0;

+          param_1[1].Data2 = 0;

+          param_1[1].Data3 = 0;

+        }

+LAB_18:

+        if (((uVar31 == 0) || (local_200 == (_GUID *)0x0)) ||

+           ((*(longlong *)(this + 0x5b8) == 0 && (*(longlong *)(this + 0x5c8) == 0))))

+        goto LAB_17;

+      }

+      iVar10 = 1;

+      uVar25 = 0;

+      if (uVar31 != 0) {

+        if (*(int *)(this + 0x4d8) != 0) {

+          PointerPromotion::xxxCompletePendingPromotion(this);

+        }

+        if ((*(int *)param_1->Data4 == 0x247) &&

+           ((*(ushort *)((longlong)&param_1[1].Data1 + 2) >> 0xd & 1) != 0)) {

+          PointerPromotion::MarkPendingPromotion(this,(ushort)param_1[1].Data1);

+        }

+        iVar14 = IsPointerInputMessageWithState(*(undefined4 *)param_1->Data4);

+        if (iVar14 != 0) {

+          uVar25 = (ushort)param_1[1].Data1;

+        }

+        lVar16 = W32GetUserSessionState();

+        CTouchProcessor::UpdateThreadPointerList

+                  (*(CTouchProcessor **)(lVar16 + 0xcb8),(tagTHREADINPUTPOINTERLIST *)(this + 0x4b8)

+                   ,uVar25);

+      }

+      if ((local_200 != (_GUID *)0x0) &&

+         (uVar12._0_2_ = local_200[6].Data2, uVar12._2_2_ = local_200[6].Data3,

+         (uVar12 >> 8 & 1) != 0)) {

+        if (uVar31 != 0) {

+          if (*(longlong *)(this + 0x5c8) == 0) {

+            if ((uVar31 == 0) || (*(longlong *)(this + 0x5b8) == 0)) goto LAB_19;

+            InputTraceLogging::ThreadLockedPerfRegion::ThreadLockedPerfRegion

+                      (local_188,"Delegation",(ThreadLockedPerfRegion *)0x0);

+            EtwTraceBeginDelegateInputCallback(local_200,param_1);

+            InputTraceLogging::Delivery::CallDelegateThread((tagQMSG *)local_200);

+            InputTraceLogging::ThreadLockedPerfRegion::ThreadLockedPerfRegion

+                      (local_150,"DelegationCallout",local_188);

+            ppuVar27 = *(undefined ***)(this + 0x5c0);

+            uVar13 = xxxClientCallDelegateThread(*(undefined8 *)(this + 0x5b8),param_1);

+            InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion(local_150);

+            EtwTraceEndDelegateInputCallback(local_200,param_1);

+            uVar30._0_2_ = local_200[6].Data2;

+            uVar30._2_2_ = local_200[6].Data3;

+            if ((uVar30 & 0x20) != 0) {

+              lVar16 = W32GetUserSessionState();

+              pCVar20 = CTouchProcessor::GetTouchProcessorLock

+                                  (*(CTouchProcessor **)(lVar16 + 0xcb8));

+              CInpLockGuardExclusive::CInpLockGuardExclusive(local_68,pCVar20,ppuVar27);

+              uVar23._0_2_ = local_200[6].Data2;

+              uVar23._2_2_ = local_200[6].Data3;

+              local_200[6].Data2 = (short)(uVar23 & 0xfffffeff);

+              local_200[6].Data3 = (short)((uVar23 & 0xfffffeff) >> 0x10);

+              ppuVar27 = (undefined **)local_200;

+              _HandleDelegatedInputWorker(this,uVar13,(tagQMSG *)local_200);

+              CInpLockGuardExclusive::~CInpLockGuardExclusive(local_68);

+            }

+            this_00 = local_188;

           }

           else {

-            FreeIsolatedTypeAndClearStackReferences<tagPOPUPMENU,NSInstrumentation::CTypeIsolation<24576,96>_>

-                      ((tagPOPUPMENU *)**(undefined8 **)(unaff_RBP + -0x19));

-            *(longlong *)(lVar7 + 0x10) = unaff_R12;

+            InputTraceLogging::ThreadLockedPerfRegion::ThreadLockedPerfRegion

+                      (local_190,"ShellHandwriting Delegation",(ThreadLockedPerfRegion *)0x0);

+            InputTraceLogging::Delivery::CallShellHandwritingDelegateThread((tagQMSG *)local_200);

+            InputTraceLogging::ThreadLockedPerfRegion::ThreadLockedPerfRegion

+                      (local_140,"ShellHandwriting DelegationCallout",local_190);

+            ppuVar27 = *(undefined ***)(this + 0x5c0);

+            uVar13 = xxxClientCallDelegateThread(*(undefined8 *)(this + 0x5c8),param_1);

+            InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion(local_140);

+            uVar2._0_2_ = local_200[6].Data2;

+            uVar2._2_2_ = local_200[6].Data3;

+            if ((uVar2 & 0x20) != 0) {

+              lVar16 = W32GetUserSessionState();

+              pCVar20 = CTouchProcessor::GetTouchProcessorLock

+                                  (*(CTouchProcessor **)(lVar16 + 0xcb8));

+              CInpLockGuardExclusive::CInpLockGuardExclusive(local_98,pCVar20,ppuVar27);

+              uVar1._0_2_ = local_200[6].Data2;

+              uVar1._2_2_ = local_200[6].Data3;

+              local_200[6].Data2 = (short)(uVar1 & 0xfffffeff);

+              local_200[6].Data3 = (short)((uVar1 & 0xfffffeff) >> 0x10);

+              ppuVar27 = (undefined **)local_200;

+              _HandleShellHandwritingDelegatedInputWorker(this,uVar13,(tagQMSG *)local_200);

+              CInpLockGuardExclusive::~CInpLockGuardExclusive(local_98);

+            }

+            this_00 = local_190;

           }

-        }

-        else {

-          puVar2 = (uint *)**(longlong **)(unaff_RBP + -0x19);

-          *puVar2 = *puVar2 & 0xbfffffff;

-        }

-        SmartObjStackRefBase<tagPOPUPMENU>::~SmartObjStackRefBase<tagPOPUPMENU>

-                  ((SmartObjStackRefBase<tagPOPUPMENU> *)(unaff_RBP + -0x19));

-      }

-      if (*(longlong *)(unaff_RDI + 0x118) != 0) {

-        Win32FreePool();

-        *(longlong *)(unaff_RDI + 0x118) = unaff_R12;

-      }

-      *(int *)(*(longlong *)(unaff_RDI + 0x28) + 0xf8) = iVar5;

-      *(int *)(unaff_R13 + 0x3b0) = *(int *)(unaff_R13 + 0x3b0) + -1;

-      iVar5 = IsWindowDesktopComposed();

-      if (iVar5 != 0) {

-        uVar9 = *(undefined8 *)unaff_RDI;

-        uVar11 = ReferenceDwmApiPort();

-        DwmAsyncChildDestroy(uVar11,uVar9);

-      }

-      *(longlong *)(*(longlong *)(unaff_RDI + 0x28) + 0x30) = unaff_R12;

-      HMAssignmentUnlock();

-      Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

-                ((Win32RawLockedNtObject<tagWINDOWSTATION> *)(unaff_RBP + 7),

-                 *(tagWINDOWSTATION **)(unaff_RSI + unaff_R14));

-      tagObjLock::LockUnInitializeThreadCreator((tagObjLock *)(unaff_RDI + 0x38));

-      HMFreeObject();

-      if (*(longlong *)(unaff_RBP + 0x17) != -1) {

-        PopAndFreeW32ThreadLock(unaff_RBP + 7);

-        *(undefined8 *)(unaff_RBP + 0x17) = 0xffffffffffffffff;

-      }

-    }

-  }

-  AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)(unaff_RBP + -9));

-  return;

+          p_Var15 = (_GUID *)0x20000;

+          local_218 = 0x20000;

+          InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion(this_00);

+          uVar12 = local_1e4;

+          goto LAB_7;

+        }

+LAB_19:

+        local_200[6].Data2 = (short)(uVar12 & 0xfffffeff);

+        local_200[6].Data3 = (short)((uVar12 & 0xfffffeff) >> 0x10);

+      }

+      if (bVar6) {

+        ppuVar27 = (undefined **)0x0;

+        InputTraceLogging::ThreadLockedPerfRegion::ThreadLockedPerfRegion

+                  (local_148,"PTPDownleveling",(ThreadLockedPerfRegion *)0x0);

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

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

+           (iVar14 = iVar10, (byte)WPP_GLOBAL_Control[0x29] < 5)) {

+          iVar14 = 0;

+        }

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

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

+          iVar10 = 0;

+        }

+        if (((char)iVar14 != '\0') || ((char)iVar10 != '\0')) {

+          W32GetUserSessionState();

+          ppuVar27 = (undefined **)CONCAT71((int7)((ulonglong)ppuVar27 >> 8),(char)iVar10);

+          WPP_RECORDER_AND_TRACE_SF_Dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+        }

+        xxxClientCallDefaultInputHandler(param_1);

+        local_f8 = 0;

+        uStack_f0 = 0;

+        local_e8 = 0;

+        uStack_e0 = 0;

+        local_d8 = 0;

+        uStack_d0 = 0;

+        param_1->Data1 = 0;

+        param_1->Data2 = 0;

+        param_1->Data3 = 0;

+        param_1->Data4[0] = '\0';

+        param_1->Data4[1] = '\0';

+        param_1->Data4[2] = '\0';

+        param_1->Data4[3] = '\0';

+        param_1->Data4[4] = '\0';

+        param_1->Data4[5] = '\0';

+        param_1->Data4[6] = '\0';

+        param_1->Data4[7] = '\0';

+        param_1[1].Data1 = 0;

+        param_1[1].Data2 = 0;

+        param_1[1].Data3 = 0;

+        param_1[1].Data4[0] = '\0';

+        param_1[1].Data4[1] = '\0';

+        param_1[1].Data4[2] = '\0';

+        param_1[1].Data4[3] = '\0';

+        param_1[1].Data4[4] = '\0';

+        param_1[1].Data4[5] = '\0';

+        param_1[1].Data4[6] = '\0';

+        param_1[1].Data4[7] = '\0';

+        param_1[2].Data1 = 0;

+        param_1[2].Data2 = 0;

+        param_1[2].Data3 = 0;

+        param_1[2].Data4[0] = '\0';

+        param_1[2].Data4[1] = '\0';

+        param_1[2].Data4[2] = '\0';

+        param_1[2].Data4[3] = '\0';

+        param_1[2].Data4[4] = '\0';

+        param_1[2].Data4[5] = '\0';

+        param_1[2].Data4[6] = '\0';

+        param_1[2].Data4[7] = '\0';

+        InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion(local_148);

+        uVar12 = local_1e4;

+      }

+      else {

+        uVar33._0_4_ = param_1[1].Data1;

+        uVar33._4_2_ = param_1[1].Data2;

+        uVar33._6_2_ = param_1[1].Data3;

+        iVar14 = IsMiPPointerMessage(*(undefined4 *)param_1->Data4,uVar33);

+        if (((iVar14 == 0) ||

+            (uVar32._0_4_ = param_1->Data1, uVar32._4_2_ = param_1->Data2,

+            uVar32._6_2_ = param_1->Data3, ptVar21 = (tagWND *)HMValidateHandleNoSecure(uVar32,1),

+            ptVar21 == (tagWND *)0x0)) || (iVar14 = IsMiPEnabledForWindow(), iVar14 != 0)) {

+          if ((param_6 != 0) && (*(int *)param_1->Data4 == 0x12)) {

+            local_218 = local_218 | 0x40000;

+            goto LAB_20;

+          }

+          if (uVar31 != 0) {

+            FreeSavedMessageInfoHandles(this);

+            SaveMessageInfoHandle(this,(tagMSG *)param_1);

+          }

+          goto LAB_21;

+        }

+        ppuVar27 = (undefined **)(ulonglong)uVar31;

+        TraceLoggingMiPSuppressedForWindow(ptVar21,*(uint *)param_1->Data4,uVar31);

+        if (uVar31 != 0) {

+          xxxClientCallDefWindowProc(param_1);

+        }

+        local_c8 = 0;

+        uStack_c0 = 0;

+        local_b8 = 0;

+        uStack_b0 = 0;

+        local_a8 = 0;

+        uStack_a0 = 0;

+        param_1->Data1 = 0;

+        param_1->Data2 = 0;

+        param_1->Data3 = 0;

+        param_1->Data4[0] = '\0';

+        param_1->Data4[1] = '\0';

+        param_1->Data4[2] = '\0';

+        param_1->Data4[3] = '\0';

+        param_1->Data4[4] = '\0';

+        param_1->Data4[5] = '\0';

+        param_1->Data4[6] = '\0';

+        param_1->Data4[7] = '\0';

+        param_1[1].Data1 = 0;

+        param_1[1].Data2 = 0;

+        param_1[1].Data3 = 0;

+        param_1[1].Data4[0] = '\0';

+        param_1[1].Data4[1] = '\0';

+        param_1[1].Data4[2] = '\0';

+        param_1[1].Data4[3] = '\0';

+        param_1[1].Data4[4] = '\0';

+        param_1[1].Data4[5] = '\0';

+        param_1[1].Data4[6] = '\0';

+        param_1[1].Data4[7] = '\0';

+        param_1[2].Data1 = 0;

+        param_1[2].Data2 = 0;

+        param_1[2].Data3 = 0;

+        param_1[2].Data4[0] = '\0';

+        param_1[2].Data4[1] = '\0';

+        param_1[2].Data4[2] = '\0';

+        param_1[2].Data4[3] = '\0';

+        param_1[2].Data4[4] = '\0';

+        param_1[2].Data4[5] = '\0';

+        param_1[2].Data4[6] = '\0';

+        param_1[2].Data4[7] = '\0';

+        uVar12 = local_1e4;

+      }

+      goto LAB_7;

+    }

+LAB_12:

+    if ((uVar12 & uVar23 & 8) != 0) {

+      p_Var28 = (_GUID *)(ulonglong)local_res18;

+      ppuVar27 = (undefined **)p_Var19;

+      iVar10 = xxxReadPostMessage(this,(tagMSG *)param_1,(tagWND *)p_Var19,local_res18,local_1e8,

+                                  uVar31);

+      uVar25 = 0;

+      if (iVar10 == 0) {

+        if (((p_Var19 != (_GUID *)0x0) ||

+            ((((local_res18 <= local_1e8 && (0x1ff < local_1e8)) && (local_res18 < 0x20f)) &&

+             (((local_res18 != 0 || (local_1e8 != 0xffffffff)) && (0x60 < local_res18)))))) &&

+           ((*(uint *)(this + 0x550) >> 0x1d & 1) != 0)) {

+          local_128.Data1 = 0;

+          local_128.Data2 = 0;

+          local_128.Data3 = 0;

+          local_128.Data4[0] = '\0';

+          local_128.Data4[1] = '\0';

+          local_128.Data4[2] = '\0';

+          local_128.Data4[3] = '\0';

+          local_128.Data4[4] = '\0';

+          local_128.Data4[5] = '\0';

+          local_128.Data4[6] = '\0';

+          local_128.Data4[7] = '\0';

+          local_118 = 0;

+          uStack_110 = 0;

+          local_108 = 0;

+          uStack_100 = 0;

+          p_Var28 = (_GUID *)&DAT_22;

+          ppuVar27 = (undefined **)0x0;

+          iVar10 = xxxReadPostMessage(this,(tagMSG *)&local_128,(tagWND *)0x0,0x60,0x60,1);

+          if (iVar10 != 0) {

+            xxxSendPostedMessage((tagMSG *)&local_128,(tagMSG *)&local_128);

+          }

+        }

+        goto LAB_23;

+      }

+      if (uVar31 != 0) {

+        if (*(uint *)param_1->Data4 < 0x400) {

+          uVar25 = *(ushort *)(&MessageTable + (ulonglong)*(uint *)param_1->Data4 * 2) >> 0xf;

+        }

+        if (uVar25 != 0) {

+          xxxSendPostedMessage((tagMSG *)param_1,(tagMSG *)param_1);

+        }

+      }

+      p_Var15 = (_GUID *)(ulonglong)(uVar30 | 1);

+      goto LAB_14;

+    }

+LAB_23:

+    if (p_Var19 == (_GUID *)0x1) {

+      local_218 = uVar30 | 0x400;

+      goto LAB_11;

+    }

+    if ((uVar12 & uVar23 & 0x3c07) == 0) {

+      if ((uVar23 & 0x2000) == 0) goto LAB_24;

+      local_218 = uVar30 | 0x800;

+      goto LAB_11;

+    }

+    p_Var28 = (_GUID *)(ulonglong)local_res18;

+    ppuVar27 = (undefined **)p_Var19;

+    _Var11 = xxxScanSysQueue(this,(tagMSG *)param_1,(tagWND *)p_Var19,local_res18,local_1e8,param_5,

+                             uVar12 & uVar23 & 0x3c07,(tagQMSG **)&local_200);

+    if (_Var11 == 2) {

+      iVar10 = IsShellFrameHangResilient(this);

+      if (((iVar10 == 0) || (((byte)uVar12 & (byte)uVar23 & 1) == 0)) || (param_6 == 0))

+      goto LAB_24;

+      ppuVar27 = (undefined **)(ulonglong)local_1ec;

+      uVar23 = (uint)((ulonglong)_DAT_2 * _DAT_fffff78000000320 >> 0x18);

+      if (local_1ec == 0) {

+        ppuVar27 = (undefined **)

+                   ((ulonglong)_DAT_2 * _DAT_fffff78000000320 >> 0x18 & 0xffffffff);

+        local_1f4 = 0;

+        local_1f8 = uVar23;

+        local_1ec = uVar23;

+      }

+      uVar13 = local_1f4;

+      p_Var28 = (_GUID *)(ulonglong)local_1f8;

+      uVar24 = uVar23 - (uint)ppuVar27;

+      if (0xf9 < uVar24) {

+        if (local_1f8 == (uint)ppuVar27) {

+          TraceLoggingSysQueueLockedRetryFailed(local_1f4,uVar24);

+          local_1f8 = 0;

+        }

+        goto LAB_24;

+      }

+      ppuVar27 = (undefined **)0x1;

+      xxxSleepThread2(uVar12);

+      local_1f4 = uVar13 + 1;

+      goto LAB_7;

+    }

+    local_1f8 = 0;

+    local_1f4 = 0;

+    local_1ec = 0;

+    if (_Var11 == 1) {

+      p_Var15 = (_GUID *)(ulonglong)(uVar30 | 2);

+      goto LAB_14;

+    }

+LAB_24:

+    if ((*(uint *)(*(longlong *)(this + 0x1e8) + 8) & uVar12 & 0x40) == 0) {

+      if ((*(uint *)(*(longlong *)(this + 0x1e8) + 8) & 0x40) != 0) {

+        local_218 = uVar30 | 0x1000;

+        goto LAB_11;

+      }

+    }

+    else {

+      xxxReceiveMessages(this);

+    }

+    if ((uVar12 & *(uint *)(*(longlong *)(this + 0x1e8) + 8)) == 0) {

+      local_218 = uVar30 | 0x2000;

+      goto LAB_11;

+    }

+    uVar23 = *(uint *)(*(longlong *)(this + 0x1e8) + 8);

+    if (((uVar12 & uVar23 & 0x20) != 0) && (iVar10 = xxxDoPaint(), iVar10 != 0)) {

+      uVar30 = uVar30 | 4;

+      goto LAB_13;

+    }

+    if (local_1d8 == 0) {

+      zzzWakeInputIdle(this);

+      xxxReceiveMessages(this);

+      if ((*(uint *)(*(longlong *)(this + 0x1e8) + 8) & uVar12 & 0x40) == 0) {

+        if ((*(uint *)(*(longlong *)(this + 0x1e8) + 8) & 0x40) != 0) {

+          local_218 = uVar30 | 0x4000;

+          goto LAB_11;

+        }

+      }

+      else {

+        xxxReceiveMessages(this);

+      }

+      if ((uVar12 & *(uint *)(*(longlong *)(this + 0x1e8) + 8)) == 0) {

+        local_218 = uVar30 | 0x8000;

+        goto LAB_11;

+      }

+      uVar23 = *(uint *)(*(longlong *)(this + 0x1e8) + 8);

+    }

+    if (((uVar12 & uVar23 & 0x10) != 0) && (iVar10 = DoTimer(p_Var19), iVar10 != 0)) {

+      local_218 = uVar30 | 8;

+      p_Var15 = (_GUID *)(ulonglong)local_218;

+      goto LAB_7;

+    }

+  }

+LAB_11:

+  if (*(tagTHREADINFO **)(*(longlong *)(this + 0x1d8) + 0x48) == this) {

+    *(undefined8 *)(*(longlong *)(this + 0x1d8) + 0x50) = 0;

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

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

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

+      cVar8 = '\0';

+    }

+    else {

+      cVar8 = '\x01';

+    }

+    bVar7 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar8 != '\0') || (bVar7)) {

+      lVar16 = W32GetUserSessionState();

+      p_Var28 = *(_GUID **)(lVar16 + 0x10f88);

+      WPP_RECORDER_AND_TRACE_SF_qqq

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar8,bVar7,p_Var28,4);

+    }

+    *(undefined8 *)(*(longlong *)(this + 0x1d8) + 0x48) = 0;

+    **(uint **)(this + 0x1e8) = **(uint **)(this + 0x1e8) & 0xfffffffe;

+  }

+  p_Var15 = *(_GUID **)(this + 0x1d8);

+  bVar7 = tagQ::AreMultipleThreadsAttached((tagQ *)p_Var15);

+  if (((bVar7) && (ptVar3 = *(tagQMSG **)p_Var15[1].Data4, ptVar3 != (tagQMSG *)0x0)) &&

+     (((*(uint *)(ptVar3 + 100) & 0x10) == 0 &&

+      ((*(tagTHREADINFO **)(ptVar3 + 0x68) != (tagTHREADINFO *)0x0 &&

+       (*(tagTHREADINFO **)(ptVar3 + 0x68) != this)))))) {

+    WakeSomeoneAfterUnlockingOrUndeferring(ptVar3);

+  }

+  if (param_6 == 0) {

+    if ((param_5 & 2) == 0) {

+      zzzWakeInputIdle(this);

+      xxxReceiveMessages(this);

+    }

+    goto LAB_20;

+  }

+  if (local_1e0 == 0) {

+    local_1f0 = 0;

+    ppuVar27 = *(undefined ***)(*(longlong *)(this + 0x1d8) + 0x50);

+    iVar10 = IsShellFrameHangResilient(this);

+    if (iVar10 != 0) {

+      local_1f8 = 0;

+      local_1f4 = 0;

+      local_1ec = 0;

+    }

+    p_Var15 = (_GUID *)0x1;

+    iVar10 = xxxSleepThread2(uVar12);

+    iVar14 = IsShellFrameHangResilient(this);

+    if ((iVar14 != 0) &&

+       (((*(longlong *)(*(longlong *)(this + 0x1d8) + 0x80) == *(longlong *)(this + 0x630) ||

+         (*(longlong *)(*(longlong *)(this + 0x1d8) + 0x80) == 0)) && (local_1f0 != 0)))) {

+      lVar16 = SlowAppThreadInShellFrame(this);

+      p_Var15 = (_GUID *)(ulonglong)local_218;

+      if (lVar16 != 0) {

+        ppuVar27 = (undefined **)(ulonglong)(local_1f0 == 2);

+        TryDetachShellFrame(this);

+      }

+      goto LAB_7;

+    }

+  }

+  else {

+    iVar10 = xxxSleepThreadWithPwnd(local_1d0);

+  }

+  ppuVar27 = (undefined **)p_Var15;

+  p_Var28 = (_GUID *)0x0;

+  if (iVar10 != 0) {

+    local_218 = 0;

+    p_Var15 = p_Var28;

+    goto LAB_7;

+  }

+  local_218 = local_218 | 0x10000;

+LAB_20:

+  iVar10 = 0;

+  p_Var15 = (_GUID *)(ulonglong)local_218;

+LAB_21:

+  if (local_1e0 != 0) {

+    Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+              ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_1a8);

+  }

+  iVar14 = HandleProcessSpinning();

+  if (iVar14 == 0) {

+    iVar10 = 0;

+  }

+  else if (((iVar10 != 0) && (*(int *)param_1->Data4 == 0x200)) &&

+          ((((*(uint *)(this + 0x550) >> 0x12 & 1) != 0 &&

+            ((lVar16 = *(longlong *)(this + 0x2c8), lVar16 != 0 &&

+             ((*(uint *)(lVar16 + 200) & 0x8000) != 0)))) && (*(int *)(lVar16 + 0x10c) != 0)))) {

+    *(int *)(lVar16 + 0x110) =

+         *(int *)(lVar16 + 0x110) +

+         ((int)((ulonglong)_DAT_2 * _DAT_fffff78000000320 >> 0x18) -

+         *(int *)(lVar16 + 0x10c));

+    *(int *)(lVar16 + 0x114) = *(int *)(lVar16 + 0x114) + 1;

+    *(undefined4 *)(lVar16 + 0x10c) = 0;

+  }

+  if (iVar10 != 0) {

+    *(undefined8 *)(this + 0x520) = *(undefined8 *)param_1;

+    *(undefined4 *)(this + 0x528) = *(undefined4 *)param_1->Data4;

+    *(undefined8 *)(this + 0x530) = *(undefined8 *)(param_1 + 1);

+    uVar5._0_4_ = param_1->Data1;

+    uVar5._4_2_ = param_1->Data2;

+    uVar5._6_2_ = param_1->Data3;

+    ptVar21 = (tagWND *)HMValidateHandleNoSecure(uVar5,1);

+    InputTraceLogging::Delivery::GetMessageW

+              ((tagMSG *)param_1,this,ptVar21,(tagBWND *)p_Var28,SUB41(uVar31,0));

+  }

+  EtwTraceBeginAppMessageProcessing(param_6,p_Var15,param_1);

+LAB_0:

+  Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

+            ((Win32HMOptionalThreadLockAlways<tagWND> *)local_1a8);

+  return iVar10;

 }
```

## `ReadCursorSuppressionConfig`  (modified)

```diff
--- ReadCursorSuppressionConfig
+++ ReadCursorSuppressionConfig
@@ -1,10 +1,28 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void ReadCursorSuppressionConfig(void)

+bool ReadCursorSuppressionConfig(void)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  int iVar1;

+  longlong lVar2;

+  bool bVar3;

+  int local_res8 [8];

+  

+  local_res8[0] = 0;

+  iVar1 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+  if (iVar1 == 0) {

+    iVar1 = IsCurrentSessionServiceSession();

+    if (iVar1 != 0) goto LAB_0;

+    lVar2 = W32GetUserSessionState();

+    bVar3 = *(short *)(lVar2 + 0x10df0) == 0;

+  }

+  else {

+    iVar1 = IsCurrentSessionServiceSession();

+    bVar3 = iVar1 == 0;

+  }

+  if (bVar3) {

+    FastGetProfileDword(0,0x31,L"EnableCursorSuppression",0,local_res8);

+  }

+LAB_0:

+  return local_res8[0] != 0;

 }
```

## `GreWindowResizeStarted`  (modified)

```diff
--- GreWindowResizeStarted
+++ GreWindowResizeStarted
@@ -1,79 +1,108 @@
 

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

-

-undefined8 GreWindowResizeStarted(void)

+undefined8

+GreWindowResizeStarted

+          (HDEV__ *param_1,HWND__ *param_2,int param_3,uint *param_4,undefined4 *param_5)

 

 {

+  SURFACE *this;

   undefined8 *puVar1;

-  longlong lVar2;

-  undefined8 uVar3;

-  char *in_RAX;

-  tagTHREADINFO *ptVar4;

-  undefined8 uVar5;

-  undefined8 *unaff_R14;

-  longlong unaff_R15;

-  longlong in_stack_00000048;

-  undefined8 uStack0000000000000050;

-  undefined8 in_stack_00000090;

-  undefined8 in_stack_000000b8;

-  undefined8 in_stack_000000c0;

-  undefined8 in_stack_000000c8;

-  undefined8 in_stack_000000d0;

-  undefined8 in_stack_000000d8;

-  undefined8 in_stack_000000e0;

-  undefined8 in_stack_000000e8;

-  undefined8 in_stack_000000f0;

-  undefined8 in_stack_000000f8;

-  undefined8 in_stack_00000100;

-  undefined8 in_stack_00000108;

-  undefined8 in_stack_00000110;

-  undefined8 in_stack_00000118;

-  undefined8 in_stack_00000120;

-  undefined8 in_stack_00000128;

-  undefined8 in_stack_00000130;

-  byte in_stack_00000280;

-  longlong in_stack_00000288;

+  undefined8 uVar2;

+  CompositionObject *pCVar3;

+  int iVar4;

+  long lVar5;

+  longlong lVar6;

+  SESSION_GLOBALS *pSVar7;

+  undefined8 uVar8;

+  undefined4 uVar9;

+  byte bVar10;

+  uint uVar11;

+  uint uVar12;

+  undefined8 uVar13;

+  CompositionObject *local_98;

+  void *local_90;

+  HSEMAPHORE__ *local_88;

+  ENTER_DWM_CRIT_COMMON local_80 [32];

+  DWMSPRITEREF local_60 [32];

+  DWMSPRITE *local_40;

   

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

-  uStack0000000000000050 = 0;

-  RtlCopyFromUser(&stack0x00000050,in_stack_00000048,8);

-  uVar5 = uStack0000000000000050;

-  in_stack_00000090 = uStack0000000000000050;

-  if (((in_stack_00000288 == 0) || ((*(uint *)(in_stack_00000288 + 0x54) & 5) == 0)) &&

-     ((in_stack_00000280 & 2) == 0)) {

-    ptVar4 = PtiCurrent();

-    lVar2 = *(longlong *)(ptVar4 + 0x228);

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

-       (*(undefined8 **)(lVar2 + 0x60) != unaff_R14)) {

-      uVar3 = *(undefined8 *)(in_stack_00000048 + 0x10);

-      memset(&stack0x000000b8,0,0x8c);

-      RtlCopyFromUser(&stack0x000000b8,uVar3,0x8c);

-      *unaff_R14 = in_stack_000000b8;

-      unaff_R14[1] = in_stack_000000c0;

-      unaff_R14[2] = in_stack_000000c8;

-      unaff_R14[3] = in_stack_000000d0;

-      unaff_R14[4] = in_stack_000000d8;

-      unaff_R14[5] = in_stack_000000e0;

-      unaff_R14[6] = in_stack_000000e8;

-      unaff_R14[7] = in_stack_000000f0;

-      unaff_R14[8] = in_stack_000000f8;

-      unaff_R14[9] = in_stack_00000100;

-      unaff_R14[10] = in_stack_00000108;

-      unaff_R14[0xb] = in_stack_00000110;

-      unaff_R14[0xc] = in_stack_00000118;

-      unaff_R14[0xd] = in_stack_00000120;

-      puVar1 = (undefined8 *)((longlong)unaff_R14 + unaff_R15 + -0x10);

-      *puVar1 = in_stack_00000128;

-      puVar1[1] = in_stack_00000130;

-      *(undefined8 *)((longlong)unaff_R14 + unaff_R15) =

-           *(undefined8 *)((longlong)&stack0x000000b8 + unaff_R15);

-      *(undefined4 *)((longlong)unaff_R14 + unaff_R15 + 8) =

-           *(undefined4 *)((longlong)&stack0x000000c0 + unaff_R15);

+  uVar13 = 0;

+  lVar6 = W32GetSessionState();

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

+  uVar11 = *(uint *)(lVar6 + 0x6c);

+  uVar12 = uVar11 & 2;

+  pSVar7 = Gre::Base::Globals();

+  SEMOBJ<2>::SEMOBJ<2>((SEMOBJ<2> *)&local_88,pSVar7);

+  iVar4 = IsDwmActive();

+  if (iVar4 == 0) goto LAB_0;

+  ENTER_DWM_CRIT_COMMON::ENTER_DWM_CRIT_COMMON(local_80,pSVar7,param_1,0);

+  iVar4 = IsDwmActive();

+  if (iVar4 != 0) {

+    DWMSPRITEREF::DWMSPRITEREF(local_60,param_2);

+    if (local_40 != (DWMSPRITE *)0x0) {

+      puVar1 = *(undefined8 **)(local_40 + 0x98);

+      if (((puVar1 == (undefined8 *)0x0) || (puVar1[0x17] == 0)) ||

+         (this = (SURFACE *)(puVar1[0x17] + -0x18), this == (SURFACE *)0x0)) {

+LAB_1:

+        bVar10 = 0;

+      }

+      else {

+        iVar4 = SURFACE::bRedirectionBitmap(this);

+        if (iVar4 == 0) goto LAB_1;

+        bVar10 = 1;

+      }

+      if ((((uVar11 & 1) != 0) && (bVar10 != 0)) || ((param_3 != 0 && (uVar12 != 0)))) {

+        if (0 < *(int *)(local_40 + 0x7c)) {

+          CheckAndProcessWindowResizeComplete(local_40,1,(int *)0x0);

+        }

+        *(uint *)(local_40 + 0x7c) = bVar10 + 1;

+        *(undefined4 *)(local_40 + 0x80) = 0;

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

+          uVar9 = *(undefined4 *)(lVar6 + 0x70);

+          uVar11 = *(uint *)(lVar6 + 0x6c) & 4;

+        }

+        else {

+          local_98 = (CompositionObject *)0x0;

+          iVar4 = UserDCompositionCreateSynchronizationObject(&local_98);

+          pCVar3 = local_98;

+          if (iVar4 != 0) {

+            local_90 = (void *)0x0;

+            lVar5 = CompositionObject::OpenDwmHandle(local_98,&local_90);

+            if (lVar5 < 0) {

+              ObfDereferenceObject(pCVar3);

+            }

+            else {

+              *(void **)(local_40 + 0x68) = local_90;

+              *(CompositionObject **)(local_40 + 0x60) = pCVar3;

+              *(undefined4 *)(local_40 + 0x80) = 1;

+              *(undefined4 *)(local_40 + 0x84) = 1;

+              uVar13 = *puVar1;

+              uVar2 = *(undefined8 *)local_40;

+              uVar8 = UserReferenceDwmApiPort();

+              DwmAsyncUpdateSprite(uVar8,uVar2,uVar13,0x200,0,0,0,0,0,0,0);

+            }

+          }

+          uVar11 = *(uint *)(lVar6 + 0x6c) & 8;

+          iVar4 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+          if ((iVar4 == 0) || (param_3 == 1)) {

+            uVar9 = *(undefined4 *)(lVar6 + 0x74);

+          }

+          else {

+            uVar9 = 200;

+          }

+        }

+        uVar13 = 1;

+        *param_4 = uVar11;

+        *param_5 = uVar9;

+      }

     }

-    else {

-      uVar5 = 0;

-    }

+    DWMSPRITEREF::~DWMSPRITEREF(local_60);

   }

-  return uVar5;

+  ENTER_DWM_CRIT::~ENTER_DWM_CRIT((ENTER_DWM_CRIT *)local_80);

+LAB_0:

+  if (local_88 != (HSEMAPHORE__ *)0x0) {

+    GreReleaseSemaphoreCommon<2,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+              (GreReleaseSemaphoreExclusiveInternal_exref,local_88);

+  }

+  return uVar13;

 }
```

## `zzzClearStartGlass`  (modified)

```diff
--- zzzClearStartGlass
+++ xxxDesktopThread
@@ -1,46 +1,290 @@
 

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

-

-void zzzClearStartGlass(longlong param_1)

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

+

+void xxxDesktopThread(tagTERMINAL *param_1)

 

 {

-  int iVar1;

-  longlong lVar2;

-  longlong *plVar3;

-  longlong lVar4;

+  tagQ *ptVar1;

+  tagQ *this;

+  code *pcVar2;

+  uint uVar3;

+  bool bVar4;

+  int iVar5;

+  long lVar6;

+  int iVar7;

+  longlong lVar8;

+  undefined8 uVar9;

+  tagTHREADINFO *ptVar10;

+  wchar_t *pwVar11;

+  tagTERMINAL *ptVar12;

+  char cVar13;

+  uint uVar14;

+  uint uVar15;

+  uint uVar16;

+  bool bVar17;

+  undefined1 local_f8 [32];

+  LegacyInputDispatcher *local_b0;

+  undefined4 local_a8;

+  int local_a4;

+  undefined8 local_a0;

+  undefined8 uStack_98;

+  code *local_88 [10];

+  ulonglong local_38;

   

-                    /* 0x2840f0  2402  zzzClearStartGlass */

-  lVar2 = W32GetUserSessionState();

-  *(undefined4 *)(lVar2 + 0x8e28) = 0;

-  lVar2 = W32GetUserSessionState();

-  plVar3 = (longlong *)(lVar2 + 0x8e18);

-  while (lVar2 = *plVar3, lVar2 != 0) {

-    if (lVar2 == param_1) {

-      *(uint *)(lVar2 + 0xc) = *(uint *)(lVar2 + 0xc) & 0xfffffffb;

-      *plVar3 = *(longlong *)(lVar2 + 0x20);

-      *(undefined8 *)(lVar2 + 0x20) = 0;

-    }

-    else {

-      lVar4 = W32GetUserSessionState();

-      iVar1 = *(int *)(lVar2 + 0x18);

-      if (0 < iVar1 - *(int *)(lVar4 + 0x8e28)) {

-        lVar4 = W32GetUserSessionState();

-        *(int *)(lVar4 + 0x8e28) = iVar1;

+                    /* 0x281f40  2375  xxxDesktopThread */

+  local_38 = __security_cookie ^ (ulonglong)local_f8;

+  bVar4 = false;

+  local_b0 = (LegacyInputDispatcher *)0x0;

+  uVar15 = 0;

+  local_a0 = 0;

+  uStack_98 = 0;

+  memset(local_88,0,0x50);

+  uVar16 = *(uint *)param_1 & 2;

+  lVar8 = W32GetUserSessionState();

+  iVar7 = *(int *)(lVar8 + 0x4b20);

+  local_a4 = iVar7;

+  SetThreadBasePriority(SystemReserved1[0xf],(-(uint)(uVar16 != 0) & 0xfffffffc) + 0x10);

+  if (uVar16 == 0) {

+    lVar8 = W32GetUserSessionState();

+    if (*(longlong *)(lVar8 + 0xf760) != 0) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x352);

+    }

+    uVar9 = CreateKernelEvent(1);

+    lVar8 = W32GetUserSessionState();

+    *(undefined8 *)(lVar8 + 0xf760) = uVar9;

+  }

+  pwVar11 = L"IO_DT";

+  if (uVar16 != 0) {

+    pwVar11 = L"NOIO_DT";

+  }

+  RtlInitUnicodeString(&local_a0,pwVar11);

+  SetThreadName(0xfffffffffffffffe);

+  iVar5 = InitSystemThread(&local_a0);

+  if ((iVar5 < 0) ||

+     ((uVar16 == 0 && (lVar8 = W32GetUserSessionState(), *(longlong *)(lVar8 + 0xf760) == 0)))) {

+    *(uint *)param_1 = *(uint *)param_1 | 8;

+    LOCK();

+    UNLOCK();

+    KeSetEvent(*(undefined8 *)(param_1 + 0x28),1);

+    if (uVar16 != 0) {

+      return;

+    }

+    lVar8 = W32GetUserSessionState();

+    if (*(longlong *)(lVar8 + 0xf760) == 0) {

+      return;

+    }

+  }

+  else {

+    lVar6 = LegacyInputDispatcher::Create(&local_b0);

+    if (-1 < lVar6) {

+      ptVar10 = PtiCurrent();

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

+      this = *(tagQ **)(ptVar10 + 0x1d8);

+      *(tagQ **)(param_1 + 0x18) = this;

+      *(int *)(this + 0x200) = *(int *)(this + 0x200) + 1;

+      lVar8 = W32GetUserSessionState();

+      *(undefined8 *)(ptVar10 + 0x1f8) = *(undefined8 *)(lVar8 + 0xf650);

+      *(undefined8 *)(ptVar10 + 0x290) = 0;

+      if (uVar16 == 0) {

+        lVar8 = W32GetUserSessionState();

+        local_88[0] = *(code **)(*(longlong *)(lVar8 + 0x8e70) + 0x48);

+        local_88[1] = OnPointerCursorOperation;

+        uVar14 = 1;

+        if (iVar7 == 0) {

+          lVar8 = W32GetUserSessionState();

+          local_88[2] = *(code **)(lVar8 + 0x41b8);

+          local_88[3] = OnPTPMouseOperation;

+          uVar14 = 2;

+        }

+        lVar8 = W32GetUserSessionState();

+        uVar15 = uVar14 + 1;

+        pcVar2 = *(code **)(lVar8 + 0xf760);

+        local_88[(ulonglong)uVar14 * 2 + 1] =

+             <lambda_4b38a1a7408fa8114f557b782837fd1c>::<lambda_invoker_cdecl>;

+        local_88[(ulonglong)uVar14 * 2] = pcVar2;

+        iVar5 = IsCurrentSessionServiceSession();

+        if (iVar5 == 0) {

+          if (iVar7 == 0) {

+            bVar4 = true;

+            lVar8 = W32GetUserSessionState();

+            lVar6 = CBaseInput::InitializeSensor(*(CBaseInput **)(lVar8 + 0xc18));

+            if (-1 < lVar6) {

+              iVar5 = IsRemoteConnection();

+              if (iVar5 != 0) {

+                EnterCrit(1);

+                lVar8 = W32GetUserSessionState();

+                CBaseInput::HandleTSRequest(*(CBaseInput **)(lVar8 + 0xc18),0);

+                UserSessionSwitchLeaveCrit();

+              }

+              lVar8 = W32GetUserSessionState();

+              CBaseInput::Read(*(CBaseInput **)(lVar8 + 0xc18));

+            }

+          }

+        }

+        else {

+          lVar8 = W32GetUserSessionState();

+          CBaseInput::InitializeSensor(*(CBaseInput **)(lVar8 + 0xc18));

+          bVar4 = true;

+        }

       }

-      plVar3 = (longlong *)(lVar2 + 0x20);

-    }

-  }

-  if ((*(uint *)(param_1 + 0xc) & 4) != 0) {

-                    /* WARNING: Subroutine does not return */

-    KeBugCheckEx(0x164,0x12,0,0,0);

-  }

-  lVar4 = (ulonglong)_DAT_0 * _DAT_fffff78000000320;

-  lVar2 = W32GetUserSessionState();

-  if (-1 < (int)((ulonglong)lVar4 >> 0x18) - *(int *)(lVar2 + 0x8e28)) {

-    lVar2 = W32GetUserSessionState();

-    *(undefined4 *)(lVar2 + 0x8e28) = 0;

-  }

-  zzzUpdateCursorImage();

+      EnterCrit(1);

+      tagTERMINAL::SetDTEThread(param_1);

+      KeSetEvent(*(undefined8 *)(param_1 + 0x28),1);

+      uVar9 = *(undefined8 *)(param_1 + 0x38);

+      ObReferenceObjectByPointer(uVar9,0x1f0003,*(undefined8 *)ExEventObjectType_exref,0);

+      UserSessionSwitchLeaveCrit();

+      KeWaitForSingleObject(uVar9,0xd);

+      EnterCrit(1);

+      ObfDereferenceObject(uVar9);

+      if ((*(uint *)param_1 & 0x10) == 0) {

+        local_a8 = 1;

+        ZwSetInformationProcess(0xffffffffffffffff,0x1d);

+        uVar14 = uVar15 + 1;

+        local_88[(ulonglong)uVar15 * 2] = *(code **)(ptVar10 + 0x648);

+        if (5 < uVar14) {

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+        }

+        uVar3 = uVar14;

+        if ((uVar16 == 0) && (iVar7 == 0)) {

+          W32GetUserSessionState();

+          uVar3 = uVar15 + 10;

+        }

+        LegacyInputDispatcher::Initialize

+                  (local_b0,'\x01',false,uVar3,uVar14,(LegacyDispatcherObject *)local_88);

+        if ((uVar3 != uVar14) && (local_a4 == 0)) {

+          lVar8 = W32GetUserSessionState();

+          CBaseInput::RegisterDispatcherObject

+                    (*(CBaseInput **)(lVar8 + 0xc18),(IRegisterInputDispatcherObjects *)local_b0);

+        }

+        *(uint *)(local_b0 + 0x3c) = uVar15;

+        lVar8 = W32GetUserSessionState();

+        if (uVar16 == 0) {

+          *(LegacyInputDispatcher **)(lVar8 + 0x4b68) = local_b0;

+        }

+        else {

+          *(LegacyInputDispatcher **)(lVar8 + 0x4b70) = local_b0;

+        }

+        do {

+          do {

+            uVar14 = xxxDesktopThreadWaiter(1,0);

+          } while (uVar14 != uVar15);

+          ptVar12 = param_1;

+          iVar7 = xxxHandleDesktopMessages(ptVar10,param_1);

+          uVar14 = (uint)ptVar12;

+        } while (iVar7 != 0);

+        lVar8 = W32GetUserSessionState();

+        if (param_1 == (tagTERMINAL *)(lVar8 + 0x10cd0)) {

+          HYDRA_HINT(0x100000);

+        }

+        *(undefined8 *)(param_1 + 0x10) = 0;

+        *(undefined8 *)(param_1 + 0x18) = 0;

+        *(undefined4 *)(param_1 + 0x20) = 0;

+        if (*(longlong *)(ptVar10 + 0x1f0) != 0) {

+          HMAssignmentUnlock(*(longlong *)(ptVar10 + 0x1f0) + 0xc0);

+          if ((*(longlong **)(*(longlong *)(ptVar10 + 0x1f0) + 8))[3] != 0) {

+            *(undefined8 *)(**(longlong **)(*(longlong *)(ptVar10 + 0x1f0) + 8) + 8) = 0;

+            HMAssignmentUnlock();

+          }

+        }

+        lVar8 = W32GetUserSessionState();

+        *(undefined8 *)(ptVar10 + 0x1f8) = *(undefined8 *)(lVar8 + 0xf650);

+        if (*(int *)(this + 0x200) == 0) {

+          uVar14 = 0x20000;

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x4bc);

+        }

+        *(int *)(this + 0x200) = *(int *)(this + 0x200) + -1;

+        if (*(tagQ **)(ptVar10 + 0x1d8) != this) {

+          zzzDestroyQueue(this);

+          uVar14 = (uint)ptVar10;

+        }

+        if (bVar4) {

+          CleanupSensorExplicitly(0);

+        }

+        if (local_b0 != (LegacyInputDispatcher *)0x0) {

+          LegacyInputDispatcher::_scalar_deleting_destructor_(local_b0,uVar14);

+        }

+        local_b0 = (LegacyInputDispatcher *)0x0;

+        if (uVar16 == 0) {

+          lVar8 = W32GetUserSessionState();

+          Win32FreePool(*(undefined8 *)(lVar8 + 0xf760));

+          *(undefined8 *)(lVar8 + 0xf760) = 0;

+        }

+        local_a8 = 0;

+        ZwSetInformationProcess(0xffffffffffffffff,0x1d,&local_a8);

+        tagTERMINAL::ClearDTEThread(param_1);

+      }

+      else {

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

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

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

+          cVar13 = '\0';

+        }

+        else {

+          cVar13 = '\x01';

+        }

+        bVar17 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar13 != '\0') || (bVar17)) {

+          lVar8 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar13,bVar17,

+                     *(undefined8 *)(lVar8 + 0x10f88));

+        }

+        LOCK();

+        UNLOCK();

+        if (*(longlong *)(param_1 + 8) != 0) {

+          xxxCleanupMotherDesktopWindow(param_1);

+        }

+        ptVar12 = param_1;

+        DestroyPendingDesktops(ptVar10,param_1);

+        uVar15 = (uint)ptVar12;

+        if (*(longlong *)(param_1 + 0x28) != 0) {

+          uVar15 = 1;

+          KeSetEvent();

+        }

+        ptVar1 = this + 0x200;

+        *(int *)ptVar1 = *(int *)ptVar1 + -1;

+        if (((*(int *)ptVar1 == 0) && (bVar17 = tagQ::IsAnyThreadAttached(this), !bVar17)) &&

+           ((*(uint *)(this + 0x1fc) & 0x4000000) != 0)) {

+          uVar15 = 0x20000;

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x431);

+        }

+        *(undefined8 *)(param_1 + 0x10) = 0;

+        *(undefined8 *)(param_1 + 0x18) = 0;

+        if (*(longlong *)(param_1 + 0x38) != 0) {

+          ObfDereferenceObject();

+          *(undefined8 *)(param_1 + 0x38) = 0;

+        }

+        tagTERMINAL::ClearDTEThread(param_1);

+        if (bVar4) {

+          CleanupSensorExplicitly(0);

+        }

+        if (local_b0 != (LegacyInputDispatcher *)0x0) {

+          LegacyInputDispatcher::_scalar_deleting_destructor_(local_b0,uVar15);

+        }

+        if (uVar16 == 0) {

+          lVar8 = W32GetUserSessionState();

+          if (*(longlong *)(lVar8 + 0xf760) == 0) {

+            MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x445);

+          }

+          lVar8 = W32GetUserSessionState();

+          Win32FreePool(*(undefined8 *)(lVar8 + 0xf760));

+          *(undefined8 *)(lVar8 + 0xf760) = 0;

+        }

+      }

+      UserSessionSwitchLeaveCrit();

+      return;

+    }

+    *(uint *)param_1 = *(uint *)param_1 | 8;

+    LOCK();

+    UNLOCK();

+    KeSetEvent(*(undefined8 *)(param_1 + 0x28),1);

+    if (uVar16 != 0) {

+      return;

+    }

+  }

+  lVar8 = W32GetUserSessionState();

+  Win32FreePool(*(undefined8 *)(lVar8 + 0xf760));

+  *(undefined8 *)(lVar8 + 0xf760) = 0;

   return;

 }
```

## `NtUserSetJobUILimits`  (modified)

```diff
--- NtUserSetJobUILimits
+++ NtUserSetJobUILimits
@@ -1,161 +1,39 @@
 

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

-

-longlong NtUserSetJobUILimits(void)

+bool NtUserSetJobUILimits(undefined8 param_1,undefined4 param_2)

 

 {

-  undefined8 uVar1;

-  uint uVar2;

-  undefined *puVar3;

-  byte in_AL;

-  int iVar4;

-  PositionWindowAsyncResult PVar5;

-  longlong lVar6;

-  undefined8 uVar7;

-  uint unaff_EBX;

-  char cVar8;

-  uint unaff_EDI;

-  tagWND *unaff_R13;

-  bool bVar9;

-  longlong unaff_retaddr;

+  char cVar1;

+  int iVar2;

+  undefined4 uVar3;

+  longlong *plVar4;

+  ulonglong uVar5;

+  undefined8 local_res18 [2];

   

-  if ((in_AL & 0x78) == 0) {

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3))

-    {

-      unaff_EDI = unaff_EBX & 0xff;

+                    /* 0x298c60  1992  NtUserSetJobUILimits */

+  plVar4 = (longlong *)PsGetCurrentProcessWin32Process();

+  uVar5 = 0;

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

+    uVar5 = (ulonglong)plVar4 & -(ulonglong)(*plVar4 != 0);

+  }

+  if (((*(byte *)(uVar5 + 800) & 0x30) == 0x20) || (cVar1 = HasTcbPrivilege(), cVar1 != '\0')) {

+    local_res18[0] = 0;

+    iVar2 = ObReferenceObjectByHandleWithTag

+                      (param_1,2,*(undefined8 *)PsJobType_exref,1,0x47727355,local_res18,0);

+    if (-1 < iVar2) {

+      iVar2 = KfSetJobUILimits(local_res18[0],param_2);

+      if (-1 >= iVar2) {

+        uVar3 = RtlNtStatusToDosError(iVar2);

+        UserSetLastError(uVar3);

+      }

+      ObfDereferenceObjectWithTag(local_res18[0],0x47727355);

+      return -1 < iVar2;

     }

-    bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    cVar8 = (char)unaff_EDI;

-    if ((cVar8 != '\0') || (bVar9)) {

-      *(undefined8 *)(unaff_retaddr + -8) = 0x14029bccc;

-      lVar6 = W32GetUserSessionState();

-      *(undefined **)(unaff_retaddr + 0x38) = &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids;

-      *(undefined2 *)(unaff_retaddr + 0x30) = 0x4b;

-LAB_0:

-      uVar7 = *(undefined8 *)(lVar6 + 0x10f88);

-      *(undefined4 *)(unaff_retaddr + 0x28) = 4;

-      *(undefined1 *)(unaff_retaddr + 0x20) = 3;

-      uVar1 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-      *(undefined8 *)(unaff_retaddr + -8) = 0x14029b97f;

-      WPP_RECORDER_AND_TRACE_SF_(uVar1,cVar8,bVar9,uVar7);

-    }

-LAB_1:

-    uVar7 = 0x57;

+    uVar3 = RtlNtStatusToDosError(iVar2);

   }

   else {

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) ||

-       (uVar2 = unaff_EDI, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      uVar2 = unaff_EBX;

-    }

-    bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    *(bool *)(unaff_retaddr + 0x61) = bVar9;

-    if (((char)uVar2 != '\0') || (bVar9)) {

-      *(undefined8 *)(unaff_retaddr + -8) = 0x14029bb1d;

-      lVar6 = W32GetUserSessionState();

-      *(undefined **)(unaff_retaddr + 0x38) = &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids;

-      *(undefined2 *)(unaff_retaddr + 0x30) = 0x4a;

-      *(undefined4 *)(unaff_retaddr + 0x28) = 4;

-      puVar3 = WPP_GLOBAL_Control;

-      *(undefined1 *)(unaff_retaddr + 0x20) = 4;

-      uVar7 = *(undefined8 *)(lVar6 + 0x10f88);

-      uVar1 = *(undefined8 *)(puVar3 + 0x18);

-      *(undefined8 *)(unaff_retaddr + -8) = 0x14029bb61;

-      WPP_RECORDER_AND_TRACE_SF_(uVar1,(char)uVar2,*(undefined1 *)(unaff_retaddr + 0x61),uVar7);

-    }

-    if ((*(byte *)(*(longlong *)(unaff_R13 + 0x28) + 0x1f) & 0x20) == 0) {

-      *(undefined8 *)(unaff_retaddr + -8) = 0x14029bc28;

-      bVar9 = IsArranged(unaff_R13);

-      if (!bVar9) {

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

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

-          unaff_EDI = unaff_EBX & 0xff;

-        }

-        bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-        cVar8 = (char)unaff_EDI;

-        if ((cVar8 != '\0') || (bVar9)) {

-          *(undefined8 *)(unaff_retaddr + -8) = 0x14029bc6c;

-          lVar6 = W32GetUserSessionState();

-          *(undefined **)(unaff_retaddr + 0x38) = &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids;

-          *(undefined2 *)(unaff_retaddr + 0x30) = 0x4c;

-          goto LAB_0;

-        }

-        goto LAB_1;

-      }

-    }

-    else {

-      *(uint *)(unaff_retaddr + 100) = unaff_EBX;

-    }

-    cVar8 = *(char *)(unaff_retaddr + 0x60);

-    *(undefined8 *)(unaff_retaddr + -8) = 0x14029bb7d;

-    iVar4 = Feature_ApplyWindowActionConvergence__private_IsEnabledDeviceUsageNoInline();

-    if (iVar4 != 0) {

-      if (*(uint *)(unaff_retaddr + 0x68) != unaff_EBX) {

-        *(undefined8 *)(unaff_retaddr + -8) = 0x14029bb9c;

-        bVar9 = RunForegroundAccessCheck(unaff_R13,3);

-        if (!bVar9) {

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

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 3)) {

-            unaff_EDI = unaff_EBX & 0xff;

-          }

-          bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-          if (((char)unaff_EDI != '\0') || (bVar9)) {

-            *(undefined8 *)(unaff_retaddr + -8) = 0x14029bbe0;

-            lVar6 = W32GetUserSessionState();

-            uVar7 = *(undefined8 *)(lVar6 + 0x10f88);

-            *(undefined **)(unaff_retaddr + 0x38) = &WPP_ee910b509ed73fb465c6a84e13eeb380_Traceguids

-            ;

-            *(undefined2 *)(unaff_retaddr + 0x30) = 0x4d;

-            *(undefined4 *)(unaff_retaddr + 0x28) = 4;

-            *(undefined1 *)(unaff_retaddr + 0x20) = 3;

-            uVar1 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-            *(undefined8 *)(unaff_retaddr + -8) = 0x14029bc1b;

-            WPP_RECORDER_AND_TRACE_SF_(uVar1,(char)unaff_EDI,bVar9,uVar7);

-          }

-          goto LAB_2;

-        }

-      }

-      *(undefined4 *)(unaff_retaddr + 0x28) = *(undefined4 *)(unaff_retaddr + 0x128);

-      *(undefined4 *)(unaff_retaddr + 0x20) = *(undefined4 *)(unaff_retaddr + 0x120);

-      *(undefined8 *)(unaff_retaddr + -8) = 0x14029bd3c;

-      ShellWindowPos::ShellSetWindowPosAsync

-                (unaff_R13,*(HWND__ **)(unaff_retaddr + 0x78),

-                 (tagRECT *)(-(ulonglong)(cVar8 != '\0') & unaff_retaddr + 0xa0U),

-                 *(_SHELLSETWINDOWPOS_STATE *)(unaff_retaddr + 100),

-                 *(_SHELLSETWINDOWPOS_OPTIONS *)(unaff_retaddr + 0x20),

-                 *(ulong *)(unaff_retaddr + 0x28));

-      goto LAB_3;

-    }

-    *(undefined4 *)(unaff_retaddr + 0x28) = *(undefined4 *)(unaff_retaddr + 0x128);

-    *(undefined4 *)(unaff_retaddr + 0x20) = *(undefined4 *)(unaff_retaddr + 0x120);

-    *(undefined8 *)(unaff_retaddr + -8) = 0x14029bd6e;

-    PVar5 = ShellWindowPos::PositionWindowAsyncOld

-                      (unaff_R13,*(HWND__ **)(unaff_retaddr + 0x78),

-                       (tagRECT *)(unaff_retaddr + 0xa0),

-                       *(_SHELLSETWINDOWPOS_STATE *)(unaff_retaddr + 100),

-                       *(_SHELLSETWINDOWPOS_OPTIONS *)(unaff_retaddr + 0x20),

-                       *(ulong *)(unaff_retaddr + 0x28));

-    if (PVar5 == 2) {

-      uVar7 = 0xe;

-    }

-    else {

-      if (PVar5 != 3) goto LAB_3;

-LAB_2:

-      uVar7 = 0x139f;

-    }

+    uVar3 = 5;

   }

-  *(undefined8 *)(unaff_retaddr + -8) = 0x14029b1e1;

-  UserSetLastError(uVar7);

-  unaff_EDI = unaff_EBX;

-LAB_3:

-  *(undefined8 *)(unaff_retaddr + -8) = 0x14029be31;

-  AtomicExecutionCheck::Disarm((AtomicExecutionCheck *)(unaff_retaddr + 0x90));

-  *(undefined8 *)(unaff_retaddr + -8) = 0x14029be38;

-  UserSessionSwitchLeaveCrit();

-  *(undefined8 *)(unaff_retaddr + -8) = 0x14029be50;

-  return (longlong)(int)unaff_EDI;

+  UserSetLastError(uVar3);

+  return false;

 }
```

## `xxxFreeDdeConv`  (modified)

```diff
--- xxxFreeDdeConv
+++ xxxFreeDdeConv
@@ -1,19 +1,78 @@
 

-void xxxFreeDdeConv(undefined8 param_1,undefined8 param_2,void *param_3)

+tagDDECONV * xxxFreeDdeConv(tagMONITOR *param_1)

 

 {

-  code *pcVar1;

-  void *unaff_RBX;

-  void *pvVar2;

+  tagDDECONV *ptVar1;

+  short *psVar2;

+  int iVar3;

+  uint uVar4;

+  longlong lVar5;

+  tagTHREADINFO *ptVar6;

+  __uint64 _Var7;

+  _Win32HMThreadLockItem local_18 [16];

   

-  pvVar2 = (void *)0x3;

-  pcVar1 = (code *)swi(0x29);

-  (*pcVar1)();

-  NSInstrumentation::

-  CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

-  ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

-                 *)&stack0x00000028);

-  NSInstrumentation::PlatformAbort(3,unaff_RBX,param_3,pvVar2);

-  return;

+  _Var7 = 0;

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

+    if (((*(uint *)(param_1 + 0x50) & 2) == 0) &&

+       (lVar5 = _HMPheFromObject(*(undefined8 *)(param_1 + 0x30)),

+       (*(byte *)(lVar5 + 0x19) & 1) == 0)) {

+      ptVar6 = PtiCurrent();

+      Win32HM_LockIntoThread<1>(ptVar6,(_HEAD *)param_1,local_18);

+      iVar3 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

+      if (iVar3 != 0) {

+        *(uint *)(param_1 + 0x50) = *(uint *)(param_1 + 0x50) | 2;

+      }

+      if (*(__uint64 **)(param_1 + 0x28) != (__uint64 *)0x0) {

+        _Var7 = **(__uint64 **)(param_1 + 0x28);

+      }

+      _PostTransformableMessageExtended

+                (*(tagWND **)(param_1 + 0x30),0x3e1,_Var7,0,(tagINPUT_MESSAGE_SOURCE *)0x0,1);

+      param_1 = Win32HMThreadLockBase<tagMONITOR,1,1>::ManualUnlock<void>

+                          ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_18);

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

+        Win32HMThreadLockBase<tagMONITOR,1,1>::~Win32HMThreadLockBase<tagMONITOR,1,1>

+                  ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_18);

+        return (tagDDECONV *)0x0;

+      }

+      Win32HMThreadLockBase<tagMONITOR,1,1>::~Win32HMThreadLockBase<tagMONITOR,1,1>

+                ((Win32HMThreadLockBase<tagMONITOR,1,1> *)local_18);

+    }

+    ptVar1 = (tagDDECONV *)(param_1 + 0x20);

+    if (*(longlong *)ptVar1 != 0) {

+      LOCK();

+      uVar4 = *(uint *)(*(longlong *)(param_1 + 0x10) + 0x210);

+      if (uVar4 == 0) {

+        *(uint *)(*(longlong *)(param_1 + 0x10) + 0x210) = 0;

+        uVar4 = 0;

+      }

+      UNLOCK();

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

+        *(uint *)(*(longlong *)ptVar1 + 0x50) = *(uint *)(*(longlong *)ptVar1 + 0x50) | 2;

+      }

+    }

+    UnlinkConv((tagDDECONV *)param_1);

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

+      psVar2 = (short *)(*(longlong *)(param_1 + 0x58) + 0x5a);

+      *psVar2 = *psVar2 + -1;

+      lVar5 = *(longlong *)(param_1 + 0x58);

+      if ((*(short *)(lVar5 + 0x5a) == 0) && (*(short *)(lVar5 + 0x58) == 0)) {

+        SeDeleteClientSecurity(lVar5 + 0x10);

+        Win32FreePool(*(undefined8 *)(param_1 + 0x58));

+      }

+      *(undefined8 *)(param_1 + 0x58) = 0;

+    }

+    HMAssignmentUnlock(ptVar1);

+    HMAssignmentUnlock((tagDDECONV *)(param_1 + 0x30));

+    HMAssignmentUnlock((tagDDECONV *)(param_1 + 0x28));

+    iVar3 = HMMarkObjectDestroy(param_1);

+    if (iVar3 == 0) {

+      return (tagDDECONV *)param_1;

+    }

+    while (*(longlong *)(param_1 + 0x38) != 0) {

+      PopState((tagDDECONV *)param_1);

+    }

+    HMFreeObject();

+  }

+  return (tagDDECONV *)0x0;

 }
```

## `NtUserEnableSoftwareCursorForScreenCapture`  (modified)

```diff
--- NtUserEnableSoftwareCursorForScreenCapture
+++ NtUserEnableSoftwareCursorForScreenCapture
@@ -1,10 +1,28 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void NtUserEnableSoftwareCursorForScreenCapture(void)

+undefined8 NtUserEnableSoftwareCursorForScreenCapture(int param_1)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  int iVar1;

+  longlong lVar2;

+  undefined8 uVar3;

+  

+                    /* 0x23b7b0  1634  NtUserEnableSoftwareCursorForScreenCapture */

+  EnterCrit(0,0);

+  iVar1 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+  uVar3 = 0;

+  if (iVar1 == 0) {

+    iVar1 = IsCurrentProcessDwm();

+    if (iVar1 != 0) {

+      lVar2 = W32GetUserSessionState();

+      if (param_1 != *(int *)(lVar2 + 0x8e58)) {

+        ChangeComposableCursor(param_1);

+        lVar2 = W32GetUserSessionState();

+        *(int *)(lVar2 + 0x8e58) = param_1;

+      }

+      uVar3 = 1;

+    }

+  }

+  UserSessionSwitchLeaveCrit();

+  return uVar3;

 }
```

## `zzzAttachThreadInput`  (modified)

```diff
--- zzzAttachThreadInput
+++ zzzAttachThreadInput
@@ -1,24 +1,193 @@
 

-longlong zzzAttachThreadInput(void)

+undefined1 * zzzAttachThreadInput(tagTHREADINFO *param_1,tagTHREADINFO *param_2,ulonglong param_3)

 

 {

-  byte *pbVar1;

-  longlong lVar2;

-  int iVar3;

-  ulonglong unaff_RBX;

-  void *in_stack_00000040;

+  longlong *plVar1;

+  longlong *plVar2;

+  bool bVar3;

+  int iVar4;

+  tagTHREADINFO *ptVar5;

+  undefined1 *puVar6;

+  longlong lVar7;

+  undefined8 *puVar8;

+  char cVar9;

+  uint uVar10;

+  bool bVar11;

+  undefined8 local_58;

+  undefined4 local_50;

   

-  lVar2 = HMAllocObject();

-  if (lVar2 == 0) {

-    lVar2 = 0;

+  ptVar5 = PtiCurrent();

+  cVar9 = '\x01';

+  if ((((uint)param_3 >> 0xe & 1) == 0) || (bVar11 = true, (param_3 & 1) != 0)) {

+    bVar11 = false;

+  }

+  iVar4 = Feature_UIPIEliminateATIOverride__private_IsEnabledDeviceUsageNoInline();

+  if (iVar4 == 0) {

+    uVar10 = ~((uint)(param_3 >> 0xf) & 0x1ffff) & 1;

+  }

+  else if (((param_1 != ptVar5) || ((*(uint *)(param_1 + 0x550) >> 0x14 & 1) == 0)) ||

+          (uVar10 = 0, (*(uint *)(param_2 + 0x550) >> 0x12 & 1) == 0)) {

+    uVar10 = 1;

+  }

+  if (param_1 == param_2) {

+LAB_0:

+    puVar6 = (undefined1 *)0xc000000d;

   }

   else {

-    memcpy((void *)(lVar2 + 0x1c),in_stack_00000040,unaff_RBX & 0xffffffff);

-    iVar3 = (int)(unaff_RBX / 6);

-    *(int *)(lVar2 + 0x18) = iVar3;

-    pbVar1 = (byte *)(lVar2 + 0x1c + (ulonglong)(iVar3 - 1) * 6);

-    *pbVar1 = *pbVar1 | 0x80;

+    if ((uVar10 == 0) ||

+       ((*(longlong *)(param_2 + 0x1d0) == *(longlong *)(param_1 + 0x1d0) &&

+        (*(longlong *)(ptVar5 + 0x1d0) == *(longlong *)(param_2 + 0x1d0))))) {

+LAB_1:

+      LOCK();

+      uVar10 = *(uint *)(param_2 + 0x210);

+      if (uVar10 == 0) {

+        *(uint *)(param_2 + 0x210) = 0;

+        uVar10 = 0;

+      }

+      UNLOCK();

+      if ((uVar10 & 0x40) == 0) {

+        LOCK();

+        uVar10 = *(uint *)(param_1 + 0x210);

+        if (uVar10 == 0) {

+          *(uint *)(param_1 + 0x210) = 0;

+          uVar10 = 0;

+        }

+        UNLOCK();

+        if (((uVar10 & 0x40) == 0) &&

+           (*(longlong *)(param_2 + 0x1f0) == *(longlong *)(param_1 + 0x1f0))) {

+          lVar7 = W32GetUserSessionState();

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

+            for (puVar8 = *(undefined8 **)(lVar7 + 0x4208); puVar8 != (undefined8 *)0x0;

+                puVar8 = (undefined8 *)*puVar8) {

+              if ((((tagTHREADINFO *)puVar8[2] == param_2) &&

+                  ((tagTHREADINFO *)puVar8[1] == param_1)) ||

+                 (((tagTHREADINFO *)puVar8[2] == param_1 && ((tagTHREADINFO *)puVar8[1] == param_2))

+                 )) {

+                if (*(int *)(puVar8 + 3) != -1) {

+                  *(int *)(puVar8 + 3) = *(int *)(puVar8 + 3) + 1;

+                  return (undefined1 *)0x0;

+                }

+                goto LAB_0;

+              }

+            }

+            puVar8 = (undefined8 *)Win32AllocPoolZInit(0x20,0x69617355);

+            if (puVar8 == (undefined8 *)0x0) {

+              return &DAT_2;

+            }

+            puVar8[1] = param_1;

+            puVar8[2] = param_2;

+            *(undefined4 *)(puVar8 + 3) = 1;

+            lVar7 = W32GetUserSessionState();

+            *puVar8 = *(undefined8 *)(lVar7 + 0x4208);

+            lVar7 = W32GetUserSessionState();

+            *(undefined8 **)(lVar7 + 0x4208) = puVar8;

+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;

+          }

+          plVar1 = (longlong *)(lVar7 + 0x4208);

+          for (plVar2 = *(longlong **)(lVar7 + 0x4208); plVar2 != (longlong *)0x0;

+              plVar2 = (longlong *)*plVar2) {

+            if ((((tagTHREADINFO *)plVar2[2] == param_2) && ((tagTHREADINFO *)plVar2[1] == param_1))

+               || (((tagTHREADINFO *)plVar2[2] == param_1 && ((tagTHREADINFO *)plVar2[1] == param_2)

+                   ))) {

+              *(int *)(plVar2 + 3) = (int)plVar2[3] + -1;

+              if ((*(int *)((longlong *)*plVar1 + 3) != 0) && (!bVar11)) {

+                return (undefined1 *)0x0;

+              }

+              *plVar1 = *(longlong *)*plVar1;

+              Win32FreePool();

+              goto LAB_3;

+            }

+            plVar1 = plVar2;

+          }

+          goto LAB_0;

+        }

+      }

+    }

+    else {

+      bVar3 = UIPrivilegeIsolation::CheckAccess

+                        ((tagUIPI_INFO *)(*(longlong *)(ptVar5 + 0x1d0) + 0x358),

+                         (tagUIPI_INFO *)(*(longlong *)(param_2 + 0x1d8) + 0x220));

+      if ((bVar3) || (*(int *)(*(longlong *)(ptVar5 + 0x1d0) + 0xc) < 0)) {

+        bVar3 = UIPrivilegeIsolation::CheckAccess

+                          ((tagUIPI_INFO *)(*(longlong *)(ptVar5 + 0x1d0) + 0x358),

+                           (tagUIPI_INFO *)(*(longlong *)(param_1 + 0x1d8) + 0x220));

+        if ((bVar3) || (*(int *)(*(longlong *)(ptVar5 + 0x1d0) + 0xc) < 0)) {

+          iVar4 = Feature_UIPIBlockCrossACAttach__private_IsEnabledDeviceUsageNoInline();

+          if ((iVar4 != 0) &&

+             (((bVar3 = UIPrivilegeIsolation::IsInAppContainer

+                                  ((tagUIPI_INFO *)(*(longlong *)(param_1 + 0x1d0) + 0x358)), bVar3

+               && (bVar3 = UIPrivilegeIsolation::IsInAppContainer

+                                     ((tagUIPI_INFO *)(*(longlong *)(param_2 + 0x1d0) + 0x358)),

+                  bVar3)) &&

+              (bVar3 = UIPrivilegeIsolation::IsSameAppContainer

+                                 ((tagUIPI_INFO *)(*(longlong *)(param_1 + 0x1d0) + 0x358),

+                                  (tagUIPI_INFO *)(*(longlong *)(param_2 + 0x1d0) + 0x358),0),

+              !bVar3)))) {

+            iVar4 = IsShellProcess(*(undefined8 *)(ptVar5 + 0x1d0));

+            if ((iVar4 != 0) && (iVar4 = IAMThreadAccessGranted(ptVar5), iVar4 != 0)) {

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

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

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

+                cVar9 = '\0';

+              }

+              bVar3 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

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

+                tagPROCESSINFO::GetPID(*(tagPROCESSINFO **)(param_2 + 0x1d0));

+                tagPROCESSINFO::GetPID(*(tagPROCESSINFO **)(param_1 + 0x1d0));

+                lVar7 = W32GetUserSessionState();

+                WPP_RECORDER_AND_TRACE_SF_DLDL

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

+                           *(undefined8 *)(lVar7 + 0x10f88));

+              }

+              goto LAB_4;

+            }

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

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

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

+              cVar9 = '\0';

+            }

+            bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

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

+              tagPROCESSINFO::GetPID(*(tagPROCESSINFO **)(param_2 + 0x1d0));

+              tagPROCESSINFO::GetPID(*(tagPROCESSINFO **)(param_1 + 0x1d0));

+              lVar7 = W32GetUserSessionState();

+              WPP_RECORDER_AND_TRACE_SF_DLDL

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

+                         *(undefined8 *)(lVar7 + 0x10f88));

+            }

+            goto LAB_5;

+          }

+LAB_4:

+          iVar4 = IsDesktopApp(*(undefined8 *)(ptVar5 + 0x1d0));

+          if ((((iVar4 == 0) ||

+               ((iVar4 = IsImmersiveAppRestricted(*(undefined8 *)(param_2 + 0x1d0)), iVar4 == 0 &&

+                (iVar4 = IsImmersiveAppRestricted(*(undefined8 *)(param_1 + 0x1d0)), iVar4 == 0))))

+              || (iVar4 = ExemptedFromImmersiveRestrictions(ptVar5), iVar4 != 0)) ||

+             ((*(uint *)(*(longlong *)(ptVar5 + 0x1d0) + 800) >> 8 & 1) != 0)) goto LAB_1;

+        }

+        lVar7 = *(longlong *)(param_1 + 0x1d8);

+      }

+      else {

+        lVar7 = *(longlong *)(param_2 + 0x1d8);

+        param_1 = param_2;

+      }

+      local_58 = *(undefined8 *)(lVar7 + 0x220);

+      local_50 = *(undefined4 *)(lVar7 + 0x228);

+      EtwTraceUIPIInputError(ptVar5,param_1,lVar7,&local_58,2);

+    }

+LAB_5:

+    puVar6 = (undefined1 *)0xc0000022;

   }

-  return lVar2;

+  return puVar6;

 }
```

## `NtUserSetWindowsHookAW`  (modified)

```diff
--- NtUserSetWindowsHookAW
+++ NtUserSetWindowsHookAW
@@ -1,14 +1,30 @@
 

-undefined1 NtUserSetWindowsHookAW(longlong param_1)

+HHOOK__ * NtUserSetWindowsHookAW(int param_1,_func___int64 *param_2,tagHookFlags param_3)

 

 {

-  byte *pbVar1;

-  undefined4 in_EAX;

-  longlong unaff_RBP;

+  tagTHREADINFO *ptVar1;

+  HHOOK__ *pHVar2;

+  HHOOK__ *pHVar3;

+  int local_res18 [2];

   

-  out(9,in_EAX);

-  pbVar1 = (byte *)(unaff_RBP + -100 + param_1 * 4);

-  *pbVar1 = *pbVar1 >> 4 | *pbVar1 << 4;

-  return uRam49105b8b49000000;

+                    /* 0x29a5c0  2055  NtUserSetWindowsHookAW */

+  EnterSharedCrit(0);

+  if ((param_3 != 0) && ((param_3 & 0xffffffbd) != 0)) {

+    local_res18[0] = 0x20000;

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x196e);

+  }

+  local_res18[0] = 0;

+  ptVar1 = PtiCurrent();

+  pHVar2 = zzzSetWindowsHookEx((void *)0x0,(ushort *)0x0,ptVar1,param_1,param_2,param_3,local_res18)

+  ;

+  if (pHVar2 == (HHOOK__ *)0x0) {

+    pHVar3 = (HHOOK__ *)0xffffffffffffffff;

+  }

+  else if ((local_res18[0] == 0) ||

+          (pHVar3 = (HHOOK__ *)0x0, (*(uint *)(&DAT_0 + (longlong)param_1 * 4) & 8) != 0)) {

+    pHVar3 = pHVar2;

+  }

+  UserSessionSwitchLeaveCrit();

+  return pHVar3;

 }
```

## `NtUserShowStartGlass`  (modified)

```diff
--- NtUserShowStartGlass
+++ NtUserShowStartGlass
@@ -1,27 +1,21 @@
 

-void NtUserShowStartGlass(undefined8 param_1)

+longlong NtUserShowStartGlass(undefined4 param_1)

 

 {

-  uint *puVar1;

-  int *in_RAX;

+  int iVar1;

   longlong lVar2;

-  undefined8 unaff_RBX;

   

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

-  LOCK();

-  puVar1 = (uint *)(*(longlong *)

-                     ((ulonglong)

-                      ((int)in_RAX + 0x116394 +

-                      (uint)(*(byte *)((longlong)in_RAX + -1) < (byte)param_1)) + 0x8e70) + 100);

-  *puVar1 = *puVar1 & 0xfffff8ff;

-  UNLOCK();

-  lVar2 = W32GetUserSessionState();

-  LOCK();

-  puVar1 = (uint *)(*(longlong *)(lVar2 + 0x8e70) + 100);

-  *puVar1 = *puVar1 | ((int)CONCAT71((int7)((ulonglong)unaff_RBX >> 8),

-                                     (char)unaff_RBX + (char)((ulonglong)param_1 >> 8)) + 1) * 0x200

-  ;

-  UNLOCK();

-  return;

+                    /* 0x29be70  2068  NtUserShowStartGlass */

+  iVar1 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+  if (iVar1 == 0) {

+    EnterCrit(0,0);

+    iVar1 = zzzShowStartGlass(param_1);

+    lVar2 = (longlong)iVar1;

+    UserSessionSwitchLeaveCrit();

+  }

+  else {

+    lVar2 = 1;

+  }

+  return lVar2;

 }
```

## `xxxSetProcessInitState`  (modified)

```diff
--- xxxSetProcessInitState
+++ xxxSetProcessInitState
@@ -1,9 +1,125 @@
+

+/* long __cdecl xxxSetProcessInitState(struct _EPROCESS * __ptr64,enum PROCESS_INIT_HINT) */

 

 long __cdecl xxxSetProcessInitState(_EPROCESS *param_1,PROCESS_INIT_HINT param_2)

 

 {

-  long in_EAX;

+  uint uVar1;

+  int iVar2;

+  int iVar3;

+  longlong lVar4;

+  longlong lVar5;

+  longlong lVar6;

+  undefined8 uVar7;

+  char cVar8;

+  bool bVar9;

+  undefined4 local_res18 [2];

+  AtomicExecutionCheck local_38 [8];

+  undefined8 local_30;

   

-  return in_EAX;

+  iVar3 = 0;

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

+  local_30 = 0;

+  AtomicExecutionCheck::Arm(local_38);

+  lVar4 = W32GetUserSessionState();

+  if ((*(int *)(lVar4 + 0x11528) != 0) && (uVar1 = AtomicExecutionCheck::GetCount(), uVar1 == 0)) {

+    local_res18[0] = 0x20000;

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x3b8);

+  }

+  lVar4 = W32GetUserSessionState();

+  *(int *)(lVar4 + 0x11528) = *(int *)(lVar4 + 0x11528) + 1;

+  lVar4 = PsGetProcessWin32Process(param_1);

+  if (lVar4 == 0) {

+    iVar2 = AllocateW32ProcessImpl(param_1);

+    if (iVar2 < 0) goto LAB_0;

+    lVar4 = PsGetProcessWin32Process(param_1);

+  }

+  iVar2 = iVar3;

+  if (param_2 == 0) {

+    if ((*(uint *)(lVar4 + 800) >> 0x1c & 1) != 0) {

+      local_res18[0] = 0x20000;

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x96);

+    }

+    if ((*(uint *)(lVar4 + 0xc) & 4) != 0) {

+      if ((*(uint *)(lVar4 + 0xc) & 0x20) == 0) {

+        local_res18[0] = 0x20000;

+        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x9c);

+      }

+      iVar3 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+      if (iVar3 == 0) {

+        *(uint *)(lVar4 + 0xc) = *(uint *)(lVar4 + 0xc) & 0xfffffffb;

+        zzzCalcStartCursorHide(0,0);

+      }

+      else {

+        zzzClearStartGlass(lVar4);

+      }

+    }

+    *(uint *)(lVar4 + 0xc) = *(uint *)(lVar4 + 0xc) | 1;

+    lVar5 = *(longlong *)(lVar4 + 0x10);

+    if (lVar5 != 0) {

+      if (lVar5 == -1) goto LAB_0;

+      KeSetEvent(lVar5,1);

+      ObfDereferenceObject(*(undefined8 *)(lVar4 + 0x10));

+    }

+    *(undefined8 *)(lVar4 + 0x10) = 0xffffffffffffffff;

+  }

+  else {

+    lVar5 = W32GetUserGdiSessionState();

+    lVar5 = *(longlong *)(lVar5 + 0x28);

+    lVar6 = PsGetCurrentProcess();

+    if (lVar6 != lVar5) {

+      local_res18[0] = 0x20000;

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xae);

+    }

+    if ((*(uint *)(lVar4 + 0xc) & 0x20) != 0) {

+      local_res18[0] = 0x20000;

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xaf);

+    }

+    *(uint *)(lVar4 + 0xc) = *(uint *)(lVar4 + 0xc) | 0x20;

+    lVar5 = W32GetUserSessionState();

+    *(uint *)(lVar5 + 0x10650) = *(uint *)(lVar5 + 0x10650) | 0x8000000;

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

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

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

+      cVar8 = '\0';

+    }

+    bVar9 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar8 != '\0') || (bVar9)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_q

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar8,bVar9,

+                 *(undefined8 *)(lVar5 + 0x10f88),4,2,10,

+                 &WPP_c11aa8953abf3c0709bb1ef6d3c16643_Traceguids,lVar4);

+    }

+    lVar5 = W32GetUserGdiSessionState();

+    if (param_1 == *(_EPROCESS **)(lVar5 + 0x28)) {

+      local_res18[0] = 0x20000;

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xbb);

+    }

+    if (param_2 == 2) {

+      iVar3 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+      *(uint *)(lVar4 + 0xc) = *(uint *)(lVar4 + 0xc) | 2;

+      if (iVar3 != 0) goto LAB_0;

+      uVar7 = 0;

+      lVar4 = 0;

+    }

+    else {

+      if (param_2 != 1) {

+        local_res18[0] = 0x20000;

+        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xce);

+      }

+      iVar3 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+      uVar7 = 2000;

+      if (iVar3 != 0) {

+        zzzSetStartGlass(lVar4,2000);

+        goto LAB_0;

+      }

+    }

+    zzzCalcStartCursorHide(lVar4,uVar7);

+  }

+LAB_0:

+  CWinEventNoopDeferral::~CWinEventNoopDeferral((CWinEventNoopDeferral *)local_res18);

+  AtomicExecutionCheck::Disarm(local_38);

+  return iVar2;

 }
```

## `xxxDDETrackWindowDying`  (modified)

```diff
--- xxxDDETrackWindowDying
+++ xxxDDETrackWindowDying
@@ -1,14 +1,119 @@
 

-int xxxDDETrackWindowDying(undefined8 param_1,longlong param_2,int param_3,int param_4)

+void xxxDDETrackWindowDying(undefined8 param_1,_HEAD *param_2)

 

 {

-  char cVar1;

-  longlong in_R10;

-  ulonglong in_R11;

+  _HEAD *p_Var1;

+  longlong lVar2;

+  int iVar3;

+  tagTHREADINFO *ptVar4;

+  ulonglong uVar5;

+  longlong lVar6;

+  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;

   

-  cVar1 = RtlTestBit(in_R11 ^ *(ulonglong *)(in_R10 + 0x18),

-                     (param_3 - (*(uint *)(param_2 + 8) ^ *(uint *)(in_R10 + 0x10)) >> 0xc) * 0x2a +

-                     param_4);

-  return 2 - (uint)(cVar1 != '\0');

+  while (param_2 != (_HEAD *)0x0) {

+    p_Var1 = *(_HEAD **)(param_2 + 0x18);

+    lVar6 = 0;

+    ptVar4 = PtiCurrent();

+    Win32HM_LockIntoThread<1>(ptVar4,p_Var1,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)) ||

+         (lVar2 = *(longlong *)(*(longlong *)(param_2 + 0x30) + 0x10),

+         0x400 < *(uint *)(lVar2 + 0x2a0))) || ((*(uint *)(lVar2 + 0x2b0) & 0x20) == 0)))) {

+      iVar3 = Feature_433841464__private_IsEnabledDeviceUsageNoInline();

+      if (iVar3 != 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);

+    }

+    lVar2 = *(longlong *)(param_2 + 0x20);

+    if (lVar2 == 0) {

+      bVar10 = true;

+    }

+    else {

+      bVar10 = (*(uint *)(lVar2 + 0x50) & 10) != 0;

+      if (bVar10) {

+        lVar6 = *(longlong *)(lVar2 + 0x48);

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

+      }

+      *(uint *)(*(longlong *)(param_2 + 0x20) + 0x50) =

+           *(uint *)(*(longlong *)(param_2 + 0x20) + 0x50) | 6;

+    }

+    lVar2 = *(longlong *)(param_2 + 0x48);

+    *(undefined8 *)(param_2 + 0x48) = 0;

+    local_40 = (code *)0xffffffffffffffff;

+    local_50 = 0;

+    lStack_48 = 0;

+    if (lVar2 != 0) {

+      ptVar4 = PtiCurrent();

+      local_50 = *(undefined8 *)(ptVar4 + 0x180);

+      *(undefined8 **)(ptVar4 + 0x180) = &local_50;

+      local_40 = xxxFreeListFree;

+      lStack_48 = lVar2;

+    }

+    local_58 = (code *)0xffffffffffffffff;

+    local_68 = 0;

+    lStack_60 = 0;

+    if (lVar6 != 0) {

+      ptVar4 = PtiCurrent();

+      local_68 = *(undefined8 *)(ptVar4 + 0x180);

+      *(undefined8 **)(ptVar4 + 0x180) = &local_68;

+      local_58 = xxxFreeListFree;

+      lStack_60 = lVar6;

+    }

+    if ((((*(uint *)(param_2 + 0x50) & 2) != 0) && (bVar10)) ||

+       ((*(uint *)(param_2 + 0x50) & 4) != 0)) {

+      lVar6 = _HMPheFromObject(param_2);

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

+        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);

+  }

+  return;

 }
```

## `zzzSetWindowsHookEx`  (modified)

```diff
--- zzzSetWindowsHookEx
+++ zzzSetWindowsHookEx
@@ -1,429 +1,362 @@
 

-tagHOOK * __cdecl

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

+/* struct HHOOK__ * __ptr64 __cdecl zzzSetWindowsHookEx(void * __ptr64,unsigned short const *

+   __ptr64,struct tagTHREADINFO * __ptr64,int,__int64 (__cdecl*)(void),enum tagHookFlags,int *

+   __ptr64) */

+

+HHOOK__ * __cdecl

 zzzSetWindowsHookEx(void *param_1,ushort *param_2,tagTHREADINFO *param_3,int param_4,

                    _func___int64 *param_5,tagHookFlags param_6,int *param_7)

 

 {

-  tagMENU *ptVar1;

-  _HEAD *p_Var2;

-  longlong *plVar3;

-  int iVar4;

-  longlong lVar5;

-  undefined8 uVar6;

-  longlong lVar7;

-  tagHOOK *extraout_RAX;

-  HMENU pHVar8;

-  char cVar9;

-  tagDESKTOP *ptVar10;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  char cVar11;

-  tagDESKTOP *ptVar12;

-  uint *puVar13;

-  tagWINDOWSTATION *unaff_R12;

-  tagTERMINAL *ptVar14;

-  tagWINDOWSTATION *unaff_R13;

-  tagDESKTOP *unaff_R14;

-  tagTHREADINFO *ptVar15;

-  undefined8 unaff_R15;

-  undefined1 in_ZF;

-  bool bVar16;

+  undefined8 *puVar1;

+  undefined8 *puVar2;

+  HHOOK__ *pHVar3;

+  char cVar4;

+  int iVar5;

+  tagTHREADINFO *ptVar6;

+  undefined8 *puVar7;

+  uint uVar8;

+  tagTHREADINFO *ptVar9;

+  char cVar10;

+  undefined8 uVar11;

+  tagTHREADINFO *ptVar12;

+  longlong lVar13;

+  undefined8 *puVar14;

+  bool bVar15;

+  undefined1 auStack_188 [32];

+  undefined1 local_168;

+  undefined4 local_160;

+  undefined2 local_158;

+  undefined *local_150;

+  undefined8 local_148;

+  int local_140;

+  tagHookFlags local_138;

+  ushort *local_128;

+  undefined8 *local_120;

+  int local_118;

+  void *local_110;

+  uint *local_108;

+  undefined8 *local_100;

+  tagTHREADINFO *local_f8;

+  void *local_f0;

+  tagTHREADINFO *local_e8;

+  ObjectLock<> local_d8 [48];

+  ObjectLock<> local_a8 [48];

+  ObjectLock<> local_78 [48];

+  ulonglong local_48;

   

-code_r0x000140235bc8:

-  if ((bool)in_ZF) {

-    ptVar10 = *(tagDESKTOP **)(unaff_R12 + 0x10);

-    unaff_RSI = 0;

-    if (ptVar10 != (tagDESKTOP *)0x0) {

+  local_48 = __security_cookie ^ (ulonglong)auStack_188;

+  lVar13 = (longlong)param_4;

+  local_108 = (uint *)param_7;

+  local_128 = param_2;

+  local_118 = param_4;

+  local_110 = param_1;

+  local_f0 = param_1;

+  local_e8 = param_3;

+  if (0xf < param_4 + 1U) {

+    UserSetLastError(0x592);

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

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

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

+      cVar10 = '\0';

+    }

+    else {

+      cVar10 = '\x01';

+    }

+    bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar10 == '\0') && (!bVar15)) {

+      return (HHOOK__ *)0x0;

+    }

+    lVar13 = W32GetUserSessionState();

+    uVar11 = *(undefined8 *)(lVar13 + 0x10f88);

+    local_158 = 10;

 LAB_0:

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

-          (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-         (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-        cVar11 = '\0';

-      }

-      bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar11 != '\0') || (bVar16)) {

-        GetDesktopName(ptVar10);

-        lVar7 = W32GetUserSessionState();

-        WPP_RECORDER_AND_TRACE_SF_qqS

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar16,

-                   *(undefined8 *)(lVar7 + 0x10f88));

-      }

-      ptVar14 = *(tagTERMINAL **)(unaff_RBP + 0x6f);

-      LockObjectAssignment(*(longlong *)(ptVar14 + 8) + 0x18,ptVar10);

-      unaff_R15 = *(undefined8 *)(unaff_RBP + 0x77);

-      goto LAB_1;

-    }

+    local_148 = (void *)CONCAT44(local_148._4_4_,param_4);

+    local_150 = &WPP_6d99e6e562e933b3b3e6eb3fc19d43cb_Traceguids;

+    local_160 = 5;

+    local_168 = 3;

+    WPP_RECORDER_AND_TRACE_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar15,uVar11);

+    return (HHOOK__ *)0x0;

+  }

+  ptVar9 = (tagTHREADINFO *)0x0;

+  if (param_5 == (_func___int64 *)0x0) {

+    UserSetLastError(0x593);

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

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

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

+      cVar10 = '\0';

+    }

+    else {

+      cVar10 = '\x01';

+    }

+    bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar10 == '\0') && (!bVar15)) {

+      return (HHOOK__ *)0x0;

+    }

+    lVar13 = W32GetUserSessionState();

+    uVar11 = *(undefined8 *)(lVar13 + 0x10f88);

+    local_158 = 0xb;

   }

   else {

-    lVar7 = W32GetUserSessionState();

-    if (*(longlong *)(lVar7 + 0xf8a8) != unaff_RSI) {

-      lVar7 = W32GetUserSessionState();

-      for (lVar7 = *(longlong *)(*(longlong *)(lVar7 + 0xf8a8) + 8); lVar7 != 0;

-          lVar7 = *(longlong *)(lVar7 + 8)) {

-        ptVar10 = *(tagDESKTOP **)(lVar7 + 0x10);

-        if (ptVar10 != (tagDESKTOP *)0x0) goto LAB_0;

-        unaff_RSI = 0;

-      }

-    }

+    ptVar6 = PtiCurrent();

+    cVar10 = '\0';

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

+      if ((param_1 == (void *)0x0) && ((*(uint *)(&DAT_1 + lVar13 * 4) & 0x20) == 0)) {

+        UserSetLastError(0x594);

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

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

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

+          cVar10 = '\0';

+        }

+        else {

+          cVar10 = '\x01';

+        }

+        bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar10 == '\0') && (!bVar15)) {

+          return (HHOOK__ *)0x0;

+        }

+        lVar13 = W32GetUserSessionState();

+        uVar11 = *(undefined8 *)(lVar13 + 0x10f88);

+        local_158 = 0xc;

+        goto LAB_2;

+      }

+    }

+    else {

+      if ((*(uint *)(&DAT_1 + lVar13 * 4) & 2) == 0) {

+        UserSetLastError(0x595);

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

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

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

+          cVar10 = '\0';

+        }

+        else {

+          cVar10 = '\x01';

+        }

+        bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar10 == '\0') && (!bVar15)) {

+          return (HHOOK__ *)0x0;

+        }

+        lVar13 = W32GetUserSessionState();

+        uVar11 = *(undefined8 *)(lVar13 + 0x10f88);

+        local_158 = 0xd;

+        goto LAB_0;

+      }

+      if (*(longlong *)(param_3 + 0x1f0) != *(longlong *)(ptVar6 + 0x1f0)) {

+        UserSetLastError(5);

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

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

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

+          cVar10 = '\0';

+        }

+        else {

+          cVar10 = '\x01';

+        }

+        bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar10 == '\0') && (!bVar15)) {

+          return (HHOOK__ *)0x0;

+        }

+        lVar13 = W32GetUserSessionState();

+        uVar11 = *(undefined8 *)(lVar13 + 0x10f88);

+        local_158 = 0xe;

+        goto LAB_2;

+      }

+      if (*(longlong *)(ptVar6 + 0x1d0) != *(longlong *)(param_3 + 0x1d0)) {

+        if ((param_1 == (void *)0x0) && ((*(uint *)(&DAT_1 + lVar13 * 4) & 0x20) == 0)) {

+          UserSetLastError(5);

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

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

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

+            cVar10 = '\0';

+          }

+          else {

+            cVar10 = '\x01';

+          }

+          bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar10 == '\0') && (!bVar15)) {

+            return (HHOOK__ *)0x0;

+          }

+          lVar13 = W32GetUserSessionState();

+          uVar11 = *(undefined8 *)(lVar13 + 0x10f88);

+          local_158 = 0xf;

+          goto LAB_2;

+        }

+        LOCK();

+        uVar8 = *(uint *)(param_3 + 0x210);

+        if (uVar8 == 0) {

+          *(uint *)(param_3 + 0x210) = 0;

+          uVar8 = 0;

+        }

+        UNLOCK();

+        if (((uVar8 & 0xc) != 0) && ((*(uint *)(&DAT_1 + lVar13 * 4) & 0x10) == 0)) {

+          UserSetLastError(0x5b2);

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

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

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

+            cVar10 = '\x01';

+          }

+          bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar10 == '\0') && (!bVar15)) {

+            return (HHOOK__ *)0x0;

+          }

+          lVar13 = W32GetUserSessionState();

+          local_148 = (void *)CONCAT44(local_148._4_4_,param_4);

+          local_150 = &WPP_6d99e6e562e933b3b3e6eb3fc19d43cb_Traceguids;

+          local_160 = 5;

+          local_168 = 3;

+          WPP_RECORDER_AND_TRACE_SF_l

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar15,

+                     *(undefined8 *)(lVar13 + 0x10f88));

+          return (HHOOK__ *)0x0;

+        }

+      }

+    }

+    cVar4 = RtlAreAllAccessesGranted(*(undefined4 *)(ptVar6 + 0x3a8),8);

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

+      DomainShared<>::DomainExclusive<DLT_HOOK>::ObjectLock<>::ObjectLock<>(local_d8);

+      DomainShared<>::DomainExclusive<DLT_HANDLEMANAGER>::ObjectLock<>::ObjectLock<>(local_a8);

+      puVar7 = (undefined8 *)HMAllocObject(ptVar6,*(undefined8 *)(ptVar6 + 0x1f0),5,0x68);

+      local_120 = puVar7;

+      local_100 = puVar7;

+      DomainShared<>::DomainExclusive<DLT_HANDLEMANAGER>::ObjectLock<>::~ObjectLock<>(local_a8);

+      if (puVar7 == (undefined8 *)0x0) {

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

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

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

+          cVar10 = '\x01';

+        }

+        bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+        if ((cVar10 != '\0') || (bVar15)) {

+          lVar13 = W32GetUserSessionState();

+          local_150 = &WPP_6d99e6e562e933b3b3e6eb3fc19d43cb_Traceguids;

+          local_158 = 0x12;

+          local_160 = 5;

+          local_168 = 2;

+          WPP_RECORDER_AND_TRACE_SF_

+                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar15,

+                     *(undefined8 *)(lVar13 + 0x10f88));

+        }

+LAB_3:

+        DomainShared<>::DomainExclusive<DLT_HANDLEMANAGER>::ObjectLock<>::~ObjectLock<>

+                  ((ObjectLock<> *)local_d8);

+        return (HHOOK__ *)0x0;

+      }

+      *(undefined4 *)((longlong)puVar7 + 0x44) = 0xffffffff;

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

+        iVar5 = GetHmodTableIndex(local_128);

+        *(int *)((longlong)puVar7 + 0x44) = iVar5;

+        if (iVar5 == -1) {

+          UserSetLastError(0x7e);

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

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

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

+            cVar10 = '\x01';

+          }

+          bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar10 != '\0') || (bVar15)) {

+            lVar13 = W32GetUserSessionState();

+            local_150 = &WPP_6d99e6e562e933b3b3e6eb3fc19d43cb_Traceguids;

+            local_158 = 0x13;

+            local_160 = 5;

+            local_168 = 3;

+            WPP_RECORDER_AND_TRACE_SF_

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar15,

+                       *(undefined8 *)(lVar13 + 0x10f88));

+          }

+          DomainShared<>::DomainExclusive<DLT_HANDLEMANAGER>::ObjectLock<>::ObjectLock<>(local_78);

+          HMFreeObject(puVar7);

+          DomainShared<>::DomainExclusive<DLT_HANDLEMANAGER>::ObjectLock<>::~ObjectLock<>(local_78);

+          goto LAB_3;

+        }

+        if (-1 < iVar5) {

+          AddHmodDependency(iVar5);

+        }

+      }

+      cVar10 = '\x01';

+      uVar8 = 1 << ((byte)(param_4 + 1) & 0x1f);

+      lVar13 = (longlong)(param_4 + 1) * 8;

+      puVar14 = puVar7;

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

+        ptVar12 = (tagTHREADINFO *)(*(longlong *)(ptVar6 + 0x1f8) + lVar13 + 0x28);

+        *(uint *)(puVar7 + 8) = *(uint *)(puVar7 + 8) | 1;

+        *(uint *)(**(longlong **)(ptVar6 + 0x1f8) + 0x10) =

+             *(uint *)(**(longlong **)(ptVar6 + 0x1f8) + 0x10) | uVar8;

+      }

+      else {

+        ptVar12 = param_3 + lVar13 + 0x3c0;

+        *(uint *)(param_3 + 0x2d0) = *(uint *)(param_3 + 0x2d0) | uVar8;

+        ptVar9 = param_3;

+        local_f8 = ptVar12;

+        if (*(longlong *)(param_3 + 0x208) != 0) {

+          puVar1 = *(undefined8 **)(param_3 + 0x1d0);

+          puVar2 = *(undefined8 **)(ptVar6 + 0x1d0);

+          if (puVar1 != puVar2) {

+            KeAttachProcess(*puVar1);

+          }

+          puVar14 = local_120;

+          uVar8 = (uint)(puVar1 != puVar2);

+          local_128 = (ushort *)CONCAT44(local_128._4_4_,uVar8);

+          *(undefined4 *)(*(longlong *)(param_3 + 0x208) + 0x38) = *(undefined4 *)(param_3 + 0x2d0);

+          if (uVar8 != 0) {

+            KeDetachProcess();

+          }

+        }

+      }

+      puVar14[9] = ptVar9;

+      *(tagHookFlags *)(puVar7 + 8) = *(tagHookFlags *)(puVar7 + 8) | param_6 & 0x42;

+      *(int *)(puVar7 + 6) = param_4;

+      puVar7[7] = (longlong)param_5 - (longlong)local_110;

+      lVar13 = *(longlong *)ptVar12;

+      puVar7[5] = lVar13;

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

+        *local_108 = (uint)(lVar13 == 0);

+      }

+      *(undefined8 **)ptVar12 = puVar7;

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

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

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

+        cVar10 = '\0';

+      }

+      bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+      if ((cVar10 != '\0') || (bVar15)) {

+        lVar13 = W32GetUserSessionState();

+        local_138 = param_6;

+        local_148 = local_110;

+        local_150 = &WPP_6d99e6e562e933b3b3e6eb3fc19d43cb_Traceguids;

+        local_158 = 0x14;

+        local_160 = 5;

+        local_140 = param_4;

+        WPP_RECORDER_AND_TRACE_SF_qDD

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar15,

+                   *(undefined8 *)(lVar13 + 0x10f88));

+      }

+      pHVar3 = (HHOOK__ *)*puVar7;

+      DomainShared<>::DomainExclusive<DLT_HANDLEMANAGER>::ObjectLock<>::~ObjectLock<>

+                ((ObjectLock<> *)local_d8);

+      return pHVar3;

+    }

+    UserSetLastError(5);

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

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

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

+      cVar10 = '\0';

+    }

+    else {

+      cVar10 = '\x01';

+    }

+    bVar15 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar10 == '\0') && (!bVar15)) {

+      return (HHOOK__ *)0x0;

+    }

+    lVar13 = W32GetUserSessionState();

+    uVar11 = *(undefined8 *)(lVar13 + 0x10f88);

+    local_158 = 0x11;

   }

-  lVar7 = W32GetUserSessionState();

-  ptVar14 = *(tagTERMINAL **)(unaff_RBP + 0x6f);

-  if (ptVar14 == (tagTERMINAL *)(lVar7 + 0x10cd0)) {

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

-        (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-       (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      cVar11 = (char)unaff_RSI;

-    }

-    bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((cVar11 != '\0') || (bVar16)) {

-      lVar7 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_q

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar16,

-                 *(undefined8 *)(lVar7 + 0x10f88),4);

-    }

-    xxxCleanupMotherDesktopWindow(ptVar14);

-  }

-LAB_1:

-  cVar11 = '\0';

-  if ((*(longlong *)(unaff_R14 + 8) != 0) &&

-     (p_Var2 = *(_HEAD **)(*(longlong *)(unaff_R14 + 8) + 0x18), p_Var2 != (_HEAD *)0x0)) {

-    if ((*(byte *)(*(longlong *)(p_Var2 + 0x28) + 0x1f) & 0x10) != 0) {

-      Win32HM_LockIntoThread<0>

-                (*(tagTHREADINFO **)(unaff_RBP + 0x67),p_Var2,

-                 (_Win32HMThreadLockItem *)(unaff_RBP + -0x21));

-      xxxSetWindowPos(p_Var2,0,0,0,0);

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

-                ((Win32HMThreadLockBase<tagWND,0,0> *)(unaff_RBP + -0x21));

-    }

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

-        (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-       (cVar9 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      cVar9 = cVar11;

-    }

-    bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((cVar9 != '\0') || (bVar16)) {

-      lVar7 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar16,

-                 *(undefined8 *)(lVar7 + 0x10f88),4);

-    }

-    xxxDestroyWindow(*(undefined8 *)(*(longlong *)(unaff_R14 + 8) + 0x18));

-    lVar7 = W32GetUserSessionState();

-    if (unaff_R14 == *(tagDESKTOP **)(lVar7 + 0x4b58)) {

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

-          (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-         (cVar9 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-        cVar9 = cVar11;

-      }

-      bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar9 != '\0') || (bVar16)) {

-        lVar7 = W32GetUserSessionState();

-        WPP_RECORDER_AND_TRACE_SF_q

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar16,

-                   *(undefined8 *)(lVar7 + 0x10f88),4);

-      }

-    }

-    else {

-      plVar3 = *(longlong **)(unaff_R14 + 8);

-      *(undefined8 *)(*plVar3 + 8) = 0;

-      HMAssignmentUnlock(plVar3 + 3);

-    }

-    *(uint *)(unaff_R14 + 0x30) = *(uint *)(unaff_R14 + 0x30) | 2;

-  }

-  if ((((*(uint *)ptVar14 & 2) == 0) || (unaff_R13 == (tagWINDOWSTATION *)0x0)) ||

-     ((*(uint *)(unaff_R13 + 0x30) & 6) == 0)) {

-    xxxSetThreadDesktop(unaff_R15,unaff_R13);

-  }

-  if ((*(uint *)ptVar14 & 2) == 0) {

-    W32GetUserSessionState();

-  }

-  if (*(longlong *)(unaff_RBP + -0x41) != -1) {

-    PopAndFreeW32ThreadLock(unaff_RBP + -0x51);

-    *(undefined8 *)(unaff_RBP + -0x41) = 0xffffffffffffffff;

-  }

-  if (*(longlong *)(unaff_RBP + -0x29) != -1) {

-    PopAndFreeW32ThreadLock(unaff_RBP + -0x39);

-    *(undefined8 *)(unaff_RBP + -0x29) = 0xffffffffffffffff;

-  }

-  if (*(longlong *)(unaff_RBP + 0x17) != -1) {

-    PopAndFreeW32ThreadLock(unaff_RBP + 7);

-  }

-  ptVar15 = *(tagTHREADINFO **)(unaff_RBP + 0x67);

-  unaff_R14 = *(tagDESKTOP **)(ptVar14 + 0x30);

-  if (unaff_R14 == (tagDESKTOP *)0x0) {

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

-        (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-       (cVar9 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      cVar9 = cVar11;

-    }

-    bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((cVar9 != '\0') || (bVar16)) {

-      lVar7 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar9,bVar16,

-                 *(undefined8 *)(lVar7 + 0x10f88),4);

-    }

-    lVar7 = W32GetUserSessionState();

-    KeSetEvent(*(undefined8 *)(lVar7 + 0xf668),1);

-    SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

-              ((SmartObjStackRef<tagMENU> *)(unaff_RBP + -0x69));

-    return extraout_RAX;

-  }

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

-      (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-     (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar11 = '\0';

-  }

-  if ((cVar11 != '\0') || ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED)) {

-    GetDesktopName(unaff_R14);

-    W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_Sq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11);

-  }

-  Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

-            ((Win32RawLockedNtObject<tagWINDOWSTATION> *)(unaff_RBP + 7),

-             (tagWINDOWSTATION *)unaff_R14);

-  unaff_R12 = *(tagWINDOWSTATION **)(unaff_R14 + 0x28);

-  Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

-            ((Win32RawLockedNtObject<tagWINDOWSTATION> *)(unaff_RBP + -0x39),unaff_R12);

-  ptVar10 = unaff_R14 + 0x20;

-  LockObjectAssignment(ptVar14 + 0x30,*(tagDESKTOP **)ptVar10);

-  DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)ptVar10);

-  lVar7 = W32GetUserSessionState();

-  if (unaff_R14 != *(tagDESKTOP **)(lVar7 + 0x4b58)) {

-    if (unaff_R14 != *(tagDESKTOP **)(ptVar15 + 0x1f0)) goto LAB_2;

-    lVar7 = W32GetUserSessionState();

-    puVar13 = *(uint **)(unaff_RBP + 0x6f);

-    for (lVar7 = *(longlong *)(lVar7 + 0xf8a8); ptVar10 = (tagDESKTOP *)0x0, lVar7 != 0;

-        lVar7 = *(longlong *)(lVar7 + 8)) {

-      if ((((*(uint *)(lVar7 + 0x40) & 0x10) == 0) && (*(uint **)(lVar7 + 0x38) == puVar13)) &&

-         (ptVar10 = *(tagDESKTOP **)(lVar7 + 0x10), ptVar10 != (tagDESKTOP *)0x0))

-      goto LAB_3;

-    }

-    goto LAB_4;

-  }

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

-      (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

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

-    cVar11 = '\0';

-  }

-  else {

-    cVar11 = '\x01';

-  }

-  bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-  if ((cVar11 != '\0') || (bVar16)) {

-    lVar7 = W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar16,

-               *(undefined8 *)(lVar7 + 0x10f88),4);

-  }

-  if ((*(uint *)(unaff_R12 + 0x40) & 1) == 0) {

-    ptVar12 = *(tagDESKTOP **)(unaff_R12 + 0x10);

-    if (ptVar12 == unaff_R14) {

-      ptVar12 = *(tagDESKTOP **)ptVar10;

-    }

-    if (ptVar12 == (tagDESKTOP *)0x0) {

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

-          (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-         (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-        cVar11 = '\0';

-      }

-      bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar11 != '\0') || (bVar16)) {

-        lVar7 = W32GetUserSessionState();

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar16,

-                   *(undefined8 *)(lVar7 + 0x10f88),4);

-      }

-      ClearWakeBit(ptVar15,0x3c07,0);

-    }

-  }

-  else {

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

-        (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-       (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-      cVar11 = '\0';

-    }

-    bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((cVar11 != '\0') || (bVar16)) {

-      lVar7 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar16,

-                 *(undefined8 *)(lVar7 + 0x10f88),4);

-    }

-    lVar7 = W32GetUserSessionState();

-    if ((*(longlong *)(lVar7 + 0xf690) != 0) &&

-       (((lVar7 = W32GetUserSessionState(), unaff_R14 == *(tagDESKTOP **)(lVar7 + 0xf688) ||

-         (lVar7 = W32GetUserSessionState(), *(longlong *)(lVar7 + 0xf688) == 0)) ||

-        (lVar7 = W32GetUserSessionState(),

-        (*(uint *)(*(longlong *)(lVar7 + 0xf688) + 0x30) & 2) != 0)))) {

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

-          (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-         (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-        cVar11 = '\0';

-      }

-      bVar16 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if ((cVar11 != '\0') || (bVar16)) {

-        lVar7 = W32GetUserSessionState();

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11,bVar16,

-                   *(undefined8 *)(lVar7 + 0x10f88),4);

-      }

-      W32GetUserSessionState();

-      W32GetUserSessionState();

-      lVar7 = W32GetUserSessionState();

-      uVar6 = *(undefined8 *)(lVar7 + 0xf690);

-      lVar7 = W32GetUserSessionState();

-      RemoteDisableScreen(*(undefined8 *)(lVar7 + 0x4b58),uVar6);

-      goto LAB_2;

-    }

-    lVar7 = W32GetUserSessionState();

-    ptVar12 = *(tagDESKTOP **)(lVar7 + 0xf688);

-  }

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

-      (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

-     (cVar11 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar11 = '\0';

-  }

-  if ((cVar11 != '\0') || ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED)) {

-    GetDesktopName(ptVar12);

-    W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_Sq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar11);

-  }

-  Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

-            ((Win32RawLockedNtObject<tagWINDOWSTATION> *)(unaff_RBP + -0x11),

-             (tagWINDOWSTATION *)ptVar12);

-  xxxSwitchDesktop(unaff_R12,ptVar12);

-  if (*(longlong *)(unaff_RBP + -1) != -1) {

-    PopAndFreeW32ThreadLock(unaff_RBP + -0x11);

-  }

-  ptVar15 = *(tagTHREADINFO **)(unaff_RBP + 0x67);

 LAB_2:

-  puVar13 = *(uint **)(unaff_RBP + 0x6f);

-  goto LAB_5;

-  while (ptVar10 = *(tagDESKTOP **)(ptVar10 + 0x20), ptVar10 != (tagDESKTOP *)0x0) {

-LAB_3:

-    if (ptVar10 != unaff_R14) goto LAB_4;

-  }

-  if (unaff_R14 == (tagDESKTOP *)0x0) {

-    ptVar10 = (tagDESKTOP *)0x0;

-  }

-LAB_4:

-  xxxSetThreadDesktop(0,ptVar10);

-LAB_5:

-  unaff_RSI = 0;

-  lVar7 = W32GetUserSessionState();

-  if (unaff_R14 == *(tagDESKTOP **)(lVar7 + 0x4b60)) {

-    for (lVar7 = *(longlong *)(unaff_R12 + 0x10);

-        (lVar7 != 0 &&

-        ((lVar5 = W32GetUserSessionState(), lVar7 == *(longlong *)(lVar5 + 0xf688) ||

-         (lVar5 = W32GetUserSessionState(), lVar7 == *(longlong *)(lVar5 + 0xf690)))));

-        lVar7 = *(longlong *)(lVar7 + 0x20)) {

-    }

-    lVar5 = W32GetUserSessionState();

-    LockObjectAssignment(lVar5 + 0x4b60,lVar7);

-  }

-  if ((*puVar13 & 2) == 0) {

-    W32GetUserSessionState();

-  }

-  unaff_R13 = *(tagWINDOWSTATION **)(ptVar15 + 0x1f0);

-  unaff_R15 = *(undefined8 *)(ptVar15 + 0x278);

-  *(undefined8 *)(unaff_RBP + 0x77) = unaff_R15;

-  Win32RawLockedNtObject<tagWINDOWSTATION>::Win32RawLockedNtObject<tagWINDOWSTATION>

-            ((Win32RawLockedNtObject<tagWINDOWSTATION> *)(unaff_RBP + -0x51),unaff_R13);

-  xxxSetThreadDesktop(0,unaff_R14);

-  tagUNIQUE_WINDOW_HANDLE::Clear((tagUNIQUE_WINDOW_HANDLE *)(unaff_R14 + 0x58));

-  HMAssignmentUnlock(unaff_R14 + 0xc0);

-  *(uint *)(unaff_R14 + 0x30) = *(uint *)(unaff_R14 + 0x30) & 0xfffffc3f;

-  ptVar1 = *(tagMENU **)(unaff_R14 + 0x38);

-  if (ptVar1 != (tagMENU *)0x0) {

-    *(undefined8 *)(unaff_RBP + -0x59) = 0;

-    SmartObjStackRefBase<tagMENU>::operator=

-              ((SmartObjStackRefBase<tagMENU> *)(unaff_RBP + -0x69),ptVar1);

-    lVar7 = UnlockDesktopSysMenu(unaff_R14 + 0x38);

-    if (lVar7 != 0) {

-      pHVar8 = *(HMENU *)(unaff_RBP + -0x59);

-      if (pHVar8 == (HMENU)0x0) {

-        pHVar8 = (HMENU)**(undefined8 **)(unaff_RBP + -0x69);

-      }

-      _DestroyMenu(pHVar8);

-    }

-  }

-  ptVar1 = *(tagMENU **)(unaff_R14 + 0x40);

-  if (ptVar1 != (tagMENU *)0x0) {

-    *(undefined8 *)(unaff_RBP + -0x59) = 0;

-    SmartObjStackRefBase<tagMENU>::operator=

-              ((SmartObjStackRefBase<tagMENU> *)(unaff_RBP + -0x69),ptVar1);

-    lVar7 = UnlockDesktopSysMenu(unaff_R14 + 0x40);

-    if (lVar7 != 0) {

-      pHVar8 = *(HMENU *)(unaff_RBP + -0x59);

-      if (pHVar8 == (HMENU)0x0) {

-        pHVar8 = (HMENU)**(undefined8 **)(unaff_RBP + -0x69);

-      }

-      _DestroyMenu(pHVar8);

-    }

-  }

-  ptVar1 = *(tagMENU **)(unaff_R14 + 0x48);

-  if (ptVar1 != (tagMENU *)0x0) {

-    *(undefined8 *)(unaff_RBP + -0x59) = 0;

-    SmartObjStackRefBase<tagMENU>::operator=

-              ((SmartObjStackRefBase<tagMENU> *)(unaff_RBP + -0x69),ptVar1);

-    lVar7 = UnlockDesktopMenu(unaff_R14 + 0x48);

-    if (lVar7 != 0) {

-      pHVar8 = *(HMENU *)(unaff_RBP + -0x59);

-      if (pHVar8 == (HMENU)0x0) {

-        pHVar8 = (HMENU)**(undefined8 **)(unaff_RBP + -0x69);

-      }

-      _DestroyMenu(pHVar8);

-    }

-  }

-  ptVar1 = *(tagMENU **)(unaff_R14 + 0x50);

-  if (ptVar1 != (tagMENU *)0x0) {

-    *(undefined8 *)(unaff_RBP + -0x59) = 0;

-    SmartObjStackRefBase<tagMENU>::operator=

-              ((SmartObjStackRefBase<tagMENU> *)(unaff_RBP + -0x69),ptVar1);

-    lVar7 = UnlockDesktopMenu(unaff_R14 + 0x50);

-    if (lVar7 != 0) {

-      pHVar8 = *(HMENU *)(unaff_RBP + -0x59);

-      if (pHVar8 == (HMENU)0x0) {

-        pHVar8 = (HMENU)**(undefined8 **)(unaff_RBP + -0x69);

-      }

-      _DestroyMenu(pHVar8);

-    }

-  }

-  if (*(longlong *)(unaff_R14 + 8) != 0) {

-    if (*(longlong *)(*(longlong *)(unaff_R14 + 8) + 0xa8) != 0) {

-      iVar4 = IsWindowDesktopComposed();

-      if (iVar4 != 0) {

-        uVar6 = ReferenceDwmApiPort();

-        DwmAsyncShellWindowChange(uVar6);

-      }

-      plVar3 = *(longlong **)(unaff_R14 + 8);

-      *(undefined8 *)(*plVar3 + 0x18) = 0;

-      HMAssignmentUnlock(plVar3 + 0x15);

-    }

-    if ((*(longlong **)(unaff_R14 + 8))[0x17] != 0) {

-      *(undefined8 *)(**(longlong **)(unaff_R14 + 8) + 0x20) = 0;

-      HMAssignmentUnlock();

-    }

-    if ((*(longlong **)(unaff_R14 + 8))[0x18] != 0) {

-      *(undefined8 *)(**(longlong **)(unaff_R14 + 8) + 0x28) = 0;

-      HMAssignmentUnlock();

-    }

-  }

-  lVar7 = *(longlong *)(unaff_R14 + 0x70);

-  if ((lVar7 != 0) && (lVar5 = HMAssignmentUnlock(), lVar5 != 0)) {

-    xxxDestroyWindow(lVar7);

-  }

-  if (*(CMonitorTopology **)(unaff_R14 + 0x108) != (CMonitorTopology *)0x0) {

-    CMonitorTopology::Release(*(CMonitorTopology **)(unaff_R14 + 0x108));

-    *(undefined8 *)(unaff_R14 + 0x108) = 0;

-  }

-  if ((*(longlong *)(puVar13 + 2) != 0) &&

-     (*(tagDESKTOP **)(*(longlong *)(puVar13 + 2) + 0x18) == unaff_R14)) goto code_r0x000140235bc4;

-  ptVar14 = *(tagTERMINAL **)(unaff_RBP + 0x6f);

-  goto LAB_1;

-code_r0x000140235bc4:

-  in_ZF = (*puVar13 & 2) == 0;

-  goto code_r0x000140235bc8;

+  local_150 = &WPP_6d99e6e562e933b3b3e6eb3fc19d43cb_Traceguids;

+  local_160 = 5;

+  local_168 = 3;

+  WPP_RECORDER_AND_TRACE_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar10,bVar15,uVar11);

+  return (HHOOK__ *)0x0;

 }
```

## `ResizeTimerFunc`  (modified)

```diff
--- ResizeTimerFunc
+++ ResizeTimerFunc
@@ -1,24 +1,24 @@
 

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

+/* void __cdecl ResizeTimerFunc(struct tagWND * __ptr64,unsigned int,unsigned __int64,__int64) */

 

 void __cdecl ResizeTimerFunc(tagWND *param_1,uint param_2,__uint64 param_3,__int64 param_4)

 

 {

-  undefined4 uVar1;

-  undefined1 unaff_SIL;

-  undefined4 *unaff_RDI;

-  undefined4 uStack0000000000000028;

-  undefined2 uStack0000000000000030;

-  undefined *puStack0000000000000038;

-  undefined4 uStack0000000000000040;

+  longlong lVar1;

+  int iVar2;

   

-  uVar1 = *unaff_RDI;

-  W32GetUserSessionState(param_1,param_2,(char)param_3);

-  puStack0000000000000038 = &WPP_a4942bb3c27731613b7ebe66d62ba7d5_Traceguids;

-  uStack0000000000000030 = 0x81;

-  uStack0000000000000028 = SUB84(unaff_RDI,0);

-  uStack0000000000000040 = uVar1;

-  WPP_RECORDER_AND_TRACE_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_SIL);

+  FindTimer(param_1,param_3,2,1,0);

+  lVar1 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x2c8);

+  if ((lVar1 != 0) && (*(tagWND **)(lVar1 + 0x10) == param_1)) {

+    iVar2 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+    if (iVar2 != 0) {

+      EtwTraceSmoothResizeTimeoutEvent(*(undefined8 *)param_1);

+      if (*(int *)(param_1 + 0x17c) < 0) goto LAB_0;

+    }

+    *(uint *)(lVar1 + 200) = *(uint *)(lVar1 + 200) | 0x4000000;

+  }

+LAB_0:

+  GreCancelSynchronizedWindowResize(*(undefined8 *)param_1);

   return;

 }
```

## `NtUserLayoutCompleted`  (modified)

```diff
--- NtUserLayoutCompleted
+++ NtUserLayoutCompleted
@@ -1,53 +1,41 @@
 

-ulonglong NtUserLayoutCompleted(longlong param_1,undefined8 param_2,longlong *param_3)

+undefined8 NtUserLayoutCompleted(__int64 param_1)

 

 {

-  char *pcVar1;

-  longlong lVar2;

-  longlong unaff_RSI;

-  ulonglong unaff_RDI;

-  int unaff_R12D;

-  longlong unaff_R14;

-  char unaff_R15B;

-  bool bVar3;

+  tagTHREADINFO *ptVar1;

+  _HEAD *p_Var2;

+  undefined8 uVar3;

+  undefined8 *puVar4;

+  int local_res10 [2];

+  _Win32HMThreadLockItem local_18 [16];

   

-  *param_3 = *param_3 + (longlong)param_3;

-  pcVar1 = (char *)(param_1 + 0x20 + unaff_RDI);

-  *pcVar1 = *pcVar1 + (char)param_1;

-  if (*pcVar1 == '\0') {

-    unaff_RDI = 0xc0000008;

+                    /* 0x23dbd0  1818  NtUserLayoutCompleted */

+  ptVar1 = (tagTHREADINFO *)EnterCrit(0,0);

+  p_Var2 = (_HEAD *)ValidateHwndStrict(param_1);

+  uVar3 = 0;

+  if (p_Var2 != (_HEAD *)0x0) {

+    Win32HM_LockIntoThread<0>(ptVar1,p_Var2,local_18);

+    EtwTraceLayoutChangeStop(ptVar1,param_1,p_Var2);

+    if (*(_HEAD **)(*(longlong *)(p_Var2 + 0x18) + 0x130) == p_Var2) {

+      uVar3 = ReferenceDwmApiPort();

+      DwmAsyncCancelRotationDelay(uVar3);

+    }

+    PostIAMShellHookMessage(0x26,param_1);

+    if (*(char *)(*(longlong *)(p_Var2 + 0x28) + 0x19) < '\0') {

+      puVar4 = (undefined8 *)_GetTopLevelWindow(p_Var2);

+      if ((puVar4 != (undefined8 *)0x0) && ((*(ushort *)(puVar4[5] + 0x2a) & 0x2fff) != 0x29d)) {

+        local_res10[0] = 0;

+        GreWindowLayoutComplete(*puVar4,local_res10);

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

+          HandleAsyncResizeComplete(puVar4);

+        }

+      }

+    }

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

+              ((Win32HMThreadLockBase<tagWND,0,0> *)local_18);

+    uVar3 = 1;

   }

-  else if (*(int *)(unaff_RSI + 8) == unaff_R12D) {

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4))

-    {

-      unaff_R15B = (char)unaff_R12D;

-    }

-    bVar3 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((unaff_R15B != '\0') || (bVar3)) {

-      lVar2 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_d

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_R15B,bVar3,

-                 *(undefined8 *)(lVar2 + 0x10f88),4);

-    }

-    *(uint *)(unaff_R14 + 0xc) = *(uint *)(unaff_R14 + 0xc) & 0xfbf7ffff;

-  }

-  else {

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

-        ((byte)(unaff_R15B + 1U & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

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

-      unaff_R15B = (char)unaff_R12D;

-    }

-    bVar3 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-    if ((unaff_R15B != '\0') || (bVar3)) {

-      lVar2 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_d

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_R15B,bVar3,

-                 *(undefined8 *)(lVar2 + 0x10f88),4);

-    }

-    *(uint *)(unaff_R14 + 0xc) = *(uint *)(unaff_R14 + 0xc) | 0x4080000;

-  }

-  ObfDereferenceObject();

-  return unaff_RDI & 0xffffffff;

+  UserSessionSwitchLeaveCrit();

+  return uVar3;

 }
```

## `xxxDDETrackGetMessageHook`  (modified)

```diff
--- xxxDDETrackGetMessageHook
+++ xxxDDETrackGetMessageHook
@@ -1,13 +1,119 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-void xxxDDETrackGetMessageHook(char param_1)

+void xxxDDETrackGetMessageHook(undefined8 *param_1)

 

 {

-  longlong in_RAX;

+  longlong *plVar1;

+  tagFREELIST *ptVar2;

+  uint uVar3;

+  int iVar4;

+  uint uVar5;

+  tagWND *ptVar6;

+  tagWND *ptVar7;

+  tagDDECONV *ptVar8;

+  tagTHREADINFO *ptVar9;

+  longlong lVar10;

+  undefined8 uVar11;

+  tagXSTATE *ptVar12;

+  _HEAD *p_Var13;

+  longlong lVar14;

+  _Win32HMThreadLockItem local_48 [16];

+  _Win32HMThreadLockItem local_38 [16];

+  Win32HMThreadLockBase<tagMENU,0,0> local_28 [16];

   

-  *(char *)(in_RAX + -0x7b) = *(char *)(in_RAX + -0x7b) + param_1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  if (*(int *)(param_1 + 1) != 0x3e1) {

+    plVar1 = param_1 + 3;

+    p_Var13 = (_HEAD *)HMValidateHandleNoRipNoIL(*plVar1);

+    if (p_Var13 == (_HEAD *)0x0) {

+      *plVar1 = 0;

+      *(undefined4 *)(param_1 + 1) = 0;

+      return;

+    }

+    uVar5 = *(uint *)(p_Var13 + 0x40);

+    ptVar9 = PtiCurrent();

+    Win32HM_LockIntoThread<0>(ptVar9,p_Var13,local_48);

+    lVar10 = *(longlong *)(p_Var13 + 0x38);

+    lVar14 = xxxClientCopyDDEOut1(lVar10);

+    if (lVar14 == 0) {

+      *(undefined4 *)(param_1 + 1) = 0x3e1;

+      uVar11 = 0;

+    }

+    else {

+      uVar11 = *(undefined8 *)(lVar10 + 0x18);

+    }

+    *plVar1 = lVar14;

+    ptVar12 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                        ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_48);

+    if (ptVar12 != (tagXSTATE *)0x0) {

+      if ((uVar5 >> 9 & 1) == 0) {

+        if (*(longlong *)(p_Var13 + 0x28) == 0) {

+          *(undefined8 *)(p_Var13 + 0x28) = uVar11;

+        }

+        else {

+          *(undefined8 *)(p_Var13 + 0x30) = uVar11;

+        }

+      }

+      else {

+        FreeDdeXact(p_Var13);

+      }

+    }

+    Win32HMOptionalThreadLockAlways<tagWND>::~Win32HMOptionalThreadLockAlways<tagWND>

+              ((Win32HMOptionalThreadLockAlways<tagWND> *)local_48);

+    return;

+  }

+  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);

+        }

+        lVar10 = _HMPheFromObject(ptVar8);

+        if ((*(byte *)(lVar10 + 0x19) & 1) == 0) {

+          uVar11 = xxxFreeDdeConv(*(undefined8 *)(ptVar8 + 0x20));

+          *(undefined8 *)(ptVar8 + 0x20) = uVar11;

+        }

+        ptVar12 = Win32HMThreadLockBase<tagXSTATE,0,1>::ManualUnlock<void>

+                            ((Win32HMThreadLockBase<tagXSTATE,0,1> *)local_38);

+        if (ptVar12 != (tagXSTATE *)0x0) {

+          xxxFreeDdeConv(ptVar12);

+        }

+        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;

 }
```

## `memcpy`  (modified)

```diff
--- memcpy
+++ __security_check_cookie
@@ -1,294 +1,13 @@
 

-void * __cdecl memcpy(void *_Dst,void *_Src,size_t _Size)

+/* WARNING: This is an inlined function */

+

+void __cdecl __security_check_cookie(uintptr_t _StackCookie)

 

 {

-  undefined4 *puVar1;

-  undefined1 *puVar2;

-  undefined8 uVar3;

-  undefined8 uVar4;

-  undefined8 uVar5;

-  undefined8 uVar6;

-  undefined8 uVar7;

-  undefined8 uVar8;

-  undefined1 *puVar9;

-  undefined8 *puVar10;

-  undefined8 *puVar11;

-  undefined4 *puVar12;

-  undefined4 *puVar13;

-  undefined4 *puVar14;

-  longlong lVar15;

-  ulonglong uVar16;

-  ulonglong uVar17;

-  undefined4 uVar18;

-  undefined4 uVar19;

-  undefined4 uVar20;

-  undefined4 uVar21;

-  undefined4 uVar22;

-  undefined4 uVar23;

-  undefined4 uVar24;

-  undefined4 uVar25;

-  

-                    /* 0x33bd40  2342  memcpy

-                       0x33bd40  2343  memmove */

-  if (_Size < 8) {

-    if (_Size != 0) {

-      puVar9 = _Dst;

-      if (_Src < _Dst) {

-        puVar9 = (undefined1 *)((longlong)_Dst + _Size);

-        do {

-          puVar2 = puVar9 + ((longlong)_Src - (longlong)_Dst) + -1;

-          puVar9 = puVar9 + -1;

-          _Size = _Size - 1;

-          *puVar9 = *puVar2;

-        } while (_Size != 0);

-        return _Dst;

-      }

-      do {

-        _Size = _Size - 1;

-        *puVar9 = puVar9[(longlong)_Src - (longlong)_Dst];

-        puVar9 = puVar9 + 1;

-      } while (_Size != 0);

-    }

-    return _Dst;

+  if ((_StackCookie == __security_cookie) && ((short)(_StackCookie >> 0x30) == 0)) {

+    return;

   }

-  if (_Size < 0x11) {

-    uVar3 = *(undefined8 *)((longlong)_Src + (_Size - 8));

-    *(undefined8 *)_Dst = *(undefined8 *)_Src;

-    *(undefined8 *)((longlong)_Dst + (_Size - 8)) = uVar3;

-    return _Dst;

-  }

-  if (_Size < 0x21) {

-    uVar3 = *(undefined8 *)((longlong)_Src + 8);

-    puVar10 = (undefined8 *)((longlong)_Src + (_Size - 0x10));

-    uVar4 = *puVar10;

-    uVar5 = puVar10[1];

-    *(undefined8 *)_Dst = *(undefined8 *)_Src;

-    *(undefined8 *)((longlong)_Dst + 8) = uVar3;

-    puVar10 = (undefined8 *)((longlong)_Dst + (_Size - 0x10));

-    *puVar10 = uVar4;

-    puVar10[1] = uVar5;

-    return _Dst;

-  }

-  lVar15 = (longlong)_Src - (longlong)_Dst;

-  if ((_Src < _Dst) && (_Dst < (void *)((longlong)_Src + _Size))) {

-    puVar14 = (undefined4 *)((longlong)_Dst + lVar15 + (_Size - 0x10));

-    uVar18 = puVar14[1];

-    uVar20 = puVar14[2];

-    uVar22 = puVar14[3];

-    puVar12 = (undefined4 *)((longlong)_Dst + (_Size - 0x10));

-    uVar16 = _Size - 0x10;

-    puVar13 = puVar12;

-    uVar19 = *puVar14;

-    uVar21 = uVar18;

-    uVar23 = uVar20;

-    uVar25 = uVar22;

-    if (((ulonglong)puVar12 & 0xf) != 0) {

-      puVar13 = (undefined4 *)((ulonglong)puVar12 & 0xfffffffffffffff0);

-      puVar1 = (undefined4 *)((longlong)puVar13 + lVar15);

-      uVar19 = *puVar1;

-      uVar21 = puVar1[1];

-      uVar23 = puVar1[2];

-      uVar25 = puVar1[3];

-      *puVar12 = *puVar14;

-      *(undefined4 *)((longlong)_Dst + (_Size - 0xc)) = uVar18;

-      *(undefined4 *)((longlong)_Dst + (_Size - 8)) = uVar20;

-      *(undefined4 *)((longlong)_Dst + (_Size - 4)) = uVar22;

-      uVar16 = (longlong)puVar13 - (longlong)_Dst;

-    }

-    uVar17 = uVar16 >> 6;

-    if (uVar17 != 0) {

-      uVar16 = uVar16 & 0x3f;

-      puVar14 = puVar13;

-      uVar18 = uVar19;

-      uVar20 = uVar21;

-      uVar22 = uVar23;

-      uVar24 = uVar25;

-      do {

-        puVar10 = (undefined8 *)((longlong)puVar14 + lVar15 + -0x10);

-        uVar3 = *puVar10;

-        uVar4 = puVar10[1];

-        puVar10 = (undefined8 *)((longlong)puVar14 + lVar15 + -0x20);

-        uVar5 = *puVar10;

-        uVar6 = puVar10[1];

-        puVar10 = (undefined8 *)((longlong)puVar14 + lVar15 + -0x30);

-        uVar7 = *puVar10;

-        uVar8 = puVar10[1];

-        puVar13 = (undefined4 *)((longlong)puVar14 + lVar15 + -0x40);

-        uVar19 = *puVar13;

-        uVar21 = puVar13[1];

-        uVar23 = puVar13[2];

-        uVar25 = puVar13[3];

-        *puVar14 = uVar18;

-        puVar14[1] = uVar20;

-        puVar14[2] = uVar22;

-        puVar14[3] = uVar24;

-        puVar13 = puVar14 + -0x10;

-        uVar17 = uVar17 - 1;

-        *(undefined8 *)(puVar14 + -4) = uVar3;

-        *(undefined8 *)(puVar14 + -2) = uVar4;

-        *(undefined8 *)(puVar14 + -8) = uVar5;

-        *(undefined8 *)(puVar14 + -6) = uVar6;

-        *(undefined8 *)(puVar14 + -0xc) = uVar7;

-        *(undefined8 *)(puVar14 + -10) = uVar8;

-        puVar14 = puVar13;

-        uVar18 = uVar19;

-        uVar20 = uVar21;

-        uVar22 = uVar23;

-        uVar24 = uVar25;

-      } while (uVar17 != 0);

-    }

-    for (uVar17 = uVar16 >> 4; uVar17 != 0; uVar17 = uVar17 - 1) {

-      *puVar13 = uVar19;

-      puVar13[1] = uVar21;

-      puVar13[2] = uVar23;

-      puVar13[3] = uVar25;

-      puVar14 = (undefined4 *)((longlong)puVar13 + lVar15 + -0x10);

-      uVar19 = *puVar14;

-      uVar21 = puVar14[1];

-      uVar23 = puVar14[2];

-      uVar25 = puVar14[3];

-      puVar13 = puVar13 + -4;

-    }

-    if ((uVar16 & 0xf) != 0) {

-      puVar10 = (undefined8 *)((longlong)puVar13 - (uVar16 & 0xf));

-      uVar3 = ((undefined8 *)((longlong)puVar10 + lVar15))[1];

-      *puVar10 = *(undefined8 *)((longlong)puVar10 + lVar15);

-      puVar10[1] = uVar3;

-    }

-    *puVar13 = uVar19;

-    puVar13[1] = uVar21;

-    puVar13[2] = uVar23;

-    puVar13[3] = uVar25;

-    return _Dst;

-  }

-  puVar14 = (undefined4 *)((longlong)_Dst + lVar15);

-  uVar18 = puVar14[1];

-  uVar20 = puVar14[2];

-  uVar22 = puVar14[3];

-  puVar10 = (undefined8 *)((longlong)_Dst + 0x10);

-  uVar19 = *puVar14;

-  uVar21 = uVar18;

-  uVar23 = uVar20;

-  uVar25 = uVar22;

-  if (((ulonglong)puVar10 & 0xf) != 0) {

-    puVar13 = (undefined4 *)(((ulonglong)puVar10 & 0xfffffffffffffff0) + lVar15);

-    uVar19 = *puVar13;

-    uVar21 = puVar13[1];

-    uVar23 = puVar13[2];

-    uVar25 = puVar13[3];

-    *(undefined4 *)_Dst = *puVar14;

-    *(undefined4 *)((longlong)_Dst + 4) = uVar18;

-    *(undefined4 *)((longlong)_Dst + 8) = uVar20;

-    *(undefined4 *)((longlong)_Dst + 0xc) = uVar22;

-    puVar10 = (undefined8 *)(((ulonglong)puVar10 & 0xfffffffffffffff0) + 0x10);

-  }

-  uVar16 = (longlong)_Dst + (_Size - (longlong)puVar10);

-  uVar17 = uVar16 >> 6;

-  if (uVar17 != 0) {

-    if (uVar17 < 0x1001) {

-      uVar16 = uVar16 & 0x3f;

-      puVar11 = puVar10;

-      uVar18 = uVar19;

-      uVar20 = uVar21;

-      uVar22 = uVar23;

-      uVar24 = uVar25;

-      do {

-        uVar3 = *(undefined8 *)((longlong)puVar11 + lVar15);

-        uVar4 = ((undefined8 *)((longlong)puVar11 + lVar15))[1];

-        puVar10 = (undefined8 *)((longlong)puVar11 + lVar15 + 0x10);

-        uVar5 = *puVar10;

-        uVar6 = puVar10[1];

-        puVar10 = (undefined8 *)((longlong)puVar11 + lVar15 + 0x20);

-        uVar7 = *puVar10;

-        uVar8 = puVar10[1];

-        puVar14 = (undefined4 *)((longlong)puVar11 + lVar15 + 0x30);

-        uVar19 = *puVar14;

-        uVar21 = puVar14[1];

-        uVar23 = puVar14[2];

-        uVar25 = puVar14[3];

-        *(undefined4 *)(puVar11 + -2) = uVar18;

-        *(undefined4 *)((longlong)puVar11 + -0xc) = uVar20;

-        *(undefined4 *)(puVar11 + -1) = uVar22;

-        *(undefined4 *)((longlong)puVar11 + -4) = uVar24;

-        puVar10 = puVar11 + 8;

-        uVar17 = uVar17 - 1;

-        *puVar11 = uVar3;

-        puVar11[1] = uVar4;

-        puVar11[2] = uVar5;

-        puVar11[3] = uVar6;

-        puVar11[4] = uVar7;

-        puVar11[5] = uVar8;

-        puVar11 = puVar10;

-        uVar18 = uVar19;

-        uVar20 = uVar21;

-        uVar22 = uVar23;

-        uVar24 = uVar25;

-      } while (uVar17 != 0);

-    }

-    else {

-      uVar17 = uVar16 >> 6;

-      uVar16 = uVar16 & 0x3f;

-      puVar11 = puVar10;

-      uVar18 = uVar19;

-      uVar20 = uVar21;

-      uVar22 = uVar23;

-      uVar24 = uVar25;

-      do {

-        uVar3 = *(undefined8 *)((longlong)puVar11 + lVar15);

-        uVar4 = ((undefined8 *)((longlong)puVar11 + lVar15))[1];

-        puVar10 = (undefined8 *)((longlong)puVar11 + lVar15 + 0x10);

-        uVar5 = *puVar10;

-        uVar6 = puVar10[1];

-        puVar10 = (undefined8 *)((longlong)puVar11 + lVar15 + 0x20);

-        uVar7 = *puVar10;

-        uVar8 = puVar10[1];

-        puVar14 = (undefined4 *)((longlong)puVar11 + lVar15 + 0x30);

-        uVar19 = *puVar14;

-        uVar21 = puVar14[1];

-        uVar23 = puVar14[2];

-        uVar25 = puVar14[3];

-        *(undefined4 *)(puVar11 + -2) = uVar18;

-        *(undefined4 *)((longlong)puVar11 + -0xc) = uVar20;

-        *(undefined4 *)(puVar11 + -1) = uVar22;

-        *(undefined4 *)((longlong)puVar11 + -4) = uVar24;

-        puVar10 = puVar11 + 8;

-        uVar17 = uVar17 - 1;

-        *puVar11 = uVar3;

-        puVar11[1] = uVar4;

-        puVar11[2] = uVar5;

-        puVar11[3] = uVar6;

-        puVar11[4] = uVar7;

-        puVar11[5] = uVar8;

-        puVar11 = puVar10;

-        uVar18 = uVar19;

-        uVar20 = uVar21;

-        uVar22 = uVar23;

-        uVar24 = uVar25;

-      } while (uVar17 != 0);

-    }

-  }

-  for (uVar17 = uVar16 >> 4; uVar17 != 0; uVar17 = uVar17 - 1) {

-    *(undefined4 *)(puVar10 + -2) = uVar19;

-    *(undefined4 *)((longlong)puVar10 + -0xc) = uVar21;

-    *(undefined4 *)(puVar10 + -1) = uVar23;

-    *(undefined4 *)((longlong)puVar10 + -4) = uVar25;

-    puVar14 = (undefined4 *)((longlong)puVar10 + lVar15);

-    uVar19 = *puVar14;

-    uVar21 = puVar14[1];

-    uVar23 = puVar14[2];

-    uVar25 = puVar14[3];

-    puVar10 = puVar10 + 2;

-  }

-  if ((uVar16 & 0xf) != 0) {

-    puVar11 = (undefined8 *)((longlong)puVar10 + ((uVar16 & 0xf) - 0x10));

-    uVar3 = ((undefined8 *)((longlong)puVar11 + lVar15))[1];

-    *puVar11 = *(undefined8 *)((longlong)puVar11 + lVar15);

-    puVar11[1] = uVar3;

-  }

-  *(undefined4 *)(puVar10 + -2) = uVar19;

-  *(undefined4 *)((longlong)puVar10 + -0xc) = uVar21;

-  *(undefined4 *)(puVar10 + -1) = uVar23;

-  *(undefined4 *)((longlong)puVar10 + -4) = uVar25;

-  return _Dst;

+                    /* WARNING: Subroutine does not return */

+  __report_gsfailure(_StackCookie);

 }
```

## `NtUserSetClipboardData`  (modified)

```diff
--- NtUserSetClipboardData
+++ NtUserSetClipboardData
@@ -1,11 +1,240 @@
 

-void NtUserSetClipboardData(void)

+longlong NtUserSetClipboardData(UINT param_1,HANDLE param_2,_GUID *param_3,_GUID *param_4)

 

 {

-  code *pcVar1;

+  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;

+  ulonglong uVar14;

+  longlong lVar15;

+  HANDLE pvVar16;

+  uint *puVar17;

+  _GUID *p_Var18;

+  longlong lVar19;

+  _GUID *p_Var20;

+  undefined8 local_res20;

+  _GUID local_78;

+  undefined1 local_68 [24];

+  undefined4 local_50;

+  undefined4 local_4c;

+  undefined8 local_40;

   

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

-  (*pcVar1)();

-  return;

+                    /* 0x240770  1962  NtUserSetClipboardData */

+  local_40 = 0;

+  p_Var18 = param_3;

+  lVar10 = EnterCrit(0,0);

+  ptVar11 = PtiCurrent();

+  lVar19 = *(longlong *)(ptVar11 + 0x1d0) + 0x3c8;

+  local_68._0_8_ = lVar19;

+  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();

+    uVar14 = 0;

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

+      uVar14 = (ulonglong)plVar13 & -(ulonglong)(*plVar13 != 0);

+    }

+    bVar6 = UIPrivilegeIsolation::IsInAppContainer((tagUIPI_INFO *)(uVar14 + 0x358));

+    if (!bVar6) {

+LAB_0:

+      p_Var18 = *(_GUID **)MmUserProbeAddress_exref;

+      if (param_3 < *(_GUID **)MmUserProbeAddress_exref) {

+        p_Var18 = param_3;

+      }

+      local_40._0_4_ = p_Var18->Data1;

+      uVar2 = p_Var18->Data2;

+      uVar3 = p_Var18->Data3;

+      local_40._4_4_ = CONCAT22(uVar3,uVar2);

+      p_Var18 = (_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_1) {

+        puVar17 = &DAT_1;

+        cVar7 = _tlgKeywordOn(&DAT_1,0x400000000000);

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

+          if (iVar8 == 0) {

+            local_78._0_8_ = lVar19;

+            uVar9 = UserGetLastError();

+            if (0 < (int)uVar9) {

+              uVar9 = uVar9 & 0xffff | 0x80070000;

+            }

+          }

+          else {

+            uVar9 = 0;

+            local_78._0_8_ = lVar19;

+          }

+          local_res20 = CONCAT44(local_res20._4_4_,uVar9);

+          local_78.Data4 = (uchar  [8])0x14034aaf8;

+          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_Var18 = (_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_2,p_Var20,(_tlgWrapperByVal<8> *)p_Var18

+                     ,(_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_3)) {

+          puVar17 = &DAT_3;

+          cVar7 = _tlgKeywordOn(&DAT_3,1);

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

+            local_res20 = lVar19;

+            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_4,p_Var20,p_Var18,

+                       (_tlgWrapSz<char> *)(local_68 + 8),(_tlgWrapperByVal<4> *)local_68,

+                       (_tlgWrapSz<unsigned_short> *)&local_res20);

+          }

+        }

+      }

+      goto LAB_5;

+    }

+    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_1) {

+        puVar17 = &DAT_1;

+        cVar7 = _tlgKeywordOn(&DAT_1,0x400000000000);

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

+          local_res20 = CONCAT44(local_res20._4_4_,0x80070005);

+          local_78.Data4 = (uchar  [8])0x140356058;

+          local_68._0_8_ = 1;

+          param_4 = (_GUID *)local_68;

+          local_78._0_8_ = lVar19;

+          _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_2,p_Var18,(_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_3) {

+        puVar17 = &DAT_3;

+        cVar7 = _tlgKeywordOn(&DAT_3,1);

+        auVar5 = (uchar  [8])"NoForeground";

+        auVar4 = local_78.Data4;

+joined_r0x000140240a64:

+        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_ = lVar19;

+          _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_4,p_Var18,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_0;

+      if (5 < DAT_1) {

+        puVar17 = &DAT_1;

+        cVar7 = _tlgKeywordOn(&DAT_1,0x400000000000);

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

+          local_res20 = CONCAT44(local_res20._4_4_,0x80070005);

+          local_78.Data4 = (uchar  [8])0x140355f68;

+          local_68._0_8_ = 1;

+          param_4 = (_GUID *)local_68;

+          local_78._0_8_ = lVar19;

+          _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_2,p_Var18,(_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_3) {

+        puVar17 = &DAT_3;

+        cVar7 = _tlgKeywordOn(&DAT_3,1);

+        auVar5 = (uchar  [8])"UnsupportedFormatForLowBoxApp";

+        auVar4 = local_78.Data4;

+        goto joined_r0x000140240a64;

+      }

+    }

+  }

+  else {

+    EtwTraceUiLimitWriteClipboard(uVar1,&local_50);

+    if (5 < DAT_1) {

+      puVar17 = &DAT_1;

+      cVar7 = _tlgKeywordOn(&DAT_1,0x400000000000);

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

+        local_res20 = CONCAT44(local_res20._4_4_,0x80070005);

+        local_78.Data4 = (uchar  [8])0x140355f40;

+        local_78.Data1 = 1;

+        local_78.Data2 = 0;

+        local_78.Data3 = 0;

+        param_4 = &local_78;

+        local_68._0_8_ = lVar19;

+        _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_2,p_Var18,(_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_3) {

+      puVar17 = &DAT_3;

+      cVar7 = _tlgKeywordOn(&DAT_3,1);

+      auVar5 = (uchar  [8])"RestrictedThread";

+      auVar4 = local_78.Data4;

+      goto joined_r0x000140240a64;

+    }

+  }

+  local_78.Data4 = auVar4;

+  iVar8 = 0;

+  UserSetLastError(5);

+LAB_5:

+  UserSessionSwitchLeaveCrit();

+  return (longlong)iVar8;

 }
```

## `NtUserGetClipboardData`  (modified)

```diff
--- NtUserGetClipboardData
+++ NtUserGetClipboardData
@@ -1,27 +1,268 @@
 

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

-/* WARNING: Removing unreachable block (ram,0x00014023e558) */

-

-undefined8 NtUserGetClipboardData(void)

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

+

+longlong NtUserGetClipboardData(int param_1,void *param_2,_GUID *param_3,_GUID *param_4)

 

 {

-  undefined4 uVar1;

-  longlong unaff_RBX;

-  undefined4 uStack0000000000000030;

-  longlong in_stack_00000068;

-  longlong in_stack_000000a0;

+  undefined8 *puVar1;

+  char *pcVar2;

+  char *pcVar3;

+  char cVar4;

+  bool bVar5;

+  int iVar6;

+  undefined4 uVar7;

+  uint uVar8;

+  tagTHREADINFO *ptVar9;

+  tagWINDOWSTATION *ptVar10;

+  longlong lVar11;

+  uint *puVar12;

+  uchar auVar13 [8];

+  _GUID *p_Var14;

+  _GUID *p_Var15;

+  _GUID local_res18;

+  undefined8 in_stack_ffffffffffffff48;

+  undefined4 uVar16;

+  undefined1 local_98 [16];

+  char *local_88 [4];

+  undefined1 local_68 [16];

+  undefined8 uStack_58;

+  Win32RawLockedNtObject<tagWINDOWSTATION> local_48 [32];

   

-  *(char *)(unaff_RBX + 0x11) = *(char *)(unaff_RBX + 0x11) + '\x01';

-  uStack0000000000000030 = 0xc0000206;

-  uVar1 = RtlNtStatusToDosError(0xc0000206);

-  UserSetLastError(uVar1);

-  if (in_stack_000000a0 != 0) {

-    Win32FreePool();

+                    /* 0x23bce0  1671  NtUserGetClipboardData */

+  uVar16 = (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();

+  auVar13 = (uchar  [8])(*(longlong *)(ptVar9 + 0x1d0) + 0x3c8);

+  local_98._8_8_ = auVar13;

+  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 = auVar13;

+        _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_r0x00014023bf14:

+      local_98._0_8_ = pcVar3;

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

+        local_res18.Data1 = 0x80070005;

+        local_res18.Data4 = auVar13;

+        _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_;

+      }

+    }

   }

-  if (in_stack_00000068 != 0) {

-    Win32FreePool(in_stack_00000068);

+  else {

+    bVar5 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(ptVar9 + 0x1d0),2);

+    if (bVar5) {

+      bVar5 = UIPrivilegeIsolation::IsInAppContainer

+                        ((tagUIPI_INFO *)(*(longlong *)(ptVar9 + 0x1d0) + 0x358));

+      if ((bVar5) &&

+         ((iVar6 = InForegroundQueue(ptVar9,1), iVar6 == 0 || ((param_1 != 1 && (param_1 != 0xd)))))

+         ) {

+        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 = auVar13;

+            _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 = auVar13;

+            _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);

+      }

+      else {

+        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_Var15 = &local_res18;

+        EtwTraceUiAuditReadClipboard

+                  (*(undefined4 *)(*(longlong *)(ptVar9 + 0x1d0) + 0x38),(longlong)&local_res18 + 8,

+                   uVar7,p_Var15,CONCAT44(uVar16,*(undefined4 *)(ptVar10 + 0x90)));

+        local_68._8_4_ = param_1;

+        p_Var14 = (_GUID *)(local_68 + 8);

+        lVar11 = xxxGetClipboardData(ptVar10,param_1);

+        if (lVar11 != 0) {

+          if (*(void **)MmUserProbeAddress_exref <= param_2) {

+            param_2 = *(void **)MmUserProbeAddress_exref;

+          }

+          p_Var14 = (_GUID *)&DAT_4;

+          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_ = auVar13;

+              uVar8 = UserGetLastError();

+              if (0 < (int)uVar8) {

+                uVar8 = uVar8 & 0xffff | 0x80070000;

+              }

+            }

+            else {

+              uVar8 = 0;

+              local_res18._0_8_ = auVar13;

+            }

+            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_Var15 = (_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_Var14,

+                       (_tlgWrapperByVal<8> *)p_Var15,(_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_ = auVar13;

+              uVar8 = UserGetLastError();

+              if (0 < (int)uVar8) {

+                uVar8 = uVar8 & 0xffff | 0x80070000;

+              }

+              local_98._8_4_ = uVar8;

+              local_res18.Data4 = (uchar  [8])0x14034aaf8;

+              _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_Var14,p_Var15,

+                         (_tlgWrapSz<char> *)((longlong)&local_res18 + 8),

+                         (_tlgWrapperByVal<4> *)(local_98 + 8),

+                         (_tlgWrapSz<unsigned_short> *)&local_res18);

+            }

+          }

+        }

+      }

+      goto LAB_5;

+    }

+    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 = auVar13;

+        _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_r0x00014023bf14;

+    }

   }

+  local_98._0_8_ = pcVar2;

+  lVar11 = 0;

+LAB_5:

   UserSessionSwitchLeaveCrit();

-  return 0;

+  return lVar11;

 }
```

## `GreWindowLayoutComplete`  (modified)

```diff
--- GreWindowLayoutComplete
+++ GreWindowLayoutComplete
@@ -1,96 +1,50 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-ulonglong GreWindowLayoutComplete(longlong param_1,_HEAD *param_2,_Win32HMThreadLockItem *param_3)

+undefined8 GreWindowLayoutComplete(HWND__ *param_1,int *param_2)

 

 {

-  uint *puVar1;

-  tagWND *ptVar2;

-  int iVar3;

-  tagTHREADINFO *in_RAX;

-  tagTHREADINFO *ptVar4;

-  tagMENU *ptVar5;

-  ulonglong unaff_RBX;

-  longlong unaff_RBP;

-  _HEAD *unaff_RSI;

-  longlong lVar6;

-  longlong unaff_R15;

-  float10 in_ST0;

+  int iVar1;

+  SESSION_GLOBALS *pSVar2;

+  HSEMAPHORE__ *pHVar3;

+  int iVar4;

+  undefined8 uVar5;

+  HSEMAPHORE__ *pHVar6;

+  int local_res10 [2];

+  DWMSPRITEREF local_48 [32];

+  DWMSPRITE *local_28;

   

-  ptVar4 = in_RAX + -0x75;

-  *(int *)ptVar4 = *(int *)ptVar4 + -1;

-  if (*(int *)ptVar4 == 0) {

-    param_2 = unaff_RSI;

-    if (unaff_RSI == (_HEAD *)0x0) {

-      if (**(ulonglong **)(unaff_RBP + -0x20) == unaff_RBX) goto LAB_0;

-      param_2 = (_HEAD *)**(undefined8 **)(unaff_RBP + -0x20);

+  iVar4 = 0;

+  local_res10[0] = 0;

+  uVar5 = 0;

+  pSVar2 = Gre::Base::Globals();

+  pHVar6 = (HSEMAPHORE__ *)(*(longlong *)pSVar2 + 0x478);

+  GreAcquireSemaphoreCommon<2,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+            (GreAcquireSemaphoreInternal_exref,pHVar6);

+  iVar1 = IsDwmActive();

+  if (iVar1 != 0) {

+    pHVar3 = (HSEMAPHORE__ *)(*(longlong *)pSVar2 + 0x208);

+    GreAcquireSemaphoreCommon<7,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+              (GreAcquireSemaphoreInternal_exref,pHVar3);

+    iVar1 = IsDwmActive();

+    if (iVar1 != 0) {

+      DWMSPRITEREF::DWMSPRITEREF(local_48,param_1);

+      if (((local_28 != (DWMSPRITE *)0x0) && (uVar5 = 1, iVar4 = 0, 0 < *(int *)(local_28 + 0x7c)))

+         && (0 < *(int *)(local_28 + 0x80))) {

+        *(int *)(local_28 + 0x80) = *(int *)(local_28 + 0x80) + -1;

+        CheckAndProcessWindowResizeComplete(local_28,0,local_res10);

+        iVar4 = local_res10[0];

+      }

+      DWMSPRITEREF::~DWMSPRITEREF(local_48);

     }

-    in_RAX = PtiCurrent();

-    param_3 = (_Win32HMThreadLockItem *)(unaff_RBP + -0x40);

-    unaff_RSI = param_2;

+    if (pHVar3 != (HSEMAPHORE__ *)0x0) {

+      GreReleaseSemaphoreCommon<7,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+                (GreReleaseSemaphoreExclusiveInternal_exref,pHVar3);

+    }

   }

-  else if (param_1 == 1) {

-    *(int *)(in_RAX + -0x77) = (int)in_ST0;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-    halt_baddata();

+  *param_2 = iVar4;

+  if (pHVar6 != (HSEMAPHORE__ *)0x0) {

+    GreReleaseSemaphoreCommon<2,void_(__cdecl*)(HSEMAPHORE__*___ptr64)>

+              (GreReleaseSemaphoreExclusiveInternal_exref,pHVar6);

   }

-  Win32HM_LockIntoThread<0>(in_RAX,param_2,param_3);

-  *(uint *)(*(longlong *)(unaff_RSI + 0x28) + 0x28) =

-       *(uint *)(*(longlong *)(unaff_RSI + 0x28) + 0x28) | 0x200;

-  lVar6 = *(longlong *)(**(longlong **)(unaff_RBP + -0x20) + 0x28);

-  if ((*(byte *)(unaff_RBP + 0x58) & 1) == 0) {

-    puVar1 = (uint *)(lVar6 + 0x28);

-    *puVar1 = *puVar1 | 0x10;

-  }

-  else {

-    puVar1 = (uint *)(lVar6 + 0x28);

-    *puVar1 = *puVar1 & 0xffffffef;

-  }

-  ptVar2 = *(tagWND **)(**(longlong **)(unaff_RBP + -0x20) + 0x50);

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

-            ((Win32HMThreadLockBase<tagWND,1,0> *)(unaff_RBP + -0x30),ptVar2);

-  if (((unaff_R15 != *(longlong *)(**(longlong **)(unaff_RBP + -0x20) + 0x50)) ||

-      (*(int *)(**(longlong **)(unaff_RBP + -0x20) + 0x40) == (int)unaff_RBX)) ||

-     (*(int *)(**(longlong **)(unaff_RBP + -0x20) + 0x44) == (int)unaff_RBX)) {

-    xxxMenuBarCompute(unaff_RBP + -0x20);

-  }

-  iVar3 = IsInsideUserApiHook();

-  if (((iVar3 != 0) && (ptVar2 != (tagWND *)0x0)) &&

-     (iVar3 = xxxSendUAHInitMenuMessage(ptVar2,unaff_RBP + -0x20), iVar3 != 0)) {

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

-    if (lVar6 == 0) {

-      lVar6 = **(longlong **)(unaff_RBP + -0x20);

-    }

-    xxxSendUAHMenuMessage(ptVar2,0x91,lVar6);

-  }

-  ptVar4 = PtiCurrent();

-  Win32HM_UnlockFromThread<1>(ptVar4,(_Win32HMThreadLockItem *)(unaff_RBP + -0x30));

-  ptVar5 = *(tagMENU **)(unaff_RBP + -0x10);

-  if (ptVar5 == (tagMENU *)0x0) {

-    ptVar5 = (tagMENU *)**(undefined8 **)(unaff_RBP + -0x20);

-  }

-  iVar3 = MNIsUAHMenu(ptVar5);

-  if (iVar3 == 0) {

-    if (*(ulonglong *)(*(longlong *)(**(longlong **)(unaff_RBP + -0x20) + 0x28) + 0x18) == unaff_RBX

-       ) {

-      W32GetUserSessionState();

-    }

-    GreSelectBrush();

-    NtGdiPatBlt();

-    xxxMenuDraw();

-    GreSelectBrush();

-  }

-  else {

-    xxxMenuDraw();

-  }

-  unaff_RBX = (ulonglong)*(uint *)(**(longlong **)(unaff_RBP + -0x20) + 0x44);

-  puVar1 = (uint *)(*(longlong *)(*(longlong *)(unaff_RBP + -0x38) + 0x28) + 0x28);

-  *puVar1 = *puVar1 & 0xfffffdff;

-  ptVar4 = PtiCurrent();

-  Win32HM_UnlockFromThread<0>(ptVar4,(_Win32HMThreadLockItem *)(unaff_RBP + -0x40));

-LAB_0:

-  SmartObjStackRef<tagMENU>::~SmartObjStackRef<tagMENU>

-            ((SmartObjStackRef<tagMENU> *)(unaff_RBP + -0x20));

-  return unaff_RBX & 0xffffffff;

+  return uVar5;

 }
```

## `xxxDDETrackPostHook`  (modified)

```diff
--- xxxDDETrackPostHook
+++ xxxDDETrackPostHook
@@ -1,184 +1,157 @@
 

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

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

 

-uint xxxDDETrackPostHook(byte param_1,undefined8 param_2,longlong param_3)

+ulong xxxDDETrackPostHook(ulong *param_1,tagWND *param_2,undefined8 param_3,ushort *param_4)

 

 {

-  byte *pbVar1;

-  uint *puVar2;

-  byte bVar3;

-  short sVar5;

-  code *pcVar6;

-  int iVar7;

-  uint uVar8;

-  uint uVar9;

-  longlong in_RAX;

-  longlong lVar10;

-  uint unaff_EBX;

-  undefined4 uVar11;

-  uint unaff_EDI;

-  byte bVar12;

-  uint unaff_R12D;

-  longlong unaff_R13;

-  longlong unaff_R14;

-  uint unaff_R15D;

-  bool bVar13;

-  longlong in_stack_00000060;

-  int in_stack_00000068;

-  undefined2 uStack0000000000000078;

-  uint uStack000000000000007c;

-  int iStack0000000000000080;

-  uint uStack0000000000000084;

-  int iStack0000000000000088;

-  int iStack000000000000008c;

-  int in_stack_00000090;

-  undefined4 in_stack_00000098;

-  undefined8 in_stack_000000a0;

-  int in_stack_0000032c;

-  byte bVar4;

+  tagFREELIST *ptVar1;

+  int iVar2;

+  longlong lVar3;

+  tagTHREADINFO *ptVar4;

+  tagWND *ptVar5;

+  tagDDECONV *ptVar6;

+  uint uVar7;

+  undefined8 uVar8;

+  ulong uVar9;

+  _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;

   

-  pbVar1 = (byte *)(in_RAX + -0x75);

-  bVar12 = *pbVar1;

-  *pbVar1 = *pbVar1 + param_1;

-  pbVar1 = (byte *)(param_3 + -1);

-  bVar3 = *pbVar1;

-  bVar4 = *pbVar1;

-  *pbVar1 = bVar4 + param_1 + CARRY1(bVar12,param_1);

-  if (((int)in_RAX + 0x16ab0a +

-       (uint)(CARRY1(bVar3,param_1) || CARRY1(bVar4 + param_1,CARRY1(bVar12,param_1))) == 0) ||

-     (iVar7 = DrvSessionHasAnyGraphicsDevice(), uVar8 = unaff_EBX, iVar7 != 0)) {

-    DispBrokerUpdateKernelDisplayPolicies();

-    lVar10 = W32GetUserSessionState();

-    uVar8 = xxxUserSetDisplayConfig

-                      (0,0,(-(uint)(in_stack_0000032c != 0) & 0x100) + 0x88f,0x802,

-                       *(undefined8 *)(lVar10 + 0x4b60));

-    if ((int)uVar8 < 0) {

-      bVar12 = (byte)unaff_R12D;

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

-          ((bVar12 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-         (bVar12 <= (byte)WPP_GLOBAL_Control[0x29])) {

-        unaff_EBX = unaff_R15D & 0xff;

+  ptVar6 = (tagDDECONV *)0x0;

+  lVar3 = W32GetUserSessionState();

+  if ((*(uint *)(lVar3 + 0x105e0) & 0x4000000) != 0) {

+    uVar9 = *param_1;

+    local_28 = 0;

+    local_58 = 0;

+    uStack_50 = 0;

+    local_48 = 0;

+    uStack_40 = 0;

+    local_38 = 0;

+    uStack_30 = 0;

+    if ((((uVar9 == 0x3e2) || (uVar9 == 0x3e4)) || (uVar9 == 0x3e5)) ||

+       ((uVar9 == 999 || (uVar9 == 1000)))) {

+      xxxClientGetDDEHookData(uVar9,*(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) {

+    uVar9 = (*param_1 == 0x3e1) + 1;

+  }

+  else {

+    ptVar6 = FindDdeConv(ptVar5,param_2);

+    if (ptVar6 == (tagDDECONV *)0x0) {

+      uVar9 = (ulong)(*param_1 == 0x3e1);

+    }

+    else {

+      ptVar4 = PtiCurrent();

+      if ((ptVar4 != *(tagTHREADINFO **)(ptVar6 + 0x10)) &&

+         (ptVar4 = PtiCurrent(), *(short *)(ptVar4 + 0x2a0) != 0x400)) {

+        UserSetLastError(0x580);

+        return 0;

       }

-      bVar13 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

-      if (((char)unaff_EBX != '\0') || (bVar13)) {

-        lVar10 = W32GetUserSessionState();

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)unaff_EBX,bVar13,

-                   *(undefined8 *)(lVar10 + 0x10f88),bVar12);

+      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) {

+        lVar3 = _HMPheFromObject(ptVar6);

+        if ((*(byte *)(lVar3 + 0x19) & 1) == 0) {

+          if (*param_1 != 0x3e1) {

+            uVar7 = *(uint *)(ptVar6 + 0x50) & 6;

+            goto LAB_0;

+          }

+          goto LAB_1;

+        }

+LAB_2:

+        uVar9 = 1;

       }

-      goto LAB_0;

+      else {

+        lVar3 = _HMPheFromObject();

+        if ((*(byte *)(lVar3 + 0x19) & 1) != 0) goto LAB_2;

+        if (*param_1 != 0x3e1) {

+          uVar7 = *(uint *)(ptVar6 + 0x50) & 0xe;

+LAB_0:

+          if (uVar7 != 0) goto LAB_2;

+        }

+LAB_1:

+        if (*(longlong *)(ptVar6 + 0x38) == 0) {

+          if ((*(uint *)(ptVar6 + 0x50) & 1) == 0) {

+            uVar9 = xxxUnexpectedClientPost(param_1,(__int64 *)param_4,ptVar6);

+          }

+          else {

+            uVar9 = xxxUnexpectedServerPost(param_1,(__int64 *)param_4,ptVar6);

+          }

+        }

+        else {

+          uVar9 = (**(code **)(*(longlong *)(ptVar6 + 0x38) + 0x20))();

+        }

+      }

+      Win32HMThreadLockBase<tagKL,0,0>::~Win32HMThreadLockBase<tagKL,0,0>

+                ((Win32HMThreadLockBase<tagKL,0,0> *)local_68);

     }

   }

-  iVar7 = IsRemoteConnection();

-  if (iVar7 == 0) {

-    if (*(short *)(unaff_R14 + 0x260) != (short)unaff_EBX) {

-      RemoveInputDevices();

+  if (uVar9 != 1) {

+    return uVar9;

+  }

+  ptVar4 = PtiCurrent();

+  LOCK();

+  uVar7 = *(uint *)(ptVar4 + 0x210);

+  if (uVar7 == 0) {

+    *(uint *)(ptVar4 + 0x210) = 0;

+    uVar7 = 0;

+  }

+  UNLOCK();

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

+    return 1;

+  }

+  uVar8 = 0x8000;

+  uVar7 = *param_1 & 0xffff;

+  if (uVar7 == 0x3e2) {

+    uVar8 = 0x8101;

+  }

+  else if (uVar7 != 0x3e3) {

+    if (uVar7 == 0x3e4) {

+      uVar8 = 0x8001;

     }

-    AttachInputDevices(unaff_R15D);

-    xxxUserReinitializeAutoRotation();

-    UserSessionSwitchLeaveCrit();

-    RegisterCDROMNotify();

-    uStack0000000000000084 = unaff_R15D;

-    EnterCrit(unaff_R15D,0);

-  }

-  else {

-    if (uStack000000000000007c != unaff_EBX) {

-      lVar10 = W32GetUserSessionState();

-      iVar7 = DrvEscapeRemoteDrivers

-                        (*(undefined8 *)(*(longlong *)(lVar10 + 0xdf10) + 0x10),

-                         *(undefined2 *)(unaff_R14 + 0x138),*(undefined8 *)(unaff_R13 + 0x28),2,

-                         *(undefined8 *)(unaff_R14 + 0x1f8));

-      if (iVar7 == 0) {

-        uVar8 = unaff_EDI;

+    else {

+      if (uVar7 != 0x3e5) {

+        if (uVar7 == 0x3e6) goto LAB_3;

+        if (uVar7 != 999) {

+          if (uVar7 != 1000) {

+            return 1;

+          }

+          uVar8 = 0x8800;

+          goto LAB_3;

+        }

       }

-    }

-    AttachInputDevices(0);

-  }

-  uVar11 = 2;

-  lVar10 = W32GetUserSessionState();

-  RemoteRedrawScreen(lVar10 + 0x4b60);

-  InitKeyboard();

-  UpdateKeyLights(0);

-  SetPointer(unaff_R15D);

-  lVar10 = W32GetUserSessionState();

-  *(undefined4 *)(lVar10 + 0x8e8c) = 9;

-  TransitionCursorSuppressionState(10);

-  lVar10 = W32GetUserSessionState();

-  if ((*(uint *)(lVar10 + 0x8e8c) == unaff_R15D) ||

-     (lVar10 = W32GetUserSessionState(), *(int *)(lVar10 + 0x8e8c) == 5)) {

-    lVar10 = W32GetUserSessionState();

-    uVar11 = *(undefined4 *)(lVar10 + 0x8e8c);

-  }

-  TransitionCursorSuppressionState(uVar11,0);

-  SetConnectedState(unaff_R15D,*(undefined4 *)(unaff_R14 + 0x140));

-  iVar7 = IsRemoteConnection();

-  if ((iVar7 == 0) ||

-     (FastGetProfileIntW(0,0x27,L"CursorBlinkEnable",0,&stack0x00000068), in_stack_00000068 != 0)) {

-    lVar10 = W32GetUserSessionState();

-    puVar2 = (uint *)(*(longlong *)(lVar10 + 0x4e30) + 0x8bc);

-    *puVar2 = *puVar2 | unaff_R12D;

-  }

-  else {

-    lVar10 = W32GetUserSessionState();

-    puVar2 = (uint *)(*(longlong *)(lVar10 + 0x4e30) + 0x8bc);

-    *puVar2 = *puVar2 & 0xfffffffb;

-  }

-  lVar10 = W32GetUserSessionState();

-  sVar5 = *(short *)(lVar10 + 0x10df0);

-  lVar10 = DxDdGetDxgkWin32kInterface();

-  pcVar6 = *(code **)(lVar10 + 0x180);

-  uVar9 = DrvGetRemoteDeviceCount();

-  (*pcVar6)(sVar5 == 0,uVar9);

-  lVar10 = W32GetUserSessionState();

-  CitSessionConnectChange(unaff_R15D & 0xff,*(short *)(lVar10 + 0x10df0) == 0);

-LAB_0:

-  SetMouseTrails();

-  if (((int)uVar8 < 0) && (iStack0000000000000080 != 0)) {

-    GreDrvDisconnect();

-  }

-  if ((uVar8 == 0) && (lVar10 = W32GetUserSessionState(), *(short *)(lVar10 + 0x10df0) == 0)) {

-    W32GetCurrentWin32kSessionId();

-    RtlSetActiveConsoleId();

-  }

-  lVar10 = W32GetUserSessionState();

-  if (*(short *)(lVar10 + 0x10df0) == 0) {

-    DrvNotifySessionStateChange(unaff_R12D);

-  }

-  if ((int)uVar8 < 0) {

-    CleanupRemoteHandles();

-  }

-  SetConsoleSwitchInProgress(0);

-  DxgkEngNotifyDisplayChange((char)unaff_R15D);

-  if ((int)uVar8 < 0) {

-    *(undefined4 *)(unaff_R14 + 0xb0) = in_stack_00000098;

-    *(undefined4 *)(unaff_R13 + 0x40) = in_stack_00000098;

-    if (uStack0000000000000084 != 0) {

-      UnregisterDeviceClassNotifications();

-    }

-    if (iStack0000000000000088 != 0) {

-      DrvCloseGraphicsDevices(unaff_R15D);

-    }

-    if (iStack000000000000008c != 0) {

-      SetProtocolType(uStack0000000000000078);

-    }

-    if (in_stack_00000090 != 0) {

-      DrvSetGraphicsDevices(&stack0x000002a0);

+      uVar8 = 0x8083;

     }

   }

-  if (in_stack_00000060 != 0) {

-    Win32FreePool(in_stack_00000060);

+LAB_3:

+  uVar9 = 1;

+  if (ptVar6 != (tagDDECONV *)0x0) {

+    xxxClientFreeDDEHandle(*(undefined8 *)param_4,uVar8);

+    uVar9 = 3;

   }

-  if ((uVar8 == 0) && (iVar7 = IsRemoteConnection(), iVar7 != 0)) {

-    lVar10 = W32GetUserSessionState();

-    DrvEscapeRemoteDrivers

-              (*(undefined8 *)(*(longlong *)(lVar10 + 0xdf10) + 0x10),

-               *(undefined2 *)(unaff_R14 + 0x138),*(undefined8 *)(unaff_R13 + 0x28),6,0);

-  }

-  DrvOcclusionStateChangeNotify();

-  DispBrokerAsyncSessionStateChanged(in_stack_000000a0);

-  CDisplayScenarioContextScope::~CDisplayScenarioContextScope

-            ((CDisplayScenarioContextScope *)&stack0x000000a8);

-  return uVar8;

+  return uVar9;

 }
```

## `GetCharDimensions`  (modified)

```diff
--- GetCharDimensions
+++ GetCharDimensions
@@ -1,77 +1,110 @@
 

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

-

-void GetCharDimensions(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

-                      undefined4 param_5)

+ulonglong GetCharDimensions(HDC param_1,LONG *param_2,LONG *param_3)

 

 {

-  undefined4 uVar1;

-  undefined4 uVar2;

-  undefined8 uVar3;

-  undefined8 uVar4;

-  undefined8 uVar5;

-  undefined8 uVar6;

-  int iVar7;

-  undefined4 in_EAX;

-  undefined4 unaff_EBX;

-  longlong unaff_RBP;

-  int unaff_ESI;

-  int unaff_EDI;

-  undefined4 in_R10D;

-  undefined4 in_R11D;

-  int unaff_R12D;

-  int unaff_R14D;

-  undefined8 *unaff_R15;

-  undefined4 in_XMM0_Da;

+  LONG *pLVar1;

+  LONG LVar2;

+  int iVar3;

+  BOOL BVar4;

+  longlong lVar5;

+  LONG LVar6;

+  LONG LVar7;

+  LONG LVar8;

+  LONG LVar9;

+  LONG LVar10;

+  LONG LVar11;

+  LONG LVar12;

+  LONG LVar13;

+  LONG LVar14;

+  undefined8 local_res10;

+  tagTEXTMETRICW local_58;

   

-  *(undefined4 *)unaff_R15 = in_R10D;

-  *(undefined4 *)((longlong)unaff_R15 + 4) = in_R11D;

-  *(undefined4 *)(unaff_R15 + 1) = unaff_EBX;

-  *(undefined4 *)((longlong)unaff_R15 + 0xc) = param_2;

-  *(undefined4 *)(unaff_R15 + 2) = param_3;

-  *(undefined4 *)((longlong)unaff_R15 + 0x14) = param_4;

-  *(undefined4 *)(unaff_R15 + 3) = param_1;

-  *(undefined4 *)((longlong)unaff_R15 + 0x1c) = param_5;

-  *(undefined4 *)(unaff_R15 + 4) = in_EAX;

-  ComputeInverseMatrix3x3(in_XMM0_Da,unaff_RBP + -0x41);

-  uVar2 = *(undefined4 *)(unaff_RBP + -0x21);

-  *(int *)((longlong)unaff_R15 + 0x4c) = unaff_EDI;

-  if (unaff_EDI != 1000000) {

-    if (unaff_EDI == 0) {

-      *(int *)(unaff_RBP + -0x51) = unaff_R12D;

-      unaff_R14D = unaff_R12D;

-      unaff_ESI = unaff_R12D;

+  local_58.tmHeight = 0;

+  local_58.tmAscent = 0;

+  local_58.tmDescent = 0;

+  local_58.tmInternalLeading = 0;

+  local_58.tmDefaultChar = L'\0';

+  local_58.tmBreakChar = L'\0';

+  local_58.tmItalic = '\0';

+  local_58.tmUnderlined = '\0';

+  local_58.tmStruckOut = '\0';

+  local_58.tmPitchAndFamily = '\0';

+  local_58.tmExternalLeading = 0;

+  local_58.tmAveCharWidth = 0;

+  local_58.tmMaxCharWidth = 0;

+  local_58.tmWeight = 0;

+  local_58._56_4_ = 0;

+  local_58.tmOverhang = 0;

+  local_58.tmDigitizedAspectX = 0;

+  local_58.tmDigitizedAspectY = 0;

+  local_58.tmFirstChar = L'\0';

+  local_58.tmLastChar = L'\0';

+  iVar3 = GreTextInitialized();

+  if ((iVar3 == 0) || (BVar4 = _GetTextMetricsW(param_1,&local_58), BVar4 == 0)) {

+    lVar5 = Get96DpiServerInfo();

+    local_58.tmExternalLeading = *(LONG *)(lVar5 + 0x38);

+    local_58.tmAveCharWidth = *(uint *)(lVar5 + 0x3c);

+    local_58.tmMaxCharWidth = *(LONG *)(lVar5 + 0x40);

+    local_58.tmWeight = *(LONG *)(lVar5 + 0x44);

+    LVar6 = *(LONG *)(lVar5 + 0x60);

+    local_58._48_8_ = *(ulonglong *)(lVar5 + 0x58);

+    pLVar1 = (LONG *)(lVar5 + 0x28);

+    LVar7 = *pLVar1;

+    LVar8 = *(LONG *)(lVar5 + 0x2c);

+    local_58.tmHeight = pLVar1[0];

+    local_58.tmAscent = pLVar1[1];

+    pLVar1 = (LONG *)(lVar5 + 0x30);

+    LVar9 = *pLVar1;

+    LVar10 = *(LONG *)(lVar5 + 0x34);

+    local_58.tmDescent = pLVar1[0];

+    local_58.tmInternalLeading = pLVar1[1];

+    LVar11 = *(LONG *)(lVar5 + 0x48);

+    LVar12 = *(LONG *)(lVar5 + 0x4c);

+    LVar13 = *(LONG *)(lVar5 + 0x50);

+    LVar14 = *(LONG *)(lVar5 + 0x54);

+    if (local_58.tmAveCharWidth == 0) {

+      local_58.tmAveCharWidth = 8;

     }

-    else {

-      unaff_ESI = DivFD6(unaff_ESI,unaff_EDI);

-      *(int *)(unaff_RBP + -0x51) = unaff_ESI;

-      unaff_R14D = DivFD6(unaff_R14D,unaff_EDI);

+  }

+  else {

+    LVar7 = local_58.tmHeight;

+    LVar8 = local_58.tmAscent;

+    LVar9 = local_58.tmDescent;

+    LVar10 = local_58.tmInternalLeading;

+    LVar11 = local_58.tmOverhang;

+    LVar12 = local_58.tmDigitizedAspectX;

+    LVar13 = local_58.tmDigitizedAspectY;

+    LVar14 = local_58._44_4_;

+    LVar6 = local_58._56_4_;

+  }

+  LVar2 = local_58.tmAveCharWidth;

+  if (param_2 != (LONG *)0x0) {

+    *param_2 = LVar7;

+    param_2[1] = LVar8;

+    param_2[2] = LVar9;

+    param_2[3] = LVar10;

+    param_2[4] = local_58.tmExternalLeading;

+    param_2[5] = local_58.tmAveCharWidth;

+    param_2[6] = local_58.tmMaxCharWidth;

+    param_2[7] = local_58.tmWeight;

+    param_2[8] = LVar11;

+    param_2[9] = LVar12;

+    param_2[10] = LVar13;

+    param_2[0xb] = LVar14;

+    *(undefined8 *)(param_2 + 0xc) = local_58._48_8_;

+    param_2[0xe] = LVar6;

+  }

+  if (param_3 != (LONG *)0x0) {

+    *param_3 = local_58.tmHeight;

+  }

+  if ((iVar3 != 0) && ((local_58._48_8_ & 0x100000000000000) != 0)) {

+    local_res10 = 0;

+    iVar3 = GreGetTextExtentW(param_1,L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",0x34,

+                              &local_res10);

+    if (iVar3 != 0) {

+      return (longlong)((int)local_res10 / 0x1a + 1) / 2 & 0xffffffff;

     }

-    *(undefined4 *)(unaff_RBP + -0x4d) = 1000000;

-    unaff_EDI = 1000000;

   }

-  iVar7 = unaff_R12D;

-  if (*(char *)(*(longlong *)(unaff_RBP + -0x19) + 0x21) == '\0') {

-    iVar7 = unaff_ESI + (unaff_R14D + unaff_EDI * 5) * 3;

-    unaff_R12D = DivFD6(unaff_ESI * 4,iVar7);

-    iVar7 = DivFD6(unaff_EDI * 9,iVar7);

-  }

-  uVar3 = *(undefined8 *)(unaff_RBP + -0x41);

-  uVar4 = *(undefined8 *)(unaff_RBP + -0x39);

-  uVar5 = *(undefined8 *)(unaff_RBP + -0x31);

-  uVar6 = *(undefined8 *)(unaff_RBP + -0x29);

-  *(undefined4 *)((longlong)unaff_R15 + 0x44) = *(undefined4 *)(unaff_RBP + -0x6d);

-  uVar1 = *(undefined4 *)(unaff_RBP + -0x69);

-  *unaff_R15 = uVar3;

-  unaff_R15[1] = uVar4;

-  *(int *)((longlong)unaff_R15 + 0x3c) = unaff_R12D;

-  *(undefined8 *)((longlong)unaff_R15 + 0x24) = *(undefined8 *)(unaff_RBP + -0x51);

-  unaff_R15[2] = uVar5;

-  unaff_R15[3] = uVar6;

-  *(int *)((longlong)unaff_R15 + 0x2c) = unaff_R14D;

-  *(undefined4 *)(unaff_R15 + 4) = uVar2;

-  *(int *)(unaff_R15 + 8) = iVar7;

-  *(undefined4 *)(unaff_R15 + 9) = uVar1;

-  return;

+  return (ulonglong)(uint)LVar2;

 }
```

## `EditionPushProcessLaunchForegroundPolicy`  (modified)

```diff
--- EditionPushProcessLaunchForegroundPolicy
+++ Win32HMThreadLockBase<tagDDECONV,0,1>::ManualLock<void>
@@ -1,23 +1,16 @@
 

-void EditionPushProcessLaunchForegroundPolicy

-               (undefined8 param_1,_RECTL *param_2,ulong param_3,code *param_4)

+/* public: void __cdecl Win32HMThreadLockBase<struct tagDDECONV,0,1>::ManualLock<void>(struct

+   tagDDECONV * __ptr64) __ptr64 */

+

+void __thiscall

+Win32HMThreadLockBase<tagDDECONV,0,1>::ManualLock<void>

+          (Win32HMThreadLockBase<tagDDECONV,0,1> *this,tagDDECONV *param_1)

 

 {

-  code *pcVar1;

-  EPATHOBJ *unaff_RBP;

-  uint uStack0000000000000058;

-  uint uStack000000000000005c;

-  uint *in_stack_000000a0;

-  int in_stack_000000a8;

+  tagTHREADINFO *ptVar1;

   

-  uStack0000000000000058 = *in_stack_000000a0 & 7;

-  uStack000000000000005c = in_stack_000000a0[1] & 7;

-  pcVar1 = vBrushPath8_8x8EnumRow;

-  if (in_stack_000000a8 != 3) {

-    pcVar1 = vBrushPath4_8x8EnumRow;

-    param_4 = vBrushPath4_8x8Enum;

-  }

-  bEngFastFillEnum(unaff_RBP,param_2,param_3,param_4,pcVar1,&stack0x00000030);

+  ptVar1 = PtiCurrent();

+  Win32HM_LockIntoThread<0>(ptVar1,(_HEAD *)param_1,(_Win32HMThreadLockItem *)this);

   return;

 }
```

## `NtUserEnableSynchronizedLayout`  (modified)

```diff
--- NtUserEnableSynchronizedLayout
+++ Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline
@@ -1,34 +1,16 @@
 

-bool NtUserEnableSynchronizedLayout(undefined8 param_1)

+ulonglong Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline(void)

 

 {

-  int iVar1;

-  tagTHREADINFO *ptVar2;

-  _HEAD *p_Var3;

-  bool bVar4;

-  _Win32HMThreadLockItem local_18 [16];

+  ulonglong uVar1;

   

-                    /* 0x28f530  1635  NtUserEnableSynchronizedLayout */

-  ptVar2 = (tagTHREADINFO *)EnterCrit(0,0);

-  p_Var3 = (_HEAD *)ValidateHwnd(param_1);

-  bVar4 = false;

-  if ((p_Var3 != (_HEAD *)0x0) &&

-     (((*(ushort *)(*(longlong *)(p_Var3 + 0x28) + 0x2a) & 0xffff2fff) - 0x29d & 0xfffffffd) != 0))

-  {

-    Win32HM_LockIntoThread<0>(ptVar2,p_Var3,local_18);

-    iVar1 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

-    if (iVar1 == 0) {

-      UserSetLastError(0x32);

-    }

-    else {

-      SetOrClrWF(1,p_Var3,0x980);

-      *(uint *)(p_Var3 + 0x17c) = *(uint *)(p_Var3 + 0x17c) | 0x80000000;

-    }

-    bVar4 = iVar1 != 0;

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

-              ((Win32HMThreadLockBase<tagWND,0,0> *)local_18);

+  if ((Feature_StartGlassModern__private_featureState & 0x10) == 0) {

+    uVar1 = Feature_StartGlassModern__private_IsEnabledFallback

+                      (Feature_StartGlassModern__private_featureState,3);

   }

-  UserSessionSwitchLeaveCrit();

-  return bVar4;

+  else {

+    uVar1 = (ulonglong)(Feature_StartGlassModern__private_featureState & 1);

+  }

+  return uVar1;

 }
```

## `NtUserEnableSynchronizedLayout`  (modified)

```diff
--- NtUserEnableSynchronizedLayout
+++ Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline
@@ -1,34 +1,16 @@
 

-bool NtUserEnableSynchronizedLayout(undefined8 param_1)

+ulonglong Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline(void)

 

 {

-  int iVar1;

-  tagTHREADINFO *ptVar2;

-  _HEAD *p_Var3;

-  bool bVar4;

-  _Win32HMThreadLockItem local_18 [16];

+  ulonglong uVar1;

   

-                    /* 0x28f530  1635  NtUserEnableSynchronizedLayout */

-  ptVar2 = (tagTHREADINFO *)EnterCrit(0,0);

-  p_Var3 = (_HEAD *)ValidateHwnd(param_1);

-  bVar4 = false;

-  if ((p_Var3 != (_HEAD *)0x0) &&

-     (((*(ushort *)(*(longlong *)(p_Var3 + 0x28) + 0x2a) & 0xffff2fff) - 0x29d & 0xfffffffd) != 0))

-  {

-    Win32HM_LockIntoThread<0>(ptVar2,p_Var3,local_18);

-    iVar1 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

-    if (iVar1 == 0) {

-      UserSetLastError(0x32);

-    }

-    else {

-      SetOrClrWF(1,p_Var3,0x980);

-      *(uint *)(p_Var3 + 0x17c) = *(uint *)(p_Var3 + 0x17c) | 0x80000000;

-    }

-    bVar4 = iVar1 != 0;

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

-              ((Win32HMThreadLockBase<tagWND,0,0> *)local_18);

+  if ((Feature_SynchronizedLayoutPublicApi__private_featureState & 0x10) == 0) {

+    uVar1 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledFallback

+                      (Feature_SynchronizedLayoutPublicApi__private_featureState,3);

   }

-  UserSessionSwitchLeaveCrit();

-  return bVar4;

+  else {

+    uVar1 = (ulonglong)(Feature_SynchronizedLayoutPublicApi__private_featureState & 1);

+  }

+  return uVar1;

 }
```

## `NtUserEnableSynchronizedLayout`  (modified)

```diff
--- NtUserEnableSynchronizedLayout
+++ Feature_433841464__private_IsEnabledDeviceUsageNoInline
@@ -1,34 +1,15 @@
 

-bool NtUserEnableSynchronizedLayout(undefined8 param_1)

+ulonglong Feature_433841464__private_IsEnabledDeviceUsageNoInline(void)

 

 {

-  int iVar1;

-  tagTHREADINFO *ptVar2;

-  _HEAD *p_Var3;

-  bool bVar4;

-  _Win32HMThreadLockItem local_18 [16];

+  ulonglong uVar1;

   

-                    /* 0x28f530  1635  NtUserEnableSynchronizedLayout */

-  ptVar2 = (tagTHREADINFO *)EnterCrit(0,0);

-  p_Var3 = (_HEAD *)ValidateHwnd(param_1);

-  bVar4 = false;

-  if ((p_Var3 != (_HEAD *)0x0) &&

-     (((*(ushort *)(*(longlong *)(p_Var3 + 0x28) + 0x2a) & 0xffff2fff) - 0x29d & 0xfffffffd) != 0))

-  {

-    Win32HM_LockIntoThread<0>(ptVar2,p_Var3,local_18);

-    iVar1 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

-    if (iVar1 == 0) {

-      UserSetLastError(0x32);

-    }

-    else {

-      SetOrClrWF(1,p_Var3,0x980);

-      *(uint *)(p_Var3 + 0x17c) = *(uint *)(p_Var3 + 0x17c) | 0x80000000;

-    }

-    bVar4 = iVar1 != 0;

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

-              ((Win32HMThreadLockBase<tagWND,0,0> *)local_18);

+  if ((Feature_433841464__private_featureState & 0x10) == 0) {

+    uVar1 = Feature_433841464__private_IsEnabledFallback(Feature_433841464__private_featureState,3);

   }

-  UserSessionSwitchLeaveCrit();

-  return bVar4;

+  else {

+    uVar1 = (ulonglong)(Feature_433841464__private_featureState & 1);

+  }

+  return uVar1;

 }
```

## `CursorApiRouter::HandleRoutingStateAction`  (modified)

```diff
--- CursorApiRouter::HandleRoutingStateAction
+++ CursorApiRouter::HandleRoutingStateAction
@@ -1,2 +1,24 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::HandleRoutingStateAction : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void __cdecl CursorApiRouter::HandleRoutingStateAction(enum

+   CursorApiRouter::RoutingStateActionNeeded) __ptr64 */

+

+void __thiscall

+CursorApiRouter::HandleRoutingStateAction(CursorApiRouter *this,RoutingStateActionNeeded param_1)

+

+{

+  undefined4 uVar1;

+  undefined8 uVar2;

+  int iVar3;

+  

+  if (param_1 == 1) {

+    InputTraceLogging::Cursor::Api::SetCursorSynchronizationMode(0 < *(int *)(this + 0xc));

+    uVar1 = *(undefined4 *)(this + 0xc);

+    uVar2 = ReferenceDwmApiPort();

+    iVar3 = DwmAsyncChangeCursorSynchronization(uVar2,uVar1);

+    if (iVar3 < 0) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x29a);

+    }

+  }

+  return;

+}

+
```

## `CursorApiRouter::CursorApiRouter`  (modified)

```diff
--- CursorApiRouter::CursorApiRouter
+++ CursorApiRouter::CursorApiRouter
@@ -1,2 +1,26 @@
-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)

+

+{

+  *(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;

+}

+
```

## `NSInstrumentation::CTypeIsolation<28672,112>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<28672,112>::Allocate
+++ NSInstrumentation::CTypeIsolation<28672,112>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kfull.sys - .ProgramDB NSInstrumentation::CTypeIsolation<28672,112>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<28672,112>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<28672,112>::Allocate(CTypeIsolation<28672,112> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<28672,112> *pCVar6;

+  void *_Dst;

+  undefined1 *puVar7;

+  void *unaff_R14;

+  undefined1 auStack_38 [32];

+  W32_PUSH_LOCK *local_18;

+  undefined1 local_10;

+  

+  puVar7 = auStack_38;

+  if (this[0x24] == (CTypeIsolation<28672,112>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    W32AcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<28672,112> **)this; pCVar6 != (CSectionEntry<28672,112> *)this;

+        pCVar6 = *(CSectionEntry<28672,112> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<28672,112>::Allocate

+                            (*(CSectionBitmapAllocator<28672,112> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<28672,112>::Create();

+    if (pCVar6 != (CSectionEntry<28672,112> *)0x0) {

+      _Dst = CSectionBitmapAllocator<28672,112>::Allocate

+                       (*(CSectionBitmapAllocator<28672,112> **)(pCVar6 + 0x20));

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

+        CSectionEntry<24576,96>::Destroy((CSectionEntry<24576,96> *)pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<28672,112> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<28672,112> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<28672,112> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xfc;

+          *(CSectionEntry<28672,112> **)this = pCVar6;

+          W32ReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

+              pcVar4 = (code *)swi(0x29);

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<28672,112> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x1402dc0e2;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x1402dc0ee;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<28672,112> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<28672,112> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<28672,112> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<28672,112> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<28672,112> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<28672,112> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x1402dc126;

+          W32ReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x1402dc130;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0x70);

+    }

+  }

+  return _Dst;

+}

+
```

## `CursorApiRouter::GetTelemetryInfo`  (modified)

```diff
--- CursorApiRouter::GetTelemetryInfo
+++ CursorApiRouter::GetTelemetryInfo
@@ -1,2 +1,253 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::GetTelemetryInfo : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl CursorApiRouter::GetTelemetryInfo(struct CursorTelemetryInfo * __ptr64)

+   __ptr64 */

+

+void __thiscall

+CursorApiRouter::GetTelemetryInfo(CursorApiRouter *this,CursorTelemetryInfo *param_1)

+

+{

+  undefined4 uVar1;

+  undefined4 uVar2;

+  undefined4 uVar3;

+  undefined8 uVar4;

+  undefined1 auVar5 [16];

+  bool bVar6;

+  int iVar7;

+  int iVar8;

+  longlong lVar9;

+  longlong lVar10;

+  ulong *puVar11;

+  ulonglong uVar12;

+  ulonglong uVar13;

+  undefined4 local_res8 [2];

+  undefined4 local_138;

+  uint uStack_134;

+  uint uStack_130;

+  undefined4 uStack_12c;

+  undefined8 local_128;

+  undefined8 uStack_120;

+  undefined8 local_118;

+  undefined8 uStack_110;

+  undefined8 local_108;

+  undefined8 uStack_100;

+  undefined4 local_f8;

+  undefined4 uStack_f4;

+  undefined4 uStack_f0;

+  undefined4 uStack_ec;

+  undefined4 uStack_e8;

+  undefined4 uStack_e4;

+  undefined4 uStack_e0;

+  undefined4 uStack_dc;

+  undefined4 uStack_d8;

+  undefined4 local_d4;

+  undefined4 uStack_d0;

+  undefined1 local_cc;

+  undefined2 local_cb;

+  undefined1 local_c9;

+  undefined8 local_c8;

+  undefined8 uStack_c0;

+  undefined8 local_b8;

+  undefined8 uStack_b0;

+  undefined8 local_a8;

+  undefined8 uStack_a0;

+  undefined8 local_98;

+  undefined8 uStack_90;

+  undefined8 uStack_88;

+  undefined8 uStack_80;

+  undefined8 uStack_78;

+  undefined8 local_70;

+  undefined8 local_68;

+  undefined8 uStack_60;

+  undefined8 uStack_58;

+  undefined8 uStack_50;

+  undefined8 uStack_48;

+  undefined8 local_40;

+  undefined8 local_38;

+  

+  local_d4 = 0;

+  uStack_d0 = 0;

+  local_cb = 0;

+  local_c9 = 0;

+  local_98 = 0;

+  local_118 = 0;

+  uStack_110 = 0;

+  local_108 = 0;

+  uStack_100 = 0;

+  local_f8 = 0;

+  uStack_f4 = 0;

+  uStack_f0 = 0;

+  uStack_ec = 0;

+  uStack_e8 = 0;

+  local_cc = 0;

+  uStack_e4 = 0;

+  uStack_e0 = 0;

+  uStack_dc = 0;

+  uStack_d8 = 0;

+  local_70 = 0;

+  local_c8 = 0;

+  uStack_c0 = 0;

+  local_68 = 0;

+  local_b8 = 0;

+  uStack_b0 = 0;

+  local_40 = 0;

+  local_a8 = 0;

+  uStack_a0 = 0;

+  local_38 = 0;

+  uStack_90 = 0;

+  uStack_88 = 0;

+  uStack_80 = 0;

+  uStack_78 = 0;

+  uStack_60 = 0;

+  uStack_58 = 0;

+  uStack_50 = 0;

+  uStack_48 = 0;

+  *(undefined8 *)param_1 = 0;

+  *(undefined8 *)(param_1 + 8) = 0;

+  *(undefined8 *)(param_1 + 0x10) = 0;

+  *(undefined8 *)(param_1 + 0x18) = 0;

+  *(undefined8 *)(param_1 + 0x20) = 0;

+  *(undefined8 *)(param_1 + 0x28) = 0;

+  *(undefined8 *)(param_1 + 0x30) = 0;

+  *(undefined8 *)(param_1 + 0x38) = 0;

+  *(undefined8 *)(param_1 + 0x40) = 0;

+  *(undefined8 *)(param_1 + 0x48) = 0;

+  *(undefined8 *)(param_1 + 0x50) = 0;

+  *(undefined8 *)(param_1 + 0x58) = 0;

+  *(undefined8 *)(param_1 + 0x60) = 0;

+  *(undefined8 *)(param_1 + 0x68) = 0;

+  *(undefined8 *)(param_1 + 0x70) = 0;

+  *(undefined8 *)(param_1 + 0x78) = 0;

+  *(undefined8 *)(param_1 + 0x80) = 0;

+  *(undefined8 *)(param_1 + 0x88) = 0;

+  *(undefined8 *)(param_1 + 0x90) = 0;

+  *(undefined8 *)(param_1 + 0x98) = 0;

+  *(undefined8 *)(param_1 + 0xa0) = 0;

+  *(undefined8 *)(param_1 + 0xa8) = 0;

+  *(undefined8 *)(param_1 + 0xb0) = 0;

+  *(undefined8 *)(param_1 + 0xb8) = 0;

+  *(undefined8 *)(param_1 + 0xc0) = 0;

+  *(undefined8 *)(param_1 + 200) = 0;

+  *(undefined8 *)(param_1 + 0xd0) = 0;

+  *(undefined8 *)(param_1 + 0xd8) = 0;

+  *(undefined8 *)(param_1 + 0xe0) = 0;

+  *(undefined4 *)param_1 = *(undefined4 *)(this + 8);

+  *(CursorApiRouter *)(param_1 + 4) = this[0x10];

+  *(CursorApiRouter *)(param_1 + 5) = this[0x11];

+  param_1[6] = (CursorTelemetryInfo)(0 < *(int *)(this + 0xc));

+  *(undefined8 *)(param_1 + 8) = *(undefined8 *)(this + 0x18);

+  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(this + 0x20);

+  *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(this + 0x24);

+  param_1[0x18] = (CursorTelemetryInfo)(*(int *)(this + 0x28) == 1);

+  uVar4 = *(undefined8 *)(this + 0x58);

+  *(undefined8 *)(param_1 + 0x1c) = *(undefined8 *)(this + 0x50);

+  *(undefined8 *)(param_1 + 0x24) = uVar4;

+  uVar4 = *(undefined8 *)(this + 0x68);

+  *(undefined8 *)(param_1 + 0x2c) = *(undefined8 *)(this + 0x60);

+  *(undefined8 *)(param_1 + 0x34) = uVar4;

+  uVar1 = *(undefined4 *)(this + 0x74);

+  uVar2 = *(undefined4 *)(this + 0x78);

+  uVar3 = *(undefined4 *)(this + 0x7c);

+  *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)(this + 0x70);

+  *(undefined4 *)(param_1 + 0x40) = uVar1;

+  *(undefined4 *)(param_1 + 0x44) = uVar2;

+  *(undefined4 *)(param_1 + 0x48) = uVar3;

+  *(undefined4 *)(param_1 + 0x4c) = *(undefined4 *)(this + 0x80);

+  lVar9 = W32GetUserSessionState();

+  param_1[0x19] = (CursorTelemetryInfo)((byte)(*(uint *)(lVar9 + 0x10654) >> 0xe) & 1);

+  lVar9 = W32GetUserSessionState();

+  if (*(longlong *)(lVar9 + 0x8e80) != 0) {

+    lVar9 = W32GetUserSessionState();

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

+    uVar4 = *(undefined8 *)(lVar9 + 0x58);

+    *(undefined8 *)(param_1 + 0x50) = *(undefined8 *)(lVar9 + 0x50);

+    *(undefined8 *)(param_1 + 0x58) = uVar4;

+    uVar4 = *(undefined8 *)(lVar9 + 0x68);

+    *(undefined8 *)(param_1 + 0x60) = *(undefined8 *)(lVar9 + 0x60);

+    *(undefined8 *)(param_1 + 0x68) = uVar4;

+    uVar4 = *(undefined8 *)(lVar9 + 0x78);

+    *(undefined8 *)(param_1 + 0x70) = *(undefined8 *)(lVar9 + 0x70);

+    *(undefined8 *)(param_1 + 0x78) = uVar4;

+    *(undefined8 *)(param_1 + 0x80) = *(undefined8 *)(lVar9 + 0x80);

+    if (*(longlong *)(lVar9 + 0x58) != 0) {

+      local_138 = 0;

+      uStack_134 = 0;

+      uStack_130 = 0;

+      uStack_12c = 0;

+      local_128 = 0;

+      uStack_120 = 0;

+      iVar7 = GreExtGetObjectW(*(longlong *)(lVar9 + 0x58),0x20,&local_138);

+      if (iVar7 != 0) {

+        *(undefined4 *)(param_1 + 0x88) = local_138;

+        *(uint *)(param_1 + 0x8c) = uStack_134;

+        *(uint *)(param_1 + 0x90) = uStack_130;

+        *(undefined4 *)(param_1 + 0x94) = uStack_12c;

+        *(short *)(param_1 + 0x98) = (short)local_128;

+        *(short *)(param_1 + 0x9a) = local_128._2_2_;

+        *(undefined2 *)(param_1 + 0x9c) = local_128._4_2_;

+        *(undefined2 *)(param_1 + 0x9e) = local_128._6_2_;

+        *(undefined2 *)(param_1 + 0xa0) = (undefined2)uStack_120;

+        *(undefined2 *)(param_1 + 0xa2) = uStack_120._2_2_;

+        *(undefined2 *)(param_1 + 0xa4) = uStack_120._4_2_;

+        *(undefined2 *)(param_1 + 0xa6) = uStack_120._6_2_;

+        if (((short)local_128 == 1) && (local_128._2_2_ == 1)) {

+          local_res8[0] = 0;

+          iVar7 = GreGetBitmapBits(*(undefined8 *)(lVar9 + 0x58),0,0,local_res8);

+          if (iVar7 != 0) {

+            lVar10 = Win32AllocPoolZInit(iVar7,0x43547072);

+            if (lVar10 != 0) {

+              iVar8 = GreGetBitmapBits(*(undefined8 *)(lVar9 + 0x58),iVar7,lVar10,local_res8);

+              if (iVar8 == iVar7) {

+                *(longlong *)(param_1 + 0xa8) = lVar10;

+                *(int *)(param_1 + 0xb0) = iVar7;

+              }

+              else {

+                Win32FreePool(lVar10);

+              }

+            }

+          }

+        }

+      }

+    }

+    if (*(longlong *)(lVar9 + 0x60) != 0) {

+      local_138 = 0;

+      uStack_134 = 0;

+      uStack_130 = 0;

+      uStack_12c = 0;

+      local_128 = 0;

+      uStack_120 = 0;

+      iVar7 = GreExtGetObjectW(*(longlong *)(lVar9 + 0x60),0x20,&local_138);

+      if (iVar7 != 0) {

+        auVar5._4_4_ = uStack_134;

+        auVar5._0_4_ = local_138;

+        auVar5._8_4_ = uStack_130;

+        auVar5._12_4_ = uStack_12c;

+        *(undefined1 (*) [16])(param_1 + 0xb8) = auVar5;

+        *(undefined4 *)(param_1 + 200) = (undefined4)local_128;

+        *(undefined4 *)(param_1 + 0xcc) = local_128._4_4_;

+        *(undefined4 *)(param_1 + 0xd0) = (undefined4)uStack_120;

+        *(undefined4 *)(param_1 + 0xd4) = uStack_120._4_4_;

+        uVar13 = (ulonglong)uStack_134 * (ulonglong)uStack_130;

+        if (uVar13 < 0x100000000) {

+          uVar12 = (uVar13 & 0xffffffff) << 2;

+          if (uVar12 < 0x100000000) {

+            puVar11 = (ulong *)Win32AllocPoolZInit(uVar12 & 0xffffffff,0x43547072);

+            if (puVar11 != (ulong *)0x0) {

+              bVar6 = GetCursorColorPixels

+                                (*(HBITMAP__ **)(lVar9 + 0x60),(tagBITMAP *)&local_138,(uint)uVar13,

+                                 puVar11);

+              if (bVar6) {

+                *(ulong **)(param_1 + 0xd8) = puVar11;

+                *(int *)(param_1 + 0xe0) = (int)uVar12;

+              }

+              else {

+                Win32FreePool(puVar11);

+              }

+            }

+          }

+        }

+      }

+    }

+  }

+  return;

+}

+
```

## `NSInstrumentation::CTypeIsolation<36864,144>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<36864,144>::Allocate
+++ NSInstrumentation::CTypeIsolation<36864,144>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kfull.sys - .ProgramDB NSInstrumentation::CTypeIsolation<36864,144>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<36864,144>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<36864,144>::Allocate(CTypeIsolation<36864,144> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<36864,144> *pCVar6;

+  void *_Dst;

+  undefined1 *puVar7;

+  void *unaff_R14;

+  undefined1 auStack_38 [32];

+  W32_PUSH_LOCK *local_18;

+  undefined1 local_10;

+  

+  puVar7 = auStack_38;

+  if (this[0x24] == (CTypeIsolation<36864,144>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    W32AcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<36864,144> **)this; pCVar6 != (CSectionEntry<36864,144> *)this;

+        pCVar6 = *(CSectionEntry<36864,144> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<36864,144>::Allocate

+                            (*(CSectionBitmapAllocator<36864,144> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<36864,144>::Create();

+    if (pCVar6 != (CSectionEntry<36864,144> *)0x0) {

+      _Dst = CSectionBitmapAllocator<36864,144>::Allocate

+                       (*(CSectionBitmapAllocator<36864,144> **)(pCVar6 + 0x20));

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

+        CSectionEntry<24576,96>::Destroy((CSectionEntry<24576,96> *)pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<36864,144> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<36864,144> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<36864,144> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xfc;

+          *(CSectionEntry<36864,144> **)this = pCVar6;

+          W32ReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

+              pcVar4 = (code *)swi(0x29);

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<36864,144> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x1401b525e;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x1401b526a;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<36864,144> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<36864,144> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<36864,144> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<36864,144> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<36864,144> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<36864,144> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x1401b52a2;

+          W32ReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x1401b52ac;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0x90);

+    }

+  }

+  return _Dst;

+}

+
```

## `CPhysicalMonitorHandle::Destroy`  (modified)

```diff
--- CPhysicalMonitorHandle::Destroy
+++ CPhysicalMonitorHandle::Destroy
@@ -1,2 +1,30 @@
-Failed to decompile win32kfull.sys - .ProgramDB CPhysicalMonitorHandle::Destroy : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: virtual long __cdecl CPhysicalMonitorHandle::Destroy(void) __ptr64 */

+

+long __thiscall CPhysicalMonitorHandle::Destroy(CPhysicalMonitorHandle *this)

+

+{

+  int iVar1;

+  long lVar2;

+  CAutoMutex local_res10 [8];

+  

+  iVar1 = Feature_PhysMonHandleDestroyFix__private_IsEnabledDeviceUsageNoInline();

+  if (iVar1 == 0) {

+    lVar2 = OPM::CMonitorPDO::Destroy((CMonitorPDO *)this);

+    OPM::CAutoMutex::CAutoMutex(local_res10,(CMutex *)(this + 0x48));

+    DDCCIFreeMemory(*(void **)(this + 0x50));

+    *(undefined8 *)(this + 0x50) = 0;

+    *(undefined4 *)(this + 0x58) = 0;

+    OPM::CAutoMutex::~CAutoMutex(local_res10);

+  }

+  else {

+    OPM::CAutoMutex::CAutoMutex(local_res10,(CMutex *)(this + 0x48));

+    DDCCIFreeMemory(*(void **)(this + 0x50));

+    *(undefined8 *)(this + 0x50) = 0;

+    *(undefined4 *)(this + 0x58) = 0;

+    OPM::CAutoMutex::~CAutoMutex(local_res10);

+    lVar2 = OPM::CMonitorPDO::Destroy((CMonitorPDO *)this);

+  }

+  return lVar2;

+}

+
```

## `NSInstrumentation::CTypeIsolation<237568,928>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<237568,928>::Allocate
+++ NSInstrumentation::CTypeIsolation<237568,928>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kfull.sys - .ProgramDB NSInstrumentation::CTypeIsolation<237568,928>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<237568,928>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<237568,928>::Allocate(CTypeIsolation<237568,928> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<237568,928> *pCVar6;

+  void *_Dst;

+  undefined1 *puVar7;

+  void *unaff_R14;

+  undefined1 auStack_38 [32];

+  W32_PUSH_LOCK *local_18;

+  undefined1 local_10;

+  

+  puVar7 = auStack_38;

+  if (this[0x24] == (CTypeIsolation<237568,928>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    W32AcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<237568,928> **)this; pCVar6 != (CSectionEntry<237568,928> *)this;

+        pCVar6 = *(CSectionEntry<237568,928> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<237568,928>::Allocate

+                            (*(CSectionBitmapAllocator<237568,928> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<237568,928>::Create();

+    if (pCVar6 != (CSectionEntry<237568,928> *)0x0) {

+      _Dst = CSectionBitmapAllocator<237568,928>::Allocate

+                       (*(CSectionBitmapAllocator<237568,928> **)(pCVar6 + 0x20));

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

+        CSectionEntry<24576,96>::Destroy((CSectionEntry<24576,96> *)pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<237568,928> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<237568,928> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<237568,928> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xe8;

+          *(CSectionEntry<237568,928> **)this = pCVar6;

+          W32ReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

+              pcVar4 = (code *)swi(0x29);

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<237568,928> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x1401c476a;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x1401c4776;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<237568,928> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<237568,928> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<237568,928> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<237568,928> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<237568,928> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<237568,928> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x1401c47ae;

+          W32ReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x1401c47b8;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0x3a0);

+    }

+  }

+  return _Dst;

+}

+
```

## `CForegroundLaunch::PushForegroundPolicy`  (modified)

```diff
--- CForegroundLaunch::PushForegroundPolicy
+++ CForegroundLaunch::PushForegroundPolicy
@@ -1,2 +1,148 @@
-Failed to decompile win32kfull.sys - .ProgramDB CForegroundLaunch::PushForegroundPolicy : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl CForegroundLaunch::PushForegroundPolicy(struct _EPROCESS * __ptr64,struct

+   tagProcessLaunchPolicy) __ptr64 */

+

+void __thiscall

+CForegroundLaunch::PushForegroundPolicy

+          (CForegroundLaunch *this,_EPROCESS *param_1,undefined8 param_3)

+

+{

+  undefined4 uVar1;

+  longlong lVar2;

+  undefined8 uVar3;

+  longlong *plVar4;

+  tagPROCESSINFO *ptVar5;

+  char cVar6;

+  char cVar7;

+  CForegroundLaunch *pCVar8;

+  uint uVar9;

+  uint uVar10;

+  bool bVar11;

+  int iStackX_1c;

+  

+  cVar7 = '\0';

+  uVar9 = (uint)param_3;

+  if (uVar9 == 0) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x179);

+  }

+  if (uVar9 == 4) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x17a);

+  }

+  W32AcquirePushLockExclusiveEx((W32_PUSH_LOCK *)this,0);

+  cVar6 = '\0';

+  if (this[0x1b8] != (CForegroundLaunch)0x0) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x17f);

+  }

+  if (this[0x1a0] == (CForegroundLaunch)0x0) {

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) != 0)) && (2 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      cVar6 = '\x01';

+    }

+    bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar11)) {

+      lVar2 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar11,

+                 *(undefined8 *)(lVar2 + 0x10f88),3,2,10,

+                 &WPP_3a9bdd50f7c03a7fca9c73fc795cb0ec_Traceguids);

+    }

+  }

+  else {

+    uVar1 = PsGetProcessId(param_1);

+    cVar6 = '\x01';

+    iStackX_1c = (int)((ulonglong)param_3 >> 0x20);

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      cVar7 = '\x01';

+    }

+    bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar7 != '\0') || (bVar11)) {

+      lVar2 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_Ddd

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,bVar11,

+                 *(undefined8 *)(lVar2 + 0x10f88),4,2,0xb,

+                 &WPP_3a9bdd50f7c03a7fca9c73fc795cb0ec_Traceguids,uVar1,uVar9,iStackX_1c);

+    }

+    uVar10 = 0;

+    pCVar8 = this + 0x74;

+    do {

+      bVar11 = CProcessAsPid::IsValid((CProcessAsPid *)(pCVar8 + -0x14));

+      if (!bVar11) {

+        bVar11 = CProcessAsPid::Store((CProcessAsPid *)(pCVar8 + -0x14),param_1);

+        if (bVar11) {

+          *(uint *)pCVar8 = (uint)(iStackX_1c == 1);

+          *(uint *)(pCVar8 + -4) = uVar9;

+          uVar3 = PsGetProcessCreateTimeQuadPart(param_1);

+          *(undefined8 *)(pCVar8 + 4) = uVar3;

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

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

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

+            cVar7 = '\0';

+          }

+          else {

+            cVar7 = '\x01';

+          }

+          bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+          if ((cVar7 != '\0') || (bVar11)) {

+            lVar2 = W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_Ddd

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,bVar11,

+                       *(undefined8 *)(lVar2 + 0x10f88),4,2,0xc,

+                       &WPP_3a9bdd50f7c03a7fca9c73fc795cb0ec_Traceguids,uVar1,uVar9,iStackX_1c);

+          }

+          if ((iStackX_1c == 1) == 1) {

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

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

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

+              cVar7 = '\0';

+            }

+            else {

+              cVar7 = '\x01';

+            }

+            bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+            if ((cVar7 != '\0') || (bVar11)) {

+              lVar2 = W32GetUserSessionState();

+              WPP_RECORDER_AND_TRACE_SF_d

+                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,bVar11,

+                         *(undefined8 *)(lVar2 + 0x10f88),4,2,0xd,

+                         &WPP_3a9bdd50f7c03a7fca9c73fc795cb0ec_Traceguids,uVar1);

+            }

+            plVar4 = (longlong *)PsGetProcessWin32Process(param_1);

+            ptVar5 = (tagPROCESSINFO *)0x0;

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

+              ptVar5 = (tagPROCESSINFO *)((ulonglong)plVar4 & -(ulonglong)(*plVar4 != 0));

+            }

+            ForegroundBoost::SetForegroundPriority(ptVar5,1,1);

+          }

+          goto LAB_0;

+        }

+        *(undefined8 *)(pCVar8 + -0x14) = 0;

+        *(undefined8 *)(pCVar8 + -0xc) = 0;

+        *(undefined8 *)(pCVar8 + -4) = 0;

+        *(undefined8 *)(pCVar8 + 4) = 0;

+        break;

+      }

+      uVar10 = uVar10 + 1;

+      pCVar8 = pCVar8 + 0x20;

+    } while (uVar10 < 10);

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3))

+    {

+      cVar6 = '\0';

+    }

+    bVar11 = (undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED;

+    if ((cVar6 != '\0') || (bVar11)) {

+      lVar2 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_d

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar11,

+                 *(undefined8 *)(lVar2 + 0x10f88),3,2,0xe,

+                 &WPP_3a9bdd50f7c03a7fca9c73fc795cb0ec_Traceguids,uVar1);

+    }

+  }

+LAB_0:

+  W32ReleasePushLockExclusiveEx((W32_PUSH_LOCK *)this,0);

+  return;

+}

+
```

## `CursorApiRouter::DwmMovePointer`  (modified)

```diff
--- CursorApiRouter::DwmMovePointer
+++ CursorApiRouter::DwmMovePointer
@@ -1,2 +1,41 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::DwmMovePointer : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void __cdecl CursorApiRouter::DwmMovePointer(int,int,unsigned long,enum

+   CursorApiRouter::CursorMoveMode,void * __ptr64,unsigned __int64) __ptr64 */

+

+void __thiscall

+CursorApiRouter::DwmMovePointer

+          (CursorApiRouter *this,int param_1,int param_2,ulong param_3,CursorMoveMode param_4,

+          void *param_5,__uint64 param_6)

+

+{

+  undefined8 uVar1;

+  char cVar2;

+  int iVar3;

+  undefined8 uVar4;

+  int local_res8;

+  int iStackX_c;

+  

+  local_res8 = param_1;

+  iStackX_c = param_2;

+  if (param_4 != 1) {

+    cVar2 = IsKSTThread();

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

+      InvokeMouseCursorPositionCallout

+                ((ulonglong)param_5 & 0xffffffff,CONCAT44(iStackX_c,local_res8),param_3 & 1,param_6)

+      ;

+      goto LAB_0;

+    }

+  }

+  SendPositionChanged(&local_res8,param_3 & 1);

+LAB_0:

+  if (0 < *(int *)(this + 0xc)) {

+    uVar1 = CONCAT44(iStackX_c,local_res8);

+    uVar4 = ReferenceDwmApiPort();

+    iVar3 = DwmAsyncUpdateCursorPosition(uVar4,uVar1);

+    if (iVar3 < 0) {

+      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x22f);

+    }

+  }

+  return;

+}

+
```

## `CursorApiRouter::UpdateRoutingState`  (modified)

```diff
--- CursorApiRouter::UpdateRoutingState
+++ CursorApiRouter::DwmMovePointer
@@ -1,2 +1,2 @@
-Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::UpdateRoutingState : Error: Decompile error: 
+Failed to decompile win32kfull.sys - .ProgramDB CursorApiRouter::DwmMovePointer : Error: Decompile error: 
 Marshaling error: Did not see expected closing element
```

## `NSInstrumentation::CTypeIsolation<24576,96>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<24576,96>::Allocate
+++ NSInstrumentation::CTypeIsolation<24576,96>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kfull.sys - .ProgramDB NSInstrumentation::CTypeIsolation<24576,96>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<24576,96>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<24576,96>::Allocate(CTypeIsolation<24576,96> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<24576,96> *pCVar6;

+  void *_Dst;

+  undefined1 *puVar7;

+  void *unaff_R14;

+  undefined1 auStack_38 [32];

+  W32_PUSH_LOCK *local_18;

+  undefined1 local_10;

+  

+  puVar7 = auStack_38;

+  if (this[0x24] == (CTypeIsolation<24576,96>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    W32AcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<24576,96> **)this; pCVar6 != (CSectionEntry<24576,96> *)this;

+        pCVar6 = *(CSectionEntry<24576,96> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<24576,96>::Allocate

+                            (*(CSectionBitmapAllocator<24576,96> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<24576,96>::Create();

+    if (pCVar6 != (CSectionEntry<24576,96> *)0x0) {

+      _Dst = CSectionBitmapAllocator<24576,96>::Allocate

+                       (*(CSectionBitmapAllocator<24576,96> **)(pCVar6 + 0x20));

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

+        CSectionEntry<24576,96>::Destroy(pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<24576,96> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<24576,96> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<24576,96> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xfc;

+          *(CSectionEntry<24576,96> **)this = pCVar6;

+          W32ReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

+              pcVar4 = (code *)swi(0x29);

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<24576,96> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x1401fc82e;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x1401fc83a;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<24576,96> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<24576,96> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<24576,96> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<24576,96> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<24576,96> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<24576,96> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x1401fc872;

+          W32ReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x1401fc87c;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0x60);

+    }

+  }

+  return _Dst;

+}

+
```

## `Feature_YieldInputQueue3__private_IsEnabledDeviceUsageNoInline`  (modified)

```diff
--- Feature_YieldInputQueue3__private_IsEnabledDeviceUsageNoInline
+++ tagPROCESSINFO::GetPID
@@ -1,29 +1,2 @@
-

-void Feature_YieldInputQueue3__private_IsEnabledDeviceUsageNoInline(char param_1)

-

-{

-  char *in_RAX;

-  longlong unaff_RBP;

-  longlong lStack0000000000000028;

-  undefined8 uStack0000000000000030;

-  longlong lStack0000000000000038;

-  longlong lStack0000000000000048;

-  longlong lStack0000000000000058;

-  longlong lStack0000000000000068;

-  longlong lStack0000000000000078;

-  

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

-  in_RAX[-0x77] = in_RAX[-0x77] + param_1;

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

-  in_RAX[-0x73] = in_RAX[-0x73] + param_1;

-  lStack0000000000000078 = unaff_RBP + 0x7f;

-  lStack0000000000000068 = unaff_RBP + 0x77;

-  lStack0000000000000058 = unaff_RBP + 0x6f;

-  lStack0000000000000048 = unaff_RBP + 0x67;

-  lStack0000000000000038 = unaff_RBP + 0x5f;

-  lStack0000000000000028 = unaff_RBP + 0x57;

-  uStack0000000000000030 = 8;

-  WppAutoLogTrace();

-  return;

-}

-

+Failed to decompile win32kfull.sys - .ProgramDB tagPROCESSINFO::GetPID : Error: Decompile error: 
+Marshaling error: Did not see expected closing element
```

## `CForegroundLaunch::PushForegroundPolicy_Old`  (modified)

```diff
--- CForegroundLaunch::PushForegroundPolicy_Old
+++ PtiCurrent
@@ -1,2 +1,19 @@
-Failed to decompile win32kfull.sys - .ProgramDB CForegroundLaunch::PushForegroundPolicy_Old : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* struct tagTHREADINFO * __ptr64 __cdecl PtiCurrent(void) */

+

+tagTHREADINFO * __cdecl PtiCurrent(void)

+

+{

+  undefined8 *puVar1;

+  tagTHREADINFO *ptVar2;

+  

+  puVar1 = (undefined8 *)W32GetCurrentThreadNonPaged();

+  if (puVar1 == (undefined8 *)0x0) {

+    ptVar2 = (tagTHREADINFO *)0x0;

+  }

+  else {

+    ptVar2 = (tagTHREADINFO *)*puVar1;

+  }

+  return ptVar2;

+}

+
```

## `NTOSKRNL.EXE::RtlAreAllAccessesGranted`  (modified)

```diff
--- NTOSKRNL.EXE::RtlAreAllAccessesGranted calling
+++ NTOSKRNL.EXE::RtlAreAllAccessesGranted calling
@@ -4 +3,0 @@
-EditionIsRIMInjectionBlocked
@@ -10 +8,0 @@
-xxxInternalKeyEventDirect
@@ -13 +10,0 @@
-zzzSetWindowsHookEx_New
```

## `NTOSKRNL.EXE::RtlNtStatusToDosError`  (modified)

```diff
--- NTOSKRNL.EXE::RtlNtStatusToDosError calling
+++ NTOSKRNL.EXE::RtlNtStatusToDosError calling
@@ -5,0 +6 @@
+GreGetOrCreateLayoutSyncHandle
```

## `NTOSKRNL.EXE::PsGetCurrentProcess`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentProcess calling
+++ NTOSKRNL.EXE::PsGetCurrentProcess calling
@@ -9 +8,0 @@
-EditionIsRIMInjectionBlocked
@@ -30,0 +30 @@
+NtUserInitializeUserModeMenus
@@ -86 +85,0 @@
-xxxInternalKeyEventDirect
@@ -89 +87,0 @@
-xxxMouseEventDirect
```

## `WIN32KBASE.SYS::UserSessionSwitchLeaveCrit`  (modified)

```diff
--- WIN32KBASE.SYS::UserSessionSwitchLeaveCrit calling
+++ WIN32KBASE.SYS::UserSessionSwitchLeaveCrit calling
@@ -17,0 +18,2 @@
+EditionWindowBeginLayoutForDCompk
+EditionWindowLayoutCompleteForDCompk
@@ -82,0 +85 @@
+NtUserCreateLayoutSyncForHwnd
@@ -138,0 +142 @@
+NtUserEnableSynchronizedLayout
@@ -241,0 +246 @@
+NtUserGetResizeDCompositionSynchronizationObject
@@ -271 +275,0 @@
-NtUserHandleGrantAccess
@@ -287,0 +292 @@
+NtUserInitializeUserModeMenus
@@ -633,0 +639 @@
+xxxSendInput
```

## `WIN32KBASE.SYS::UpconvertTime`  (modified)

```diff
--- WIN32KBASE.SYS::UpconvertTime calling
+++ WIN32KBASE.SYS::UpconvertTime calling
@@ -3 +2,0 @@
-xxxSendInputEx
```

## `NTOSKRNL.EXE::ObfDereferenceObject`  (modified)

```diff
--- NTOSKRNL.EXE::ObfDereferenceObject calling
+++ NTOSKRNL.EXE::ObfDereferenceObject calling
@@ -122 +121,0 @@
-NtUserHandleGrantAccess
```

## `WIN32KBASE.SYS::Gre::Base::Globals`  (modified)

```diff
--- WIN32KBASE.SYS::Gre::Base::Globals calling
+++ WIN32KBASE.SYS::Gre::Base::Globals calling
@@ -138,0 +139 @@
+GreGetOrCreateLayoutSyncHandle
```

## `NTOSKRNL.EXE::KeDetachProcess`  (modified)

```diff
--- NTOSKRNL.EXE::KeDetachProcess calling
+++ NTOSKRNL.EXE::KeDetachProcess calling
@@ -17 +16,0 @@
-zzzSetWindowsHookEx_New
```

## `NTOSKRNL.EXE::PsGetJobUIRestrictionsClass`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetJobUIRestrictionsClass calling
+++ NTOSKRNL.EXE::PsGetJobUIRestrictionsClass calling
@@ -2 +1,0 @@
-NtUserHandleGrantAccess
```

## `NTOSKRNL.EXE::ExReleaseResourceAndLeaveCriticalRegion`  (modified)

```diff
--- NTOSKRNL.EXE::ExReleaseResourceAndLeaveCriticalRegion calling
+++ NTOSKRNL.EXE::ExReleaseResourceAndLeaveCriticalRegion calling
@@ -4 +3,0 @@
-NtUserUserHandleGrantAccess
```

## `WIN32KBASE.SYS::Win32AllocPoolZInit`  (modified)

```diff
--- WIN32KBASE.SYS::Win32AllocPoolZInit calling
+++ WIN32KBASE.SYS::Win32AllocPoolZInit calling
@@ -38 +37,0 @@
-CreateW32Job
@@ -96 +94,0 @@
-JobCalloutAddProcessWorker
@@ -112 +109,0 @@
-NtUserUserHandleGrantAccess
```

## `WIN32KBASE.SYS::UserReAllocPool`  (modified)

```diff
--- WIN32KBASE.SYS::UserReAllocPool calling
+++ WIN32KBASE.SYS::UserReAllocPool calling
@@ -3,2 +2,0 @@
-JobCalloutAddProcessWorker
-NtUserUserHandleGrantAccess
```

## `NTOSKRNL.EXE::KeStackAttachProcess`  (modified)

```diff
--- NTOSKRNL.EXE::KeStackAttachProcess calling
+++ NTOSKRNL.EXE::KeStackAttachProcess calling
@@ -6 +5,0 @@
-SetProcessFlags
```

## `WIN32KBASE.SYS::Win32ProcessCapability::Injection`  (modified)

```diff
--- WIN32KBASE.SYS::Win32ProcessCapability::Injection calling
+++ WIN32KBASE.SYS::Win32ProcessCapability::Injection calling
@@ -2 +1,0 @@
-EditionIsRIMInjectionBlocked
```

## `WIN32KBASE.SYS::HMFreeObject`  (modified)

```diff
--- WIN32KBASE.SYS::HMFreeObject calling
+++ WIN32KBASE.SYS::HMFreeObject calling
@@ -20 +19,0 @@
-zzzSetWindowsHookEx_New
```

## `NTOSKRNL.EXE::ObReferenceObjectByHandle`  (modified)

```diff
--- NTOSKRNL.EXE::ObReferenceObjectByHandle calling
+++ NTOSKRNL.EXE::ObReferenceObjectByHandle calling
@@ -12 +11,0 @@
-NtUserHandleGrantAccess
```

## `WIN32K.SYS::W32GetUserSessionState`  (modified)

```diff
--- WIN32K.SYS::W32GetUserSessionState calling
+++ WIN32K.SYS::W32GetUserSessionState calling
@@ -7 +7 @@
-<lambda_6baa4152dc1fda69394d048151fac486>::<lambda_invoker_cdecl>
+<lambda_4b38a1a7408fa8114f557b782837fd1c>::<lambda_invoker_cdecl>
@@ -80 +79,0 @@
-CForegroundLaunch::PushForegroundPolicy_Old
@@ -212,0 +212 @@
+ChangeCursorSynchronization
@@ -271 +270,0 @@
-CreateW32Job
@@ -272,0 +272 @@
+CursorApiRouter::CalcCursorSynchronization
@@ -281,0 +282 @@
+CursorApiRouter::TraceCurrentState
@@ -347,0 +349 @@
+DisableDwmSwCursorMoveSize
@@ -440 +441,0 @@
-EditionPushProcessLaunchForegroundPolicy
@@ -539 +539,0 @@
-GetCharDimensions
@@ -746,3 +745,0 @@
-JobCalloutAddProcess
-JobCalloutAddProcessWorker
-JobCalloutTerminate
@@ -864 +860,0 @@
-NtUserHandleGrantAccess
@@ -867,0 +864 @@
+NtUserInitializeUserModeMenus
@@ -1079 +1075,0 @@
-RemoveProcessFromJob
@@ -1149 +1144,0 @@
-SetProcessFlags
@@ -1234 +1228,0 @@
-UpdateJob
@@ -1256 +1249,0 @@
-UserJobCallout
@@ -1281 +1273,0 @@
-W32GetUserJobsGlobals
@@ -1719 +1710,0 @@
-xxxSendInputEx
@@ -1805,0 +1797 @@
+zzzClearStartGlass
@@ -1836,0 +1829 @@
+zzzSetStartGlass
@@ -1841 +1833,0 @@
-zzzSetWindowsHookEx_New
```

## `WIN32KBASE.SYS::ForegroundBoost::SetForegroundPriority`  (modified)

```diff
--- WIN32KBASE.SYS::ForegroundBoost::SetForegroundPriority calling
+++ WIN32KBASE.SYS::ForegroundBoost::SetForegroundPriority calling
@@ -5 +4,0 @@
-CForegroundLaunch::PushForegroundPolicy_Old
```

## `WIN32KBASE.SYS::Win32AllocPoolZInit`  (modified)

```diff
--- WIN32KBASE.SYS::Win32AllocPoolZInit calling
+++ WIN32KBASE.SYS::EnterCrit calling
@@ -1,43 +1,4 @@
-AddInputHangInfo
-AddMessageToFilter
-AddPublicObject
-AdvancedWindowPos::PostAsyncWindowAction
-AllocAndLinkThreadPointerData
-AllocateAndLinkHidPageOnlyRequest
-AllocateAndLinkHidTLCInfo
-AllocateCvr
-AssociateShellFrameAppThreads
-AsyncWindowPos
-BuildHwndList
-BuildWindowListWithDpiBoundaryInfo
-CDwmNotifyBatch::IncrementCounter
-CForegroundLaunch::_AppStarting_Set
-CInterceptWindowProp::SaveData
-CMonitorTopology::CreateTopologySnapshot
-COLORTRANSFORMOBJ::hCreate
-CRapidHpdInfo::ProcessModeChange
-CRecalcProp::EnsureRecalcProperty
-CRecalcState::CreateRecalcState
-CWindowProp::CreateWindowProp<CHwndTargetProp>
-CWindowProp::CreateWindowProp<CInputQueueProp>
-CWindowProp::CreateWindowProp<CInterceptWindowProp>
-CWindowProp::CreateWindowProp<CSwapChainProp>
-CWindowProp::CreateWindowProp<CVisRgnTrackerProp>
-CWindowProp::CreateWindowProp<CoreWindowProp>
-CWindowProp::CreateWindowProp<WindowMargins::CWindowMarginProp>
-CancelAutoPromotion
-ClassAlloc
-ClassAllocString
-ClipContact
-CoreWindowProp::AddComponent
-CreateMousePromotionEntry
-CreateNotify
-CreatePointerDeviceProcessEvent
-CreateSetupNameArray
-CreateValidTouchInputInfo
-CursorApiRouter::GetCursorMaskAndXorBits
-CursorApiRouter::GetTelemetryInfo
-CursorApiRouter::Initialize
-CursorApiRouter::SendMITCursorShape
-DIBtoDIBV5
-DWP_SetHotKey
+AttachWindowCompositionTarget
+CCursorSizes::zzzUpdateGlobalCursorSize
+CleanOutOldInputMessages
+CursorApiRouter::DestroyGreTrailsTimerIfExists
@@ -45,61 +6,212 @@
-DestroySMWP
-DeviceClassCDROMNotifyWorker
-DxLddmSharedPrimaryLockNotification
-Edgy::_GrowListeners
-Edgy::_InitializeData
-EditionAllocThreadPointerData
-EditionInitGlobalCursorSizes
-EngCreatePath
-EngCreateWnd
-EngMapFile
-EngPlgBlt
-EnsureKMDpiMetricsCacheNode
-FHOBJ::bAddPFELink
-ForegroundLaunch::Initialize
-FreeListAdd
-GeneratePointerMessageFromMouse
-GetCustomFlickPath
-GetTiltKeyName
-Gre::FileQueryObj::QueryInSystemFontsDir
-Gre::Full::AllocateSessionGlobalsArea
-GreDwmStartup
-GrepGetGlyphIndicesW
-GrepGetTextExtentExW
-GrepGetTextMetricsW
-HKAddChildHotkey
-HideInkCursorProvider::ProcessInkFeedbackCommand
-HwndLookupAllocTableData
-InitClipFormatExceptionList
-InitClipboardILDef
-InitFNTCache
-InitInputTransformList
-InitPlaySound
-InitializeFeedbackData
-InitializeWinArrangeGlobal
-InkDevice::Initialize
-InkDevice::ProcessInkFeedbackCommand
-InkProcessor::Initialize
-InkProcessor::OnDeviceAttached
-InputTransform::OnInput
-InteractiveControlDevice::CreateDeadzone
-InteractiveControlDevice::Initialize
-InteractiveControlDevice::SetComponentResolution
-InteractiveControlInput::ParseInputReport
-InteractiveControlManager::Instance
-InteractiveControlManager::OnDeviceAttach
-InteractiveControlParser::BuildComponentInformation
-InteractiveControlParser::BuildDeviceCapabilities
-InteractiveControlParser::CreateAndLinkComponent
-InternalRebuildHwndListForIMEClass
-InternalSetClipboardData
-MALLOCOBJ::MALLOCOBJ
-MNAllocMenuItems
-MagControl
-MagSetLensContextInformation
-MirrorRegion
-MoveSizeApi::PostAsyncMoveSize
-MsgLookupTableAlloc
-NtGdiGetDIBitsInternal
-NtGdiSetPUMPDOBJ
-NtUserDoSoundConnect
-NtUserGetPointerDeviceProperties
+DestroyWindowStation
+DetachWindowCompositionTarget
+EditionCloseDesktopEntryPoint
+EditionCloseWindowStationEntryPoint
+EditionCreateDesktopEntryPoint
+EditionCreateWindowStationEntryPointEx
+EditionEnableSoftwareCursorForDCompk
+EditionGetUserObjectInformationEntryPoint
+EditionOpenInputDesktopEntryPoint
+EditionParseDesktop
+EditionSetProcessWindowStationEntryPoint
+EditionStopSonar
+EnterEditionCrit
+EnterLeaveCritSharedOrExclusive::EnterLeaveCritSharedOrExclusive
+FreeWindowStation
+GetResizeDCompositionSynchronizationObject
+GetWindowCompositionVisualBitmap
+InitiateWin32kCleanup
+InputCoreProviderCallbackWorker
+InteractiveControlDefaultScroller::GenerateWheelMessage
+LeaveEnterCrit::~LeaveEnterCrit
+LeaveEnterUserCritIfAcquired::~LeaveEnterUserCritIfAcquired
+MagGetLensContextInformation
+NormalAPCInvalidateCOMPOSITEDWnd
+NtRIMRegisterForInputEx
+NtUserAcquireIAMKey
+NtUserAcquireInteractiveControlBackgroundAccess
+NtUserAddClipboardFormatListener
+NtUserAllowSetForegroundWindow
+NtUserAlterWindowStyle
+NtUserApplyWindowAction
+NtUserArrangeIconicWindows
+NtUserAssociateInputContext
+NtUserAttachThreadInput
+NtUserAutoPromoteMouseInPointer
+NtUserBeginDeferWindowPos
+NtUserBeginLayoutUpdate
+NtUserBeginPaint
+NtUserBitBltSysBmp
+NtUserBlockInput
+NtUserBroadcastImeShowStatusChange
+NtUserBroadcastThemeChangeEvent
+NtUserCalcMenuBar
+NtUserCalculatePopupWindowPosition
+NtUserCallNextHookEx
+NtUserCancelQueueEventCompletionPacket
+NtUserChangeClipboardChain
+NtUserChangeWindowMessageFilter
+NtUserChangeWindowMessageFilterEx
+NtUserCheckImeShowStatusInThread
+NtUserCheckMenuItem
+NtUserClearWakeMask
+NtUserClearWindowState
+NtUserCloseClipboard
+NtUserCompositionInputSinkLuidFromPoint
+NtUserCompositionInputSinkViewInstanceIdFromPoint
+NtUserConsoleControl
+NtUserConvertMemHandle
+NtUserConvertPrimaryPointerToMouseDrag
+NtUserConvertToInterceptWindow
+NtUserCreateAcceleratorTable
+NtUserCreateCaret
+NtUserCreateEmptyCursorObject
+NtUserCreateInputContext
+NtUserCreateLayoutSyncForHwnd
+NtUserCreateLocalMemHandle
+NtUserCreateMenu
+NtUserCreatePopupMenu
+NtUserCreateWindowEx
+NtUserCsDdeUninitialize
+NtUserCtxDisplayIOCtl
+NtUserDWP_GetEnabledPopupOffset
+NtUserDdeInitialize
+NtUserDefSetText
+NtUserDeferWindowDpiChanges
+NtUserDeferWindowPosAndBand
+NtUserDeferredDesktopRotation
+NtUserDelegateInput
+NtUserDeleteMenu
+NtUserDeregisterShellHookWindow
+NtUserDestroyAcceleratorTable
+NtUserDestroyCaret
+NtUserDestroyCursor
+NtUserDestroyInputContext
+NtUserDestroyMenu
+NtUserDestroyWindow
+NtUserDisableImmersiveOwner
+NtUserDisableProcessWindowFiltering
+NtUserDisableProcessWindowsGhosting
+NtUserDisableThreadIme
+NtUserDiscardPointerFrameMessages
+NtUserDispatchMessage
+NtUserDoInitMessagePumpHook
+NtUserDoUninitMessagePumpHook
+NtUserDragDetect
+NtUserDragObject
+NtUserDrainThreadCoreMessagingCompletions2
+NtUserDrawAnimatedRects
+NtUserDrawCaption
+NtUserDrawCaptionTemp
+NtUserDrawIconEx
+NtUserDrawMenuBar
+NtUserDwmKernelShutdown
+NtUserDwmKernelStartup
+NtUserDwmLockScreenUpdates
+NtUserDwmWindowNotificationsEnabled
+NtUserEmptyClipboard
+NtUserEnableChildWindowDpiMessage
+NtUserEnableIAMAccess
+NtUserEnableMenuItem
+NtUserEnableModernAppWindowKeyboardIntercept
+NtUserEnableMouseInPointerForThread
+NtUserEnableMouseInPointerForWindow
+NtUserEnableMouseInputForCursorSuppression
+NtUserEnableNonClientDpiScaling
+NtUserEnableResizeLayoutSynchronization
+NtUserEnableScrollBar
+NtUserEnableShellWindowManagementBehavior
+NtUserEnableSoftwareCursorForScreenCapture
+NtUserEnableSynchronizedLayout
+NtUserEnableWindow
+NtUserEnableWindowGDIScaledDpiMessage
+NtUserEnableWindowResizeOptimization
+NtUserEnableWindowShellWindowManagementBehavior
+NtUserEndDeferWindowPosEx
+NtUserEndMenu
+NtUserEndPaint
+NtUserEnsureDpiDepSysMetCacheForPlateau
+NtUserEnsureDpiMetricsForDpi
+NtUserEnsureDpiServerInfoForDpi
+NtUserEnsureOemBitmapInfoForDpi
+NtUserEnterMoveSizeLoop
+NtUserEnumClipboardFormats
+NtUserEvent
+NtUserExcludeUpdateRgn
+NtUserFillWindow
+NtUserFlashWindowEx
+NtUserForceEnableNumpadTranslation
+NtUserForceWindowToDpiForTest
+NtUserGetCPD
+NtUserGetClassIcoCur
+NtUserGetClassInfoEx
+NtUserGetClipboardData
+NtUserGetComboBoxInfo
+NtUserGetControlBrush
+NtUserGetControlColor
+NtUserGetDeviceChangeInfo
+NtUserGetGestureExtArgs
+NtUserGetGestureInfo
+NtUserGetHimetricScaleFactorFromPixelLocation
+NtUserGetIMEShowStatus
+NtUserGetIconInfo
+NtUserGetInputDesktop
+NtUserGetInputEvent
+NtUserGetListBoxInfo
+NtUserGetMenuBarInfo
+NtUserGetMenuItemRect
+NtUserGetMessage
+NtUserGetModernAppWindow
+NtUserGetOemBitmapSize
+NtUserGetPointerDeviceRects
+NtUserGetProcessDefaultLayout
+NtUserGetRequiredCursorSizes
+NtUserGetResizeDCompositionSynchronizationObject
+NtUserGetScrollBarInfo
+NtUserGetSysMenuOffset
+NtUserGetSystemMenu
+NtUserGetTitleBarInfo
+NtUserGetTouchInputInfo
+NtUserGetUpdateRect
+NtUserGetUpdateRgn
+NtUserGetWinStationInfo
+NtUserGetWindowContextHelpId
+NtUserGetWindowMinimizeRect
+NtUserGetWindowPlacement
+NtUserGetWindowTrackInfoAsync
+NtUserGrantJobUIRestrictionException
+NtUserHandleDelegatedInput
+NtUserHandleSystemThreadCreationFailure
+NtUserHardErrorControl
+NtUserHideCaret
+NtUserHideCursorNoCapture
+NtUserHidePointerContactVisualization
+NtUserHiliteMenuItem
+NtUserHwndSetRedirectionInfo
+NtUserInheritWindowMonitor
+NtUserInitAnsiOem
+NtUserInitThreadCoreMessagingIocp
+NtUserInitThreadCoreMessagingIocp2
+NtUserInitializeClientPfnArrays
+NtUserInitializeTouchInjection
+NtUserInitializeUserModeMenus
+NtUserInjectGesture
+NtUserInjectTouchInput
+NtUserInjectTouchpadAction
+NtUserInternalGetWindowIcon
+NtUserInvalidateRect
+NtUserInvalidateRgn
+NtUserKillSystemTimer
+NtUserKillTimer
+NtUserLW_LoadFonts
+NtUserLayoutCompleted
+NtUserLinkDpiCursor
+NtUserLoadCursorsAndIcons
+NtUserLoadUserApiHook
+NtUserLockSetForegroundWindow
+NtUserLockWindowStation
+NtUserLockWindowUpdate
+NtUserLockWorkStation
+NtUserMNDragLeave
+NtUserMNDragOver
+NtUserMagControl
@@ -107,0 +220,148 @@
+NtUserMapDesktopObject
+NtUserMenuItemFromPoint
+NtUserMessageBeep
+NtUserMinMaximize
+NtUserModifyUserStartupInfoFlags
+NtUserModifyWindowTouchCapability
+NtUserMoveWindow
+NtUserMsgWaitForMultipleObjectsEx
+NtUserNavigateFocus
+NtUserNlsKbdSendIMENotification
+NtUserNotifyIMEStatus
+NtUserNotifyOverlayWindow
+NtUserNotifyProcessCreate
+NtUserOpenClipboard
+NtUserOpenDesktop
+NtUserOpenThreadDesktop
+NtUserOpenWindowStation
+NtUserPaintDesktop
+NtUserPaintMenuBar
+NtUserPaintMonitor
+NtUserPeekMessage
+NtUserPlayEventSound
+NtUserPostMessage
+NtUserPostQuitMessage
+NtUserPostThreadMessage
+NtUserPrepareForLogoff
+NtUserPrintWindow
+NtUserProcessConnect
+NtUserPromoteMouseInPointer
+NtUserPromotePointer
+NtUserQueryInformationThread
+NtUserQueryWindow
+NtUserRaiseLowerShellWindow
+NtUserRealInternalGetMessage
+NtUserRealWaitMessageEx
+NtUserRealizePalette
+NtUserReassociateQueueEventCompletionPacket
+NtUserRedrawFrame
+NtUserRedrawFrameAndHook
+NtUserRedrawTitle
+NtUserRedrawWindow
+NtUserRegisterBSDRWindow
+NtUserRegisterClassExWOW
+NtUserRegisterDManipHook
+NtUserRegisterEdgy
+NtUserRegisterForCustomDockTargets
+NtUserRegisterForTooltipDismissNotification
+NtUserRegisterGhostWindow
+NtUserRegisterHotKey
+NtUserRegisterLPK
+NtUserRegisterPointerDeviceNotifications
+NtUserRegisterPointerInputTarget
+NtUserRegisterRawInputDevices
+NtUserRegisterServicesProcess
+NtUserRegisterShellHookWindow
+NtUserRegisterSiblingFrostWindow
+NtUserRegisterSystemThread
+NtUserRegisterTasklist
+NtUserRegisterTouchHitTestingWindow
+NtUserRegisterTouchpadCapableWindow
+NtUserRegisterUserApiHook
+NtUserRegisterWindowArrangementCallout
+NtUserReleaseCapture
+NtUserRemoteConnect
+NtUserRemoteConnectState
+NtUserRemoteConsoleShadowStop
+NtUserRemoteDisconnect
+NtUserRemoteNotify
+NtUserRemotePassthruDisable
+NtUserRemotePassthruEnable
+NtUserRemoteReconnect
+NtUserRemoteRedrawRectangle
+NtUserRemoteRedrawScreen
+NtUserRemoteShadowCleanup
+NtUserRemoteShadowSetup
+NtUserRemoteShadowStart
+NtUserRemoteShadowStop
+NtUserRemoteStopScreenUpdates
+NtUserRemoteThinwireStats
+NtUserRemoveClipboardFormatListener
+NtUserRemoveMenu
+NtUserRemoveQueueCompletion
+NtUserReplyMessage
+NtUserResetDblClk
+NtUserResolveDesktopForWOW
+NtUserRestoreWindowDpiChanges
+NtUserScaleSystemMetricForDPIWithoutCache
+NtUserScheduleDispatchNotification
+NtUserScrollWindowEx
+NtUserSelectPalette
+NtUserSendEventMessage
+NtUserSendInput
+NtUserSetActivationFilter
+NtUserSetActiveWindow
+NtUserSetAdditionalPowerThrottlingProcess
+NtUserSetAppImeLevel
+NtUserSetAutoRotation
+NtUserSetBridgeWindowChild
+NtUserSetBrokeredForeground
+NtUserSetCalibrationData
+NtUserSetCancelRotationDelayHintWindow
+NtUserSetCapture
+NtUserSetCaretBlinkTime
+NtUserSetCaretPos
+NtUserSetChildWindowNoActivate
+NtUserSetClassLong
+NtUserSetClassLongPtr
+NtUserSetClassWord
+NtUserSetClipboardData
+NtUserSetClipboardViewer
+NtUserSetCoreWindow
+NtUserSetCoreWindowPartner
+NtUserSetCoveredWindowStates
+NtUserSetCursor
+NtUserSetCursorIconDataEx
+NtUserSetCursorPos
+NtUserSetDialogControlDpiChangeBehavior
+NtUserSetDialogPointer
+NtUserSetDialogSystemMenu
+NtUserSetDisplayMapping
+NtUserSetDoubleClickTime
+NtUserSetDpiForWindow
+NtUserSetFocus
+NtUserSetForegroundWindow
+NtUserSetForegroundWindowForApplication
+NtUserSetGestureConfig
+NtUserSetImeHotKey
+NtUserSetImeInfoEx
+NtUserSetImeOwnerWindow
+NtUserSetInformationThread
+NtUserSetInteractiveControlFocus
+NtUserSetInternalWindowPos
+NtUserSetLayeredWindowAttributes
+NtUserSetMaxTouchpadSensitivity
+NtUserSetMenu
+NtUserSetMenuContextHelpId
+NtUserSetMenuDefaultItem
+NtUserSetMenuFlagRtoL
+NtUserSetMessageExtraInfo
+NtUserSetMirrorRendering
+NtUserSetModernAppWindow
+NtUserSetMsgBox
+NtUserSetObjectInformation
+NtUserSetParent
+NtUserSetProcessDefaultLayout
+NtUserSetProcessInteractionFlags
+NtUserSetProcessRestrictionExemption
+NtUserSetProcessUIAccessZorder
@@ -108,0 +369,53 @@
+NtUserSetProgmanWindow
+NtUserSetScrollInfo
+NtUserSetSensorPresence
+NtUserSetShellSpecialWindow
+NtUserSetShellWindowEx
+NtUserSetSysMenu
+NtUserSetSystemCursor
+NtUserSetSystemMenu
+NtUserSetSystemTimer
+NtUserSetTSFEventState
+NtUserSetTargetForResourceBrokering
+NtUserSetTaskmanWindow
+NtUserSetThreadDesktop
+NtUserSetThreadInputBlocked
+NtUserSetThreadLayoutHandles
+NtUserSetThreadQueueMergeSetting
+NtUserSetThreadState
+NtUserSetTimer
+NtUserSetUserObjectCapability
+NtUserSetVisible
+NtUserSetWaitForQueueAttach
+NtUserSetWatermarkStrings
+NtUserSetWindowBand
+NtUserSetWindowCompositionAttribute
+NtUserSetWindowCompositionTransition
+NtUserSetWindowContextHelpId
+NtUserSetWindowDisplayAffinity
+NtUserSetWindowFNID
+NtUserSetWindowFeedbackSetting
+NtUserSetWindowLong
+NtUserSetWindowLongPtr
+NtUserSetWindowMessageCapability
+NtUserSetWindowPlacement
+NtUserSetWindowPos
+NtUserSetWindowRgn
+NtUserSetWindowRgnEx
+NtUserSetWindowShowState
+NtUserSetWindowState
+NtUserSetWindowStationUser
+NtUserSetWindowWord
+NtUserShellHandwritingDelegateInput
+NtUserShellHandwritingHandleDelegatedInput
+NtUserShellHandwritingUndelegateInput
+NtUserShellMigrateWindow
+NtUserShellRegisterHotKey
+NtUserShellSetWindowPos
+NtUserShowCaret
+NtUserShowCursor
+NtUserShowOwnedPopups
+NtUserShowScrollBar
+NtUserShowStartGlass
+NtUserShowWindow
+NtUserShowWindowAsync
@@ -110,74 +423,71 @@
-PALLOCMEM
-PFFOBJ::bAddPvtData
-PROXYPORT::PROXYPORT
-PUBLIC_PFTOBJ::bLoadFonts
-PackAffectedThreadList
-PanEnablePDEV
-PostWindowAction
-PrepareGammaRampData
-ProbeAndCaptureSoftKbdData
-ProcessDownOnly
-ReEnableTRNH::ReTarget
-ReadCalibrationDataImp
-ReadLinearityData
-ReadLinearityDataImp
-RegQueryValueCal
-ResizeVisExcludeMemory
-SetGlobalWallpaperSettings
-SetImeHotKey
-SetLPITEMInfoNoRedraw
-SetRedirectionBitmap
-SetWindowCompositionInfo
-SfnIMECONTROL
-ShellForegroundBoost::Initialize
-ShellWindowPos::MigrateWindowAsyncOld
-ShellWindowPos::PositionWindowAsyncOld
-SimpleHapticsController::Initialize
-SimpleHapticsController::InitializeSupportedWaveformList
-SimpleHapticsController::SetAutoTriggerWaveform
-TooltipDismiss::InsertTooltipRegistration
-TouchTargetingRankForRegion
-TransformRegionBetweenCoordinateSpaces
-TransformRgn
-UMPDOBJ::CreateUMPDHeap
-UpdateDesktopMonitorNavigationOrder
-UpdateTiltCalData
-VWPLAddBase
-XDCOBJ::bAddRemoteFont
-XUMPDOBJ::XUMPDOBJ
-_EnableIAMThreadAccess
-_GetWindowCompositionVisualBitmap
-_RegisterHotKey
-_RegisterPointerDeviceNotifications
-_SetActivationFilter
-_SetMagnificationInputTransform
-`anonymous_namespace'::ContactVisualizationWorker
-bAddFlEntry
-bAddPrintKView
-bAppendSysDirectory
-bComputeGISET
-bComputeQuickLookup
-bReadUserSystemEUDCRegistry
-bSpEnableSprites
-bUnloadEudcFont
-pSpCreatePresent
-pSpCreateSprite
-rotate::bInitPlgDDA
-vInitFontsDirectoryNameInformation
-xxxAddShadow
-xxxBMPtoDIB
-xxxClientCopyDDEIn1
-xxxConnectService
-xxxCreateDesktopEx2
-xxxCreateWindowEx
-xxxDiscardPointerWindowFrameMessages
-xxxDrawMenuBarUnderlines
-xxxDrawMenuItemText
-xxxForceWindowToDpiForTest
-xxxImeWindowPosChanged
-xxxImmLoadLayout
-xxxInheritWindowMonitor
-xxxInternalDoSyncPaint
-xxxPSMGetTextExtent
-xxxPSMTextOut
-xxxPointerWindowHitTest
+NtUserShutdownReasonDestroy
+NtUserSoundSentry
+NtUserSuppressWindowDisplayChange
+NtUserSwapMouseButton
+NtUserSwitchDesktop
+NtUserSwitchToThisWindow
+NtUserSystemParametersInfoForDpi
+NtUserThreadMessageQueueAttached
+NtUserThunkedMenuInfo
+NtUserThunkedMenuItemInfo
+NtUserTraceLoggingSendMixedModeTelemetry
+NtUserTrackMouseEvent
+NtUserTrackPopupMenuEx
+NtUserTranslateAccelerator
+NtUserTranslateMessage
+NtUserUndelegateInput
+NtUserUnlockWindowStation
+NtUserUnregisterClass
+NtUserUnregisterHotKey
+NtUserUnregisterUserApiHook
+NtUserUpdateClientRect
+NtUserUpdateDefaultDesktopThumbnail
+NtUserUpdateInputContext
+NtUserUpdateInstance
+NtUserUpdateLayeredWindow
+NtUserUpdatePerUserImmEnabling
+NtUserUpdatePerUserSystemParameters
+NtUserUpdateWindow
+NtUserUpdateWindowTrackingInfo
+NtUserUpdateWindows
+NtUserUserHandleGrantAccess
+NtUserUserPowerCalloutWorker
+NtUserValidateHandleSecure
+NtUserValidateRect
+NtUserValidateRgn
+NtUserWaitAvailableMessageEx
+NtUserWaitForInputIdle
+NtUserWaitMessage
+NtUserWakeRITForShutdown
+NtUserWindowFromPhysicalPoint
+NtUserZapActiveAndFocus
+RawInputThread
+ReEnterLeaveCrit::ReEnterLeaveCrit
+ReEnterLeaveCritIfNotOwnedAtAll::ReEnterLeaveCritIfNotOwnedAtAll
+ShowAutorunCursor
+SimpleHapticsController::HapticsDeviceNotifyWorker
+SpbApc
+TerminateDesktopThreads
+UserDetachQueueFromInputWindow
+UserOnGreTextReady
+UserRemoveWindowedSwapChain
+UserSetWindowedSwapChain
+ValidateAndAttachQueueToInputWindow
+`anonymous_namespace'::HandlePointerCursorSideOp
+`anonymous_namespace'::RenderCursor
+xxxActivateDebugger
+xxxCreateDesktopEx
+xxxDCEWindowHitTestIndirect
+xxxDesktopThread
+xxxDwmStopRedirection
+xxxInitTerminal
+xxxLeaveSharedEnterExclusiveLeaveReEnterSharedIfRequired::xxxLeaveSharedEnterExclusiveLeaveReEnterSharedIfRequired
+xxxMinMaximizeEx
+xxxMouseEventDirect
+xxxMoveEventAbsolute
+xxxPrintWindow
+xxxProcessMousePromotionQueue
+xxxRemoteReconnect
+xxxSendInput
+xxxSoundSentry
+xxxSwitchDesktop
@@ -185,5 +494,0 @@
-xxxValidateClassAndSize
-xxxWindowEvent
-xxxbEnumerateRegistryFonts
-xxxbEnumerateRegistryFontsInternal
-zzzAttachThreadInput
```

## `WIN32K.SYS::W32GetUserGdiSessionState`  (modified)

```diff
--- WIN32K.SYS::W32GetUserGdiSessionState calling
+++ WIN32K.SYS::W32GetUserGdiSessionState calling
@@ -7 +6,0 @@
-EditionIsRIMInjectionBlocked
@@ -18,0 +18 @@
+NtUserInitializeUserModeMenus
@@ -67 +66,0 @@
-xxxInternalKeyEventDirect
@@ -70 +68,0 @@
-xxxMouseEventDirect
```

## `NTOSKRNL.EXE::RtlDestroyAtomTable`  (modified)

```diff
--- NTOSKRNL.EXE::RtlDestroyAtomTable calling
+++ NTOSKRNL.EXE::RtlDestroyAtomTable calling
@@ -2 +1,0 @@
-JobCalloutTerminate
```

## `WIN32KBASE.SYS::HMAllocObject`  (modified)

```diff
--- WIN32KBASE.SYS::HMAllocObject calling
+++ WIN32KBASE.SYS::HMAllocObject calling
@@ -18 +17,0 @@
-zzzSetWindowsHookEx_New
```

## `NTOSKRNL.EXE::PsGetProcessWin32Process`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetProcessWin32Process calling
+++ NTOSKRNL.EXE::PsGetProcessWin32Process calling
@@ -3 +2,0 @@
-CForegroundLaunch::PushForegroundPolicy_Old
@@ -21 +19,0 @@
-UserJobCallout
```

## `NTOSKRNL.EXE::ExEnterCriticalRegionAndAcquireResourceExclusive`  (modified)

```diff
--- NTOSKRNL.EXE::ExEnterCriticalRegionAndAcquireResourceExclusive calling
+++ NTOSKRNL.EXE::ExEnterCriticalRegionAndAcquireResourceExclusive calling
@@ -3 +2,0 @@
-NtUserUserHandleGrantAccess
```

## `NTOSKRNL.EXE::PsGetCurrentProcessWin32Process`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentProcessWin32Process calling
+++ NTOSKRNL.EXE::PsGetCurrentProcessWin32Process calling
@@ -69,0 +70 @@
+NtUserSetGUISystemInformation
```

## `NTOSKRNL.EXE::KeAttachProcess`  (modified)

```diff
--- NTOSKRNL.EXE::KeAttachProcess calling
+++ NTOSKRNL.EXE::KeAttachProcess calling
@@ -17 +16,0 @@
-zzzSetWindowsHookEx_New
```

## `NTOSKRNL.EXE::KeUnstackDetachProcess`  (modified)

```diff
--- NTOSKRNL.EXE::KeUnstackDetachProcess calling
+++ NTOSKRNL.EXE::KeUnstackDetachProcess calling
@@ -6 +5,0 @@
-SetProcessFlags
```

## `NTOSKRNL.EXE::PsGetCurrentProcess`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentProcess calling
+++ WIN32KBASE.SYS::ValidateHwnd calling
@@ -1 +1 @@
-AddApiSetHostLoadRefCount
+<lambda_277e27b1cd4deb1c0da16912fdfd9d5e>::<lambda_invoker_cdecl>
@@ -3,2 +2,0 @@
-CreateXlateObject
-DEVLOCKOBJ::~DEVLOCKOBJ
@@ -6,17 +4,19 @@
-DoInputCheck
-EXLATEOBJ::bInitXlateObj
-EXLATEOBJ::bSearchCache
-EngCreateDriverObj
-GetProcessSessionFonts
-GreGetCurrentThreadCrossSessionCheck
-GreIsCurrentProcessSystemCritical
-GrepAcquireLockValidate<16>
-GrepComputeAdditionalFontLinkChangeFlagsForEnableEUDC
-InitializeClientPfnArrays
-IsCurrentProcessDwm
-IsThreadCrossSessionAttached
-NtGdiAddFontResourceW
-NtGdiAddInitialFonts
-NtGdiCreateDIBSection
-NtGdiSetPUMPDOBJ
-NtUserAutoRotateScreen
+Edgy::_AdjustFrameHwnd
+Edgy::_GetArcData
+EditionPostInputEvent
+EditionQueryInertiaWorker
+EditionTransformIvTouchInput
+EditionTransformPointForIvSpatialInput
+GetInheritedMonitor
+GetMiPInputTransform
+GetPwndFromPointerMsgId
+GetResizeDCompositionSynchronizationObject
+GetWindowCompositionVisualBitmap
+HidRequestValidityCheck
+IVContainerForegroundSync::xxxIVSyncForeground
+InteractiveControlDevice::SetFocus
+NtUserAcquireInteractiveControlBackgroundAccess
+NtUserApplyWindowAction
+NtUserArrangeIconicWindows
+NtUserBeginLayoutUpdate
+NtUserBroadcastImeShowStatusChange
@@ -23,0 +24,6 @@
+NtUserBuildPropList
+NtUserChangeClipboardChain
+NtUserCheckImeShowStatusInThread
+NtUserCheckWindowThreadDesktop
+NtUserChildWindowFromPointEx
+NtUserClearWindowState
@@ -25,14 +31,104 @@
-NtUserCtxDisplayIOCtl
-NtUserDestroyCursor
-NtUserGetDwmCursorShape
-NtUserGetScrollBarInfo
-NtUserHardErrorControl
-NtUserInitializeUserModeMenus
-NtUserMsgWaitForMultipleObjectsEx
-NtUserNotifyProcessCreate
-NtUserProcessConnect
-NtUserQueryInformationThread
-NtUserRemoteConnect
-NtUserRemoteRedrawRectangle
-NtUserRemoteRedrawScreen
-NtUserRemoteStopScreenUpdates
+NtUserCreateLayoutSyncForHwnd
+NtUserCreateWindowEx
+NtUserDeferWindowDpiChanges
+NtUserDispatchMessage
+NtUserDragObject
+NtUserDrawAnimatedRects
+NtUserDrawCaptionTemp
+NtUserDrawMenuBar
+NtUserDwmValidateWindow
+NtUserEnableModernAppWindowKeyboardIntercept
+NtUserEnableResizeLayoutSynchronization
+NtUserEnableScrollBar
+NtUserEnableSynchronizedLayout
+NtUserEnableWindow
+NtUserEnableWindowShellWindowManagementBehavior
+NtUserFillWindow
+NtUserFindWindowEx
+NtUserForceWindowToDpiForTest
+NtUserFrostCrashedWindow
+NtUserGetAncestor
+NtUserGetAppImeLevel
+NtUserGetClassIcoCur
+NtUserGetClassName
+NtUserGetControlColor
+NtUserGetCurrentDpiInfoForWindow
+NtUserGetDCEx
+NtUserGetGestureConfig
+NtUserGetLayeredWindowAttributes
+NtUserGetMenuItemRect
+NtUserGetOwnerTransformedMonitorRect
+NtUserGetResizeDCompositionSynchronizationObject
+NtUserGetSysMenuOffset
+NtUserGetSystemMenu
+NtUserGetTitleBarInfo
+NtUserGetTopLevelWindow
+NtUserGetWindowBand
+NtUserGetWindowCompositionAttribute
+NtUserGetWindowDC
+NtUserGetWindowDisplayAffinity
+NtUserGetWindowFeedbackSetting
+NtUserGetWindowMinimizeRect
+NtUserGetWindowPlacement
+NtUserGetWindowProcessHandle
+NtUserGetWindowRgnEx
+NtUserGetWindowTrackInfoAsync
+NtUserGhostWindowFromHungWindow
+NtUserHideCaret
+NtUserHungWindowFromGhostWindow
+NtUserHwndQueryRedirectionInfo
+NtUserHwndSetRedirectionInfo
+NtUserImpersonateDdeClientWindow
+NtUserInheritWindowMonitor
+NtUserInjectGesture
+NtUserInternalGetWindowIcon
+NtUserInternalGetWindowText
+NtUserInvalidateRect
+NtUserIsChildWindowDpiMessageEnabled
+NtUserIsInterceptWindow
+NtUserIsNonClientDpiScalingEnabled
+NtUserIsResizeLayoutSynchronizationEnabled
+NtUserIsTopLevelWindow
+NtUserIsTouchWindow
+NtUserIsWindowBroadcastingDpiToChildren
+NtUserIsWindowDisplayChangeSuppressed
+NtUserIsWindowGDIScaledDpiMessageEnabled
+NtUserKillSystemTimer
+NtUserKillTimer
+NtUserLockWindowUpdate
+NtUserLogicalToPerMonitorDPIPhysicalPoint
+NtUserLogicalToPhysicalDpiPointForWindow
+NtUserLogicalToPhysicalPoint
+NtUserMagControl
+NtUserMagGetContextInformation
+NtUserMagSetContextInformation
+NtUserMenuItemFromPoint
+NtUserMessageCall
+NtUserMinMaximize
+NtUserMoveWindow
+NtUserNavigateFocus
+NtUserNotifyOverlayWindow
+NtUserNotifyWinEvent
+NtUserOpenClipboard
+NtUserPerMonitorDPIPhysicalToLogicalPoint
+NtUserPhysicalToLogicalDpiPointForWindow
+NtUserPhysicalToLogicalPoint
+NtUserPostMessage
+NtUserPrintWindow
+NtUserQueryWindow
+NtUserRaiseLowerShellWindow
+NtUserRealChildWindowFromPoint
+NtUserRedrawFrame
+NtUserRedrawFrameAndHook
+NtUserRedrawTitle
+NtUserRedrawWindow
+NtUserRegisterBSDRWindow
+NtUserRegisterCloakedNotification
+NtUserRegisterEdgy
+NtUserRegisterErrorReportingDialog
+NtUserRegisterForCustomDockTargets
+NtUserRegisterForTooltipDismissNotification
+NtUserRegisterHotKey
+NtUserRegisterPointerDeviceNotifications
+NtUserRegisterPointerInputTarget
+NtUserRestoreWindowDpiChanges
@@ -40,11 +136,60 @@
-NtUserSetInformationThread
-NtUserSetSensorPresence
-NtUserSetThreadDesktop
-NtUserSetWindowsHookEx
-PROXYPORT::PROXYPORT
-RFONTOBJ::bInit
-RIMDevChangeDoUsermodeCallback
-RemotePassthruDisable
-RemoteShadowCleanup
-RemoteShadowStart
-RemoteThinwireStats
+NtUserSendEventMessage
+NtUserSetActivationFilter
+NtUserSetActiveWindow
+NtUserSetBrokeredForeground
+NtUserSetCapture
+NtUserSetClassLongPtr
+NtUserSetClipboardViewer
+NtUserSetDialogPointer
+NtUserSetDialogSystemMenu
+NtUserSetDpiForWindow
+NtUserSetFocus
+NtUserSetForegroundWindow
+NtUserSetForegroundWindowForApplication
+NtUserSetGestureConfig
+NtUserSetImeOwnerWindow
+NtUserSetInteractiveControlFocus
+NtUserSetInternalWindowPos
+NtUserSetMenu
+NtUserSetMirrorRendering
+NtUserSetParent
+NtUserSetProgmanWindow
+NtUserSetScrollInfo
+NtUserSetShellWindowEx
+NtUserSetSysMenu
+NtUserSetTaskmanWindow
+NtUserSetTimer
+NtUserSetVisible
+NtUserSetWindowBand
+NtUserSetWindowContextHelpId
+NtUserSetWindowFNID
+NtUserSetWindowPlacement
+NtUserSetWindowPos
+NtUserSetWindowRgn
+NtUserSetWindowRgnEx
+NtUserSetWindowShowState
+NtUserSetWindowState
+NtUserShellRegisterHotKey
+NtUserShowCaret
+NtUserShowOwnedPopups
+NtUserShowScrollBar
+NtUserShowWindow
+NtUserShowWindowAsync
+NtUserShutdownBlockReasonQuery
+NtUserSuppressWindowDisplayChange
+NtUserSwitchToThisWindow
+NtUserTrackPopupMenuEx
+NtUserTranslateAccelerator
+NtUserTranslateMessage
+NtUserUnregisterHotKey
+NtUserUpdateClientRect
+NtUserUpdateDefaultDesktopThumbnail
+NtUserUpdateWindow
+NtUserUpdateWindowTrackingInfo
+NtUserUpdateWindows
+NtUserValidateRect
+NtUserValidateRgn
+NtUserfnDDEINIT
+PointerPromotion::xxxProcessPointerInputAsMouse
+RefreshMiPIdleNotificationTimer
+SetProcDeviceRequest
@@ -52,49 +197,40 @@
-TraceLoggingRapidHpdComplete
-UmfdHostLifeTimeManager::IsCurrentProcessUmfdHost
-UmfdHostLifeTimeManager::IsCurrentProcessUmfdHostNoLock
-UmfdLoadFontFile
-UserCommitDesktopMemory
-W32AttachToProcessAndExecute<<lambda_679956ec8699b4d63e5c901704edddc1>_>
-W32AttachToProcessAndExecute<<lambda_735e0558695e6dec8da91e7614b43783>_>
-W32GetCurrentThreadCrossSessionCheck
-W32GetCurrentWin32kSessionId
-W32GetThreadWin32ThreadCrossSessionCheck
-WakeRITForShutdown
-_BlockInput
-_CreateEmptyCursorObject
-_DestroyCursor
-_GetInputDesktop
-_GetProcessDefaultLayout
-_GetThreadDesktop
-_LoadCursorsAndIcons
-_RegisterHotKey
-_SetClipboardData
-_SetCursorIconDataEx
-bIsProcessLocalSystem
-bSpDwmUpdateSurface
-vAdjustDelegatePriority
-vCleanupUMWindowlessSprite
-xxxCallHook2
-xxxCloseClipboard
-xxxCreateDesktopEx2
-xxxFreeWindow_Phase2
-xxxGetDeviceChangeInfo
-xxxGetEventProc
-xxxGetRenderData
-xxxInitTerminal
-xxxInterSendMsgEx
-xxxLoadPermanentFonts
-xxxLoadUserApiHook
-xxxRemoteConsoleShadowStop
-xxxRemoteDisconnect
-xxxRemoteNotify
-xxxRemotePassthruEnable
-xxxRemoteReconnect
-xxxRemoteShadowSetup
-xxxRemoteShadowStop
-xxxResolveDesktop
-xxxSetDeskWallpaper
-xxxSetProcessInitState
-xxxSetProcessWindowStation
-xxxSetThreadDesktop
-zzzInternalSetSystemCursor
+TrackMouseEvent
+UserAssociateHwnd
+UserGetHwndProcess
+UserRecreateRedirectionBitmap
+UserRemoveWindowedSwapChain
+UserSetWindowedSwapChain
+ValidateDDEConvPair
+ValidateHWNDND
+ValidateHwndIAM
+ValidateHwndIAMComponetUIAware
+ValidateReceivingHwnd
+WakeSomeone
+WindowActions::xxxApplyAction
+`anonymous_namespace'::ContactVisualizationWorker
+`anonymous_namespace'::DeferPointerCursorOperation
+`anonymous_namespace'::GetWindowBarrelVisualizationSetting
+`anonymous_namespace'::GetWindowVisualizationSetting
+xxxConsoleControl
+xxxCsEvent
+xxxDDETrackGetMessageHook
+xxxDDETrackPostHook
+xxxDDETrackSendHook
+xxxDiscardPointerWindowFrameMessages
+xxxDispatchMessage
+xxxDoDeferredPointerActivate
+xxxDragObject
+xxxHelpLoop
+xxxImeWindowPosChanged
+xxxRealDefWindowProc
+xxxRealInternalGetMessage
+xxxScanSysQueue
+xxxSendPostedMessage
+xxxSetConsoleCaretInfo
+xxxSetInformationThread
+xxxSetModernAppWindow
+xxxSetWindowData
+xxxSysCommand
+xxxTargetingHitTest
+xxxTranslateMessage
+xxxWindowHitTestFromTargetingProperty
```

## `NTOSKRNL.EXE::KeBugCheckEx`  (modified)

```diff
--- NTOSKRNL.EXE::KeBugCheckEx calling
+++ NTOSKRNL.EXE::KeBugCheckEx calling
@@ -24,0 +25 @@
+OnHideAppStartCursor
@@ -55,0 +57,2 @@
+zzzClearStartGlass
+zzzSetStartGlass
```

## `WIN32KBASE.SYS::ValidateHwndStrict`  (modified)

```diff
--- WIN32KBASE.SYS::ValidateHwndStrict calling
+++ WIN32KBASE.SYS::ValidateHwndStrict calling
@@ -2,0 +3 @@
+NtUserLayoutCompleted
```

## `WIN32KBASE.SYS::EngSetLastError`  (modified)

```diff
--- WIN32KBASE.SYS::EngSetLastError calling
+++ WIN32KBASE.SYS::EngSetLastError calling
@@ -40,0 +41 @@
+GreGetOrCreateLayoutSyncHandle
```

## `WIN32KBASE.SYS::CreateGlobalAtomTable`  (modified)

```diff
--- WIN32KBASE.SYS::CreateGlobalAtomTable calling
+++ WIN32KBASE.SYS::CreateGlobalAtomTable calling
@@ -1 +0,0 @@
-CreateW32Job
```

## `WIN32KBASE.SYS::Win32FreePool`  (modified)

```diff
--- WIN32KBASE.SYS::Win32FreePool calling
+++ WIN32KBASE.SYS::Win32FreePool calling
@@ -65 +64,0 @@
-CreateW32Job
@@ -194 +192,0 @@
-JobCalloutTerminate
@@ -303 +300,0 @@
-RemoveProcessFromJob
```

## `WIN32KBASE.SYS::RGNOBJ::bInside`  (modified)

```diff
--- WIN32KBASE.SYS::RGNOBJ::bInside calling
+++ WIN32KBASE.SYS::RGNOBJ::bInside calling
@@ -1,6 +1,2 @@
-GrepRectVisible
-InternalSpritesCollision
-SpSaveScreenBits
-UNDOWNDOBJSPRITEOVERLAPCLIP::vUndo
-vSpUpdateSpriteVisRgn
-vSpUpdateWndobjOverlap
+NtGdiExtFloodFill
+NtGdiPtVisible
```
