# CVE-2026-119910 — win32kbase.sys patch diff

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

## `NtUserDisplayConfigSetDeviceInfo`  (modified)

```diff
--- NtUserDisplayConfigSetDeviceInfo
+++ NtUserDisplayConfigSetDeviceInfo
@@ -1,28 +1,154 @@
 

-longlong NtUserDisplayConfigSetDeviceInfo(void)

+int NtUserDisplayConfigSetDeviceInfo(void *param_1)

 

 {

-  int iVar1;

-  longlong lVar2;

-  longlong unaff_RSI;

-  int unaff_EDI;

-  TELEMETRY_POINTER_FRAME_TIMES *in_stack_00000070;

-  tagTHREADINFO *in_stack_00000078;

+  bool bVar1;

+  bool bVar2;

+  char cVar3;

+  int iVar4;

+  DISPLAYCONFIG_DEVICE_INFO_TYPE DVar5;

+  longlong lVar6;

+  longlong lVar7;

+  tagTHREADINFO *ptVar8;

+  DISPLAYCONFIG_DEVICE_INFO_TYPE *pDVar9;

+  DISPLAYCONFIG_DEVICE_INFO_TYPE *pDVar10;

+  ulonglong _Size;

+  undefined1 uVar11;

+  undefined8 local_58;

+  DISPLAYCONFIG_DEVICE_INFO_TYPE *local_50;

+  code *local_48;

+  undefined4 local_40;

+  undefined4 local_3c;

+  undefined4 local_38;

+  CDisplayScenarioContextScope local_28 [32];

   

-  iVar1 = 0;

-  if ((((unaff_EDI == 0) || ((short)((uint)unaff_EDI >> 0x10) != 0)) || (99 < (uint)unaff_RSI - 1))

-     || ((in_stack_00000070 == (TELEMETRY_POINTER_FRAME_TIMES *)0x0 || (unaff_EDI == 1)))) {

-    UserSetLastError(0x57);

+                    /* 0x168250  1963  NtUserDisplayConfigSetDeviceInfo */

+  local_28[0] = (CDisplayScenarioContextScope)0x0;

+  CDisplayScenarioContextScope::ContextScopeConstructor(local_28,(_GUID *)0x0,0x1e,0);

+  pDVar9 = (DISPLAYCONFIG_DEVICE_INFO_TYPE *)0x0;

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>::

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>

+            ((Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)> *)

+             &local_58);

+  lVar6 = W32GetUserSessionState();

+  uVar11 = 0;

+  lVar7 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                    (lVar6,0,0,<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+  *(longlong *)(lVar6 + 0x10) = lVar7;

+  if (lVar7 != 0) {

+    DestroySharedUserCritDeferredUnlockList(lVar6 + 0x4d78);

+    DestroyDeferredUnlockObjectAssignmentList(lVar6 + 0x4db0);

+    DestroyDeferredUnlockObjectAssignmentList(lVar6 + 0x4da0);

+  }

+  lVar6 = W32GetUserGdiSessionState();

+  if (*(int *)(lVar6 + 0x20) == 0) {

+LAB_0:

+    iVar4 = -0x3fffffff;

+    goto LAB_1;

+  }

+  ptVar8 = PtiCurrent();

+  iVar4 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar4 == 0) {

+    local_40 = 0x2000;

+    local_3c = 0xffffffff;

+    local_38 = 0;

+    uVar11 = 0;

+    bVar1 = UIPrivilegeIsolation::CheckAccessEx

+                      ((tagUIPI_INFO *)(*(longlong *)(ptVar8 + 0x1d0) + 0x358),

+                       (tagUIPI_INFO *)&local_40,0);

   }

   else {

-    lVar2 = PsGetCurrentProcessWow64Process();

-    ProbeForWrite(in_stack_00000070,unaff_RSI * 0x90,(-(uint)(lVar2 != 0) & 0xfffffffd) + 4);

-    lVar2 = W32GetUserSessionState();

-    iVar1 = CTouchProcessor::GetPointerFrameTimesInternal

-                      (*(CTouchProcessor **)(lVar2 + 0xcb8),in_stack_00000078,(ushort)unaff_EDI,

-                       (uint)unaff_RSI,in_stack_00000070);

+    bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                      ((tagUIPI_INFO *)(*(longlong *)(ptVar8 + 0x1d0) + 0x358),0x2000);

+  }

+  bVar2 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(ptVar8 + 0x1d0),0x10);

+  if ((bVar2) && (bVar1 != false)) {

+    pDVar9 = *(DISPLAYCONFIG_DEVICE_INFO_TYPE **)MmUserProbeAddress_exref;

+    pDVar10 = (DISPLAYCONFIG_DEVICE_INFO_TYPE *)((longlong)param_1 + 4U);

+    if (pDVar9 <= (DISPLAYCONFIG_DEVICE_INFO_TYPE *)((longlong)param_1 + 4U)) {

+      pDVar10 = pDVar9;

+    }

+    DVar5 = *pDVar10;

+    _Size = (ulonglong)DVar5;

+    if (DVar5 < 0x14) {

+      iVar4 = -0x3fffffdd;

+      pDVar9 = (DISPLAYCONFIG_DEVICE_INFO_TYPE *)0x0;

+      goto LAB_1;

+    }

+    pDVar9 = Win32AllocPoolWithQuotaZInitImpl((__uint64)pDVar9,_Size,0x63447355);

+    if (pDVar9 == (DISPLAYCONFIG_DEVICE_INFO_TYPE *)0x0) {

+                    /* WARNING: Subroutine does not return */

+      ExRaiseStatus(0xc0000017);

+    }

+    if (local_48 != (code *)0xffffffffffffffff) {

+      ptVar8 = PtiCurrent();

+                    /* WARNING: Subroutine does not return */

+      KeBugCheckEx(0x164,0x12,&local_58,pDVar9,ptVar8);

+    }

+    ptVar8 = PtiCurrent();

+    local_58 = *(undefined8 *)(ptVar8 + 0x180);

+    *(undefined8 **)(ptVar8 + 0x180) = &local_58;

+    local_48 = GreDeleteFastMutex;

+    local_50 = pDVar9;

+    lVar6 = PsGetCurrentProcessWow64Process();

+    if (((ulonglong)param_1 & (ulonglong)(~-(uint)(lVar6 != 0) & 3)) != 0) {

+                    /* WARNING: Subroutine does not return */

+      ExRaiseDatatypeMisalignment();

+    }

+    RtlCopyVolatileMemory(pDVar9,param_1,_Size);

+    uVar11 = (undefined1)_Size;

+    pDVar9[1] = DVar5;

+    lVar6 = W32GetUserGdiSessionState();

+    if (*(int *)(lVar6 + 0x24) != 0) goto LAB_0;

+    if (*pDVar9 == 0xffffffed) {

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

+        cVar3 = RtlIsMultiSessionSku();

+        if (cVar3 == '\0') goto LAB_2;

+        iVar4 = IsCurrentProcessDwm();

+        goto LAB_3;

+      }

+    }

+    else {

+      iVar4 = UserIsWddmConnectedSession();

+LAB_3:

+      if (iVar4 == 0) goto LAB_2;

+    }

+    DVar5 = DispConfigTypes::GetSetterTypeSize(*pDVar9);

+    if ((DVar5 == 0) || (pDVar9[1] != DVar5)) {

+      iVar4 = -0x3ffffff3;

+    }

+    else {

+      iVar4 = PreAllocateForPrimaryMonitorChange();

+      if (iVar4 == 0) {

+        iVar4 = -0x3fffffe9;

+      }

+      else {

+        iVar4 = DrvDisplayConfigSetDeviceInfo(pDVar9);

+        if (iVar4 == -0x7ffffffb) {

+          iVar4 = -0x3fffffdd;

+        }

+        else if (iVar4 != -0x3fffffdd) {

+          iVar4 = _DeviceInfoTranslateStatusDefault(*pDVar9);

+        }

+      }

+    }

+  }

+  else {

+LAB_2:

+    iVar4 = -0x3fffffde;

+  }

+LAB_1:

+  if (pDVar9 != (DISPLAYCONFIG_DEVICE_INFO_TYPE *)0x0) {

+    Win32RawLockedItemBase<DISPLAYCONFIG_DEVICE_INFO_HEADER,&void___cdecl_Win32FreePool(void*___ptr64),1,1,1>

+    ::UnlockWorker((Win32RawLockedItemBase<DISPLAYCONFIG_DEVICE_INFO_HEADER,&void___cdecl_Win32FreePool(void*___ptr64),1,1,1>

+                    *)&local_58,false,(bool)uVar11);

   }

   ReleaseUserCriticalSection();

-  return (longlong)iVar1;

+  Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>::

+  ~Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+            ((Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+              *)&local_58);

+  CDisplayScenarioContextScope::~CDisplayScenarioContextScope(local_28);

+  return iVar4;

 }
```

## `NtUserSystemParametersInfo`  (modified)

```diff
--- NtUserSystemParametersInfo
+++ NtUserSystemParametersInfo
@@ -1,49 +1,1363 @@
 

-longlong NtUserSystemParametersInfo(void)

+longlong NtUserSystemParametersInfo(uint param_1,uint param_2,uint *param_3,uint param_4)

 

 {

-  int iVar1;

-  undefined4 *puVar2;

-  char *in_RAX;

-  longlong lVar3;

-  char *unaff_RBX;

-  uint unaff_ESI;

-  undefined4 unaff_EDI;

-  undefined4 *unaff_R12;

-  int unaff_R13D;

-  uint uStack0000000000000030;

-  int iStack0000000000000034;

-  undefined4 *in_stack_00000038;

-  undefined4 in_stack_00000040;

-  int iStack0000000000000078;

-  undefined4 uStack000000000000007c;

-  undefined4 *puStack0000000000000088;

+  uint uVar1;

+  void *_Src;

+  uint uVar2;

+  uint uVar3;

+  bool bVar4;

+  char cVar5;

+  bool bVar6;

+  int iVar7;

+  longlong lVar8;

+  longlong lVar9;

+  longlong *plVar10;

+  ulonglong uVar11;

+  uint *puVar12;

+  tagTHREADINFO *ptVar13;

+  uint *puVar14;

+  uint *puVar15;

+  ushort uVar16;

+  tagPROCESSINFO *this;

+  uint *puVar17;

+  undefined8 uVar18;

+  void *pvVar19;

+  ulonglong uVar20;

+  uint *puVar21;

+  tagPROCESSINFO *ptVar22;

+  uint local_338;

+  uint *local_330;

+  uint local_328;

+  undefined8 local_320;

+  uint *local_318;

+  code *local_310;

+  undefined8 local_308;

+  uint *local_300;

+  code *local_2f8;

+  int local_2f0;

+  uint local_2ec;

+  undefined4 local_2e8;

+  uint *local_2e0;

+  undefined4 local_2c8;

+  undefined4 local_2c4;

+  undefined4 local_2c0;

+  undefined8 local_2b0;

+  undefined8 uStack_2a8;

+  undefined8 local_2a0;

+  undefined8 local_298;

+  void *pvStack_290;

+  uint *local_288;

+  uint *local_280;

+  uint local_268 [140];

   

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

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

-  puStack0000000000000088 = in_stack_00000038;

-  uStack0000000000000030 = unaff_ESI;

-  lVar3 = PsGetCurrentProcessWow64Process();

-  puVar2 = puStack0000000000000088;

-  ProbeForWrite(puStack0000000000000088,uStack0000000000000030,

-                (-(uint)(lVar3 != 0) & 0xfffffffd) + unaff_ESI);

-  iStack0000000000000078 = 1;

-  *unaff_R12 = *puVar2;

-  iStack0000000000000034 =

-       func_0x0001401707a0(unaff_EDI,in_stack_00000040,unaff_R12,uStack000000000000007c);

-  if (iStack0000000000000078 != unaff_R13D) {

-    memmove(puStack0000000000000088,unaff_R12,(ulonglong)uStack0000000000000030);

+                    /* 0x16ea10  2044  NtUserSystemParametersInfo */

+  ptVar22 = (tagPROCESSINFO *)(ulonglong)param_1;

+  local_298 = 0;

+  pvStack_290 = (void *)0x0;

+  local_338 = 0;

+  local_2e0 = (uint *)0x0;

+  local_2f0 = 0;

+  lVar8 = W32GetUserSessionState();

+  lVar9 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                    (lVar8,0,0,<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+  *(longlong *)(lVar8 + 0x10) = lVar9;

+  if (lVar9 != 0) {

+    DestroySharedUserCritDeferredUnlockList(lVar8 + 0x4d78);

+    DestroyDeferredUnlockObjectAssignmentList(lVar8 + 0x4db0);

+    DestroyDeferredUnlockObjectAssignmentList(lVar8 + 0x4da0);

   }

-  iVar1 = iStack0000000000000034;

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>::

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>

+            ((Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)> *)

+             &local_308);

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>::

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>

+            ((Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)> *)

+             &local_320);

+  local_2ec = param_4 & 3;

+  iVar7 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar7 == 0) {

+    local_2c8 = 0x2000;

+    local_2c4 = 0xffffffff;

+    local_2c0 = 0;

+    plVar10 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar11 = 0;

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

+      uVar11 = (ulonglong)plVar10 & -(ulonglong)(*plVar10 != 0);

+    }

+    bVar4 = UIPrivilegeIsolation::CheckAccessEx

+                      ((tagUIPI_INFO *)(uVar11 + 0x358),(tagUIPI_INFO *)&local_2c8,0);

+  }

+  else {

+    plVar10 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar11 = 0;

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

+      uVar11 = (ulonglong)plVar10 & -(ulonglong)(*plVar10 != 0);

+    }

+    bVar4 = UIPrivilegeIsolation::MeetsUIPIThreshold((tagUIPI_INFO *)(uVar11 + 0x358),0x2000);

+  }

+  iVar7 = Feature_LearningModeExpansion__private_IsEnabledDeviceUsageNoInline();

+  if (iVar7 == 0) {

+    this = *(tagPROCESSINFO **)(lVar9 + 0x1d0);

+    bVar6 = tagPROCESSINFO::HasUILimit(this,8);

+    if ((bVar6) || (bVar4 == false)) {

+      if (param_1 < 0x6e) {

+        if (param_1 != 0x6d) {

+          if (param_1 < 0x38) {

+            if (param_1 != 0x37) {

+              if (param_1 < 0x1e) {

+                if (param_1 != 0x1d) {

+                  if (param_1 < 0x14) {

+                    uVar1 = 0xaa854 >> (param_1 & 0x1f);

+LAB_0:

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

+                  }

+                  else if (((param_1 != 0x14) && (param_1 != 0x15)) && (param_1 != 0x17)) {

+                    iVar7 = param_1 - 0x18;

+                    bVar4 = iVar7 == 0;

+                    goto LAB_2;

+                  }

+                }

+              }

+              else if (param_1 < 0x2b) {

+                if ((((param_1 != 0x2a) && (param_1 != 0x1e)) && (param_1 != 0x20)) &&

+                   (((param_1 != 0x21 && (param_1 != 0x22)) && (param_1 != 0x24)))) {

+                  bVar4 = param_1 == 0x25;

+                  goto LAB_3;

+                }

+              }

+              else if ((param_1 != 0x2c) && (param_1 != 0x2e)) {

+                iVar7 = param_1 - 0x2f;

+                goto LAB_4;

+              }

+            }

+          }

+          else if (param_1 < 0x56) {

+            if (param_1 != 0x55) {

+              if (param_1 < 0x4a) {

+                if (param_1 - 0x39 < 0x11) {

+                  this = (tagPROCESSINFO *)0x15515;

+                  uVar1 = 0x15515 >> (param_1 - 0x39 & 0x1f);

+                  goto LAB_0;

+                }

+                goto LAB_1;

+              }

+              if ((((param_1 != 0x4b) && (param_1 != 0x4c)) && (param_1 != 0x4d)) &&

+                 ((param_1 != 0x4e && (param_1 != 0x51)))) {

+                bVar4 = param_1 == 0x52;

+                goto LAB_5;

+              }

+            }

+          }

+          else {

+            if (0x60 < param_1) {

+              if (param_1 - 0x61 < 0xb) {

+                bVar4 = (param_1 - 0x61 & 1) == 0;

+LAB_5:

+                if (bVar4) goto LAB_6;

+              }

+              goto LAB_1;

+            }

+            if (((param_1 != 0x60) && (param_1 != 0x56)) &&

+               ((param_1 != 0x57 && ((param_1 != 0x58 && (param_1 != 0x5a)))))) {

+              iVar7 = param_1 - 0x5b;

+              bVar4 = iVar7 == 0;

+LAB_7:

+              if (!bVar4) {

+                bVar4 = iVar7 == 2;

+                goto LAB_3;

+              }

+            }

+          }

+        }

+      }

+      else if (param_1 < 0x1018) {

+        if (param_1 != 0x1017) {

+          if (param_1 < 0xae) {

+            if (param_1 != 0xad) {

+              if (param_1 < 0x9a) {

+                if (((param_1 != 0x99) && (param_1 != 0x6f)) &&

+                   ((param_1 != 0x71 &&

+                    (((param_1 != 0x75 && (param_1 != 0x77)) && (param_1 != 0x93)))))) {

+                  iVar7 = param_1 - 0x95;

+                  bVar4 = iVar7 == 0;

+                  goto LAB_8;

+                }

+              }

+              else if (((param_1 != 0x9b) && (param_1 != 0xa1)) &&

+                      ((param_1 != 0xa3 && (param_1 != 0xa6)))) {

+                iVar7 = param_1 - 0xa9;

+                bVar4 = iVar7 == 0;

+                goto LAB_7;

+              }

+            }

+          }

+          else if (param_1 < 0x1008) {

+            if ((((param_1 != 0x1007) && (param_1 != 0xaf)) && (param_1 != 0xb1)) &&

+               (param_1 != 0xb3)) {

+              iVar7 = param_1 - 0x1001;

+              bVar4 = iVar7 == 0;

+              goto LAB_2;

+            }

+          }

+          else if (((param_1 != 0x1009) && (param_1 != 0x100b)) && (param_1 != 0x100d)) {

+            iVar7 = param_1 - 0x100f;

+            goto joined_r0x00014016eefe;

+          }

+        }

+      }

+      else if (param_1 < 0x2004) {

+        if (param_1 != 0x2003) {

+          if (param_1 < 0x104a) {

+            if ((((param_1 != 0x1049) && (param_1 != 0x1019)) && (param_1 != 0x101d)) &&

+               ((param_1 != 0x101f && (param_1 != 0x1027)))) {

+              iVar7 = param_1 - 0x1041;

+              bVar4 = iVar7 == 0;

+              goto LAB_8;

+            }

+          }

+          else if (((param_1 != 0x104b) && (param_1 != 0x104d)) &&

+                  ((param_1 != 0x104f && ((param_1 != 0x1051 && (param_1 != 0x1053)))))) {

+            bVar4 = param_1 == 0x2001;

+LAB_3:

+            if (!bVar4) goto LAB_1;

+          }

+        }

+      }

+      else if (param_1 < 0x201a) {

+        if ((((param_1 != 0x2019) && (param_1 != 0x2005)) && (param_1 != 0x2009)) &&

+           (param_1 != 0x200f)) {

+          iVar7 = param_1 - 0x2011;

+joined_r0x00014016eefe:

+          if (iVar7 != 0) {

+            iVar7 = iVar7 + -4;

+            bVar4 = iVar7 == 0;

+LAB_8:

+            if ((!bVar4) && (iVar7 != 2)) goto LAB_1;

+          }

+        }

+      }

+      else if ((param_1 != 0x201b) && (param_1 != 0x201d)) {

+        iVar7 = param_1 - 0x2031;

+LAB_4:

+        if (iVar7 != 0) {

+          iVar7 = iVar7 + -2;

+          bVar4 = iVar7 == 0;

+LAB_2:

+          if (!bVar4) {

+            iVar7 = iVar7 + -2;

+            bVar4 = iVar7 == 0;

+            goto LAB_7;

+          }

+        }

+      }

+LAB_6:

+      plVar10 = (longlong *)PsGetCurrentProcessWin32Process();

+      uVar11 = 0;

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

+        uVar11 = (ulonglong)plVar10 & -(ulonglong)(*plVar10 != 0);

+      }

+      EtwTraceUIPISystemError(uVar11,0,1);

+      goto LAB_9;

+    }

+LAB_1:

+    lVar8 = 4;

+    puVar12 = Win32AllocPoolWithQuotaZInitImpl((__uint64)this,0x228,0x79747355);

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

+      uVar18 = 8;

+      goto LAB_10;

+    }

+    if (local_2f8 != (code *)0xffffffffffffffff) {

+      ptVar13 = PtiCurrent();

+                    /* WARNING: Subroutine does not return */

+      KeBugCheckEx(0x164,0x12,&local_308,puVar12,ptVar13);

+    }

+    ptVar13 = PtiCurrent();

+    local_308 = *(undefined8 *)(ptVar13 + 0x180);

+    *(undefined8 **)(ptVar13 + 0x180) = &local_308;

+    local_2f8 = GreDeleteFastMutex;

+    local_330 = puVar12;

+    local_328 = param_2;

+    local_300 = puVar12;

+    if (0x1026 < param_1) {

+      local_330 = param_3;

+      if (param_1 != 0x1027) {

+        if (param_1 != 0x201d) goto LAB_11;

+        local_330 = param_3;

+        if (((param_3 != (uint *)0x0) && (local_330 = param_3, param_3 != (uint *)0x1)) &&

+           (local_330 = param_3, param_3 != (uint *)0x2)) {

+          UserSetLastError(0x57);

+          iVar7 = 0;

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

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

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

+                      *)&local_320);

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

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

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

+                      *)&local_308);

+          goto LAB_12;

+        }

+      }

+      goto LAB_13;

+    }

+    if (param_1 == 0x1026) {

+LAB_14:

+      local_338 = 4;

+      puVar21 = param_3;

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

+        puVar21 = *(uint **)MmUserProbeAddress_exref;

+      }

+      *puVar21 = *puVar21;

+      local_2f0 = 1;

+      local_330 = puVar12;

+      local_2e0 = param_3;

+    }

+    else {

+      if (param_1 < 99) {

+        if (param_1 == 0x62) goto LAB_14;

+        if (param_1 < 0x33) {

+          if (param_1 == 0x32) {

+            local_338 = 0x18;

+          }

+          else {

+            if (param_1 < 0x1a) {

+              if (param_1 != 0x19) {

+                if (param_1 < 0xf) {

+                  if ((param_1 != 0xe) && (param_1 != 1)) {

+                    if (param_1 == 3) goto LAB_15;

+                    if (param_1 == 4) goto LAB_16;

+                    if ((param_1 != 5) && (param_1 != 10)) {

+                      if (param_1 != 0xd) goto LAB_11;

+LAB_17:

+                      local_330 = param_3;

+                      if (((ulonglong)param_3 & 0xffffffffffff0000) == 0) goto LAB_13;

+                    }

+                  }

+                }

+                else if ((param_1 != 0x10) && (param_1 != 0x12)) {

+                  if (param_1 == 0x14) {

+                    local_330 = param_3;

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

+                      local_330 = (uint *)0xffffffffffffffff;

+                    }

+                    if ((local_330 != (uint *)0xfffffffffffffffe) &&

+                       (local_330 != (uint *)0xffffffffffffffff)) {

+LAB_18:

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

+                        local_330 = *(uint **)MmUserProbeAddress_exref;

+                      }

+                      uVar1 = *local_330;

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

+                      _Src = *(void **)(local_330 + 2);

+                      local_2e8 = uVar1;

+                      pvStack_290 = _Src;

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

+                    /* WARNING: Subroutine does not return */

+                        ExRaiseDatatypeMisalignment();

+                      }

+                      uVar16 = (ushort)uVar1;

+                      uVar11 = (ulonglong)uVar16;

+                      pvVar19 = (void *)((longlong)_Src + uVar11 + 2);

+                      if ((pvVar19 <= _Src) || (*(void **)MmUserProbeAddress_exref <= pvVar19)) {

+                    /* WARNING: Subroutine does not return */

+                        ExRaiseAccessViolation();

+                      }

+                      local_2e8._2_2_ = (ushort)(uVar1 >> 0x10);

+                      if (local_2e8._2_2_ < uVar16) {

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

+                      }

+                      else if ((uVar1 & 1) == 0) {

+                        local_330 = Win32AllocPoolWithQuotaZInitImpl

+                                              ((ulonglong)uVar1,uVar11 + 2,0x79747355);

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

+                    /* WARNING: Subroutine does not return */

+                          ExRaiseStatus(0xc0000017);

+                        }

+                        if (local_310 != (code *)0xffffffffffffffff) {

+                          ptVar13 = PtiCurrent();

+                    /* WARNING: Subroutine does not return */

+                          KeBugCheckEx(0x164,0x12,&local_320,local_330,ptVar13);

+                        }

+                        ptVar13 = PtiCurrent();

+                        local_320 = *(undefined8 *)(ptVar13 + 0x180);

+                        *(undefined8 **)(ptVar13 + 0x180) = &local_320;

+                        local_310 = GreDeleteFastMutex;

+                        local_318 = local_330;

+                        memmove(local_330,_Src,uVar11);

+                        *(undefined2 *)((longlong)local_330 + (ulonglong)(uVar16 >> 1) * 2) = 0;

+                        goto LAB_13;

+                      }

+                      local_2ec = 0x20000;

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

+LAB_19:

+                    /* WARNING: Subroutine does not return */

+                      ExRaiseAccessViolation();

+                    }

+                  }

+                  else {

+                    if (param_1 != 0x15) {

+                      if (param_1 != 0x16) {

+                        if (param_1 == 0x18) goto LAB_17;

+                        goto LAB_11;

+                      }

+                      goto LAB_14;

+                    }

+                    local_330 = param_3;

+                    if (param_2 == 0xffffffff) goto LAB_13;

+                    local_330 = param_3;

+                    if (param_3 != (uint *)0x0) goto LAB_18;

+                  }

+                  local_328 = 0xffffffff;

+                  goto LAB_13;

+                }

+              }

+              goto LAB_14;

+            }

+            if (param_1 < 0x2b) {

+              if (param_1 == 0x2a) {

+                local_338 = param_2;

+                if ((param_2 - 500 & 0xfffffffb) != 0) {

+                  UserSetLastError(0x57);

+                  iVar7 = 0;

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

+                  ::

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

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

+                              *)&local_320);

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

+                  ::

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

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

+                              *)&local_308);

+                  goto LAB_12;

+                }

+                goto LAB_20;

+              }

+              if (param_1 == 0x1b) goto LAB_14;

+              if (param_1 == 0x1f) {

+                local_338 = 0x5c;

+              }

+              else {

+                if (param_1 == 0x22) {

+                  local_338 = 0x5c;

+                  goto LAB_21;

+                }

+                if ((param_1 == 0x23) || (param_1 == 0x26)) goto LAB_14;

+                if (param_1 != 0x29) goto LAB_11;

+                local_338 = param_2;

+                if ((param_2 - 500 & 0xfffffffb) != 0) {

+                  UserSetLastError(0x57);

+                  iVar7 = 0;

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

+                  ::

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

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

+                              *)&local_320);

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

+                  ::

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

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

+                              *)&local_308);

+                  goto LAB_12;

+                }

+              }

+            }

+            else {

+              if (param_1 != 0x2b) {

+                if (param_1 == 0x2c) {

+                  local_338 = 0x14;

+                }

+                else {

+                  if (param_1 == 0x2d) {

+                    local_338 = 0x6c;

+                    goto LAB_22;

+                  }

+                  if (param_1 != 0x2e) {

+                    if (param_1 == 0x2f) goto LAB_23;

+                    if (param_1 == 0x30) goto LAB_24;

+                    goto LAB_11;

+                  }

+                  local_338 = 0x6c;

+                }

+                goto LAB_21;

+              }

+              local_338 = 0x14;

+            }

+          }

+        }

+        else {

+          if (0x43 < param_1) {

+            if (param_1 < 0x51) {

+              if (((param_1 != 0x50) && (param_1 != 0x44)) && (param_1 != 0x46)) {

+                if (param_1 == 0x48) goto LAB_25;

+                if (param_1 == 0x49) goto LAB_26;

+                if (param_1 != 0x4a) {

+                  bVar4 = param_1 == 0x4f;

+                  goto LAB_27;

+                }

+              }

+            }

+            else if ((param_1 != 0x53) && (param_1 != 0x54)) {

+              if (param_1 == 0x59) goto LAB_25;

+              if (param_1 == 0x5a) goto LAB_26;

+              iVar7 = param_1 - 0x5e;

+              if (iVar7 != 0) {

+LAB_28:

+                bVar4 = iVar7 == 1;

+                goto LAB_27;

+              }

+            }

+            goto LAB_14;

+          }

+          if (param_1 == 0x43) {

+            local_2b0 = 0;

+            uStack_2a8 = 0;

+            local_2a0 = 0;

+            RtlCopyFromUser(&local_2b0,param_3,0x18);

+            *(undefined8 *)puVar12 = local_2b0;

+            *(undefined8 *)(puVar12 + 2) = uStack_2a8;

+            *(undefined8 *)(puVar12 + 4) = local_2a0;

+            uVar11 = *(ulonglong *)(puVar12 + 4);

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

+                    /* WARNING: Subroutine does not return */

+              ExRaiseDatatypeMisalignment();

+            }

+            uVar16 = (ushort)puVar12[2];

+            uVar20 = (ulonglong)uVar16 + 2 + uVar11;

+            if ((uVar20 <= uVar11) || (*(ulonglong *)MmUserProbeAddress_exref <= uVar20)) {

+                    /* WARNING: Subroutine does not return */

+              ExRaiseAccessViolation();

+            }

+            if (*(ushort *)((longlong)puVar12 + 10) < uVar16) {

+              if ((uVar16 & 1) == 0) goto LAB_29;

+            }

+            else if ((uVar16 & 1) == 0) {

+              if (uVar16 == 0) {

+                puVar12[4] = 0;

+                puVar12[5] = 0;

+              }

+              goto LAB_13;

+            }

+            local_2e8 = 0x20000;

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

+LAB_29:

+                    /* WARNING: Subroutine does not return */

+            ExRaiseAccessViolation();

+          }

+          if (0x3a < param_1) {

+            if (param_1 == 0x3b) {

+LAB_26:

+              local_338 = 8;

+            }

+            else {

+              if (param_1 == 0x3c) goto LAB_15;

+              if (param_1 != 0x3d) {

+                if (param_1 == 0x40) goto LAB_30;

+                if (param_1 == 0x41) goto LAB_31;

+                if (param_1 == 0x42) {

+                  local_338 = 0x10;

+                  lVar8 = PsGetCurrentProcessWow64Process();

+                  ProbeForWrite(param_3,0x10,(-(uint)(lVar8 != 0) & 0xfffffffd) + 4);

+                  uVar1 = param_3[1];

+                  uVar2 = param_3[2];

+                  uVar3 = param_3[3];

+                  *puVar12 = *param_3;

+                  puVar12[1] = uVar1;

+                  puVar12[2] = uVar2;

+                  puVar12[3] = uVar3;

+                  local_2e0 = param_3;

+                  ProbeForWrite(*(undefined8 *)(puVar12 + 2),0x100,2);

+                  goto LAB_32;

+                }

+                goto LAB_11;

+              }

+LAB_16:

+              local_338 = 0xc;

+            }

+LAB_21:

+            if (((ulonglong)param_3 & 3) != 0) {

+                    /* WARNING: Subroutine does not return */

+              ExRaiseDatatypeMisalignment();

+            }

+            goto LAB_33;

+          }

+          if (param_1 != 0x3a) {

+            if (param_1 == 0x33) {

+              local_338 = 0x18;

+              goto LAB_21;

+            }

+            if (param_1 != 0x34) {

+              if (param_1 != 0x35) {

+                if (param_1 == 0x36) goto LAB_34;

+                iVar7 = param_1 - 0x37;

+                if (iVar7 == 0) goto LAB_35;

+                goto LAB_28;

+              }

+              goto LAB_26;

+            }

+          }

+LAB_25:

+          local_338 = 8;

+        }

+      }

+      else {

+        if (param_1 < 0x95) {

+          if (param_1 == 0x94) {

+            if (param_2 != 0x28) {

+              UserSetLastError(0x57);

+              iVar7 = 0;

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

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

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

+                          *)&local_320);

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

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

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

+                          *)&local_308);

+              goto LAB_12;

+            }

+            local_338 = 0x28;

+            goto LAB_22;

+          }

+          if (param_1 < 0x7b) {

+            if (param_1 != 0x7a) {

+              if (param_1 < 0x71) {

+                if (((param_1 - 100 & 0xfffffff1) != 0) || (param_1 == 0x72)) {

+LAB_11:

+                  local_330 = param_3;

+                  if (0xb5 < param_1) {

+                    if ((0x55 < param_1 - 0x1000) && (0x37 < param_1 - 0x2000)) {

+                      UserSetLastError(0x57);

+                      iVar7 = 0;

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

+                      ::

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

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

+                                  *)&local_320);

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

+                      ::

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

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

+                                  *)&local_308);

+                      goto LAB_12;

+                    }

+                    iVar7 = 0;

+                    if ((param_2 != 0) &&

+                       (((ptVar13 = PtiCurrent(), 0x400 < *(uint *)(ptVar13 + 0x2a0) ||

+                         (param_1 != 0x103f)) || (param_2 != 1)))) {

+                      UserSetLastError(0x57);

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

+                      ::

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

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

+                                  *)&local_320);

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

+                      ::

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

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

+                                  *)&local_308);

+                      goto LAB_12;

+                    }

+                    if ((param_1 & 1) == 0) goto LAB_14;

+                    if (param_1 == 0x200b) {

+                      local_330 = param_3;

+                      local_280 = param_3;

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

+                        UserSetLastError(0x57);

+                        iVar7 = 0;

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

+                        ::

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

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

+                                    *)&local_320);

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

+                        ::

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

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

+                                    *)&local_308);

+                        goto LAB_12;

+                      }

+                    }

+                    else {

+                      local_330 = param_3;

+                      if ((param_1 == 0x2013) &&

+                         (local_330 = param_3, local_288 = param_3,

+                         ((ulonglong)param_3 & 0xfffffffe) != 0)) {

+                        UserSetLastError(0x57);

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

+                        ::

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

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

+                                    *)&local_320);

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

+                        ::

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

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

+                                    *)&local_308);

+                        goto LAB_12;

+                      }

+                    }

+                  }

+                  goto LAB_13;

+                }

+              }

+              else if (param_1 != 0x72) {

+                if (param_1 == 0x73) {

+                  local_2e0 = param_3;

+                  ProbeForWrite(param_3,(ulonglong)param_2 * 2,2);

+                  if (0x103 < param_2) {

+                    param_2 = 0x104;

+                  }

+                  local_338 = param_2 * 2;

+                  local_328 = param_2;

+LAB_32:

+                  local_2f0 = 1;

+                  goto LAB_13;

+                }

+                if (param_1 == 0x74) goto LAB_15;

+                if (param_1 == 0x75) goto LAB_16;

+                iVar7 = param_1 - 0x76;

+                goto LAB_36;

+              }

+            }

+          }

+          else if (param_1 < 0x89) {

+            if (((param_1 != 0x88) && (param_1 != 0x7c)) &&

+               ((param_1 != 0x7e && ((param_1 != 0x80 && (param_1 != 0x82)))))) {

+              iVar7 = param_1 - 0x84;

+LAB_36:

+              if (iVar7 != 0) {

+                bVar4 = iVar7 == 2;

+LAB_27:

+                if (!bVar4) goto LAB_11;

+              }

+            }

+          }

+          else if (((param_1 != 0x8a) && (param_1 != 0x8c)) &&

+                  ((param_1 != 0x8e && (param_1 != 0x90)))) {

+            if (param_1 != 0x92) {

+              if (param_1 == 0x93) {

+                if (param_2 != 0x44) {

+                  UserSetLastError(0x57);

+                  iVar7 = 0;

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

+                  ::

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

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

+                              *)&local_320);

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

+                  ::

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

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

+                              *)&local_308);

+                  goto LAB_12;

+                }

+                local_338 = 0x44;

+                goto LAB_21;

+              }

+              goto LAB_11;

+            }

+            if (param_2 != 0x44) {

+              UserSetLastError(0x57);

+              iVar7 = 0;

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

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

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

+                          *)&local_320);

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

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

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

+                          *)&local_308);

+              goto LAB_12;

+            }

+            local_338 = 0x44;

+            goto LAB_22;

+          }

+          goto LAB_14;

+        }

+        if (param_1 < 0xa6) {

+          if (param_1 == 0xa5) {

+LAB_37:

+            if (param_2 != 0xc) {

+              UserSetLastError(0x57);

+              iVar7 = 0;

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

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

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

+                          *)&local_320);

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

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

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

+                          *)&local_308);

+              goto LAB_12;

+            }

+LAB_15:

+            local_338 = 0xc;

+          }

+          else {

+            if (param_1 < 0x9c) {

+              if (param_1 == 0x9b) {

+                if (param_2 != 0x224) {

+                  UserSetLastError(0x57);

+                  iVar7 = 0;

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

+                  ::

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

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

+                              *)&local_320);

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

+                  ::

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

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

+                              *)&local_308);

+                  goto LAB_12;

+                }

+                local_338 = 0x224;

+                memset(local_268,0,0x224);

+                RtlCopyFromUser(local_268,param_3,0x224);

+                puVar21 = local_268;

+                puVar14 = puVar12;

+                do {

+                  puVar17 = puVar14;

+                  puVar15 = puVar21;

+                  uVar18 = *(undefined8 *)(puVar15 + 2);

+                  *(undefined8 *)puVar17 = *(undefined8 *)puVar15;

+                  *(undefined8 *)(puVar17 + 2) = uVar18;

+                  uVar18 = *(undefined8 *)(puVar15 + 6);

+                  *(undefined8 *)(puVar17 + 4) = *(undefined8 *)(puVar15 + 4);

+                  *(undefined8 *)(puVar17 + 6) = uVar18;

+                  uVar18 = *(undefined8 *)(puVar15 + 10);

+                  *(undefined8 *)(puVar17 + 8) = *(undefined8 *)(puVar15 + 8);

+                  *(undefined8 *)(puVar17 + 10) = uVar18;

+                  uVar18 = *(undefined8 *)(puVar15 + 0xe);

+                  *(undefined8 *)(puVar17 + 0xc) = *(undefined8 *)(puVar15 + 0xc);

+                  *(undefined8 *)(puVar17 + 0xe) = uVar18;

+                  uVar18 = *(undefined8 *)(puVar15 + 0x12);

+                  *(undefined8 *)(puVar17 + 0x10) = *(undefined8 *)(puVar15 + 0x10);

+                  *(undefined8 *)(puVar17 + 0x12) = uVar18;

+                  uVar18 = *(undefined8 *)(puVar15 + 0x16);

+                  *(undefined8 *)(puVar17 + 0x14) = *(undefined8 *)(puVar15 + 0x14);

+                  *(undefined8 *)(puVar17 + 0x16) = uVar18;

+                  uVar18 = *(undefined8 *)(puVar15 + 0x1a);

+                  *(undefined8 *)(puVar17 + 0x18) = *(undefined8 *)(puVar15 + 0x18);

+                  *(undefined8 *)(puVar17 + 0x1a) = uVar18;

+                  uVar18 = *(undefined8 *)(puVar15 + 0x1e);

+                  *(undefined8 *)(puVar17 + 0x1c) = *(undefined8 *)(puVar15 + 0x1c);

+                  *(undefined8 *)(puVar17 + 0x1e) = uVar18;

+                  lVar8 = lVar8 + -1;

+                  puVar21 = puVar15 + 0x20;

+                  puVar14 = puVar17 + 0x20;

+                } while (lVar8 != 0);

+                uVar1 = puVar15[0x21];

+                uVar2 = puVar15[0x22];

+                uVar3 = puVar15[0x23];

+                puVar17[0x20] = puVar15[0x20];

+                puVar17[0x21] = uVar1;

+                puVar17[0x22] = uVar2;

+                puVar17[0x23] = uVar3;

+                uVar1 = puVar15[0x25];

+                uVar2 = puVar15[0x26];

+                uVar3 = puVar15[0x27];

+                puVar17[0x24] = puVar15[0x24];

+                puVar17[0x25] = uVar1;

+                puVar17[0x26] = uVar2;

+                puVar17[0x27] = uVar3;

+                puVar17[0x28] = puVar15[0x28];

+                if (0x104 < puVar12[6]) {

+                  UserSetLastError(0x57);

+                  iVar7 = 0;

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

+                  ::

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

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

+                              *)&local_320);

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

+                  ::

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

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

+                              *)&local_308);

+                  goto LAB_12;

+                }

+                goto LAB_13;

+              }

+              if (param_1 == 0x95) {

+                if (param_2 != 0x28) {

+                  UserSetLastError(0x57);

+                  iVar7 = 0;

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

+                  ::

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

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

+                              *)&local_320);

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

+                  ::

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

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

+                              *)&local_308);

+                  goto LAB_12;

+                }

+                local_338 = 0x28;

+              }

+              else {

+                if (param_1 == 0x96) {

+                  if (param_2 != 0x1c) {

+                    UserSetLastError(0x57);

+                    iVar7 = 0;

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

+                    ::

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

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

+                                *)&local_320);

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

+                    ::

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

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

+                                *)&local_308);

+                    goto LAB_12;

+                  }

+LAB_34:

+                  local_338 = 0x1c;

+                  goto LAB_22;

+                }

+                if (param_1 == 0x97) {

+                  if (param_2 != 0x1c) {

+                    UserSetLastError(0x57);

+                    iVar7 = 0;

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

+                    ::

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

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

+                                *)&local_320);

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

+                    ::

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

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

+                                *)&local_308);

+                    goto LAB_12;

+                  }

+LAB_35:

+                  local_338 = 0x1c;

+                }

+                else {

+                  if (param_1 == 0x98) {

+                    if (param_2 != 0x80) {

+                      UserSetLastError(0x57);

+                      iVar7 = 0;

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

+                      ::

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

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

+                                  *)&local_320);

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

+                      ::

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

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

+                                  *)&local_308);

+                      goto LAB_12;

+                    }

+                    local_338 = 0x80;

+                    goto LAB_22;

+                  }

+                  if (param_1 != 0x99) {

+                    if (param_1 == 0x9a) {

+                      if (param_2 != 0x224) {

+                        UserSetLastError(0x57);

+                        iVar7 = 0;

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

+                        ::

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

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

+                                    *)&local_320);

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

+                        ::

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

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

+                                    *)&local_308);

+                        goto LAB_12;

+                      }

+                      local_338 = 0x224;

+                      lVar9 = PsGetCurrentProcessWow64Process();

+                      ProbeForWrite(param_3,0x224,(-(uint)(lVar9 != 0) & 0xfffffffd) + 4);

+                      puVar21 = param_3;

+                      do {

+                        puVar15 = puVar12;

+                        puVar14 = puVar21;

+                        uVar18 = *(undefined8 *)(puVar14 + 2);

+                        *(undefined8 *)puVar15 = *(undefined8 *)puVar14;

+                        *(undefined8 *)(puVar15 + 2) = uVar18;

+                        uVar18 = *(undefined8 *)(puVar14 + 6);

+                        *(undefined8 *)(puVar15 + 4) = *(undefined8 *)(puVar14 + 4);

+                        *(undefined8 *)(puVar15 + 6) = uVar18;

+                        uVar18 = *(undefined8 *)(puVar14 + 10);

+                        *(undefined8 *)(puVar15 + 8) = *(undefined8 *)(puVar14 + 8);

+                        *(undefined8 *)(puVar15 + 10) = uVar18;

+                        uVar18 = *(undefined8 *)(puVar14 + 0xe);

+                        *(undefined8 *)(puVar15 + 0xc) = *(undefined8 *)(puVar14 + 0xc);

+                        *(undefined8 *)(puVar15 + 0xe) = uVar18;

+                        uVar18 = *(undefined8 *)(puVar14 + 0x12);

+                        *(undefined8 *)(puVar15 + 0x10) = *(undefined8 *)(puVar14 + 0x10);

+                        *(undefined8 *)(puVar15 + 0x12) = uVar18;

+                        uVar18 = *(undefined8 *)(puVar14 + 0x16);

+                        *(undefined8 *)(puVar15 + 0x14) = *(undefined8 *)(puVar14 + 0x14);

+                        *(undefined8 *)(puVar15 + 0x16) = uVar18;

+                        uVar18 = *(undefined8 *)(puVar14 + 0x1a);

+                        *(undefined8 *)(puVar15 + 0x18) = *(undefined8 *)(puVar14 + 0x18);

+                        *(undefined8 *)(puVar15 + 0x1a) = uVar18;

+                        uVar18 = *(undefined8 *)(puVar14 + 0x1e);

+                        *(undefined8 *)(puVar15 + 0x1c) = *(undefined8 *)(puVar14 + 0x1c);

+                        *(undefined8 *)(puVar15 + 0x1e) = uVar18;

+                        lVar8 = lVar8 + -1;

+                        puVar21 = puVar14 + 0x20;

+                        puVar12 = puVar15 + 0x20;

+                      } while (lVar8 != 0);

+                      uVar18 = *(undefined8 *)(puVar14 + 0x22);

+                      *(undefined8 *)(puVar15 + 0x20) = *(undefined8 *)(puVar14 + 0x20);

+                      *(undefined8 *)(puVar15 + 0x22) = uVar18;

+                      uVar18 = *(undefined8 *)(puVar14 + 0x26);

+                      *(undefined8 *)(puVar15 + 0x24) = *(undefined8 *)(puVar14 + 0x24);

+                      *(undefined8 *)(puVar15 + 0x26) = uVar18;

+                      puVar15[0x28] = puVar14[0x28];

+                      local_2e0 = param_3;

+                      goto LAB_32;

+                    }

+                    goto LAB_11;

+                  }

+                  if (param_2 != 0x80) {

+                    UserSetLastError(0x57);

+                    iVar7 = 0;

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

+                    ::

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

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

+                                *)&local_320);

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

+                    ::

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

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

+                                *)&local_308);

+                    goto LAB_12;

+                  }

+                  local_338 = 0x80;

+                }

+              }

+              goto LAB_21;

+            }

+            if (param_1 != 0x9c) {

+              if (param_1 != 0x9d) {

+                if ((param_1 == 0x9e) || (param_1 == 0xa0)) goto LAB_14;

+                if (param_1 == 0xa2) goto LAB_24;

+                if (param_1 != 0xa3) goto LAB_11;

+              }

+LAB_23:

+              local_338 = 0x10;

+              goto LAB_21;

+            }

+            if (param_2 != 0x10) {

+              UserSetLastError(0x57);

+              iVar7 = 0;

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

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

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

+                          *)&local_320);

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

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

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

+                          *)&local_308);

+              goto LAB_12;

+            }

+LAB_24:

+            local_338 = 0x10;

+          }

+          goto LAB_22;

+        }

+        if (param_1 < 0xb0) {

+          if (param_1 == 0xaf) {

+            lVar8 = PsGetCurrentProcessWow64Process();

+            if (((ulonglong)param_3 & (ulonglong)(~-(uint)(lVar8 != 0) & 3)) != 0) {

+                    /* WARNING: Subroutine does not return */

+              ExRaiseDatatypeMisalignment();

+            }

+            if (*param_3 == 0) {

+              local_338 = 0x18;

+            }

+            else if (*param_3 == 1) {

+              local_338 = 0x2c;

+            }

+            else if (*param_3 == 2) {

+              local_338 = 0x30;

+            }

+            else {

+              if (*param_3 != 0xffffffff) {

+                UserSetLastError(0x57);

+                iVar7 = 0;

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

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

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

+                            *)&local_320);

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

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

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

+                            *)&local_308);

+                goto LAB_12;

+              }

+              local_338 = 0x40;

+            }

+            iVar7 = Feature_TouchpadSPIRelaxedCheck__private_IsEnabledDeviceUsageNoInline();

+            if (iVar7 == 0) {

+              if (param_2 != local_338) {

+                UserSetLastError(0x57);

+                iVar7 = 0;

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

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

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

+                            *)&local_320);

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

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

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

+                            *)&local_308);

+                goto LAB_12;

+              }

+            }

+            else if (param_2 < local_338) {

+              UserSetLastError(0x57);

+              iVar7 = 0;

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

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

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

+                          *)&local_320);

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

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

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

+                          *)&local_308);

+              goto LAB_12;

+            }

+LAB_20:

+            if (local_338 != 0) goto LAB_21;

+LAB_33:

+            memmove(puVar12,param_3,(ulonglong)local_338);

+            goto LAB_13;

+          }

+          if (param_1 == 0xa7) goto LAB_37;

+          if ((param_1 == 0xa8) || (param_1 == 0xaa)) goto LAB_14;

+          if (param_1 != 0xac) {

+            if (param_1 == 0xad) {

+              if (param_2 != 4) {

+                UserSetLastError(0x57);

+                iVar7 = 0;

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

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

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

+                            *)&local_320);

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

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

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

+                            *)&local_308);

+                goto LAB_12;

+              }

+              local_338 = 4;

+              goto LAB_21;

+            }

+            if (param_1 != 0xae) goto LAB_11;

+            lVar8 = PsGetCurrentProcessWow64Process();

+            if (((ulonglong)param_3 & (ulonglong)(~-(uint)(lVar8 != 0) & 3)) != 0) {

+                    /* WARNING: Subroutine does not return */

+              ExRaiseDatatypeMisalignment();

+            }

+            if (*param_3 == 0) {

+              local_338 = 0x18;

+            }

+            else if (*param_3 == 1) {

+              local_338 = 0x2c;

+            }

+            else if (*param_3 == 2) {

+              local_338 = 0x30;

+            }

+            else {

+              if (*param_3 != 0xffffffff) {

+                UserSetLastError(0x57);

+                iVar7 = 0;

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

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

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

+                            *)&local_320);

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

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

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

+                            *)&local_308);

+                goto LAB_12;

+              }

+              local_338 = 0x40;

+            }

+            iVar7 = Feature_TouchpadSPIRelaxedCheck__private_IsEnabledDeviceUsageNoInline();

+            if (iVar7 == 0) {

+              if (param_2 != local_338) {

+                UserSetLastError(0x57);

+                iVar7 = 0;

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

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

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

+                            *)&local_320);

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

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

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

+                            *)&local_308);

+                goto LAB_12;

+              }

+            }

+            else if (param_2 < local_338) {

+              UserSetLastError(0x57);

+              iVar7 = 0;

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

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

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

+                          *)&local_320);

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

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

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

+                          *)&local_308);

+              goto LAB_12;

+            }

+            *puVar12 = *param_3;

+            goto LAB_22;

+          }

+          if (param_2 != 4) {

+            UserSetLastError(0x57);

+            iVar7 = 0;

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

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

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

+                        *)&local_320);

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

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

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

+                        *)&local_308);

+            goto LAB_12;

+          }

+        }

+        else if (param_1 == 0xb0) {

+          if (param_2 != 0) {

+            UserSetLastError(0x57);

+            iVar7 = 0;

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

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

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

+                        *)&local_320);

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

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

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

+                        *)&local_308);

+            goto LAB_12;

+          }

+        }

+        else {

+          if (param_1 != 0xb2) {

+            if (param_1 != 0xb3) {

+              if (param_1 != 0xb4) {

+                if (param_1 != 0xb5) goto LAB_11;

+                if (param_2 != 0x38) {

+                  UserSetLastError(0x57);

+                  iVar7 = 0;

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

+                  ::

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

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

+                              *)&local_320);

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

+                  ::

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

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

+                              *)&local_308);

+                  goto LAB_12;

+                }

+LAB_31:

+                local_338 = 0x38;

+                goto LAB_21;

+              }

+              if (param_2 != 0x38) {

+                UserSetLastError(0x57);

+                iVar7 = 0;

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

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

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

+                            *)&local_320);

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

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

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

+                            *)&local_308);

+                goto LAB_12;

+              }

+LAB_30:

+              local_338 = 0x38;

+              goto LAB_22;

+            }

+            if (param_2 != 4) {

+              UserSetLastError(0x57);

+              iVar7 = 0;

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

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

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

+                          *)&local_320);

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

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

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

+                          *)&local_308);

+              goto LAB_12;

+            }

+            local_338 = 4;

+            goto LAB_20;

+          }

+          if (param_2 != 4) {

+            UserSetLastError(0x57);

+            iVar7 = 0;

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

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

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

+                        *)&local_320);

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

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

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

+                        *)&local_308);

+            goto LAB_12;

+          }

+        }

+        local_338 = 4;

+      }

+LAB_22:

+      local_2e0 = param_3;

+      lVar8 = PsGetCurrentProcessWow64Process();

+      puVar21 = local_2e0;

+      ProbeForWrite(local_2e0,local_338,(-(uint)(lVar8 != 0) & 0xfffffffd) + 4);

+      local_2f0 = 1;

+      *puVar12 = *puVar21;

+    }

+LAB_13:

+    iVar7 = xxxSystemParametersInfo(ptVar22,local_328,local_330,local_2ec);

+    if (local_2f0 != 0) {

+      memmove(local_2e0,local_330,(ulonglong)local_338);

+    }

+  }

+  else {

+    this = ptVar22;

+    cVar5 = CheckSystemParametersAccess(ptVar22,bVar4);

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

+LAB_9:

+    uVar18 = 5;

+LAB_10:

+    iVar7 = 0;

+    UserSetLastError(uVar18);

+  }

   Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

   ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

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

-             &stack0x00000048);

+             &local_320);

   Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

   ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

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

-             &stack0x00000060);

+             &local_308);

+LAB_12:

   ReleaseUserCriticalSection();

-  return (longlong)iVar1;

+  return (longlong)iVar7;

 }
```

## `EtwTraceBeginRetrieveSendMessage`  (modified)

```diff
--- EtwTraceBeginRetrieveSendMessage
+++ EtwTraceBeginRetrieveSendMessage
@@ -1,38 +1,12 @@
 

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

-

-void EtwTraceBeginRetrieveSendMessage

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

+void EtwTraceBeginRetrieveSendMessage(void)

 

 {

-  ulonglong in_RAX;

-  int *piVar1;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  _tlgWrapSz<unsigned_short> *in_stack_00000048;

-  _tlgWrapSz<unsigned_short> *in_stack_00000050;

-  _tlgWrapperByVal<4> *in_stack_00000058;

-  _tlgWrapperByVal<8> *in_stack_00000060;

-  _tlgWrapperByVal<4> *in_stack_00000068;

-  _tlgWrapperByVal<8> *in_stack_00000070;

-  

-  piVar1 = (int *)(in_RAX & 0xffffffffffffff00);

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

-  *(char *)((longlong)piVar1 + -0x77) = *(char *)((longlong)piVar1 + -0x77) + (char)param_1;

-  _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

-  ::

-  Write<_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>,_tlgWrapSz<unsigned_short>,_tlgWrapSz<unsigned_short>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>_>

-            (param_1,&DAT_0,param_3,param_4,(_tlgWrapperByVal<4> *)&stack0x000000a4,

-             (_tlgWrapperByVal<4> *)&stack0x000000a8,(_tlgWrapperByVal<4> *)&stack0x000000ac,

-             (_tlgWrapperByVal<4> *)&stack0x000000b0,(_tlgWrapSz<unsigned_short> *)&stack0x000000f8,

-             in_stack_00000048,in_stack_00000050,in_stack_00000058,in_stack_00000060,

-             in_stack_00000068,in_stack_00000070);

-  if (unaff_RDI != 0) {

-    RtlFreeUnicodeString(&stack0x00000160);

-  }

-  if ((unaff_RSI != 0) && (unaff_RDI != unaff_RSI)) {

-    RtlFreeUnicodeString(&stack0x00000170);

+                    /* 0x165950  1198  EtwTraceBeginRetrieveSendMessage */

+  if ((Microsoft_Windows_Win32kEnableBits._1_1_ & 8) != 0) {

+    GetCallbackCount();

+    McTemplateK0cppppqq_EtwWriteTransfer();

   }

   return;

 }
```

## `DestroyProcessInfo`  (modified)

```diff
--- DestroyProcessInfo
+++ DestroyProcessInfo
@@ -1,22 +1,324 @@
 

-void DestroyProcessInfo(void)

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

+

+uint DestroyProcessInfo(tagPROCESSINFO *param_1)

 

 {

-  char in_AL;

-  undefined8 *unaff_RBX;

-  longlong unaff_RBP;

-  char unaff_DIL;

-  char in_stack_00000030;

+  code *pcVar1;

+  tagPROCESSINFO *ptVar2;

+  int iVar3;

+  longlong lVar4;

+  longlong lVar5;

+  longlong lVar6;

+  tagPROCESSINFO *ptVar7;

+  undefined8 *puVar8;

+  ulonglong uVar9;

+  ulong uVar10;

+  uint uVar11;

+  undefined8 *local_res8;

+  ulonglong local_res10;

+  undefined8 uVar12;

+  ulonglong in_stack_ffffffffffffff60;

+  ulonglong uVar14;

+  undefined8 **ppuVar15;

+  undefined4 uVar16;

+  AtomicExecutionCheck local_88 [8];

+  longlong local_80;

+  CLockProcessByPid local_78 [24];

+  longlong local_60;

+  undefined4 uVar13;

   

-  *(char *)(unaff_RBP + 0x33) = *(char *)(unaff_RBP + 0x33) + in_AL;

-  *(undefined1 *)unaff_RBX = 0;

-  RtlInitializeBitMap();

-  LeaveHandleFlagsCrit();

-  PsSetProcessWin32Process(*unaff_RBX,0);

-  GreDeleteFastMutex();

-  if (in_stack_00000030 == unaff_DIL) {

-    ReleaseUserCriticalSection();

-  }

-  return;

+  *(ulonglong *)(param_1 + 800) = *(ulonglong *)(param_1 + 800) | 0x40000000000;

+  CitProcessCallout();

+  uVar9 = 0;

+  if (*(longlong *)(param_1 + 0x10) != -1) {

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

+    KeSetEvent();

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

+  }

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

+LAB_0:

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

+  local_80 = 0;

+  AtomicExecutionCheck::Arm(local_88);

+  CWinEventNoopDeferral::CWinEventNoopDeferral((CWinEventNoopDeferral *)&local_res8);

+  iVar3 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

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

+    if (iVar3 == 0) {

+      *(uint *)(param_1 + 0xc) = *(uint *)(param_1 + 0xc) & 0xfffffffb;

+      iVar3 = IszzzCalcStartCursorHideSupported();

+      if (-1 < iVar3) {

+        zzzCalcStartCursorHide(0);

+      }

+    }

+    else {

+      lVar4 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x420);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)(param_1);

+      }

+    }

+  }

+  CWinEventNoopDeferral::~CWinEventNoopDeferral((CWinEventNoopDeferral *)&local_res8);

+  lVar5 = W32GetUserSessionState();

+  W32AcquirePushLockExclusiveEx((W32_PUSH_LOCK *)(lVar5 + 0x10298),0);

+  lVar4 = W32GetUserSessionState();

+  for (lVar4 = *(longlong *)(lVar4 + 0xf8a8); lVar4 != 0; lVar4 = *(longlong *)(lVar4 + 8)) {

+    for (lVar6 = *(longlong *)(lVar4 + 0x10); lVar6 != 0; lVar6 = *(longlong *)(lVar6 + 0x20)) {

+      if (*(tagPROCESSINFO **)(lVar6 + 0x100) == param_1) {

+        *(undefined8 *)(lVar6 + 0x100) = 0;

+      }

+    }

+  }

+  W32ReleasePushLockExclusiveEx((W32_PUSH_LOCK *)(lVar5 + 0x10298),0);

+  tagPROCESSINFO::DwsUnlinkAllWindows(param_1);

+  ForegroundBoost::OnProcessDestroyed(param_1);

+  if ((param_1[0x4a8] != (tagPROCESSINFO)0x1) || ((*(uint *)(param_1 + 0xc) & 0x40) != 0)) {

+    lVar4 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x1450);

+    if (pcVar1 != (code *)0x0) {

+      (*pcVar1)(param_1);

+    }

+    if (param_1[0x4a8] != (tagPROCESSINFO)0x1) {

+      *(uint *)(param_1 + 0xc) = *(uint *)(param_1 + 0xc) | 0x1000;

+      if (local_88[0] != (AtomicExecutionCheck)0x0) {

+        *(int *)(local_80 + 0x1c) = *(int *)(local_80 + 0x1c) + -1;

+      }

+      return 0;

+    }

+  }

+  if (local_88[0] != (AtomicExecutionCheck)0x0) {

+    *(int *)(local_80 + 0x1c) = *(int *)(local_80 + 0x1c) + -1;

+  }

+  PsUpdateComponentPower(*(undefined8 *)param_1,6);

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

+    lVar4 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x760);

+    if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

+      lVar4 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x768);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)(param_1);

+      }

+    }

+  }

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

+    lVar4 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x770);

+    if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

+      lVar4 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x778);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)(param_1);

+      }

+    }

+  }

+  if (*(longlong *)(param_1 + 0x370) != -1) {

+    RIMRemoveMouseOrKeyboardInjectionDevice();

+  }

+  if (*(longlong *)(param_1 + 0x378) != -1) {

+    RIMRemoveMouseOrKeyboardInjectionDevice();

+  }

+  if (((*(uint *)(param_1 + 0xc) & 0x40001) == 0x40000) &&

+     ((*(longlong *)(param_1 + 0x290) == 0 ||

+      ((*(uint *)(*(longlong *)(param_1 + 0x290) + 0x40) & 2) == 0)))) {

+    lVar4 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x780);

+    if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

+      PostPlaySoundMessage(8);

+    }

+  }

+  iVar3 = IsShellProcess(param_1);

+  if ((iVar3 != 0) &&

+     (lVar4 = W32GetUserSessionState(),

+     *(longlong *)(param_1 + 0x158) == *(longlong *)(lVar4 + 0xf600))) {

+    iVar3 = IsCleanupIAMAccessSupported();

+    if (-1 < iVar3) {

+      CleanupIAMAccess(*(undefined8 *)(param_1 + 0x158));

+    }

+    if ((((*(uint *)(*(longlong *)(param_1 + 0x290) + 0x40) & 2) == 0) &&

+        (iVar3 = PsGetProcessExitStatus(*(undefined8 *)param_1), iVar3 != 1)) && (iVar3 != 0xff)) {

+      ppuVar15 = &local_res8;

+      local_res10 = 0;

+      uVar10 = 0x100000;

+      local_res8 = (undefined8 *)0x0;

+      uVar12 = *(undefined8 *)PsProcessType_exref;

+      iVar3 = ObOpenObjectByPointer

+                        (*(undefined8 *)param_1,0x200,0,0x100000,uVar12,

+                         in_stack_ffffffffffffff60 & 0xffffffffffffff00,ppuVar15);

+      uVar16 = (undefined4)((ulonglong)ppuVar15 >> 0x20);

+      uVar13 = (undefined4)((ulonglong)uVar12 >> 0x20);

+      if (-1 < iVar3) {

+        lVar4 = W32GetUserSessionState();

+        uVar14 = 0;

+        CLockProcessByPid::CLockProcessByPid(local_78,*(void **)(lVar4 + 0xf8c0),0,uVar10,1,0);

+        if (local_60 != 0) {

+          iVar3 = ObDuplicateObject(*(undefined8 *)param_1,local_res8,local_60,&local_res10,

+                                    CONCAT44(uVar13,0x100000),uVar14 & 0xffffffff00000000,

+                                    CONCAT44(uVar16,2),0);

+          uVar9 = 0;

+          if (-1 < iVar3) {

+            uVar9 = local_res10 & 0xffffffff;

+          }

+        }

+        ZwClose(local_res8);

+        CLockProcessByPid::~CLockProcessByPid(local_78);

+      }

+      iVar3 = PostWinlogonMessage(0x401,uVar9);

+      if ((iVar3 < 0) && ((int)uVar9 != 0)) {

+        ObCloseHandle(local_res10,1);

+      }

+    }

+  }

+  lVar4 = W32GetUserSessionState();

+  for (lVar4 = *(longlong *)(lVar4 + 0xf8a8); lVar4 != 0; lVar4 = *(longlong *)(lVar4 + 8)) {

+    for (lVar5 = *(longlong *)(lVar4 + 0x10); lVar5 != 0; lVar5 = *(longlong *)(lVar5 + 0x20)) {

+      if (*(tagPROCESSINFO **)(*(longlong *)(lVar5 + 8) + 0xb0) == param_1) {

+        *(undefined8 *)(*(longlong *)(lVar5 + 8) + 0xb0) = 0;

+        lVar6 = W32GetUserSessionState();

+        if (lVar5 == *(longlong *)(lVar6 + 0x4b58)) {

+          SynchronizeContext();

+        }

+      }

+    }

+  }

+  lVar4 = W32GetUserSessionState();

+  ptVar7 = (tagPROCESSINFO *)(lVar4 + 0x8ea8);

+  do {

+    ptVar2 = *(tagPROCESSINFO **)ptVar7;

+    if (ptVar2 == (tagPROCESSINFO *)0x0) {

+LAB_1:

+      uVar11 = *(uint *)(param_1 + 0xc) & 0x4000;

+      if ((uVar11 != 0) && ((*(uint *)(param_1 + 0xc) >> 9 & 1) != 0)) {

+        DelayedDestroyCacheDC(1);

+      }

+      lVar4 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x790);

+      if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

+        local_res8 = (undefined8 *)0x0;

+        lVar4 = W32GetWin32kBaseApiSetTable();

+        pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x798);

+        puVar8 = local_res8;

+        if (pcVar1 != (code *)0x0) {

+          (*pcVar1)(&local_res8);

+          puVar8 = local_res8;

+        }

+        for (; puVar8 != (undefined8 *)0x0; puVar8 = (undefined8 *)*puVar8) {

+          if (*(int *)((longlong)puVar8 + 0x14) == *(int *)(param_1 + 0x38)) {

+            *(undefined4 *)((longlong)puVar8 + 0x14) = 0;

+          }

+        }

+      }

+      lVar4 = W32GetUserSessionState();

+      if (*(tagPROCESSINFO **)(lVar4 + 0xf5f0) == param_1) {

+        lVar4 = W32GetUserSessionState();

+        *(undefined8 *)(lVar4 + 0xf5f0) = 0;

+        EtwTraceScreenSaverProcessEvent(2);

+      }

+      InputObjectMap::OnProcessTermination();

+      lVar4 = W32GetUserSessionState();

+      if (*(tagPROCESSINFO **)(lVar4 + 0xfb58) == param_1) {

+        lVar5 = W32GetWin32kBaseApiSetTable();

+        pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0x7a0);

+        if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

+          lVar5 = W32GetWin32kBaseApiSetTable();

+          pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0x7a8);

+          if (pcVar1 != (code *)0x0) {

+            (*pcVar1)();

+          }

+        }

+      }

+      if (*(tagPROCESSINFO **)(lVar4 + 0xfb40) == param_1) {

+        lVar4 = W32GetWin32kBaseApiSetTable();

+        pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x7b0);

+        if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x7b8);

+          if (pcVar1 != (code *)0x0) {

+            (*pcVar1)();

+          }

+        }

+      }

+      DeferrableUnlockObjectAssignment<tagWINDOWSTATION>((tagWINDOWSTATION **)(param_1 + 0x290));

+      DeferrableUnlockObjectAssignment<tagDESKTOP>((tagDESKTOP **)(param_1 + 0x158));

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

+        CloseProtectedHandle();

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

+      }

+      *(uint *)(param_1 + 0xc) = *(uint *)(param_1 + 0xc) | 0x1000;

+      puVar8 = *(undefined8 **)(param_1 + 0x2b8);

+      while (puVar8 != (undefined8 *)0x0) {

+        puVar8 = (undefined8 *)*puVar8;

+        GreDeleteFastMutex();

+      }

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

+      lVar4 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x7c0);

+      if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

+        lVar4 = W32GetWin32kBaseApiSetTable();

+        pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x7c8);

+        if (pcVar1 != (code *)0x0) {

+          (*pcVar1)(param_1);

+        }

+      }

+      lVar4 = W32GetUserSessionState();

+      if (param_1 == *(tagPROCESSINFO **)(lVar4 + 0x4a18)) {

+        lVar4 = W32GetUserSessionState();

+        *(undefined8 *)(lVar4 + 0x4a18) = 0;

+      }

+      lVar4 = W32GetUserSessionState();

+      if (param_1 == *(tagPROCESSINFO **)(lVar4 + 0x4a20)) {

+        lVar4 = W32GetUserSessionState();

+        *(undefined8 *)(lVar4 + 0x4a20) = 0;

+      }

+      lVar4 = W32GetUserSessionState();

+      if ((ulonglong)*(uint *)(param_1 + 0x38) == *(ulonglong *)(lVar4 + 0xf8c8)) {

+        lVar4 = W32GetUserSessionState();

+        *(undefined8 *)(lVar4 + 0xf8c8) = 0;

+        lVar4 = W32GetUserSessionState();

+        *(undefined4 *)(lVar4 + 0x102b4) = 0;

+        if ((*(uint *)(param_1 + 800) >> 0x13 & 1) != 0) {

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x7f0);

+          if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x7f8);

+            if (pcVar1 != (code *)0x0) {

+              (*pcVar1)(2);

+            }

+            *(ulonglong *)(param_1 + 800) = *(ulonglong *)(param_1 + 800) & 0xfffffffffff7ffff;

+          }

+        }

+      }

+      lVar4 = W32GetUserSessionState();

+      if ((ulonglong)*(uint *)(param_1 + 0x38) == *(ulonglong *)(lVar4 + 0xf8c0)) {

+        CleanupLogonProcess(0);

+      }

+      if ((*(ulong *)(param_1 + 0x434) != 0) || (*(int *)(param_1 + 0x430) != 0)) {

+        TraceLoggingDCsInUseOnProcessExit

+                  (*(ulong *)(param_1 + 0x434),*(ulong *)(param_1 + 0x430),

+                   *(ulong *)(param_1 + 0x38));

+      }

+      lVar4 = W32GetUserSessionState();

+      GreCleanDCAndSetOwnerEx(*(undefined8 *)(lVar4 + 0x10270),0x80000012,0,1);

+      lVar4 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x10f0);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)(param_1);

+      }

+      RIMOnProcessDestroy(*(undefined8 *)param_1);

+      if (Microsoft_Windows_Win32kEnableBits._1_1_ < '\0') {

+        McTemplateK0_EtwWriteTransfer

+                  (Microsoft_Windows_Win32kEnableBits._1_1_,&CompleteGuiProcessExecution,

+                   &W32kControlGuid);

+      }

+      return uVar11;

+    }

+    if (ptVar2 == param_1) {

+      *(longlong *)ptVar7 = *(longlong *)(param_1 + 0x170);

+      goto LAB_1;

+    }

+    ptVar7 = ptVar2 + 0x170;

+  } while( true );

 }
```

## `UserGlobalAtomTableCallout`  (modified)

```diff
--- UserGlobalAtomTableCallout
+++ UserGlobalAtomTableCallout
@@ -1,55 +1,37 @@
 

-uint UserGlobalAtomTableCallout(void)

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

+

+undefined8 UserGlobalAtomTableCallout(void)

 

 {

-  undefined8 uVar1;

-  uint uVar2;

-  undefined8 *in_RAX;

-  longlong lVar3;

-  tagPROCESSINFO *ptVar4;

-  __uint64 unaff_RBP;

-  void *unaff_RDI;

-  ulong in_R9D;

-  uint in_stack_00000038;

-  undefined4 in_stack_00000090;

+  code *pcVar1;

+  char cVar2;

+  int iVar3;

+  longlong *plVar4;

+  longlong lVar5;

+  undefined8 uVar6;

   

-  uVar1 = GlobalDescriptorTableRegister();

-  *in_RAX = uVar1;

-  if (((ulonglong)in_RAX & 0x70) == 0) {

-    lVar3 = W32GetUserSessionState();

-    ExInitializeRundownProtection(lVar3 + 0x10f68);

+                    /* 0x163780  2280  UserGlobalAtomTableCallout */

+  iVar3 = IsModerncoreAtomTableSupported();

+  uVar6 = 0;

+  if (iVar3 < 0) {

+    uVar6 = GetCurrentProcessAtomTable(0);

   }

   else {

-    in_stack_00000090 = 0x20000;

-    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x87);

-    lVar3 = W32GetUserSessionState();

-    ExReInitializeRundownProtection(lVar3 + 0x10f68);

-  }

-  lVar3 = W32GetUserSessionState();

-  *(int *)(lVar3 + 0x10f70) = (int)unaff_RBP;

-  W32GetUserSessionState();

-  W32GetCurrentWin32kSessionId();

-  uVar2 = WmsgpConnect();

-  lVar3 = W32GetUserSessionState();

-  if (*(__uint64 *)(lVar3 + 0x8ec0) != unaff_RBP) {

-    lVar3 = W32GetUserGdiSessionState();

-    if (*(__uint64 *)(lVar3 + 0x28) != unaff_RBP) {

-      lVar3 = W32GetUserSessionState();

-      ZwClose(*(undefined8 *)(lVar3 + 0x8ec0));

-      lVar3 = W32GetUserSessionState();

-      *(__uint64 *)(lVar3 + 0x8ec0) = unaff_RBP;

+    cVar2 = IsProcessWin32kLockedOut(0xffffffffffffffff);

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

+       (((plVar4 = (longlong *)PsGetCurrentProcessWin32Process(), plVar4 == (longlong *)0x0 ||

+         (*plVar4 == 0)) || (iVar3 = ApiSetIsCurrentProcessWinstaLocked(), iVar3 == 0)))) {

+      lVar5 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0xdc0);

+      if (pcVar1 != (code *)0x0) {

+        uVar6 = (*pcVar1)();

+      }

+    }

+    else {

+      uVar6 = 0;

     }

   }

-  if (-1 < (int)uVar2) {

-    CLockProcessByPid::CLockProcessByPid

-              ((CLockProcessByPid *)&stack0x00000030,unaff_RDI,0x200,in_R9D,5,unaff_RBP);

-    uVar2 = in_stack_00000038;

-    if (-1 < (int)in_stack_00000038) {

-      ptVar4 = CLockProcessByPid::GetProcessInfo((CLockProcessByPid *)&stack0x00000030);

-      *(uint *)(ptVar4 + 0x114) = *(uint *)(ptVar4 + 0x114) | 0xc0;

-    }

-    CLockProcessByPid::~CLockProcessByPid((CLockProcessByPid *)&stack0x00000030);

-  }

-  return ~uVar2 >> 0x1f;

+  return uVar6;

 }
```

## `UserProcessDestroyCallout`  (modified)

```diff
--- UserProcessDestroyCallout
+++ UserProcessDestroyCallout
@@ -1,7 +1,109 @@
+

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

+/* void __cdecl UserProcessDestroyCallout(struct _W32PROCESS * __ptr64) */

 

 void __cdecl UserProcessDestroyCallout(_W32PROCESS *param_1)

 

 {

+  undefined8 *puVar1;

+  code *pcVar2;

+  bool bVar3;

+  undefined8 *puVar4;

+  char cVar5;

+  int iVar6;

+  longlong lVar7;

+  longlong lVar8;

+  ulonglong uVar9;

+  uint uVar10;

+  bool bVar11;

+  AtomicExecutionCheck local_18 [8];

+  longlong local_10;

+  

+  lVar7 = W32GetUserSessionState();

+  lVar8 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                    (lVar7,1,0,<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+  *(longlong *)(lVar7 + 0x10) = lVar8;

+  if ((lVar8 != 0) &&

+     (cVar5 = UserCritInternal::`anonymous_namespace'::IsValidGuiContext(lVar8), cVar5 != '\0')) {

+    DestroySharedUserCritDeferredUnlockList(lVar7 + 0x4d78);

+    DestroyDeferredUnlockObjectAssignmentList(lVar7 + 0x4db0);

+    DestroyDeferredUnlockObjectAssignmentList(lVar7 + 0x4da0);

+  }

+  local_10 = 0;

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

+  AtomicExecutionCheck::Arm(local_18);

+  lVar7 = W32GetUserGdiSessionState();

+  if (*(longlong *)param_1 == *(longlong *)(lVar7 + 0x28)) {

+    bVar3 = true;

+    lVar7 = W32GetUserSessionState();

+    if (*(longlong *)(*(longlong *)(lVar7 + 0x8ea8) + 0x170) != 0) {

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

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

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

+        cVar5 = '\0';

+      }

+      else {

+        cVar5 = '\x01';

+      }

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

+      if ((cVar5 != '\0') || (bVar11)) {

+        lVar7 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar11,

+                   *(undefined8 *)(lVar7 + 0x10f78),3,0xe,0x20,

+                   &WPP_5ac350e0158237d630755c7723458509_Traceguids);

+      }

+    }

+  }

+  else {

+    bVar3 = false;

+  }

+  iVar6 = DestroyProcessInfo(param_1);

+  if (iVar6 != 0) {

+    lVar7 = W32GetUserSessionState();

+    lVar8 = W32GetUserSessionState();

+    uVar10 = *(uint *)(lVar8 + 0x4df8);

+    for (uVar9 = (ulonglong)uVar10 * 0x20 + *(ulonglong *)(lVar7 + 0x4e40);

+        (*(ulonglong *)(lVar7 + 0x4e40) < uVar9 && (*(char *)(uVar9 + 0x18) == '\0'));

+        uVar9 = uVar9 - 0x20) {

+      uVar10 = uVar10 - 1;

+    }

+    lVar7 = W32GetUserSessionState();

+    *(uint *)(lVar7 + 0x4df8) = uVar10;

+    lVar7 = W32GetUserSessionState();

+    lVar7 = *(longlong *)(lVar7 + 0xdf10);

+    GreLockVisRgn(*(undefined8 *)(lVar7 + 0x30));

+    puVar1 = *(undefined8 **)(lVar7 + 0x18);

+    while (puVar4 = puVar1, puVar4 != (undefined8 *)(lVar7 + 0x18)) {

+      puVar1 = (undefined8 *)*puVar4;

+      if ((*(uint *)(puVar4 + 6) & 0x400000) != 0) {

+        DestroyCacheDC(puVar4,puVar4[2]);

+      }

+    }

+    GreUnlockVisRgn(*(undefined8 *)(lVar7 + 0x30));

+    lVar7 = W32GetWin32kBaseApiSetTable();

+    pcVar2 = *(code **)(*(longlong *)(lVar7 + 0x30) + 0x1980);

+    if ((pcVar2 != (code *)0x0) && (iVar6 = (*pcVar2)(), -1 < iVar6)) {

+      lVar7 = W32GetWin32kBaseApiSetTable();

+      pcVar2 = *(code **)(*(longlong *)(lVar7 + 0x30) + 0x1988);

+      if (pcVar2 != (code *)0x0) {

+        (*pcVar2)(1);

+      }

+    }

+    if (bVar3) {

+      lVar7 = W32GetUserSessionState();

+      if (*(longlong *)(lVar7 + 0x4010) != 0) {

+        lVar7 = W32GetUserSessionState();

+        InputExtensibilityCallout::CloseCoreMsgPort(*(InputExtensibilityCallout **)(lVar7 + 0x4010))

+        ;

+      }

+      CBaseInput::RemoveInjectionDevicesForSessionUninitialize();

+    }

+  }

+  if (local_18[0] != (AtomicExecutionCheck)0x0) {

+    *(int *)(local_10 + 0x1c) = *(int *)(local_10 + 0x1c) + -1;

+  }

+  ReleaseUserCriticalSection();

   return;

 }
```

## `Win32kNtUserCleanupInternal`  (modified)

```diff
--- Win32kNtUserCleanupInternal
+++ Win32kNtUserCleanupInternal
@@ -1,168 +1,419 @@
 

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

+/* void __cdecl Win32kNtUserCleanupInternal(void) */

 

 void __cdecl Win32kNtUserCleanupInternal(void)

 

 {

   code *pcVar1;

-  undefined8 uVar2;

-  int iVar3;

-  char *in_RAX;

-  tagTHREADINFO *ptVar4;

-  longlong lVar5;

+  longlong *plVar2;

+  void *pvVar3;

+  undefined8 uVar4;

+  int iVar5;

   longlong lVar6;

-  tagDPIMETRICS *ptVar7;

-  undefined8 in_RCX;

-  longlong unaff_RBX;

-  longlong unaff_RSI;

-  HDC__ **unaff_RDI;

+  longlong *plVar7;

   longlong lVar8;

-  UnexpectedThreadTerminationHandler<SURFREF> local_res18 [16];

+  SGRDPgptmrWD<_KTIMER*___ptr64> *this;

+  SGRDPgpRemoteSessionOcclusionEvent<_KEVENT*___ptr64> *this_00;

+  undefined1 *puVar9;

+  _KTIMER *local_res8;

+  longlong *local_res10;

+  undefined1 auStack_48 [8];

+  undefined1 auStack_40 [24];

+  undefined4 local_28;

   

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

-  GreSelectBitmap(*(undefined4 *)unaff_RDI,(char)in_RAX + (char)((ulonglong)in_RCX >> 8));

-  GreDeleteObject(*(undefined8 *)(unaff_RBX + 0x10268));

-  *(longlong *)(unaff_RBX + 0x10268) = unaff_RSI;

-  DestroyDC(unaff_RDI);

-  ptVar4 = PtiCurrent();

-  DestroyCacheDCEntries(ptVar4);

-  DestroyCacheDCEntries(0);

-  DelayedDestroyCacheDC(1);

-  lVar5 = W32GetUserSessionState();

-  lVar5 = *(longlong *)(lVar5 + 0xdf10);

-  lVar8 = *(longlong *)(lVar5 + 0x58);

-  if (lVar8 != 0) {

-    UnexpectedThreadTerminationHandler<SURFREF>::UnexpectedThreadTerminationHandler<SURFREF>

-              (local_res18);

-    lVar6 = HmgShareLockCheck(lVar8,5);

-    if ((lVar6 != 0) && (((uint)lVar8 >> 0x17 & 1) == 0)) {

-      HmgSetOwner(lVar8,0x80000002,5);

-    }

-    COLORSPACEREF::~COLORSPACEREF((COLORSPACEREF *)local_res18);

-    GreDeleteObject(*(undefined8 *)(lVar5 + 0x58));

-    *(longlong *)(lVar5 + 0x58) = unaff_RSI;

-  }

-  lVar5 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0x108);

-  if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

-    lVar5 = W32GetWin32kBaseApiSetTable();

-    pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0x110);

+  puVar9 = auStack_48;

+  lVar6 = W32GetUserSessionState();

+  GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x4a68));

+  *(undefined8 *)(lVar6 + 0x4a68) = 0;

+  local_28 = 0;

+  ZwPowerInformation(0x3f,0,0,0);

+  lVar6 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x30);

+  if ((pcVar1 != (code *)0x0) && (iVar5 = (*pcVar1)(), -1 < iVar5)) {

+    lVar6 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x38);

     if (pcVar1 != (code *)0x0) {

       (*pcVar1)();

     }

   }

-  lVar5 = W32GetUserSessionState();

-  DestroyBrush((HBRUSH__ **)(lVar5 + 0xa8a8));

-  lVar5 = W32GetUserSessionState();

-  DestroyBrush((HBRUSH__ **)(*(longlong *)(lVar5 + 0x4e30) + 0x1350));

-  lVar5 = W32GetUserSessionState();

-  DestroyBrush((HBRUSH__ **)(lVar5 + 0xa8b0));

-  lVar5 = W32GetUserSessionState();

-  DestroyBrush((HBRUSH__ **)(lVar5 + 0xa8b8));

-  lVar8 = 0x1f;

-  lVar5 = unaff_RSI;

-  do {

-    lVar6 = W32GetUserSessionState();

-    DestroyBrush((HBRUSH__ **)(*(longlong *)(lVar6 + 0x4e30) + 0x1258 + lVar5));

-    lVar5 = lVar5 + 8;

-    lVar8 = lVar8 + -1;

-  } while (lVar8 != 0);

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(*(longlong *)(lVar5 + 0xdf10) + 0x80));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf7d8));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf7e0));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf7e8));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf7f0));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf7f8));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf800));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf808));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf810));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xf818));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa8c0));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa8d0));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa8d8));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa8e0));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa8e8));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa8f0));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa8f8));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa900));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa908));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa910));

-  lVar5 = W32GetUserSessionState();

-  DestroyRegion((HRGN__ **)(lVar5 + 0xa918));

-  iVar3 = Feature_DpiMetricsInUserMode__private_IsEnabledDeviceUsageNoInline();

-  if (iVar3 == 0) {

-    ptVar7 = (tagDPIMETRICS *)GetSessionDpiMetrics();

-    DestroyAllDPIMETRICSFonts(ptVar7);

-    ptVar7 = (tagDPIMETRICS *)Get96DpiMetrics();

-    DestroyAllDPIMETRICSFonts(ptVar7);

-  }

-  lVar5 = W32GetUserSessionState();

-  if (*(longlong *)(lVar5 + 0xf5d0) != unaff_RSI) {

-    lVar5 = W32GetWin32kBaseApiSetTable();

-    pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0xe8);

-    if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(), -1 < iVar3)) {

-      lVar5 = W32GetUserSessionState();

-      uVar2 = *(undefined8 *)(lVar5 + 0xf5d0);

-      lVar5 = W32GetWin32kBaseApiSetTable();

-      pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0xf0);

+  lVar6 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x40);

+  if ((pcVar1 != (code *)0x0) && (iVar5 = (*pcVar1)(), -1 < iVar5)) {

+    local_res8 = (_KTIMER *)0x0;

+    lVar6 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x48);

+    if (pcVar1 != (code *)0x0) {

+      (*pcVar1)(&local_res8);

+    }

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

+      GreDeleteFastMutex();

+      *(longlong *)local_res8 = 0;

+    }

+  }

+  lVar6 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x50);

+  if ((pcVar1 != (code *)0x0) && (iVar5 = (*pcVar1)(), -1 < iVar5)) {

+    local_res8 = (_KTIMER *)0x0;

+    lVar6 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x58);

+    if (pcVar1 != (code *)0x0) {

+      (*pcVar1)(&local_res8);

+    }

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

+      GreDeleteFastMutex();

+      *(longlong *)local_res8 = 0;

+    }

+  }

+  lVar6 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x60);

+  if ((pcVar1 != (code *)0x0) && (iVar5 = (*pcVar1)(), -1 < iVar5)) {

+    local_res8 = (_KTIMER *)0x0;

+    lVar6 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x68);

+    if (pcVar1 != (code *)0x0) {

+      (*pcVar1)(&local_res8);

+    }

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

+      GreDeleteFastMutex();

+      *(longlong *)local_res8 = 0;

+    }

+  }

+  lVar6 = W32GetUserSessionState();

+  while (plVar7 = *(longlong **)(lVar6 + 0xe150), plVar7 != (longlong *)(lVar6 + 0xe150)) {

+    lVar8 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar8 + 0x30) + 0x70);

+    if ((pcVar1 != (code *)0x0) && (iVar5 = (*pcVar1)(), -1 < iVar5)) {

+      FreeTimer(plVar7 + -9);

+    }

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10eb0) != 0) {

+    lVar6 = W32GetUserSessionState();

+    KeCancelTimer(*(undefined8 *)(lVar6 + 0x10eb0));

+    lVar6 = W32GetUserSessionState();

+    this = *(SGRDPgptmrWD<_KTIMER*___ptr64> **)(lVar6 + 0x10eb0);

+    GreDeleteFastMutex();

+    local_res8 = (_KTIMER *)0x0;

+    SGRDPgptmrWD<_KTIMER*___ptr64>::operator=(this,&local_res8);

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 22000) != 0) {

+    lVar6 = W32GetUserSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 22000));

+  }

+  local_res8 = (_KTIMER *)((ulonglong)local_res8 & 0xffffffff00000000);

+  local_res10 = (longlong *)0x0;

+  plVar7 = (longlong *)W32GetUserSessionState();

+  if (*plVar7 != 0) {

+LAB_0:

+    iVar5 = CSTPop((uint *)&local_res8,&local_res10);

+    plVar7 = local_res10;

+    if (iVar5 != 0) {

+      if (((int)local_res8 != 2) && ((int)local_res8 != 4)) goto code_r0x000140161e16;

+      goto LAB_1;

+    }

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x4a00) != 0) {

+    lVar6 = W32GetUserSessionState();

+    ExDeleteResourceLite(*(undefined8 *)(lVar6 + 0x4a00));

+    lVar6 = W32GetUserSessionState();

+    ExFreePoolWithTag(*(undefined8 *)(lVar6 + 0x4a00),0);

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10e98) != 0) {

+    lVar6 = W32GetUserSessionState();

+    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x10e98));

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10e90) != 0) {

+    lVar6 = W32GetUserSessionState();

+    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x10e90));

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10da8) != 0) {

+    lVar6 = W32GetUserSessionState();

+    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x10da8));

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0xf5e0) != 0) {

+    lVar6 = W32GetUserSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0xf5e0));

+    *(undefined8 *)(lVar6 + 0xf5e0) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10c80) != 0) {

+    lVar6 = W32GetUserSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x10c80));

+    *(undefined8 *)(lVar6 + 0x10c80) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10c88) != 0) {

+    lVar6 = W32GetUserSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x10c88));

+    *(undefined8 *)(lVar6 + 0x10c88) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10c90) != 0) {

+    lVar6 = W32GetUserSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x10c90));

+    *(undefined8 *)(lVar6 + 0x10c90) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x49a8) != 0) {

+    lVar6 = W32GetUserSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x49a8));

+    *(undefined8 *)(lVar6 + 0x49a8) = 0;

+  }

+  lVar6 = W32GetUserGdiSessionState();

+  if (*(longlong *)(lVar6 + 8) != 0) {

+    lVar6 = W32GetUserGdiSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 8));

+    *(undefined8 *)(lVar6 + 8) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10e68) != 0) {

+    lVar6 = W32GetUserSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x10e68));

+    *(undefined8 *)(lVar6 + 0x10e68) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x49f0) != 0) {

+    lVar6 = W32GetUserSessionState();

+    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x49f0));

+    *(undefined8 *)(lVar6 + 0x49f0) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x41b8) != 0) {

+    lVar6 = W32GetUserSessionState();

+    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x41b8));

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0x41b8) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0xa240) != 0) {

+    lVar6 = W32GetUserSessionState();

+    RtlDestroyAtomTable(*(undefined8 *)(lVar6 + 0xa240));

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0xa240) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0xa248) != 0) {

+    lVar6 = W32GetUserSessionState();

+    RtlDestroyAtomTable(*(undefined8 *)(lVar6 + 0xa248));

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0xa248) = 0;

+  }

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x4c80) != 0) {

+    lVar6 = W32GetUserSessionState();

+    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x4c80));

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0x4c80) = 0;

+  }

+  while (lVar6 = W32GetUserSessionState(), *(longlong *)(lVar6 + 0x10f48) != 0) {

+    Win32JobObject::`anonymous_namespace'::DeleteW32Job();

+  }

+  lVar6 = W32GetUserSessionState();

+  plVar7 = (longlong *)(lVar6 + 0x10f20);

+  iVar5 = IsFreeSMSSupported();

+  if (-1 < iVar5) {

+    puVar9 = auStack_48;

+    if (*plVar7 != 0) {

+      while (plVar2 = (longlong *)*plVar7, puVar9 = auStack_48, plVar2 != plVar7) {

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

+           (lVar8 = *plVar2, *(longlong **)(lVar8 + 8) != plVar2)) {

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

+          (*pcVar1)(3);

+          puVar9 = auStack_40;

+          break;

+        }

+        *plVar7 = lVar8;

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

+        lVar8 = W32GetWin32kBaseApiSetTable();

+        pcVar1 = *(code **)(*(longlong *)(lVar8 + 0x30) + 0xa8);

+        if (pcVar1 != (code *)0x0) {

+          (*pcVar1)(plVar2);

+        }

+      }

+    }

+    *(longlong **)(lVar6 + 0x10f28) = plVar7;

+    *plVar7 = (longlong)plVar7;

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x1401622af;

+  lVar6 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0xb0);

+  if (pcVar1 != (code *)0x0) {

+    *(undefined8 *)(puVar9 + -8) = 0x1401622ce;

+    iVar5 = (*pcVar1)();

+    if (-1 < iVar5) {

+      local_res8 = (_KTIMER *)0x0;

+      *(undefined8 *)(puVar9 + -8) = 0x1401622dd;

+      lVar6 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0xb8);

       if (pcVar1 != (code *)0x0) {

-        (*pcVar1)(uVar2);

+        *(undefined8 *)(puVar9 + -8) = 0x1401622fb;

+        (*pcVar1)(&local_res8);

       }

-    }

-    lVar5 = W32GetUserSessionState();

-    *(longlong *)(lVar5 + 0xf5d0) = unaff_RSI;

-  }

-  lVar5 = W32GetUserSessionState();

-  if (*(longlong *)(lVar5 + 0xf5d8) != unaff_RSI) {

-    lVar5 = W32GetUserSessionState();

-    GreDeleteObject(*(undefined8 *)(lVar5 + 0xf5d8));

-    lVar5 = W32GetUserSessionState();

-    *(longlong *)(lVar5 + 0xf5d8) = unaff_RSI;

-  }

-  lVar5 = W32GetUserSessionState();

-  if (*(longlong *)(*(longlong *)(lVar5 + 0xdf10) + 0x10) != unaff_RSI) {

-    lVar5 = W32GetUserSessionState();

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

-    lVar5 = W32GetUserSessionState();

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

-    lVar5 = W32GetUserSessionState();

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

-    lVar5 = W32GetUserSessionState();

-    *(longlong *)(*(longlong *)(lVar5 + 0xdf10) + 0x30) = unaff_RSI;

-  }

-  lVar5 = W32GetUserSessionState();

-  lVar5 = *(longlong *)(*(longlong *)(lVar5 + 0xdf10) + 0x70);

-  while (lVar5 != 0) {

-    lVar5 = *(longlong *)(lVar5 + 0x38);

-    DestroyMonitor();

-  }

-  lVar5 = W32GetUserSessionState();

-  if (*(longlong *)(lVar5 + 0x11788) != 0) {

-    DestroyMonitor();

-  }

-  if (*(longlong *)(lVar5 + 0x11790) != 0) {

+      pvVar3 = *(void **)local_res8;

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

+        *(undefined8 *)(puVar9 + -8) = 0x14016230e;

+        lVar6 = W32GetUserSessionState();

+        *(undefined8 *)(puVar9 + -8) = 0x14016231f;

+        NSInstrumentation::CLeakTrackingAllocator::FreePagedLookasideList

+                  ((CLeakTrackingAllocator *)(lVar6 + 0x11ac0),pvVar3);

+        *(undefined8 *)local_res8 = 0;

+      }

+    }

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x14016232d;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x4b18) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x140162343;

+    iVar5 = IsFreeMessageListSupported();

+    if (-1 < iVar5) {

+      lVar8 = *(longlong *)(lVar6 + 0x4b18);

+      *(undefined8 *)(puVar9 + -8) = 0x140162357;

+      FreeMessageList(lVar8 + 0x18);

+    }

+    uVar4 = *(undefined8 *)(lVar6 + 0x4b18);

+    *(undefined8 *)(puVar9 + -8) = 0x140162363;

+    FreeQueue(uVar4);

+    *(undefined8 *)(lVar6 + 0x4b18) = 0;

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x140162371;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x41e0) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x140162386;

+    lVar6 = W32GetUserSessionState();

+    pvVar3 = *(void **)(lVar6 + 0x41e0);

+    *(undefined8 *)(puVar9 + -8) = 0x140162399;

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(puVar9 + -8) = 0x1401623aa;

+    NSInstrumentation::CLeakTrackingAllocator::FreePagedLookasideList

+              ((CLeakTrackingAllocator *)(lVar6 + 0x11ac0),pvVar3);

+    *(undefined8 *)(puVar9 + -8) = 0x1401623b1;

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0x41e0) = 0;

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x1401623c4;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x41e8) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x1401623d9;

+    lVar6 = W32GetUserSessionState();

+    pvVar3 = *(void **)(lVar6 + 0x41e8);

+    *(undefined8 *)(puVar9 + -8) = 0x1401623ec;

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(puVar9 + -8) = 0x1401623fd;

+    NSInstrumentation::CLeakTrackingAllocator::FreePagedLookasideList

+              ((CLeakTrackingAllocator *)(lVar6 + 0x11ac0),pvVar3);

+    *(undefined8 *)(puVar9 + -8) = 0x140162404;

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0x41e8) = 0;

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x140162415;

+  CleanupKeyboardLayouts();

+  *(undefined8 *)(puVar9 + -8) = 0x14016241c;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0xf7c8) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x140162432;

     GreDeleteFastMutex();

   }

+  *(undefined8 *)(puVar9 + -8) = 0x140162439;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0xf8b8) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x14016244e;

+    lVar6 = W32GetUserSessionState();

+    uVar4 = *(undefined8 *)(lVar6 + 0xf8b8);

+    *(undefined8 *)(puVar9 + -8) = 0x14016245f;

+    GreDeleteFastMutex(uVar4);

+    *(undefined8 *)(puVar9 + -8) = 0x140162466;

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0xf8b8) = 0;

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x140162479;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x4df0) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x14016248e;

+    lVar6 = W32GetUserSessionState();

+    uVar4 = *(undefined8 *)(lVar6 + 0x4df0);

+    *(undefined8 *)(puVar9 + -8) = 0x1401624a3;

+    ExFreePoolWithTag(uVar4,0);

+    *(undefined8 *)(puVar9 + -8) = 0x1401624af;

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0x4df0) = 0;

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x1401624c2;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x1f8) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x1401624d7;

+    lVar6 = W32GetUserSessionState();

+    uVar4 = *(undefined8 *)(lVar6 + 0x1f8);

+    *(undefined8 *)(puVar9 + -8) = 0x1401624e8;

+    GreDeleteFastMutex(uVar4);

+    *(undefined8 *)(puVar9 + -8) = 0x1401624ef;

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(lVar6 + 0x1f8) = 0;

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x140162502;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 8) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x140162514;

+    lVar6 = W32GetUserSessionState();

+    *(undefined8 *)(puVar9 + -8) = 0x140162522;

+    CLEANUP_CRIT_RESOURCE((_FAST_ERESOURCE **)(lVar6 + 8));

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x140162529;

+  lVar6 = W32GetUserSessionState();

+  if (*(longlong *)(lVar6 + 0x10cb8) != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x14016253e;

+    lVar6 = W32GetUserSessionState();

+    this_00 = *(SGRDPgpRemoteSessionOcclusionEvent<_KEVENT*___ptr64> **)(lVar6 + 0x10cb8);

+    *(undefined8 *)(puVar9 + -8) = 0x140162551;

+    ObfDereferenceObject();

+    local_res8 = (_KTIMER *)0x0;

+    *(undefined8 *)(puVar9 + -8) = 0x140162563;

+    SGRDPgpRemoteSessionOcclusionEvent<_KEVENT*___ptr64>::operator=(this_00,(_KEVENT **)&local_res8)

+    ;

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x14016256a;

+  lVar6 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x1c8);

+  if (pcVar1 != (code *)0x0) {

+    *(undefined8 *)(puVar9 + -8) = 0x140162584;

+    iVar5 = (*pcVar1)();

+    if (-1 < iVar5) {

+      *(undefined8 *)(puVar9 + -8) = 0x14016258f;

+      lVar6 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x1d0);

+      if (pcVar1 != (code *)0x0) {

+        *(undefined8 *)(puVar9 + -8) = 0x1401625a9;

+        (*pcVar1)();

+      }

+    }

+  }

+  *(undefined8 *)(puVar9 + -8) = 0x1401625b0;

+  lVar8 = W32GetUserSessionState();

+  lVar6 = *(longlong *)(lVar8 + 0xdf40);

+  if (lVar6 != 0) {

+    *(undefined8 *)(puVar9 + -8) = 0x1401625d0;

+    ExFreePoolWithTag(lVar6,0x44535042);

+  }

+  *(undefined8 *)(lVar8 + 0xdf40) = 0;

   return;

+code_r0x000140161e16:

+  if ((int)local_res8 == 8) {

+    if (*local_res10 != 0) {

+      GreDeleteFastMutex();

+      *plVar7 = 0;

+    }

+LAB_1:

+    if (plVar7[1] != 0) {

+      GreDeleteFastMutex();

+      plVar7[1] = 0;

+    }

+  }

+  goto LAB_0;

 }
```

## `NtUserChangeDisplaySettings`  (modified)

```diff
--- NtUserChangeDisplaySettings
+++ NtUserChangeDisplaySettings
@@ -1,31 +1,72 @@
 

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

-

-HDC NtUserChangeDisplaySettings(void)

+undefined4

+NtUserChangeDisplaySettings(undefined8 param_1,undefined8 param_2,uint param_3,undefined8 param_4)

 

 {

-  HDC pHVar1;

-  undefined8 uVar2;

-  longlong lVar3;

-  int unaff_ESI;

-  HWND unaff_RDI;

-  undefined4 unaff_R14D;

-  undefined8 in_stack_00000028;

-  undefined8 in_stack_00000030;

+  bool bVar1;

+  bool bVar2;

+  int iVar3;

+  undefined4 uVar4;

+  longlong lVar5;

+  longlong lVar6;

+  tagTHREADINFO *ptVar7;

+  undefined8 uVar8;

+  undefined4 local_38;

+  undefined4 local_34;

+  undefined4 local_30;

+  CDisplayScenarioContextScope local_28 [8];

+  undefined8 local_20;

   

-  MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x42a);

-  pHVar1 = _GetDC(unaff_RDI);

-  if (unaff_ESI == 0) {

-    in_stack_00000028 = 0;

-    in_stack_00000030 = 0;

-    uVar2 = GreCreateRectRgnIndirect(&stack0x00000028);

-    lVar3 = W32GetUserSessionState();

-    GreLockVisRgn(*(undefined8 *)(*(longlong *)(lVar3 + 0xdf10) + 0x30));

-    GreSelectVisRgn(pHVar1,uVar2,unaff_R14D);

-    lVar3 = W32GetUserSessionState();

-    GreUnlockVisRgn(*(undefined8 *)(*(longlong *)(lVar3 + 0xdf10) + 0x30));

+                    /* 0x167a10  1945  NtUserChangeDisplaySettings */

+  local_28[0] = (CDisplayScenarioContextScope)0x0;

+  CDisplayScenarioContextScope::ContextScopeConstructor(local_28,(_GUID *)0x0,0x1a,0);

+  lVar5 = W32GetUserSessionState();

+  lVar6 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                    (lVar5,0,0,<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+  *(longlong *)(lVar5 + 0x10) = lVar6;

+  if (lVar6 != 0) {

+    DestroySharedUserCritDeferredUnlockList(lVar5 + 0x4d78);

+    DestroyDeferredUnlockObjectAssignmentList(lVar5 + 0x4db0);

+    DestroyDeferredUnlockObjectAssignmentList(lVar5 + 0x4da0);

   }

+  lVar5 = W32GetUserGdiSessionState();

+  if (*(int *)(lVar5 + 0x20) == 0) {

+    uVar4 = 0xffffffff;

+    goto LAB_0;

+  }

+  ptVar7 = PtiCurrent();

+  iVar3 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar3 == 0) {

+    local_34 = 0xffffffff;

+    local_38 = 0x2000;

+    local_30 = 0;

+    bVar1 = UIPrivilegeIsolation::CheckAccessEx

+                      ((tagUIPI_INFO *)(*(longlong *)(ptVar7 + 0x1d0) + 0x358),

+                       (tagUIPI_INFO *)&local_38,0);

+  }

+  else {

+    bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                      ((tagUIPI_INFO *)(*(longlong *)(ptVar7 + 0x1d0) + 0x358),0x2000);

+  }

+  bVar2 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(ptVar7 + 0x1d0),0x10);

+  if ((bVar2) && (bVar1 != false)) {

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

+LAB_1:

+      DrvLogDiagDisplayChange(0,8);

+      uVar4 = xxxUserChangeDisplaySettings(param_1,param_2,0,param_3,param_4,1,local_20);

+      goto LAB_0;

+    }

+    uVar8 = 0x57;

+  }

+  else {

+    if (param_3 == 0x22) goto LAB_1;

+    uVar8 = 5;

+  }

+  uVar4 = 0xffffffff;

+  UserSetLastError(uVar8);

+LAB_0:

   ReleaseUserCriticalSection();

-  return pHVar1;

+  CDisplayScenarioContextScope::~CDisplayScenarioContextScope(local_28);

+  return uVar4;

 }
```

## `EtwTraceBeginRetrieveSendMessage`  (modified)

```diff
--- EtwTraceBeginRetrieveSendMessage
+++ RealInternalSetProp
@@ -1,12 +1,43 @@
 

-void EtwTraceBeginRetrieveSendMessage(void)

+undefined8

+RealInternalSetProp(tagObjLock *param_1,longlong param_2,undefined8 param_3,ushort param_4)

 

 {

-                    /* 0x165950  1198  EtwTraceBeginRetrieveSendMessage */

-  if ((Microsoft_Windows_Win32kEnableBits._1_1_ & 8) != 0) {

-    GetCallbackCount();

-    McTemplateK0cppppqq_EtwWriteTransfer();

+  bool bVar1;

+  undefined8 *puVar2;

+  longlong *plVar3;

+  undefined8 uVar4;

+  tagPROCESSINFO *this;

+  

+                    /* 0x165360  2169  RealInternalSetProp */

+  if (param_2 == 0) {

+    UserSetLastError(0x57);

+LAB_0:

+    uVar4 = 0;

   }

-  return;

+  else {

+    LockRefactorStagingAssertOwned(param_1);

+    puVar2 = (undefined8 *)_FindProp(param_1,param_2,param_4 & 1);

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

+      puVar2 = (undefined8 *)CreateProp();

+      if (puVar2 == (undefined8 *)0x0) goto LAB_0;

+      *(short *)(puVar2 + 1) = (short)param_2;

+      *(ushort *)((longlong)puVar2 + 10) = param_4;

+      plVar3 = (longlong *)PsGetCurrentProcessWin32Process();

+      this = (tagPROCESSINFO *)0x0;

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

+        this = (tagPROCESSINFO *)((ulonglong)plVar3 & -(ulonglong)(*plVar3 != 0));

+      }

+      if ((*(uint *)(this + 800) >> 0x1a & 1) == 0) {

+        bVar1 = tagPROCESSINFO::HasUILimit(this,0x20);

+        if (!bVar1) goto LAB_1;

+      }

+      *(ushort *)((longlong)puVar2 + 10) = *(ushort *)((longlong)puVar2 + 10) | 0x10;

+    }

+LAB_1:

+    *puVar2 = param_3;

+    uVar4 = 1;

+  }

+  return uVar4;

 }
```

## `NtUserActivateKeyboardLayout`  (modified)

```diff
--- NtUserActivateKeyboardLayout
+++ NtUserActivateKeyboardLayout
@@ -1,20 +1,32 @@
 

-longlong NtUserActivateKeyboardLayout(void)

+undefined8 NtUserActivateKeyboardLayout(undefined8 param_1,undefined4 param_2)

 

 {

-  int in_EAX;

-  uint uVar1;

-  short unaff_BX;

-  byte in_CF;

-  longlong in_stack_000000a8;

-  char *pcVar2;

+  bool bVar1;

+  longlong lVar2;

+  longlong lVar3;

+  undefined8 uVar4;

   

-  uVar1 = in_EAX + 0x441f0f00 + (uint)in_CF;

-  pcVar2 = (char *)(ulonglong)uVar1;

-  *pcVar2 = *pcVar2 + (char)uVar1;

-  *(undefined8 *)(*(longlong *)(in_stack_000000a8 + 0x208) + 0x88) =

-       *(undefined8 *)(pcVar2 + 0x3878);

+                    /* 0x167930  1943  NtUserActivateKeyboardLayout */

+  lVar2 = W32GetUserSessionState();

+  lVar3 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                    (lVar2,0,0,<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+  uVar4 = 0;

+  *(longlong *)(lVar2 + 0x10) = lVar3;

+  if (lVar3 != 0) {

+    DestroySharedUserCritDeferredUnlockList(lVar2 + 0x4d78);

+    DestroyDeferredUnlockObjectAssignmentList(lVar2 + 0x4db0);

+    DestroyDeferredUnlockObjectAssignmentList(lVar2 + 0x4da0);

+  }

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

+  if (bVar1) {

+    uVar4 = ApiSetEditionGetProcessWindowStation();

+    uVar4 = xxxActivateKeyboardLayout(uVar4,param_1,param_2,0);

+  }

+  else {

+    UserSetLastError(5);

+  }

   ReleaseUserCriticalSection();

-  return (longlong)unaff_BX;

+  return uVar4;

 }
```

## `NtUserSetSysColors`  (modified)

```diff
--- NtUserSetSysColors
+++ NtUserSetSysColors
@@ -1,10 +1,116 @@
 

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

-

-void NtUserSetSysColors(void)

+longlong NtUserSetSysColors(uint param_1,void *param_2,void *param_3)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  int iVar2;

+  longlong lVar3;

+  longlong lVar4;

+  tagTHREADINFO *ptVar5;

+  int *_Dst;

+  int *piVar6;

+  tagUIPI_INFO *ptVar7;

+  _func_void_void_ptr *_Size;

+  ulonglong uVar8;

+  undefined4 local_70;

+  undefined4 local_6c;

+  undefined4 local_68;

+  Win32RawLockedItemNoCleanup<int,0> local_48 [24];

+  Win32RawLockedItemNoCleanup<int,0> local_30 [24];

+  

+                    /* 0x16e720  2041  NtUserSetSysColors */

+  uVar8 = (ulonglong)param_1;

+  _Dst = (int *)0x0;

+  piVar6 = (int *)0x0;

+  lVar3 = W32GetUserSessionState();

+  _Size = (_func_void_void_ptr *)0x0;

+  lVar4 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                    (lVar3,0,0,<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+  *(longlong *)(lVar3 + 0x10) = lVar4;

+  if (lVar4 != 0) {

+    DestroySharedUserCritDeferredUnlockList(lVar3 + 0x4d78);

+    DestroyDeferredUnlockObjectAssignmentList(lVar3 + 0x4db0);

+    DestroyDeferredUnlockObjectAssignmentList(lVar3 + 0x4da0);

+  }

+  ptVar5 = PtiCurrent();

+  bVar1 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(ptVar5 + 0x1d0),8);

+  if (bVar1) {

+    iVar2 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+    ptVar7 = (tagUIPI_INFO *)(*(longlong *)(ptVar5 + 0x1d0) + 0x358);

+    if (iVar2 == 0) {

+      local_70 = 0x2000;

+      local_6c = 0xffffffff;

+      local_68 = 0;

+      _Size = (_func_void_void_ptr *)0x0;

+      bVar1 = UIPrivilegeIsolation::CheckAccessEx(ptVar7,(tagUIPI_INFO *)&local_70,0);

+    }

+    else {

+      bVar1 = UIPrivilegeIsolation::MeetsUIPIThreshold(ptVar7,0x2000);

+    }

+    if (bVar1 != false) {

+      if (param_1 != 0) {

+        _Size = (_func_void_void_ptr *)(uVar8 * 4);

+        if (uVar8 != 0) {

+          lVar3 = PsGetCurrentProcessWow64Process();

+          if (((ulonglong)param_2 & (ulonglong)(~-(uint)(lVar3 != 0) & 3)) != 0) {

+                    /* WARNING: Subroutine does not return */

+            ExRaiseDatatypeMisalignment();

+          }

+          ptVar7 = (tagUIPI_INFO *)(_Size + (longlong)param_2);

+          if (uVar8 != 0) {

+            lVar3 = PsGetCurrentProcessWow64Process();

+            if (((ulonglong)param_3 & (ulonglong)(~-(uint)(lVar3 != 0) & 3)) != 0) {

+                    /* WARNING: Subroutine does not return */

+              ExRaiseDatatypeMisalignment();

+            }

+            ptVar7 = (tagUIPI_INFO *)(_Size + (longlong)param_3);

+          }

+        }

+        _Dst = Win32AllocPoolWithQuotaZInitImpl((__uint64)ptVar7,(__uint64)_Size,0x72637355);

+        if (_Dst == (int *)0x0) {

+                    /* WARNING: Subroutine does not return */

+          ExRaiseStatus(0xc0000017);

+        }

+        piVar6 = _Dst;

+        RtlCopyVolatileMemory(_Dst,param_2,(size_t)_Size);

+        piVar6 = Win32AllocPoolWithQuotaZInitImpl((__uint64)piVar6,(__uint64)_Size,0x76637355);

+        if (piVar6 == (int *)0x0) {

+                    /* WARNING: Subroutine does not return */

+          ExRaiseStatus(0xc0000017);

+        }

+        RtlCopyVolatileMemory(piVar6,param_3,(size_t)_Size);

+      }

+      Win32RawLockedItemNoCleanup<int,0>::Win32RawLockedItemNoCleanup<int,0>(local_30,_Dst,_Size);

+      Win32RawLockedItemNoCleanup<int,0>::Win32RawLockedItemNoCleanup<int,0>(local_48,piVar6,_Size);

+      Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>::

+      Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>

+                ((Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>

+                  *)&local_70);

+      CreateProfileUserName

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

+                  *)&local_70);

+      iVar2 = xxxSetSysColors();

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

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

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

+                  *)&local_70);

+      Win32RawLockedItemNoCleanup<unsigned_long,0>::~Win32RawLockedItemNoCleanup<unsigned_long,0>

+                ((Win32RawLockedItemNoCleanup<unsigned_long,0> *)local_48);

+      Win32RawLockedItemNoCleanup<unsigned_long,0>::~Win32RawLockedItemNoCleanup<unsigned_long,0>

+                ((Win32RawLockedItemNoCleanup<unsigned_long,0> *)local_30);

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

+        GreDeleteFastMutex(_Dst);

+      }

+      if (piVar6 != (int *)0x0) {

+        GreDeleteFastMutex(piVar6);

+      }

+      goto LAB_0;

+    }

+  }

+  iVar2 = 0;

+  UserSetLastError(5);

+LAB_0:

+  ReleaseUserCriticalSection();

+  return (longlong)iVar2;

 }
```

## `EtwTraceBeginSendMessage`  (modified)

```diff
--- EtwTraceBeginSendMessage
+++ EtwTraceBeginSendMessage
@@ -1,10 +1,22 @@
 

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

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

 

-void EtwTraceBeginSendMessage(void)

+void EtwTraceBeginSendMessage(longlong param_1,longlong param_2,longlong param_3)

 

 {

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

-  halt_baddata();

+                    /* 0x165a20  1199  EtwTraceBeginSendMessage */

+  if (((((W32kEtwEnabledKeyword & 0x400000000400000) != 0) && (2 < (byte)(DAT_0 - 1U))) &&

+      ((_DAT_1 & 0x400000000400000) != 0)) &&

+     ((DAT_2 & 0x400000000400000) == DAT_2)) {

+    if (param_2 == 0) {

+      param_3 = -param_3;

+    }

+    if ((Microsoft_Windows_Win32kEnableBits._1_1_ & 8) != 0) {

+      PsGetThreadId(**(undefined8 **)(param_1 + 0x28),param_2,param_3);

+      GetCallbackCount();

+      McTemplateK0cppppqqqqq_EtwWriteTransfer();

+    }

+  }

+  return;

 }
```

## `UserKSTInitialize`  (modified)

```diff
--- UserKSTInitialize
+++ UserKSTInitialize
@@ -1,39 +1,201 @@
 

-undefined8 UserKSTInitialize(undefined8 param_1,undefined8 param_2,int param_3)

+bool UserKSTInitialize(void *param_1,void *param_2)

 

 {

-  int *piVar1;

-  char cVar2;

-  undefined8 in_RAX;

-  longlong lVar3;

-  longlong unaff_RBX;

-  undefined8 *puVar4;

-  undefined8 *unaff_RBP;

-  undefined8 *unaff_RDI;

-  undefined8 uStack_10;

+  void *pvVar1;

+  bool bVar2;

+  long lVar3;

+  int iVar4;

+  longlong lVar5;

+  char cVar6;

+  byte bVar7;

+  byte bVar8;

+  byte bVar9;

+  bool bVar10;

   

-  piVar1 = (int *)(CONCAT71((int7)((ulonglong)in_RAX >> 8),(char)in_RAX + ';') + -0x75);

-  *piVar1 = *piVar1 + -1;

-  puVar4 = (undefined8 *)&stack0xfffffffffffffff8;

-  cVar2 = '\x17';

-  do {

-    unaff_RBP = unaff_RBP + -1;

-    puVar4 = puVar4 + -1;

-    *puVar4 = *unaff_RBP;

-    cVar2 = cVar2 + -1;

-  } while ('\0' < cVar2);

-  lVar3 = UserCritInternal::`anonymous_namespace'::EnterCritInternal(param_1,param_3 + 1);

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

-  if (lVar3 != 0) {

-    cVar2 = UserCritInternal::`anonymous_namespace'::IsValidGuiContext(lVar3);

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

-      DestroySharedUserCritDeferredUnlockList(unaff_RBX + 0x4d78);

-      DestroyDeferredUnlockObjectAssignmentList(unaff_RBX + 0x4db0);

-      DestroyDeferredUnlockObjectAssignmentList(unaff_RBX + 0x4da0);

-    }

-  }

-  ApplyFullKeyboardStates((void *)*unaff_RDI,(void *)unaff_RDI[1]);

-  ReleaseUserCriticalSection();

-  return 1;

+                    /* 0x213d20  2300  UserKSTInitialize */

+  bVar9 = 0;

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

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

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

+    bVar2 = false;

+  }

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

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

+    bVar10 = false;

+  }

+  if ((bVar2) || (bVar10)) {

+    WPP_RECORDER_AND_TRACE_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+  }

+  InputTraceLogging::KST::UserKSTInitialize();

+  InputTraceLogging::KST::DeclareThreadAsKST();

+  lVar5 = W32GetUserSessionState();

+  bVar2 = CInputThreadBase::DeclareThreadAsInput(*(CInputThreadBase **)(lVar5 + 0xc20));

+  if (!bVar2) {

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

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

+       (bVar8 = 1, (byte)WPP_GLOBAL_Control[0x29] < 2)) {

+      bVar8 = bVar9;

+    }

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

+    if ((bVar8 != 0) || (bVar2)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

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

+                 *(undefined8 *)(lVar5 + 0x10f78),2,2,0xb,

+                 &WPP_6181c045148c302f15541ca47eaaa118_Traceguids);

+    }

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

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

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

+      cVar6 = '\0';

+    }

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

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

+      bVar8 = bVar9;

+    }

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

+      WPP_RECORDER_AND_TRACE_SF_

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

+                 *(undefined8 *)(WPP_GLOBAL_Control + 0x40),5,2,0xc,

+                 &WPP_6181c045148c302f15541ca47eaaa118_Traceguids);

+    }

+    return false;

+  }

+  lVar5 = W32GetUserSessionState();

+  if (*(longlong *)(lVar5 + 0x4ba8) != 0) {

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

+  }

+  lVar5 = W32GetUserSessionState();

+  lVar3 = CKernelSensorThread::InitializeEventHandles

+                    (*(CKernelSensorThread **)(lVar5 + 0xc20),param_1,param_2);

+  bVar8 = bVar9;

+  if (-1 < lVar3) {

+    lVar5 = W32GetUserSessionState();

+    lVar3 = IOCPDispatcher::CreateInstance((IOCPDispatcher **)(lVar5 + 0x4ba8));

+    if ((-1 < lVar3) && (iVar4 = ActivateKSTInputProcessingHelper(), iVar4 != 0)) {

+      bVar8 = 1;

+      InputTraceLogging::KST::ActivateKSTInputProcessing();

+      lVar5 = W32GetUserSessionState();

+      CInputThreadBase::ActivateInputProcessing(*(CInputThreadBase **)(lVar5 + 0xc20));

+      iVar4 = Feature_NoBugcheckForSetupIOCP__private_IsEnabledDeviceUsageNoInline();

+      if (iVar4 == 0) {

+        lVar5 = W32GetUserSessionState();

+        pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x30);

+        lVar5 = W32GetUserSessionState();

+        IOCPDispatcher::RegisterThreadDispatcherObject(*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1);

+        lVar5 = W32GetUserSessionState();

+        pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x38);

+        lVar5 = W32GetUserSessionState();

+        IOCPDispatcher::RegisterThreadDispatcherObject(*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1);

+        lVar5 = W32GetUserSessionState();

+        pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x40);

+        lVar5 = W32GetUserSessionState();

+        IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback

+                  (*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1,

+                   <lambda_71b9db7af6f8465366ac3036a3d85fc6>::<lambda_invoker_cdecl>,(void *)0x0);

+        lVar5 = W32GetUserSessionState();

+        pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x48);

+        lVar5 = W32GetUserSessionState();

+        IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback

+                  (*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1,

+                   <lambda_8430d776119852f1c4a25e4614a07f0e>::<lambda_invoker_cdecl>,(void *)0x0);

+        lVar5 = W32GetUserSessionState();

+        pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x50);

+        lVar5 = W32GetUserSessionState();

+        IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback

+                  (*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1,

+                   <lambda_1a5ee060bdb1ce9703eb1122d26d57bd>::<lambda_invoker_cdecl>,(void *)0x0);

+      }

+      else {

+        lVar5 = W32GetUserSessionState();

+        pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x30);

+        lVar5 = W32GetUserSessionState();

+        lVar3 = IOCPDispatcher::RegisterThreadDispatcherObject

+                          (*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1);

+        if (-1 < lVar3) {

+          lVar5 = W32GetUserSessionState();

+          pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x38);

+          lVar5 = W32GetUserSessionState();

+          lVar3 = IOCPDispatcher::RegisterThreadDispatcherObject

+                            (*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1);

+          if (-1 < lVar3) {

+            lVar5 = W32GetUserSessionState();

+            pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x40);

+            lVar5 = W32GetUserSessionState();

+            lVar3 = IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback

+                              (*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1,

+                               <lambda_71b9db7af6f8465366ac3036a3d85fc6>::<lambda_invoker_cdecl>,

+                               (void *)0x0);

+            if (-1 < lVar3) {

+              lVar5 = W32GetUserSessionState();

+              pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x48);

+              lVar5 = W32GetUserSessionState();

+              lVar3 = IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback

+                                (*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1,

+                                 <lambda_8430d776119852f1c4a25e4614a07f0e>::<lambda_invoker_cdecl>,

+                                 (void *)0x0);

+              if (-1 < lVar3) {

+                lVar5 = W32GetUserSessionState();

+                pvVar1 = *(void **)(*(longlong *)(lVar5 + 0xc20) + 0x50);

+                lVar5 = W32GetUserSessionState();

+                lVar3 = IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback

+                                  (*(IOCPDispatcher **)(lVar5 + 0x4ba8),pvVar1,

+                                   <lambda_1a5ee060bdb1ce9703eb1122d26d57bd>::<lambda_invoker_cdecl>

+                                   ,(void *)0x0);

+              }

+            }

+          }

+        }

+        bVar8 = (byte)((uint)lVar3 >> 0x1f) ^ 1;

+        if (bVar8 == 0) goto LAB_0;

+      }

+      iVar4 = IsRemoteConnection();

+      if (iVar4 != 0) {

+        lVar5 = W32GetUserSessionState();

+        CBaseInput::HandleTSRequest(*(CBaseInput **)(lVar5 + 0xc18),0);

+      }

+      PerfomInitialReadInputExplicitly(0);

+      bVar2 = ShouldKSTInitializeHidSensor();

+      if (bVar2) {

+        PerfomInitialReadInputExplicitly(2);

+      }

+      goto LAB_1;

+    }

+  }

+LAB_0:

+  KSTIOCPDispatcher_Destroy();

+  lVar5 = W32GetUserSessionState();

+  CKernelSensorThread::DestroyEventHandles(*(CKernelSensorThread **)(lVar5 + 0xc20));

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

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

+     (bVar7 = 1, (byte)WPP_GLOBAL_Control[0x29] < 2)) {

+    bVar7 = bVar9;

+  }

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

+  if ((bVar7 != 0) || (bVar2)) {

+    lVar5 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar7,bVar2,

+               *(undefined8 *)(lVar5 + 0x10f78),2,2,0xd,

+               &WPP_6181c045148c302f15541ca47eaaa118_Traceguids);

+  }

+LAB_1:

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

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

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

+    cVar6 = '\0';

+  }

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

+     (bVar7 = 1, *(short *)(WPP_GLOBAL_Control + 0x48) == 0)) {

+    bVar7 = bVar9;

+  }

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

+    WPP_RECORDER_AND_TRACE_SF_

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,CONCAT71(0x140270b,bVar7),

+               *(undefined8 *)(WPP_GLOBAL_Control + 0x40),5,2,0xe,

+               &WPP_6181c045148c302f15541ca47eaaa118_Traceguids);

+  }

+  return bVar8 != 0;

 }
```

## `NtMITDispatchCompletion`  (modified)

```diff
--- NtMITDispatchCompletion
+++ NtMITDispatchCompletion
@@ -1,76 +1,74 @@
 

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

-

-void NtMITDispatchCompletion(longlong param_1)

+undefined8 NtMITDispatchCompletion(int param_1,uint param_2)

 

 {

   int iVar1;

-  undefined8 in_RAX;

   longlong lVar2;

-  CInputDest *pCVar3;

-  tagTHREADINFO *ptVar4;

+  int iVar3;

+  longlong lVar4;

   char cVar5;

-  undefined4 unaff_EBX;

-  _InputHitTestResult *unaff_RBP;

-  longlong unaff_RSI;

-  char unaff_R13B;

-  CInputDest *unaff_R14;

-  _InputHitTestRequest *unaff_R15;

-  bool bVar6;

-  undefined4 uStack0000000000000028;

+  char cVar6;

+  char cVar7;

+  undefined8 in_stack_ffffffffffffffb0;

+  undefined4 uVar8;

   

-  *(char *)(unaff_RSI + -0x39) = *(char *)(unaff_RSI + -0x39) + (char)((ulonglong)in_RAX >> 8);

-  uStack0000000000000028 = unaff_EBX;

-  WPP_RECORDER_AND_TRACE_SF_ddd(*(undefined8 *)(param_1 + 0x18));

-  InputTraceLogging::DWM::HitTestRequest(*(__uint64 *)(unaff_R15 + 0x30),unaff_R15);

-  lVar2 = W32GetUserSessionState();

-  iVar1 = ApiSetClientCallDitThread(*(undefined8 *)(lVar2 + 0xcd0));

-  if (iVar1 != 0) {

-    ApiSetRemoveMagnificationOutputTransform(unaff_RBP + 0x10);

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

-      pCVar3 = (CInputDest *)

-               CSpatialProcessor::ResolveDcompHitTestResultToInputDest

-                         ((_InputHitTestResult *)&stack0x00000070,(ulong)unaff_RBP,

-                          (ulonglong)*(uint *)unaff_R15);

-      CInputDest::operator=(unaff_R14,pCVar3);

-      CInputDest::~CInputDest((CInputDest *)&stack0x00000070);

-      if (*(int *)unaff_R14 != 0) {

-        ptVar4 = CInputDest::GetThreadInfo(unaff_R14);

-        if (ptVar4 == (tagTHREADINFO *)0x0) {

-          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x59);

-        }

-      }

+                    /* 0xb3e30  1891  NtMITDispatchCompletion */

+  uVar8 = (undefined4)((ulonglong)in_stack_ffffffffffffffb0 >> 0x20);

+  lVar4 = W32GetUserSessionState();

+  lVar2 = *(longlong *)(lVar4 + 0x49d8);

+  lVar4 = lVar2 + 8;

+  KeEnterCriticalRegion();

+  ExAcquirePushLockSharedEx(lVar4,0);

+  iVar3 = PsGetCurrentThreadId();

+  iVar1 = *(int *)(lVar2 + 0x28);

+  ExReleasePushLockSharedEx(lVar4,0);

+  KeLeaveCriticalRegion();

+  if (iVar3 == iVar1) {

+    cVar6 = '\x01';

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

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

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

+      cVar5 = '\0';

+    }

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

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

+      cVar7 = '\0';

+    }

+    if ((cVar5 != '\0') || (cVar7 != '\0')) {

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,cVar7,

+                 *(undefined8 *)(WPP_GLOBAL_Control + 0x40),5,CONCAT44(uVar8,2),0xd,

+                 &WPP_4c37d3b938813951dcfe59f4edab31d1_Traceguids);

+    }

+    lVar4 = W32GetUserSessionState();

+    if (param_1 == -0x80000000) {

+      IOCPDispatcher::HandleSensorDispatcherSignal(*(IOCPDispatcher **)(lVar4 + 0x4ba0),param_2);

+    }

+    else if (param_1 == -0x7fffffff) {

+      IOCPDispatcher::HandleThreadDispatcherSignal(*(IOCPDispatcher **)(lVar4 + 0x4ba0),param_2);

     }

     else {

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

-          ((byte)((byte)unaff_EBX & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-         (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-        cVar5 = '\0';

-      }

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

-      if ((cVar5 != '\0') || (bVar6)) {

-        lVar2 = W32GetUserSessionState();

-        uStack0000000000000028 = 2;

-        WPP_RECORDER_AND_TRACE_SF_

-                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar6,

-                   *(undefined8 *)(lVar2 + 0x10f78),4);

-      }

-      if (*(int *)unaff_R14 != 0) {

-        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x4e);

-      }

-      CSpatialProcessor::SatisfyNonPointerInputSinkInfoRequest(unaff_RBP);

+      DbgkWerCaptureLiveKernelDump(L"win32kbase.sys",400,(longlong)param_1,param_2,0,0,0,0,0);

     }

-    if ((*(longlong *)(unaff_RBP + 8) != 0) && (*(int *)unaff_R14 == 0)) {

-      *(undefined4 *)(unaff_RBP + 0x50) = 0;

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

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

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

+      cVar5 = '\0';

+    }

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

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

+      cVar6 = '\0';

+    }

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

+      WPP_RECORDER_AND_TRACE_SF_

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

+                 *(undefined8 *)(WPP_GLOBAL_Control + 0x40),5,2,0xe,

+                 &WPP_4c37d3b938813951dcfe59f4edab31d1_Traceguids);

     }

   }

-  InputTraceLogging::DWM::HitTestResult

-            (*(__uint64 *)(unaff_R15 + 0x30),*(uint *)(unaff_R15 + 0xc),unaff_RBP,unaff_R14);

-  if (*(void **)(unaff_RBP + 8) != (void *)0x0) {

-    InputTraceLogging::InputSink::Close(*(void **)(unaff_RBP + 8),true);

-    NtClose(*(undefined8 *)(unaff_RBP + 8));

-    *(undefined8 *)(unaff_RBP + 8) = 0;

+  else {

+    UserSetLastError(5);

   }

-  return;

+  return 0;

 }
```

## `EtwTraceDwmVisRgnDirty`  (modified)

```diff
--- EtwTraceDwmVisRgnDirty
+++ EtwTraceDwmVisRgnDirty
@@ -1,13 +1,11 @@
 

-void EtwTraceDwmVisRgnDirty(_tlgProvider_t *param_1,void *param_2,_GUID *param_3,_GUID *param_4)

+void EtwTraceDwmVisRgnDirty(undefined8 param_1,undefined8 param_2,undefined8 param_3)

 

 {

-  longlong in_RAX;

-  _tlgWrapperByVal<8> *in_stack_00000020;

-  

-  *(byte *)(in_RAX + -0x73) = *(byte *)(in_RAX + -0x73) & (byte)param_1;

-  _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>_>(param_1,param_2,param_3,param_4,in_stack_00000020);

+                    /* 0xfb710  1238  EtwTraceDwmVisRgnDirty */

+  if ((Microsoft_Windows_Win32kEnableBits._3_1_ & 1) != 0) {

+    McTemplateK0xx_EtwWriteTransfer(param_1,&DwmVisRgnDirty,param_3,param_1,param_2);

+  }

   return;

 }
```

## `DrvDisplayConfigSetDeviceInfo`  (modified)

```diff
--- DrvDisplayConfigSetDeviceInfo
+++ DrvDisplayConfigSetDeviceInfo
@@ -1,45 +1,325 @@
 

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

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

+/* WARNING: Removing unreachable block (ram,0x0001401c8afe) */

+/* WARNING: Removing unreachable block (ram,0x0001401c8b22) */

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

 

-ulonglong DrvDisplayConfigSetDeviceInfo(void)

+ulonglong DrvDisplayConfigSetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_TYPE *param_1,undefined8 param_2)

 

 {

-  int in_EAX;

-  int iVar1;

-  ulonglong uVar2;

-  ulonglong unaff_RBX;

-  longlong unaff_RBP;

-  undefined8 *unaff_RSI;

-  uint unaff_EDI;

-  byte in_CF;

+  DISPLAYCONFIG_DEVICE_INFO_TYPE *pDVar1;

+  DISPLAYCONFIG_DEVICE_INFO_TYPE *pDVar2;

+  int *piVar3;

+  int iVar4;

+  DISPLAYCONFIG_DEVICE_INFO_TYPE DVar5;

+  uint uVar6;

+  longlong lVar7;

+  ulonglong uVar8;

   

-  uVar2 = (ulonglong)(in_EAX + 0xf1aa3 + (uint)in_CF);

-  do {

-    iVar1 = (**(code **)(uVar2 + 0x1c8))

-                      (unaff_RBP + -0x18,*(undefined4 *)(unaff_RBP + -0x1c),unaff_RBP + -0x40);

-    if (-1 < iVar1) {

-      ObfReferenceObject(*unaff_RSI);

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

+                    /* 0x1c8210  1048  DrvDisplayConfigSetDeviceInfo */

+  iVar4 = DrvIsWddmDriverPresent();

+  if (iVar4 == 0) {

+    return 0xc00000bb;

+  }

+  DVar5 = DispConfigTypes::GetSetterTypeSize(*param_1);

+  if (DVar5 != param_1[1]) {

+    return 0xffffffffc000000d;

+  }

+  lVar7 = DxDdGetDxgkWin32kInterface();

+  pDVar1 = param_1 + 4;

+  pDVar2 = param_1 + 2;

+  uVar8 = (**(code **)(lVar7 + 0x228))(pDVar2,*pDVar1,pDVar2,pDVar1);

+  if ((int)uVar8 < 0) {

+    return uVar8;

+  }

+  DVar5 = *param_1;

+  if ((int)DVar5 < -0xf) {

+    if (DVar5 == 0xfffffff0) {

+      if (param_1[1] != 0x44) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x481c;

+      }

+      else if (iVar4 == 0x103) {

+        MicrosoftTelemetryAssertTriggeredNoArgsKM();

+        uVar8 = 0;

+      }

+      else if (iVar4 == 0xff) {

+        lVar7 = W32GetSessionState();

+        lVar7 = *(longlong *)(*(longlong *)(lVar7 + 0x58) + 0x6e8);

+        if (lVar7 != 0) {

+          LOCK();

+          piVar3 = (int *)(lVar7 + 0x180090);

+          *piVar3 = *piVar3 + 1;

+          UNLOCK();

+        }

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffd5) {

+      if (param_1[1] != 0x18) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x4864;

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffd7) {

+      if (param_1[1] != 0x18) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x48f2;

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffd8) {

+      if (param_1[1] != 0x18) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x48e0;

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffda) {

+      if (param_1[1] != 0x1c) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x48ce;

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffdd) {

+      if (param_1[1] < 0x18) {

+        return 0xc0000023;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x48bc;

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffe5) {

+      if (param_1[1] < 0x18) {

+        return 0xc0000023;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      uVar6 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      if (uVar6 == 0xc0000016) {

+        uVar6 = xxxUserSetDisplayConfig(0,0,0x88f,0,0,1,0,0,0,param_2,0);

+      }

+      uVar8 = (ulonglong)uVar6;

+      if ((int)uVar6 < 0) {

+        WdLogSingleEntry2(3,param_1,(longlong)(int)uVar6);

+        _WdLogGlobalForLineNumber = 0x48aa;

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffe9) {

+      if (param_1[1] != 0x30) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x4876;

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffed) {

+      if (param_1[1] != 0x18) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x4853;

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xffffffee) {

+      if (param_1[1] != 0x1c) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x4842;

+      }

+      goto LAB_0;

+    }

+LAB_1:

+    WdLogSingleEntry5(2,0xffffffffc000000d,(longlong)(int)DVar5,(longlong)(int)param_1[3],*pDVar2,

+                      *pDVar1);

+    _WdLogGlobalForLineNumber = 0x48ff;

+    uVar8 = 0xffffffffc000000d;

+  }

+  else {

+    if (DVar5 == 0xfffffffa) {

+      if (param_1[1] != 0x1c) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x47d0;

+      }

+      else if (param_1[6] != 0) {

+        iVar4 = xxxUserSetDisplayConfig(0,0,0x88f,4,0,1,0,0,0,param_2,0);

+        uVar8 = (ulonglong)iVar4;

+        if (iVar4 < 0) {

+          WdLogSingleEntry1(3,uVar8);

+          _WdLogGlobalForLineNumber = 0x47e4;

+        }

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 0xfffffffc) {

+      if (param_1[1] != 0x18) {

+        return 0xffffffffc000000d;

+      }

+      uVar6 = DrvDisplayConfigSetScaleFactorOverride(param_1,0);

+      uVar8 = (ulonglong)uVar6;

+      goto LAB_0;

+    }

+    if (DVar5 == 5) {

+      if (param_1[1] != 0x18) {

+        return 0xffffffffc000000d;

+      }

+      WdLogSingleEntry5(4,5,(longlong)(int)param_1[3],*pDVar2,*pDVar1,param_1[5] & 1);

+      _WdLogGlobalForLineNumber = 0x472e;

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0x110))();

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry5(2,uVar8,(longlong)(int)param_1[3],*pDVar2,*pDVar1,param_1[5] & 1);

+        _WdLogGlobalForLineNumber = 0x4738;

+      }

+      else {

+        if ((param_1[5] & 1) != 0) {

+          iVar4 = GetPathsModality();

+          if (iVar4 < 0) {

+            WdLogSingleEntry5(2,(longlong)iVar4,(longlong)(int)param_1[3],*pDVar2,*pDVar1,

+                              param_1[5] & 1);

+            _WdLogGlobalForLineNumber = 0x474a;

+            if (iVar4 == -0x3fffffe9) {

+              lVar7 = DxDdGetDxgkWin32kInterface();

+              iVar4 = (**(code **)(lVar7 + 0x118))();

+              if (iVar4 < 0) {

+                WdLogSingleEntry0(1);

+                _WdLogGlobalForLineNumber = 0x474f;

+              }

+              return 0xc0000017;

+            }

+          }

+        }

+        lVar7 = DxDdGetDxgkWin32kInterface();

+        iVar4 = (**(code **)(lVar7 + 0xe0))

+                          (*(undefined8 *)pDVar2,*pDVar1,~param_1[5] & 1 | 0x80000000,0);

+        uVar8 = (ulonglong)iVar4;

+        if (iVar4 < 0) {

+          WdLogSingleEntry5(2,uVar8,(longlong)(int)param_1[3],*pDVar2,*pDVar1,param_1[5] & 1);

+          _WdLogGlobalForLineNumber = 0x476e;

+        }

+        lVar7 = DxDdGetDxgkWin32kInterface();

+        iVar4 = (**(code **)(lVar7 + 0x118))();

+        if (iVar4 < 0) {

+          WdLogSingleEntry0(1);

+          _WdLogGlobalForLineNumber = 0x4787;

+        }

+        FreePathsModality((D3DKMT_GETPATHSMODALITY *)0x0);

+      }

+      goto LAB_0;

+    }

+    if (DVar5 == 8) {

+      if (param_1[1] != 0x18) {

+        return 0xffffffffc000000d;

+      }

+      lVar7 = DxDdGetDxgkWin32kInterface();

+      iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry2(3,param_1,uVar8);

+        _WdLogGlobalForLineNumber = 0x47a7;

+      }

+      else {

+        iVar4 = xxxUserSetDisplayConfig(0,0,0x98f,0,0,1,0,0,0,param_2,0);

+        uVar8 = (ulonglong)iVar4;

+        if (iVar4 < 0) {

+          WdLogSingleEntry1(3,uVar8);

+          _WdLogGlobalForLineNumber = 0x47ba;

+        }

+      }

+      goto LAB_0;

+    }

+    if (DVar5 != 10) {

+      if (DVar5 == 0xd) {

+        if (param_1[1] != 0x138) {

+          return 0xffffffffc000000d;

+        }

+        lVar7 = DxDdGetDxgkWin32kInterface();

+        iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+        uVar8 = (ulonglong)iVar4;

+        if (iVar4 < 0) {

+          WdLogSingleEntry2(3,param_1,uVar8);

+          _WdLogGlobalForLineNumber = 0x4887;

+        }

+        goto LAB_0;

+      }

+      if (1 < DVar5 - 0x10) goto LAB_1;

+    }

+    lVar7 = DxDdGetDxgkWin32kInterface();

+    iVar4 = (**(code **)(lVar7 + 0xf8))(0,param_1);

+    uVar8 = (ulonglong)iVar4;

+    if (iVar4 < 0) {

+      WdLogSingleEntry2(3,param_1,uVar8);

+      _WdLogGlobalForLineNumber = 0x47f3;

+    }

+    else if (iVar4 != 0xff) {

+      iVar4 = xxxUserSetDisplayConfig(0,0,0x88f,0,0,1,0,0,0,param_2,0);

+      uVar8 = (ulonglong)iVar4;

+      if (iVar4 < 0) {

+        WdLogSingleEntry1(3,uVar8);

+        _WdLogGlobalForLineNumber = 0x4808;

+      }

+    }

+  }

 LAB_0:

-      EnsureMonitorDevices::~EnsureMonitorDevices((EnsureMonitorDevices *)(unaff_RBP + -0x38));

-      return unaff_RBX & 0xffffffff;

-    }

-    do {

-      unaff_EDI = unaff_EDI + 1;

-      if (*(uint *)(unaff_RBP + -0x30) <= unaff_EDI) {

-        unaff_RBX = 0xc01e05e5;

-        goto LAB_0;

-      }

-      *(undefined4 *)(unaff_RBP + -0x10) = 0;

-      *(undefined8 *)(unaff_RBP + -0x20) = 0;

-      *(undefined8 *)(unaff_RBP + -0x18) = 0;

-      EnsureMonitorDevices::GetMonitorDevice

-                ((EnsureMonitorDevices *)(unaff_RBP + -0x38),unaff_EDI,

-                 (tagVIDEO_MONITOR_DEVICE *)(unaff_RBP + -0x20));

-    } while ((*(byte *)(unaff_RBP + -0x20) & 1) == 0);

-    *(ulonglong *)(unaff_RBP + -0x40) = unaff_RBX;

-    uVar2 = DxDdGetDxgkWin32kInterface();

-  } while( true );

+  return uVar8 & 0xffffffff;

 }
```

## `ValidateHwndEx`  (modified)

```diff
--- ValidateHwndEx
+++ ValidateHwndEx
@@ -1,11 +1,109 @@
 

-void ValidateHwndEx(uint param_1)

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

+

+longlong ValidateHwndEx(ulonglong param_1,int param_2,int param_3)

 

 {

-  char in_AL;

-  byte in_CF;

+  code *pcVar1;

+  undefined8 uVar2;

+  bool bVar3;

+  ushort uVar4;

+  uint uVar5;

+  int iVar6;

+  longlong lVar7;

+  longlong lVar8;

+  longlong lVar9;

+  longlong *plVar10;

+  longlong lVar11;

+  undefined8 uVar12;

+  longlong lVar13;

   

-  *(char *)((ulonglong)param_1 + 0x2b) = *(char *)((ulonglong)param_1 + 0x2b) + in_AL + (in_CF & 1);

-  return;

+                    /* 0xb0500  2342  ValidateHwndEx */

+  lVar7 = W32GetUserSessionState();

+  if ((param_1 & 0xffff) < *(ulonglong *)(*(longlong *)(lVar7 + 0x4e30) + 8)) {

+    lVar7 = W32GetUserSessionState();

+    lVar8 = W32GetUserSessionState();

+    lVar13 = (ulonglong)(uint)((int)(param_1 & 0xffff) * *(int *)(lVar8 + 0x4e48)) +

+             *(longlong *)(lVar7 + 0x4e40);

+    lVar8 = W32GetUserSessionState();

+    lVar7 = *(longlong *)(lVar8 + 0x4e40);

+    lVar8 = *(longlong *)(lVar8 + 0x4e08);

+    uVar4 = (ushort)(param_1 >> 0x10) & 0x7fff;

+    if ((((uVar4 == *(ushort *)(lVar13 + 0x1a)) || (uVar4 == 0x7fff)) ||

+        (((param_1 & 0x7fff0000) == 0 && (lVar9 = PsGetCurrentProcessWow64Process(), lVar9 != 0))))

+       && (*(char *)(lVar13 + 0x18) == '\x01')) {

+      plVar10 = (longlong *)PsGetCurrentThreadWin32Thread();

+      lVar9 = 0;

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

+        lVar9 = *plVar10;

+      }

+      lVar7 = *(longlong *)(lVar8 + (lVar13 - lVar7 >> 5 & 0xffffffffU) * 0x28);

+      if ((lVar7 != 0) && (lVar8 = *(longlong *)(lVar7 + 0x10), (*(byte *)(lVar13 + 0x19) & 1) == 0)

+         ) {

+        if ((param_2 != 0) &&

+           ((lVar8 != lVar9 && (*(longlong *)(lVar7 + 0x18) != *(longlong *)(lVar9 + 0x1f0))))) {

+          LOCK();

+          uVar5 = *(uint *)(lVar9 + 0x210);

+          if (uVar5 == 0) {

+            *(uint *)(lVar9 + 0x210) = 0;

+            uVar5 = 0;

+          }

+          UNLOCK();

+          if ((uVar5 & 4) == 0) {

+            lVar11 = W32GetWin32kBaseApiSetTable();

+            pcVar1 = *(code **)(*(longlong *)(lVar11 + 0x30) + 0x1d8);

+            if ((pcVar1 != (code *)0x0) && (iVar6 = (*pcVar1)(), -1 < iVar6)) {

+              uVar12 = *(undefined8 *)(lVar7 + 0x18);

+              uVar2 = *(undefined8 *)(lVar9 + 0x1d0);

+              lVar11 = W32GetWin32kBaseApiSetTable();

+              pcVar1 = *(code **)(*(longlong *)(lVar11 + 0x30) + 0x1e0);

+              if ((pcVar1 != (code *)0x0) && (lVar11 = (*pcVar1)(uVar2,uVar12), lVar11 != 0))

+              goto LAB_0;

+            }

+            goto LAB_1;

+          }

+        }

+LAB_0:

+        if ((param_3 != 0) && (*(int *)(*(longlong *)(lVar8 + 0x1d0) + 0x364) != 1)) {

+          param_3 = 0;

+        }

+        if (((*(char *)(lVar9 + 0x6ac) != '\x01') || (lVar8 == 0)) ||

+           (bVar3 = UIPrivilegeIsolation::CheckAccessEx

+                              ((tagUIPI_INFO *)(*(longlong *)(lVar9 + 0x1d0) + 0x358),

+                               (tagUIPI_INFO *)(*(longlong *)(lVar8 + 0x1d0) + 0x358),

+                               (uint)(param_3 != 0)), bVar3)) {

+LAB_2:

+          LOCK();

+          uVar5 = *(uint *)(lVar9 + 0x210);

+          if (uVar5 == 0) {

+            *(uint *)(lVar9 + 0x210) = 0;

+            uVar5 = 0;

+          }

+          UNLOCK();

+          if ((uVar5 >> 0x1d & 1) == 0) {

+            return lVar7;

+          }

+          iVar6 = IsHandleEntrySecure(param_1,lVar13);

+          if (iVar6 != 0) {

+            return lVar7;

+          }

+          UserSetLastError(0x578);

+          return 0;

+        }

+        lVar11 = W32GetUserGdiSessionState();

+        if (**(longlong **)(lVar8 + 0x1d0) == *(longlong *)(lVar11 + 0x28)) goto LAB_2;

+        EtwTraceUIPIHandleValidationError

+                  (*(undefined8 *)(lVar9 + 0x1d0),*(longlong **)(lVar8 + 0x1d0),param_1,

+                   *(undefined1 *)(lVar13 + 0x18));

+        uVar12 = 5;

+        goto LAB_3;

+      }

+    }

+  }

+LAB_1:

+  uVar12 = 0x578;

+LAB_3:

+  UserSetLastError(uVar12);

+  return 0;

 }
```

## `NtUserSetProcessLaunchForegroundPolicy`  (modified)

```diff
--- NtUserSetProcessLaunchForegroundPolicy
+++ NtUserSetProcessLaunchForegroundPolicy
@@ -1,49 +1,181 @@
 

-undefined8 NtUserSetProcessLaunchForegroundPolicy(undefined8 param_1)

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

+

+undefined8

+NtUserSetProcessLaunchForegroundPolicy(int param_1,uint param_2,undefined8 param_3,ulong param_4)

 

 {

-  tagTHREADINFO *ptVar1;

-  ulonglong uVar2;

-  tagTHREADINFO *ptVar3;

-  longlong lVar4;

+  code *pcVar1;

+  undefined *puVar2;

+  int iVar3;

+  undefined4 uVar4;

   longlong lVar5;

-  longlong lVar6;

-  longlong *plVar7;

+  tagPROCESSINFO *ptVar6;

+  char cVar7;

   undefined8 uVar8;

-  ulonglong uVar9;

+  bool bVar9;

+  bool bVar10;

+  ulonglong local_res18;

+  undefined8 in_stack_ffffffffffffff50;

+  undefined4 uVar12;

+  undefined8 uVar11;

+  undefined2 uVar13;

+  undefined4 local_88 [2];

+  undefined4 local_80;

+  longlong local_70;

   

-  ptVar3 = PtiCurrent();

-  if ((*(uint *)(ptVar3 + 0x550) >> 0x18 & 1) != 0) {

-    lVar4 = HMValidateHandleNoSecure(param_1,0x17);

-    if (lVar4 == 0) {

-      uVar8 = 6;

-      goto LAB_0;

+                    /* 0x1bb170  2038  NtUserSetProcessLaunchForegroundPolicy */

+  uVar12 = (undefined4)((ulonglong)in_stack_ffffffffffffff50 >> 0x20);

+  uVar4 = 3;

+  if (((byte)param_2 & 3) == 3) {

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0xc & 1) == 0)) ||

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

+      cVar7 = '\0';

     }

-    lVar5 = _HMPheFromObject(lVar4);

-    lVar6 = W32GetUserSessionState();

-    ptVar1 = *(tagTHREADINFO **)

-              (*(longlong *)(lVar6 + 0x4e08) + 8 +

-              (lVar5 - *(longlong *)(lVar6 + 0x4e40) >> 5 & 0xffffffffU) * 0x28);

-    uVar2 = *(ulonglong *)(ptVar1 + 0x1d0);

-    plVar7 = (longlong *)PsGetCurrentProcessWin32Process();

-    uVar9 = 0;

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

-      uVar9 = (ulonglong)plVar7 & -(ulonglong)(*plVar7 != 0);

+    else {

+      cVar7 = '\x01';

     }

-    if ((uVar9 != uVar2) || (ptVar3 != ptVar1)) {

-      uVar8 = 5;

-      goto LAB_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 + 0x10f78),4,CONCAT44(uVar12,0xd),0x70,

+                 &WPP_2d9ff25e81b038623ce9c364b7ad2133_Traceguids,param_2);

     }

-    if ((*(byte *)(lVar5 + 0x19) & 1) == 0) {

-      uVar8 = *(undefined8 *)(lVar4 + 0x38);

-      *(undefined8 *)(lVar4 + 0x38) = 0;

-      HMDestroyUnlockedObject(lVar5);

-      return uVar8;

+LAB_0:

+    UserSetLastError(0x57);

+    return 0;

+  }

+  bVar9 = true;

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

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0xc & 1) == 0)) ||

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

+    cVar7 = '\0';

+  }

+  else {

+    cVar7 = '\x01';

+  }

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

+  if ((cVar7 != '\0') || (bVar10)) {

+    lVar5 = W32GetUserSessionState();

+    uVar8 = *(undefined8 *)(lVar5 + 0x10f78);

+    uVar11 = CONCAT44(uVar12,0xd);

+    WPP_RECORDER_AND_TRACE_SF_Dd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar7,bVar10,uVar8,4,uVar11,0x71,

+               &WPP_2d9ff25e81b038623ce9c364b7ad2133_Traceguids,param_2,param_1);

+    uVar12 = (undefined4)((ulonglong)uVar11 >> 0x20);

+    param_4 = (ulong)uVar8;

+  }

+  if ((param_2 & 0xfffffffb) == 0) {

+    uVar4 = 1;

+  }

+  else if ((param_2 & 0xfffffffb) == 1) {

+    uVar4 = 2;

+  }

+  else if ((param_2 & 0xfffffffb) != 2) {

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0xc & 1) == 0)) ||

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

+      bVar9 = false;

+    }

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

+    if ((bVar9 != false) || (bVar10)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar9,bVar10,

+                 *(undefined8 *)(lVar5 + 0x10f78),2,CONCAT44(uVar12,0xd),0x72,

+                 &WPP_2d9ff25e81b038623ce9c364b7ad2133_Traceguids);

+    }

+    goto LAB_0;

+  }

+  EnterSharedCrit(0,0);

+  uVar12 = 0;

+  CLockProcessByPid::CLockProcessByPid

+            ((CLockProcessByPid *)local_88,(void *)(longlong)param_1,0x200,param_4,1,0);

+  if (local_70 == 0) {

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0xc & 1) == 0)) ||

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

+      bVar9 = false;

+    }

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

+    if ((bVar9) || (bVar10)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_d

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar9,bVar10,

+                 *(undefined8 *)(lVar5 + 0x10f78),2,CONCAT44(uVar12,0xd),0x75,

+                 &WPP_2d9ff25e81b038623ce9c364b7ad2133_Traceguids,param_1);

+    }

+    uVar4 = RtlNtStatusToDosError(local_80);

+    goto LAB_1;

+  }

+  ptVar6 = CLockProcessByPid::GetProcessInfo((CLockProcessByPid *)local_88);

+  puVar2 = WPP_RECORDER_INITIALIZED;

+  if (ptVar6 == (tagPROCESSINFO *)0x0) {

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0xc & 1) == 0)) ||

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

+      bVar9 = false;

+    }

+    if ((bVar9 != false) || ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED)) {

+      lVar5 = W32GetUserSessionState();

+      uVar8 = *(undefined8 *)(lVar5 + 0x10f78);

+      uVar13 = 0x73;

+LAB_2:

+      WPP_RECORDER_AND_TRACE_SF_D

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar9,

+                 (undefined **)puVar2 != &WPP_RECORDER_INITIALIZED,uVar8,2,CONCAT44(uVar12,0xd),

+                 uVar13,&WPP_2d9ff25e81b038623ce9c364b7ad2133_Traceguids,local_88[0]);

     }

   }

-  uVar8 = 0x10dd;

-LAB_0:

-  UserSetLastError(uVar8);

+  else if (ptVar6[0x4a8] == (tagPROCESSINFO)0x1) {

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0xc & 1) == 0)) ||

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

+      bVar9 = false;

+    }

+    if ((bVar9 != false) || ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED)) {

+      lVar5 = W32GetUserSessionState();

+      uVar8 = *(undefined8 *)(lVar5 + 0x10f78);

+      uVar13 = 0x74;

+      goto LAB_2;

+    }

+  }

+  else {

+    lVar5 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0x1440);

+    if ((pcVar1 != (code *)0x0) && (iVar3 = (*pcVar1)(uVar4), iVar3 != 0)) {

+      local_res18 = (ulonglong)CONCAT14((param_2 & 4) != 0,uVar4);

+      lVar5 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0x1430);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)(local_70,local_res18);

+      }

+      CLockProcessByPid::~CLockProcessByPid((CLockProcessByPid *)local_88);

+      ReleaseUserCriticalSection();

+      return 1;

+    }

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 0xc & 1) == 0)) ||

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

+      bVar9 = false;

+    }

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

+    if ((bVar9 != false) || (bVar10)) {

+      lVar5 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar9,bVar10,

+                 *(undefined8 *)(lVar5 + 0x10f78),2,CONCAT44(uVar12,0xd),0x76,

+                 &WPP_2d9ff25e81b038623ce9c364b7ad2133_Traceguids);

+    }

+  }

+  uVar4 = 5;

+LAB_1:

+  UserSetLastError(uVar4);

+  CLockProcessByPid::~CLockProcessByPid((CLockProcessByPid *)local_88);

+  ReleaseUserCriticalSection();

   return 0;

 }
```

## `NtUserActivateKeyboardLayout`  (modified)

```diff
--- NtUserActivateKeyboardLayout
+++ HMDestroyUnlockedObjectWorkerAtomic
@@ -1,32 +1,76 @@
 

-undefined8 NtUserActivateKeyboardLayout(undefined8 param_1,undefined4 param_2)

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

+/* void __cdecl HMDestroyUnlockedObjectWorkerAtomic(struct _HANDLEENTRY * __ptr64) */

+

+void __cdecl HMDestroyUnlockedObjectWorkerAtomic(_HANDLEENTRY *param_1)

 

 {

-  bool bVar1;

-  longlong lVar2;

+  _HANDLEENTRY _Var1;

+  int iVar2;

   longlong lVar3;

-  undefined8 uVar4;

+  longlong lVar4;

+  uint uVar5;

+  EtwUserHandleType EVar6;

+  longlong lVar7;

+  longlong lVar8;

+  ulonglong uVar9;

+  undefined8 uVar10;

+  longlong lVar11;

+  uint local_res8 [2];

+  undefined4 local_res10;

   

-                    /* 0x167930  1943  NtUserActivateKeyboardLayout */

-  lVar2 = W32GetUserSessionState();

-  lVar3 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

-                    (lVar2,0,0,<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

-  uVar4 = 0;

-  *(longlong *)(lVar2 + 0x10) = lVar3;

+  lVar7 = W32GetUserSessionState();

+  lVar11 = 0;

+  if (*(int *)(lVar7 + 0x4dc0) == 0) {

+    uVar5 = AtomicExecutionCheck::GetCount();

+    if (uVar5 == 0) {

+      local_res8[0] = 0x20000;

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

+    }

+  }

+  local_res8[0] = local_res8[0] & 0xffffff00;

+  IdentifyPrimaryDestroyTarget::Identify((IdentifyPrimaryDestroyTarget *)local_res8,param_1);

+  iVar2 = *(int *)(lVar7 + 0x4ddc);

+  lVar3 = *(longlong *)(lVar7 + 0x4dc8);

+  *(int *)(lVar7 + 0x4ddc) = iVar2 + 1;

+  lVar8 = W32GetUserSessionState();

+  lVar4 = *(longlong *)(lVar8 + 0x4e40);

+  lVar8 = *(longlong *)(lVar8 + 0x4e08);

+  param_1[0x19] = (_HANDLEENTRY)((byte)param_1[0x19] | 2);

+  uVar9 = (longlong)param_1 - lVar4 >> 5 & 0xffffffff;

+  _Var1 = param_1[0x18];

+  if ((_Var1 != (_HANDLEENTRY)0x13) && (_Var1 != (_HANDLEENTRY)0x16)) {

+    (*(code *)(&gahti)[(ulonglong)(byte)_Var1 * 3])(*(undefined8 *)(lVar8 + uVar9 * 0x28));

+    goto LAB_0;

+  }

+  EVar6 = GetEtwUserHandleType((uchar)_Var1);

+  EtwTraceUserDestroyHandle(**(undefined8 **)(lVar8 + uVar9 * 0x28),EVar6,0);

+  Win32JobObject::RemoveHandle((void *)**(undefined8 **)(lVar8 + uVar9 * 0x28),param_1);

+  if (param_1[0x18] == (_HANDLEENTRY)0x13) {

+    uVar10 = *(undefined8 *)(*(longlong *)(lVar8 + uVar9 * 0x28) + 0x20);

+LAB_1:

+    ObfDereferenceObject(uVar10);

+  }

+  else if (param_1[0x18] == (_HANDLEENTRY)0x16) {

+    lVar11 = *(longlong *)(*(longlong *)(lVar8 + uVar9 * 0x28) + 0x10);

+    uVar10 = *(undefined8 *)(lVar11 + 0x20);

+    goto LAB_1;

+  }

+  HMRemoveHandleForObjectWorker(param_1);

+LAB_0:

+  if ((*(int *)(lVar7 + 0x4dc0) == 0) && (lVar11 != 0)) {

+    HMUnlockObject(lVar11);

+  }

+  *(int *)(lVar7 + 0x4ddc) = iVar2;

   if (lVar3 != 0) {

-    DestroySharedUserCritDeferredUnlockList(lVar2 + 0x4d78);

-    DestroyDeferredUnlockObjectAssignmentList(lVar2 + 0x4db0);

-    DestroyDeferredUnlockObjectAssignmentList(lVar2 + 0x4da0);

+    if (*(longlong *)(lVar7 + 0x4dc8) != lVar3) {

+      local_res10 = 0x20000;

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

+    }

+    *(longlong *)(lVar7 + 0x4dc8) = lVar3;

   }

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

-  if (bVar1) {

-    uVar4 = ApiSetEditionGetProcessWindowStation();

-    uVar4 = xxxActivateKeyboardLayout(uVar4,param_1,param_2,0);

-  }

-  else {

-    UserSetLastError(5);

-  }

-  ReleaseUserCriticalSection();

-  return uVar4;

+  IdentifyPrimaryDestroyTarget::~IdentifyPrimaryDestroyTarget

+            ((IdentifyPrimaryDestroyTarget *)local_res8);

+  return;

 }
```

## `NtUserSetDisplayConfig`  (modified)

```diff
--- NtUserSetDisplayConfig
+++ NtUserSetDisplayConfig
@@ -1,138 +1,328 @@
 

-longlong NtUserSetDisplayConfig(void)

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

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

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

+

+int NtUserSetDisplayConfig

+              (uint param_1,longlong *param_2,uint param_3,undefined8 *param_4,longlong param_5)

 

 {

-  undefined4 *puVar1;

-  int in_EAX;

-  longlong lVar2;

-  tagTHREADINFO *ptVar3;

-  int iVar4;

-  uint unaff_ESI;

-  uint unaff_EDI;

-  undefined4 *unaff_R12;

-  int unaff_R14D;

-  int unaff_R15D;

-  uint in_stack_00000030;

-  int iStack0000000000000034;

-  undefined4 *in_stack_00000038;

-  undefined4 in_stack_00000040;

-  int iStack0000000000000078;

-  undefined4 uStack000000000000007c;

-  undefined4 *in_stack_00000088;

-  undefined4 *in_stack_000000e0;

-  undefined4 *in_stack_000000e8;

+  code *pcVar1;

+  bool bVar2;

+  bool bVar3;

+  uint uVar4;

+  int iVar5;

+  int iVar6;

+  longlong lVar7;

+  longlong lVar8;

+  tagTHREADINFO *ptVar9;

+  longlong *plVar10;

+  __uint64 _Var11;

+  __uint64 _Var12;

+  uint uVar13;

+  __uint64 _Var14;

+  uint uVar15;

+  undefined1 uVar16;

+  ulonglong uVar17;

+  undefined1 auStack_178 [32];

+  undefined8 local_158;

+  int local_150;

+  longlong local_148;

+  ulonglong local_140;

+  undefined8 local_138;

+  undefined8 local_130;

+  undefined8 local_128;

+  uint local_118;

+  uint local_114;

+  longlong local_110;

+  undefined4 local_108;

+  undefined4 local_104;

+  longlong *local_100;

+  uint local_f8;

+  uint local_f4;

+  longlong *local_f0;

+  uint local_e8;

+  uint local_e4;

+  undefined4 local_d8;

+  uint local_d0;

+  longlong *local_c8;

+  undefined8 local_c0;

+  longlong *local_b8;

+  code *local_b0;

+  undefined4 local_a8;

+  undefined4 local_a4;

+  undefined4 local_a0;

+  longlong local_90;

+  undefined8 *local_88;

+  CDisplayScenarioContextScope local_80 [8];

+  undefined8 local_78;

+  longlong local_70;

+  undefined8 local_60;

+  undefined1 auStack_58 [8];

+  undefined8 local_50;

+  undefined4 local_48;

+  ulonglong local_40;

   

-  if (in_EAX == 1) {

-    in_stack_00000030 = 0x10;

-    if (((ulonglong)in_stack_00000038 & 3) != 0) {

+                    /* 0x16dd10  2031  NtUserSetDisplayConfig */

+  local_40 = __security_cookie ^ (ulonglong)auStack_178;

+  local_90 = param_5;

+  _Var12 = 0;

+  local_100 = (longlong *)0x0;

+  local_118 = param_3;

+  local_e8 = param_1;

+  local_d0 = param_3;

+  local_88 = param_4;

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>::

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>

+            ((Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)> *)

+             &local_c0);

+  lVar7 = _DAT_0;

+  uVar15 = 0;

+  local_f4 = 0;

+  local_108 = 0;

+  local_60 = 0;

+  auStack_58 = (undefined1  [8])0x0;

+  local_50 = 0;

+  local_48 = 0;

+  local_70 = _DAT_0;

+  uVar4 = KeQueryTimeIncrement();

+  local_110 = (ulonglong)uVar4 * lVar7;

+  iVar5 = -0x3ffffff3;

+  local_d8 = 0xc000000d;

+  lVar7 = W32GetUserSessionState();

+  uVar16 = 0;

+  lVar8 = UserCritInternal::`anonymous_namespace'::EnterCritInternal(lVar7,0);

+  *(longlong *)(lVar7 + 0x10) = lVar8;

+  if (lVar8 != 0) {

+    DestroySharedUserCritDeferredUnlockList(lVar7 + 0x4d78);

+    DestroyDeferredUnlockObjectAssignmentList(lVar7 + 0x4db0);

+    DestroyDeferredUnlockObjectAssignmentList(lVar7 + 0x4da0);

+  }

+  lVar7 = W32GetUserGdiSessionState();

+  if (*(int *)(lVar7 + 0x20) == 0) {

+    iVar6 = -0x80000000;

+LAB_1:

+    iVar5 = -0x3fffffff;

+    uVar4 = local_118;

+LAB_2:

+  }

+  else {

+    ptVar9 = PtiCurrent();

+    iVar6 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+    if (iVar6 == 0) {

+      local_a8 = 0x2000;

+      local_a4 = 0xffffffff;

+      local_a0 = 0;

+      uVar16 = 0;

+      bVar2 = UIPrivilegeIsolation::CheckAccessEx

+                        ((tagUIPI_INFO *)(*(longlong *)(ptVar9 + 0x1d0) + 0x358),

+                         (tagUIPI_INFO *)&local_a8,0);

+    }

+    else {

+      bVar2 = UIPrivilegeIsolation::MeetsUIPIThreshold

+                        ((tagUIPI_INFO *)(*(longlong *)(ptVar9 + 0x1d0) + 0x358),0x2000);

+    }

+    bVar3 = tagPROCESSINFO::CanPerformUIOperation(*(tagPROCESSINFO **)(ptVar9 + 0x1d0),0x10);

+    uVar4 = local_118;

+    if ((!bVar3) || (bVar2 == false)) {

+      iVar5 = -0x3fffffde;

+      iVar6 = -0x7fffffff;

+LAB_3:

+      if (iVar6 == 0x12) goto LAB_4;

+      goto LAB_2;

+    }

+    if (0x400 < param_1) {

+      iVar6 = -0x7ffffffe;

+      goto LAB_2;

+    }

+    local_f0 = (longlong *)0x0;

+    local_c8 = (longlong *)0x0;

+    local_f8 = 0;

+    local_e4 = 0;

+    local_114 = 0;

+    if (param_1 != 0) {

+      if (((ulonglong)param_1 * 0xd8 != 0) &&

+         (lVar7 = PsGetCurrentProcessWow64Process(),

+         ((ulonglong)param_2 & (ulonglong)(~-(uint)(lVar7 != 0) & 3)) != 0)) {

                     /* WARNING: Subroutine does not return */

-      ExRaiseDatatypeMisalignment();

-    }

-    memmove(unaff_R12,in_stack_00000038,0x10);

-    in_stack_00000038 = unaff_R12;

-  }

-  else if (in_EAX == 2) {

-    in_stack_00000030 = 0x10;

-    in_stack_00000088 = in_stack_00000038;

-    lVar2 = PsGetCurrentProcessWow64Process();

-    puVar1 = in_stack_00000088;

-    ProbeForWrite(in_stack_00000088,0x10,(-(uint)(lVar2 != 0) & 0xfffffffd) + unaff_ESI);

-    iStack0000000000000078 = 1;

-    *unaff_R12 = *puVar1;

-    in_stack_00000038 = unaff_R12;

-  }

-  else if (0xb5 < unaff_EDI) {

-    if ((0x55 < unaff_EDI - 0x1000) && (0x37 < unaff_EDI - 0x2000)) {

-      UserSetLastError(0x57);

-      iVar4 = 0;

-      iStack0000000000000034 = 0;

-      Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-      ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  *)&stack0x00000048);

-      Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-      ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  *)&stack0x00000060);

-      goto LAB_0;

-    }

-    iVar4 = 0;

-    if ((unaff_R14D != 0) &&

-       (((ptVar3 = PtiCurrent(), 0x400 < *(uint *)(ptVar3 + 0x2a0) || (unaff_EDI != 0x103f)) ||

-        (unaff_R14D != 1)))) {

-      UserSetLastError(0x57);

-      iStack0000000000000034 = 0;

-      Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-      ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  *)&stack0x00000048);

-      Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-      ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  *)&stack0x00000060);

-      goto LAB_0;

-    }

-    if ((unaff_EDI & 1) == 0) {

-      in_stack_00000088 = in_stack_00000038;

-      if (*(undefined4 **)MmUserProbeAddress_exref <= in_stack_00000038) {

-        in_stack_00000038 = *(undefined4 **)MmUserProbeAddress_exref;

-      }

-      *in_stack_00000038 = *in_stack_00000038;

-      iStack0000000000000078 = 1;

-      in_stack_00000030 = unaff_ESI;

-      in_stack_00000038 = unaff_R12;

-    }

-    else if (unaff_EDI == 0x200b) {

-      in_stack_000000e8 = in_stack_00000038;

-      if (((ulonglong)in_stack_00000038 & 0xfffffffc) != 0) {

-        UserSetLastError(0x57);

-        iVar4 = 0;

-        iStack0000000000000034 = 0;

-        Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-        ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                    *)&stack0x00000048);

-        Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-        ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                    *)&stack0x00000060);

-        goto LAB_0;

-      }

-    }

-    else if ((unaff_EDI - 0x200b == unaff_R15D) &&

-            (in_stack_000000e0 = in_stack_00000038, ((ulonglong)in_stack_00000038 & 0xfffffffe) != 0

-            )) {

-      UserSetLastError(0x57);

-      iVar4 = 0;

-      iStack0000000000000034 = 0;

-      Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-      ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  *)&stack0x00000048);

-      Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-      ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-                  *)&stack0x00000060);

-      goto LAB_0;

-    }

-  }

-  iStack0000000000000034 =

-       xxxSystemParametersInfo(unaff_EDI,in_stack_00000040,in_stack_00000038,uStack000000000000007c)

-  ;

-  if (iStack0000000000000078 != 0) {

-    memmove(in_stack_00000088,in_stack_00000038,(ulonglong)in_stack_00000030);

-  }

-  iVar4 = iStack0000000000000034;

-  Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-  ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-            ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)> *)

-             &stack0x00000048);

-  Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>::

-  ~Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)>

-            ((Win32RawOptionalLockedItemAlways<void,&void___cdecl_Win32FreePool(void*___ptr64)> *)

-             &stack0x00000060);

-LAB_0:

+        ExRaiseDatatypeMisalignment();

+      }

+      local_f8 = 0;

+      _Var11 = _Var12;

+      local_f0 = param_2;

+      _Var14 = _Var12;

+      while( true ) {

+        local_114 = (uint)_Var11;

+        uVar13 = (uint)_Var14;

+        if (param_1 <= local_114) break;

+        if (*local_f0 < 0) {

+          local_f8 = uVar13 + 1;

+          _Var14 = (__uint64)local_f8;

+        }

+        _Var11 = (__uint64)(local_114 + 1);

+        local_f0 = local_f0 + 0x1b;

+      }

+      if (uVar13 != 0) {

+        plVar10 = Win32AllocPoolWithQuotaZInitImpl(_Var11,_Var14 * 0xd8,0x63447355);

+        local_100 = plVar10;

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

+                    /* WARNING: Subroutine does not return */

+          ExRaiseStatus(0xc0000017);

+        }

+        if (local_b0 != (code *)0xffffffffffffffff) {

+          local_158 = PtiCurrent();

+                    /* WARNING: Subroutine does not return */

+          KeBugCheckEx(0x164,0x12,&local_c0,plVar10);

+        }

+        ptVar9 = PtiCurrent();

+        local_c0 = *(undefined8 *)(ptVar9 + 0x180);

+        *(undefined8 **)(ptVar9 + 0x180) = &local_c0;

+        local_b8 = local_100;

+        local_b0 = GreDeleteFastMutex;

+      }

+      local_c8 = local_100;

+      _Var11 = _Var12;

+      plVar10 = local_100;

+      while( true ) {

+        uVar16 = 0xd8;

+        local_114 = (uint)_Var12;

+        uVar15 = (uint)_Var11;

+        uVar4 = local_118;

+        local_f0 = param_2;

+        if (local_e8 <= local_114) break;

+        if (*param_2 < 0) {

+          if (uVar13 <= uVar15) {

+            local_104 = 0xc000000d;

+            iVar6 = -0x7ffffffd;

+            local_108 = 0x80000003;

+            goto LAB_3;

+          }

+          uVar16 = 0xd8;

+          RtlCopyVolatileMemory(plVar10,param_2,0xd8);

+          if (-1 < *plVar10) {

+            iVar5 = -0x3fffffde;

+            local_104 = 0xc0000022;

+            iVar6 = -0x7ffffffc;

+            local_108 = 0x80000004;

+            uVar4 = local_118;

+            goto LAB_3;

+          }

+          local_e4 = uVar15 + 1;

+          _Var11 = (__uint64)local_e4;

+          plVar10 = plVar10 + 0x1b;

+          local_c8 = plVar10;

+        }

+        _Var12 = (__uint64)(local_114 + 1);

+        param_2 = param_2 + 0x1b;

+      }

+      if (uVar15 != uVar13) {

+        local_104 = 0xc000000d;

+        iVar6 = -0x7ffffffd;

+        local_108 = 0x80000003;

+        goto LAB_3;

+      }

+    }

+    local_f4 = uVar15;

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

+      lVar7 = PsGetCurrentProcessWow64Process();

+      if (((ulonglong)param_4 & (ulonglong)(~-(uint)(lVar7 != 0) & 3)) != 0) {

+                    /* WARNING: Subroutine does not return */

+        ExRaiseDatatypeMisalignment();

+      }

+      local_60 = *param_4;

+      auStack_58 = (undefined1  [8])param_4[1];

+      local_50 = param_4[2];

+      local_48 = *(undefined4 *)(param_4 + 3);

+    }

+    lVar7 = W32GetUserGdiSessionState();

+    if (*(int *)(lVar7 + 0x24) != 0) {

+      iVar6 = -0x7ffffffb;

+      goto LAB_1;

+    }

+    iVar5 = UserIsWddmConnectedSession();

+    if (iVar5 == 0) {

+      iVar5 = -0x3fffffde;

+      iVar6 = -0x7ffffffa;

+      uVar4 = local_118;

+      goto LAB_2;

+    }

+    if (((param_4 == (undefined8 *)0x0) || (iVar5 = DrvNeedDisplayStateCheck(&local_60), iVar5 == 0)

+        ) || (iVar5 = DrvIsDisplayStateCurrent(1,&local_60), iVar5 != 0)) {

+      local_80[0] = (CDisplayScenarioContextScope)0x0;

+      CDisplayScenarioContextScope::ContextScopeConstructor

+                (local_80,(_GUID *)(auStack_58 + 4),0x1d,0);

+      uVar4 = local_118;

+      iVar6 = 0x12;

+      local_128 = 0;

+      local_130 = local_78;

+      local_138 = 0;

+      local_140 = 0;

+      local_148 = local_90;

+      local_150 = CONCAT31(local_150._1_3_,1);

+      local_158 = (tagTHREADINFO *)0x0;

+      uVar17 = (ulonglong)local_118;

+      iVar5 = xxxUserSetDisplayConfig(uVar15,local_100,uVar17,0);

+      uVar16 = (undefined1)uVar17;

+      if (iVar5 == -0x7ffffffb) {

+        iVar5 = -0x3fffffdd;

+      }

+      else if ((iVar5 != -0x3fffffdd) && ((uVar4 >> 0x10 & 1) == 0)) {

+        if (iVar5 == -0x3fe1fcfa) {

+          iVar5 = -0x7ff8f9b6;

+        }

+        else {

+          iVar5 = _QdcSdcTranslateStatusDefault(iVar5);

+        }

+      }

+      CDisplayScenarioContextScope::~CDisplayScenarioContextScope(local_80);

+      goto LAB_3;

+    }

+    iVar5 = -0x3fe1fcc9;

+    iVar6 = -0x7ffffff9;

+    uVar4 = local_118;

+  }

+  local_138 = 0;

+  local_140 = local_140 & 0xffffffffffffff00;

+  local_158 = (tagTHREADINFO *)((ulonglong)local_158._4_4_ << 0x20);

+  uVar17 = (ulonglong)uVar4;

+  local_150 = iVar6;

+  local_148 = local_110;

+  LogDiagSDC(local_f4,local_100,uVar17,iVar5);

+  uVar16 = (undefined1)uVar17;

+LAB_4:

+  if (iVar5 < 0) {

+    if (((param_4 != (undefined8 *)0x0) && (iVar6 = DrvNeedDisplayStateCheck(&local_60), iVar6 != 0)

+        ) && (iVar6 = DrvIsDisplayStateCurrent(0), iVar6 == 0)) {

+      iVar5 = -0x3fe1fcc9;

+    }

+  }

+  else {

+    lVar7 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar7 + 0x30) + 0xf70);

+    if (pcVar1 == (code *)0x0) {

+      iVar6 = -0x3fffff45;

+    }

+    else {

+      iVar6 = (*pcVar1)();

+    }

+    if (-1 < iVar6) {

+      lVar7 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar7 + 0x30) + 0xf78);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)();

+      }

+    }

+  }

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

+    Win32RawLockedItemBase<tagDESKTOP,&void___cdecl_UserDereferenceObject(void*___ptr64),1,1,1>::

+    UnlockWorker((Win32RawLockedItemBase<tagDESKTOP,&void___cdecl_UserDereferenceObject(void*___ptr64),1,1,1>

+                  *)&local_c0,false,(bool)uVar16);

+  }

   ReleaseUserCriticalSection();

-  return (longlong)iVar4;

+  Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>::

+  ~Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+            ((Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+              *)&local_c0);

+  return iVar5;

 }
```

## `NtUserGetDC`  (modified)

```diff
--- NtUserGetDC
+++ NtUserGetDC
@@ -1,188 +1,76 @@
 

-longlong NtUserGetDC(undefined8 *param_1)

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

+

+HDC NtUserGetDC(longlong param_1)

 

 {

-  longlong *plVar1;

-  undefined8 *_Src;

-  int iVar2;

-  longlong lVar3;

-  longlong lVar4;

-  char *in_RAX;

-  undefined8 *puVar5;

-  char cVar6;

-  undefined8 *unaff_RBX;

-  ulonglong unaff_RSI;

-  ulonglong unaff_RDI;

-  undefined8 *unaff_R12;

-  byte unaff_R13B;

-  ushort unaff_R14W;

-  undefined8 *unaff_R15;

-  bool bVar8;

-  char cStack0000000000000040;

-  char cStack0000000000000041;

-  undefined8 in_stack_00000060;

-  undefined8 in_stack_00000068;

-  undefined8 in_stack_00000070;

-  undefined8 in_stack_00000078;

-  undefined8 *in_stack_00000080;

-  ushort uStack0000000000000088;

-  undefined4 uStack000000000000008c;

-  undefined8 *in_stack_00000090;

-  ushort uStack0000000000000098;

-  undefined4 uStack000000000000009c;

-  undefined8 *in_stack_00000100;

-  undefined4 in_stack_00000110;

-  undefined8 *in_stack_00000118;

-  uint uVar7;

+  undefined8 *puVar1;

+  bool bVar2;

+  bool bVar3;

+  int iVar4;

+  longlong lVar5;

+  HWND hWnd;

+  tagTHREADINFO *ptVar6;

+  HDC pHVar7;

+  undefined8 uVar8;

+  bool bVar9;

+  undefined1 auStack_58 [32];

+  undefined4 local_38;

+  undefined8 local_30;

+  undefined8 uStack_28;

+  ulonglong local_20;

   

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

-  do {

-    puVar5 = Win32AllocPoolWithQuotaZInitImpl((__uint64)param_1,unaff_RSI & 0xffff,0x74697355);

-    cVar6 = (char)unaff_RBX;

-    uVar7 = (uint)unaff_RBX;

-    in_stack_00000080 = puVar5;

-    if (puVar5 == (undefined8 *)0x0) {

-      UserSetLastError(8);

-LAB_0:

-      if (cStack0000000000000040 != cVar6) {

-        GreDeleteFastMutex(in_stack_00000080);

+                    /* 0x168e30  1973  NtUserGetDC */

+  local_20 = __security_cookie ^ (ulonglong)auStack_58;

+  bVar3 = true;

+  lVar5 = EnterSharedCrit(0,1);

+  pHVar7 = (HDC)0x0;

+  hWnd = (HWND)pHVar7;

+  if ((param_1 == 0) || (hWnd = (HWND)ValidateHwndEx(param_1,1,0), hWnd != (HWND)0x0)) {

+    iVar4 = Feature_LearningModeExpansion__private_IsEnabledDeviceUsageNoInline();

+    bVar9 = bVar3;

+    if (iVar4 == 0) {

+      bVar3 = tagPROCESSINFO::HasUILimit(*(tagPROCESSINFO **)(lVar5 + 0x1d0),1);

+      if ((bVar3) && (hWnd == (HWND)0x0)) {

+        ptVar6 = PtiCurrent();

+        puVar1 = *(undefined8 **)(*(longlong *)(*(longlong *)(ptVar6 + 0x1f0) + 8) + 0x18);

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

+          pHVar7 = (HDC)*puVar1;

+        }

+        lVar5 = ValidateHwndEx(pHVar7,1,0);

+        bVar9 = lVar5 != 0;

       }

-      if (cStack0000000000000041 != cVar6) {

-        GreDeleteFastMutex(in_stack_00000090);

+    }

+    else {

+      bVar9 = true;

+      if ((hWnd == (HWND)0x0) &&

+         (bVar2 = tagPROCESSINFO::HasUILimit(*(tagPROCESSINFO **)(lVar5 + 0x1d0),1), bVar9 = bVar3,

+         bVar2)) {

+        ptVar6 = PtiCurrent();

+        if (*(longlong *)(*(longlong *)(*(longlong *)(ptVar6 + 0x1f0) + 8) + 0x18) != 0) {

+          ptVar6 = PtiCurrent();

+          pHVar7 = (HDC)**(undefined8 **)(*(longlong *)(*(longlong *)(ptVar6 + 0x1f0) + 8) + 0x18);

+        }

+        lVar5 = ValidateHwndEx(pHVar7,1,0);

+        if (lVar5 == 0) {

+          local_38 = 0x20000;

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

+        }

       }

-LAB_1:

-      ReleaseUserCriticalSection();

-      return (longlong)(int)uVar7;

     }

-    memmove(puVar5,unaff_R15,unaff_RSI & 0xffff);

-    cStack0000000000000040 = (char)unaff_RDI;

-    do {

-      do {

-        _Src = in_stack_00000090;

-        if (unaff_R14W != 0) {

-          in_stack_00000090 =

-               Win32AllocPoolWithQuotaZInitImpl((__uint64)puVar5,(ulonglong)unaff_R14W,0x74697355);

-          if (in_stack_00000090 == (undefined8 *)0x0) {

-            UserSetLastError(8);

-            goto LAB_0;

-          }

-          memmove(in_stack_00000090,_Src,(ulonglong)unaff_R14W);

-          cStack0000000000000041 = (char)unaff_RDI;

-        }

-        if (in_stack_00000080 == unaff_RBX) {

-LAB_2:

-          UserSetLastError(0x57);

-          goto LAB_0;

-        }

-        iVar2 = RIMIDE_CreateGenericHidDevice(&stack0x00000060);

-        if (-1 < iVar2) {

-          if (*(undefined8 **)MmUserProbeAddress_exref <= unaff_R12) {

-            unaff_R12 = *(undefined8 **)MmUserProbeAddress_exref;

-          }

-          *unaff_R12 = in_stack_00000118;

-          uVar7 = (uint)unaff_RDI;

-          goto LAB_0;

-        }

-        if (iVar2 != -0x7fffffef) goto LAB_2;

-        if (cStack0000000000000040 != cVar6) {

-          GreDeleteFastMutex(in_stack_00000080);

-        }

-        if (cStack0000000000000041 != cVar6) {

-          GreDeleteFastMutex(in_stack_00000090);

-        }

-        ReleaseUserCriticalSection();

-        lVar3 = W32GetUserSessionState();

-        lVar4 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

-                          (lVar3,0,0,

-                           <lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

-        *(longlong *)(lVar3 + 0x10) = lVar4;

-        if (lVar4 != 0) {

-          while (plVar1 = *(longlong **)(lVar3 + 0x4d90), plVar1 != (longlong *)0x0) {

-            *(longlong *)(lVar3 + 0x4d90) = plVar1[2];

-            plVar1[2] = (longlong)unaff_RBX;

-            if (*(uint *)(*plVar1 + 8) < (uint)unaff_RDI) {

-              in_stack_00000110 = 0x20000;

-              MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x120b);

-            }

-            HMUnlockObject(*plVar1);

-          }

-          DestroyDeferredUnlockObjectAssignmentList(lVar3 + 0x4db0);

-          DestroyDeferredUnlockObjectAssignmentList(lVar3 + 0x4da0);

-        }

-        memset(&stack0x00000060,0,0x40);

-        iVar2 = RIMIDECheckInjectionCapability();

-        if (iVar2 == 0) {

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

-              ((unaff_R13B & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

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

-            unaff_RDI = (ulonglong)unaff_RBX & 0xff;

-          }

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

-          if (((char)unaff_RDI != '\0') || (bVar8)) {

-            lVar3 = W32GetUserSessionState();

-            WPP_RECORDER_AND_TRACE_SF_

-                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_RDI & 0xff,bVar8,

-                       *(undefined8 *)(lVar3 + 0x10f78));

-          }

-          UserSetLastError(5);

-          goto LAB_1;

-        }

-        lVar3 = PsGetCurrentProcessWow64Process();

-        if (((ulonglong)(~-(uint)(lVar3 != 0) & 3) & (ulonglong)in_stack_00000100) != 0) {

-                    /* WARNING: Subroutine does not return */

-          ExRaiseDatatypeMisalignment();

-        }

-        if ((*(undefined8 **)MmUserProbeAddress_exref < in_stack_00000100 + 8) ||

-           (puVar5 = in_stack_00000100 + 8, puVar5 < in_stack_00000100)) {

-          puVar5 = (undefined8 *)

-                   CONCAT71((int7)((ulonglong)MmUserProbeAddress_exref >> 8),

-                            **(undefined1 **)MmUserProbeAddress_exref);

-        }

-        in_stack_00000060 = *in_stack_00000100;

-        in_stack_00000068 = in_stack_00000100[1];

-        in_stack_00000070 = in_stack_00000100[2];

-        in_stack_00000078 = in_stack_00000100[3];

-        in_stack_00000080 = (undefined8 *)in_stack_00000100[4];

-        _uStack0000000000000088 = *(undefined4 *)(in_stack_00000100 + 5);

-        uStack000000000000008c = *(undefined4 *)((longlong)in_stack_00000100 + 0x2c);

-        in_stack_00000090 = (undefined8 *)in_stack_00000100[6];

-        _uStack0000000000000098 = *(undefined4 *)(in_stack_00000100 + 7);

-        uStack000000000000009c = *(undefined4 *)((longlong)in_stack_00000100 + 0x3c);

-        unaff_R14W = (ushort)_uStack0000000000000098;

-        if (unaff_R14W != 0) {

-          lVar3 = PsGetCurrentProcessWow64Process();

-          if (((ulonglong)in_stack_00000090 & (ulonglong)(~-(uint)(lVar3 != 0) & 3)) != 0) {

-                    /* WARNING: Subroutine does not return */

-            ExRaiseDatatypeMisalignment();

-          }

-          puVar5 = in_stack_00000090;

-          if ((*(undefined8 **)MmUserProbeAddress_exref <

-               (undefined8 *)((ulonglong)unaff_R14W + (longlong)in_stack_00000090)) ||

-             ((undefined8 *)((ulonglong)unaff_R14W + (longlong)in_stack_00000090) <

-              in_stack_00000090)) {

-            unaff_R14W = uStack0000000000000098;

-          }

-        }

-        unaff_RSI = (ulonglong)uStack0000000000000088;

-        cStack0000000000000040 = cVar6;

-        cStack0000000000000041 = cVar6;

-        in_stack_00000118 = unaff_RBX;

-      } while (uStack0000000000000088 == 0);

-      lVar3 = PsGetCurrentProcessWow64Process();

-      if (((ulonglong)in_stack_00000080 & (ulonglong)(~-(uint)(lVar3 != 0) & 3)) != 0) {

-                    /* WARNING: Subroutine does not return */

-        ExRaiseDatatypeMisalignment();

-      }

-      if ((*(undefined8 **)MmUserProbeAddress_exref <

-           (undefined8 *)((longlong)in_stack_00000080 + unaff_RSI)) ||

-         ((undefined8 *)((longlong)in_stack_00000080 + unaff_RSI) < in_stack_00000080)) {

-        unaff_RSI = (ulonglong)uStack0000000000000088;

-        unaff_R14W = uStack0000000000000098;

-      }

-      param_1 = in_stack_00000080;

-      puVar5 = in_stack_00000080;

-      unaff_R15 = in_stack_00000080;

-    } while ((short)unaff_RSI == 0);

-  } while( true );

+    pHVar7 = _GetDC(hWnd);

+    if (!bVar9) {

+      local_30 = 0;

+      uStack_28 = 0;

+      uVar8 = GreCreateRectRgnIndirect(&local_30);

+      lVar5 = W32GetUserSessionState();

+      GreLockVisRgn(*(undefined8 *)(*(longlong *)(lVar5 + 0xdf10) + 0x30));

+      GreSelectVisRgn(pHVar7,uVar8,1);

+      lVar5 = W32GetUserSessionState();

+      GreUnlockVisRgn(*(undefined8 *)(*(longlong *)(lVar5 + 0xdf10) + 0x30));

+    }

+  }

+  ReleaseUserCriticalSection();

+  return pHVar7;

 }
```

## `SendPositionChanged`  (modified)

```diff
--- SendPositionChanged
+++ SendPositionChanged
@@ -1,11 +1,25 @@
 

-void SendPositionChanged(void)

+void SendPositionChanged(undefined8 *param_1,undefined4 param_2)

 

 {

-  code *pcVar1;

+  longlong lVar1;

+  undefined4 local_28;

+  undefined4 local_24;

+  undefined8 local_20;

+  undefined4 local_18;

+  undefined4 local_14;

+  undefined8 local_10;

   

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

-  (*pcVar1)();

+                    /* 0x143ed0  2195  SendPositionChanged */

+  local_20 = *param_1;

+  local_24 = 0;

+  local_14 = 0;

+  local_28 = 1;

+  local_10 = KeQueryPerformanceCounter(0);

+  local_18 = param_2;

+  lVar1 = W32GetUserSessionState();

+  InputExtensibilityCallout::CoreMsgSendMessage

+            (*(InputExtensibilityCallout **)(lVar1 + 0x4010),0,&local_28,0x20);

   return;

 }
```

## `HMFreeObject`  (modified)

```diff
--- HMFreeObject
+++ HMFreeObject
@@ -1,98 +1,166 @@
 

-/* WARNING: Instruction at (ram,0x000140060451) overlaps instruction at (ram,0x000140060450)

-    */

-

-undefined4 HMFreeObject(undefined8 param_1,ushort param_2,ulonglong param_3,undefined8 param_4)

+undefined8 HMFreeObject(_HEAD *param_1)

 

 {

-  byte *pbVar1;

-  undefined1 uVar2;

-  longlong in_RAX;

-  longlong lVar3;

-  byte bVar4;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  undefined1 *unaff_RDI;

-  undefined *unaff_R12;

-  byte unaff_R13B;

-  byte bVar5;

-  bool bVar6;

-  longlong lStack0000000000000040;

-  longlong in_stack_00000068;

-  undefined4 in_stack_000000b8;

+  _HEAD *p_Var1;

+  _HANDLEENTRY _Var2;

+  ushort uVar3;

+  EtwUserHandleType EVar4;

+  longlong lVar5;

+  _HANDLEENTRY *p_Var6;

+  longlong *plVar7;

+  undefined8 uVar8;

+  undefined8 *puVar9;

+  ulonglong uVar10;

+  undefined8 *puVar11;

+  tagDESKTOP *local_res8;

   

-  pbVar1 = (byte *)(in_RAX + -0x75);

-  bVar5 = *pbVar1;

-  bVar4 = (byte)param_1;

-  *pbVar1 = *pbVar1 + bVar4;

-  *(char *)(param_3 - 0x77) = (*(char *)(param_3 - 0x77) - bVar4) - CARRY1(bVar5,bVar4);

-  uVar2 = in(param_2);

-  *unaff_RDI = uVar2;

-  do {

-    lStack0000000000000040 = unaff_RSI;

-    WPP_RECORDER_AND_TRACE_SF_qqSd(param_1,param_2,param_3,param_4);

+                    /* 0x61610  1658  HMFreeObject */

+  puVar11 = (undefined8 *)0x0;

+  lVar5 = W32GetUserSessionState();

+  local_res8 = *(tagDESKTOP **)(lVar5 + 0xa600);

+  LockRefactorStagingAssertOwned((tagDomLock *)&local_res8);

+  p_Var6 = (_HANDLEENTRY *)_HMPheFromObjectWorker(param_1);

+  plVar7 = (longlong *)_HMPkheFromObjectWorker(param_1);

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

+    _Var2 = p_Var6[0x18];

+    if ((byte)_Var2 < 0xd) {

+      if ((((_Var2 == (_HANDLEENTRY)0xc) || (6 < (byte)_Var2)) || (_Var2 == (_HANDLEENTRY)0x6)) ||

+         (_Var2 != (_HANDLEENTRY)0x0)) goto LAB_0;

+    }

+    else {

+      if ((0x11 < (byte)_Var2) || (_Var2 != (_HANDLEENTRY)0xd)) {

+LAB_0:

+                    /* WARNING: Subroutine does not return */

+        KeBugCheckEx(0x164,0x1c,param_1,*(int *)(param_1 + 8),_Var2);

+      }

+      local_res8 = (tagDESKTOP *)CONCAT44(local_res8._4_4_,0x20000);

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

+    }

+  }

+  CheckForDoubleFree(p_Var6,param_1);

+  if ((_HEAD *)*plVar7 != param_1) {

+LAB_1:

+                    /* WARNING: Subroutine does not return */

+    KeBugCheckEx(0x164,0x1f,param_1,p_Var6,plVar7);

+  }

+  if (plVar7[2] != 0) {

+    local_res8 = (tagDESKTOP *)CONCAT44(local_res8._4_4_,0x20000);

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

+  }

+  if (p_Var6[0x18] == (_HANDLEENTRY)0x10) {

+    lVar5 = W32GetUserSessionState();

+    puVar9 = *(undefined8 **)(lVar5 + 0xe150);

     do {

-      if (((*(uint *)(unaff_RBP + 0xa8) & 0x20) != 0) && ((*(uint *)(unaff_RBP + 0xa8) & 0x40) == 0)

-         ) {

-        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+      if (puVar9 == (undefined8 *)(lVar5 + 0xe150)) goto LAB_2;

+      p_Var1 = (_HEAD *)(puVar9 + -9);

+      puVar9 = (undefined8 *)*puVar9;

+    } while (p_Var1 != param_1);

+    goto LAB_1;

+  }

+LAB_2:

+  if (plVar7[3] != 0) {

+    HMCleanupObjectSecurity(plVar7,p_Var6[0x18]);

+    GreDeleteFastMutex(plVar7[3]);

+  }

+  uVar3 = *(ushort *)(&DAT_3 + (ulonglong)(byte)p_Var6[0x18] * 0x18);

+  if ((uVar3 & 2) == 0) {

+    puVar9 = puVar11;

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

+      puVar9 = *(undefined8 **)(plVar7[1] + 0x1d0);

+      goto LAB_4;

+    }

+  }

+  else {

+    puVar9 = (undefined8 *)plVar7[1];

+LAB_4:

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

+      *(int *)((longlong)puVar9 + 0x44) = *(int *)((longlong)puVar9 + 0x44) + -1;

+    }

+  }

+  lVar5 = W32GetUserSessionState();

+  *(int *)(lVar5 + 0x4dfc) = *(int *)(lVar5 + 0x4dfc) + -1;

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

+    PsGetProcessId(*puVar9);

+  }

+  EVar4 = GetEtwUserHandleType((uchar)p_Var6[0x18]);

+  EtwTraceUserDestroyHandle(*(undefined8 *)*plVar7,EVar4);

+  Win32JobObject::RemoveHandle(*(void **)*plVar7,p_Var6);

+  if ((uVar3 & 0x10) == 0) {

+    if ((uVar3 & 0x40) == 0) {

+      if (p_Var6[0x18] == (_HANDLEENTRY)0x13) {

+        uVar8 = *(undefined8 *)(*plVar7 + 0x20);

       }

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

-        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+      else {

+        if (p_Var6[0x18] != (_HANDLEENTRY)0x16) {

+          if ((uVar3 >> 8 & 1) != 0) {

+            local_res8 = *(tagDESKTOP **)(param_1 + 0x18);

+            DeferrableUnlockObjectAssignment<tagDESKTOP>(&local_res8);

+          }

+          goto LAB_5;

+        }

+        puVar11 = *(undefined8 **)(*plVar7 + 0x10);

+        uVar8 = puVar11[4];

       }

-      if ((*(void **)(unaff_RBP + 0x128) == (void *)0x0) ||

-         (unaff_RSI = in_stack_00000068, *(void **)(unaff_RBP + 0x128) == SystemReserved1[0xf])) {

-        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+      ObfDereferenceObject(uVar8);

+    }

+    else {

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

+        SharedFree(param_1);

+        puVar11 = (undefined8 *)0x0;

+        goto LAB_6;

       }

-      RIMDoOnPnpNotification(unaff_RSI,unaff_RBP);

-      *(uint *)(unaff_RBP + 0xa8) = *(uint *)(unaff_RBP + 0xa8) & 0xffffffef;

-      KeSetEvent(*(undefined8 *)(unaff_RBP + 0x150),1);

-      do {

-        unaff_RBP = *(longlong *)(unaff_RBP + 0x28);

-        bVar5 = 1;

-        if (unaff_RBP == 0) {

-          RIMSignalAllPriorPnpWorkToCompleteWaiters(unaff_RSI);

-          tagObjLock::UnLockExclusive((tagObjLock *)(unaff_RSI + 0x68));

-          ObfDereferenceObject(unaff_RSI);

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

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

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

-            bVar5 = unaff_R13B;

-          }

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

-          if ((bVar5 != 0) || (bVar6)) {

-            lVar3 = W32GetUserSessionState();

-            lStack0000000000000040 = CONCAT44(lStack0000000000000040._4_4_,in_stack_000000b8);

-            WPP_RECORDER_AND_TRACE_SF_d

-                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar5,bVar6,

-                       *(undefined8 *)(lVar3 + 0x4c18),4);

-          }

-          return in_stack_000000b8;

-        }

-        if (((WPP_GLOBAL_Control == unaff_R12) || ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0))

-           || (bVar4 = bVar5, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-          bVar4 = unaff_R13B;

-        }

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

-        if ((bVar4 != 0) || (bVar6)) {

-          lVar3 = W32GetUserSessionState();

-          lStack0000000000000040 = unaff_RSI;

-          WPP_RECORDER_AND_TRACE_SF_qq

-                    (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar4,bVar6,

-                     *(undefined8 *)(lVar3 + 0x4c18),4);

-        }

-      } while ((*(uint *)(unaff_RBP + 0xa8) & 0x10) == 0);

-      if (((WPP_GLOBAL_Control == unaff_R12) || ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0))

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

-        bVar5 = unaff_R13B;

-      }

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

-    } while ((bVar5 == 0) && (!bVar6));

-    RimDeviceTypeToRimInputType(unaff_RBP,*(undefined4 *)(unaff_RBP + 0x30));

-    lVar3 = W32GetUserSessionState();

-    param_3 = (ulonglong)bVar6;

-    param_2 = (ushort)bVar5;

-    param_4 = *(undefined8 *)(lVar3 + 0x4c18);

-    param_1 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-  } while( true );

+      SharedFree();

+LAB_5:

+      HMFreeUserOrIsolatedType(uVar3,(uchar)p_Var6[0x18],param_1);

+      puVar11 = (undefined8 *)0x0;

+    }

+    goto LAB_6;

+  }

+  local_res8 = *(tagDESKTOP **)(param_1 + 0x18);

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

+  if (((byte)p_Var6[0x19] & 0x40) == 0) {

+    if ((*(_HEAD **)(param_1 + 0x28) != (_HEAD *)0x0) && (*(_HEAD **)(param_1 + 0x28) != param_1)) {

+      RtlFreeHeap(*(undefined8 *)(local_res8 + 0x88),0);

+      goto LAB_7;

+    }

+    RtlFreeHeap(*(undefined8 *)(local_res8 + 0x88),0,param_1);

+  }

+  else {

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

+LAB_7:

+    HMFreeUserOrIsolatedType(uVar3,(uchar)p_Var6[0x18],param_1);

+  }

+  DeferrableUnlockObjectAssignment<tagDESKTOP>(&local_res8);

+LAB_6:

+  uVar3 = *(short *)(p_Var6 + 0x1a) + 1U & 0x7fff;

+  if (uVar3 == 0x7fff) {

+    uVar3 = 1;

+  }

+  *(undefined8 *)p_Var6 = 0;

+  *(undefined8 *)(p_Var6 + 8) = 0;

+  *(undefined8 *)(p_Var6 + 0x10) = 0;

+  *(undefined8 *)(p_Var6 + 0x18) = 0;

+  *plVar7 = 0;

+  plVar7[1] = 0;

+  plVar7[2] = 0;

+  plVar7[3] = 0;

+  plVar7[4] = 0;

+  *(ushort *)(p_Var6 + 0x1a) = uVar3;

+  lVar5 = W32GetUserSessionState();

+  uVar10 = (longlong)p_Var6 - *(longlong *)(lVar5 + 0x4e40) >> 5;

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

+    *plVar7 = *(longlong *)(lVar5 + 0x4d80);

+    *(ulonglong *)(lVar5 + 0x4d80) = uVar10;

+  }

+  else {

+    *plVar7 = *(longlong *)(lVar5 + 0x4d88);

+    *(ulonglong *)(lVar5 + 0x4d88) = uVar10;

+  }

+  lVar5 = W32GetUserSessionState();

+  if ((*(int *)(lVar5 + 0x4dc0) == 0) && (puVar11 != (undefined8 *)0x0)) {

+    HMUnlockObject(puVar11);

+  }

+  return 1;

 }
```

## `DrvDisplayConfigGetDeviceInfoInternal`  (modified)

```diff
--- DrvDisplayConfigGetDeviceInfoInternal
+++ DrvDisplayConfigGetDeviceInfoInternal
@@ -1,14 +1,283 @@
+

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

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

+/* long __cdecl DrvDisplayConfigGetDeviceInfoInternal(struct DISPLAYCONFIG_DEVICE_INFO_HEADER *

+   __ptr64,bool) */

 

 long __cdecl

 DrvDisplayConfigGetDeviceInfoInternal(DISPLAYCONFIG_DEVICE_INFO_HEADER *param_1,bool param_2)

 

 {

-  long in_EAX;

-  undefined4 in_register_00000004;

+  DISPLAYCONFIG_DEVICE_INFO_HEADER *pDVar1;

+  DISPLAYCONFIG_DEVICE_INFO_HEADER *pDVar2;

+  undefined8 uVar3;

+  bool bVar4;

+  char cVar5;

+  int iVar6;

+  ulong uVar7;

+  undefined4 uVar8;

+  long lVar9;

+  longlong lVar10;

+  uint uVar11;

+  int local_res8 [2];

   

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + (char)in_EAX;

-  param_1[0x5f] = (DISPLAYCONFIG_DEVICE_INFO_HEADER)((char)param_1[0x5f] + (char)in_EAX);

-  return in_EAX;

+  WdLogSingleEntry1(4,(longlong)*(int *)param_1);

+  _WdLogGlobalForLineNumber = 0x458b;

+  bVar4 = DispConfigTypes::AllowInAnySession(*(DISPLAYCONFIG_DEVICE_INFO_TYPE *)param_1);

+  if ((!bVar4) &&

+     ((iVar6 = UserIsWddmConnectedSession(), iVar6 == 0 ||

+      ((bVar4 = DispConfigTypes::RequiresUserCritShared(*(DISPLAYCONFIG_DEVICE_INFO_TYPE *)param_1),

+       bVar4 && (iVar6 = DrvIsWddmDriverPresent(), iVar6 == 0)))))) {

+    return -0x3fffff45;

+  }

+  uVar7 = DispConfigTypes::GetGetterTypeSize(*(DISPLAYCONFIG_DEVICE_INFO_TYPE *)param_1);

+  if (uVar7 != *(ulong *)(param_1 + 4)) {

+    return -0x3ffffff3;

+  }

+  pDVar1 = param_1 + 0x10;

+  if (*(int *)pDVar1 != -1) {

+    lVar10 = DxDdGetDxgkWin32kInterface();

+    pDVar2 = param_1 + 8;

+    iVar6 = (**(code **)(lVar10 + 0x228))(pDVar2,*(int *)pDVar1,pDVar2,pDVar1);

+    if (iVar6 < 0) {

+      if (*(int *)param_1 == -0x15) {

+        *(undefined4 *)(param_1 + 0x7e8) = 0x44315707;

+        WdLogSingleEntry5(2,(longlong)*(int *)(param_1 + 0xc),*(undefined4 *)pDVar2,*(int *)pDVar1,

+                          (longlong)iVar6,0x44315707);

+        _WdLogGlobalForLineNumber = 0x45b8;

+        return iVar6;

+      }

+      return iVar6;

+    }

+  }

+  iVar6 = Feature_ScalarMultiplierForBrightness__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar6 != 0) && (*(int *)param_1 == -0x2e)) {

+    lVar10 = DxDdGetDxgkWin32kInterface();

+    iVar6 = (**(code **)(lVar10 + 0xf8))(1,param_1);

+    if (iVar6 < 0) {

+      WdLogSingleEntry2(3,param_1,(longlong)iVar6);

+      _WdLogGlobalForLineNumber = 0x45c5;

+      return iVar6;

+    }

+    return iVar6;

+  }

+  iVar6 = *(int *)param_1;

+  if (iVar6 < -10) {

+    if (iVar6 == -0xb) {

+LAB_0:

+      lVar9 = DrvpDisplayConfigGetDisplayDeviceInfo(param_1);

+      return lVar9;

+    }

+    if (iVar6 < -0x19) {

+      if ((iVar6 != -0x1a) && (iVar6 != -0x2f)) {

+        if (iVar6 == -0x2c) {

+          lVar10 = DxDdGetDxgkWin32kInterface();

+          iVar6 = (**(code **)(lVar10 + 0xf8))(1,param_1);

+          if (iVar6 < 0) {

+            WdLogSingleEntry2(3,param_1,(longlong)iVar6);

+            _WdLogGlobalForLineNumber = 0x4626;

+            return iVar6;

+          }

+          return iVar6;

+        }

+        if (iVar6 != -0x2a) {

+          if (iVar6 == -0x27) {

+            lVar10 = W32GetUserSessionState();

+            *(uint *)(param_1 + 0x14) =

+                 (*(uint *)(lVar10 + 0x10dc0) ^ *(uint *)(param_1 + 0x14)) & 0xfffffffe ^

+                 *(uint *)(lVar10 + 0x10dc0);

+            iVar6 = UserRemoteConnectedSessionUsingWddm();

+            *(uint *)(param_1 + 0x14) =

+                 (iVar6 * 2 ^ *(uint *)(param_1 + 0x14)) & 0xfffffffd ^ iVar6 * 2;

+            iVar6 = UserRemoteConnectedSessionUsingXddm();

+            *(uint *)(param_1 + 0x14) =

+                 (iVar6 << 2 ^ *(uint *)(param_1 + 0x14)) & 0xfffffffb ^ iVar6 << 2;

+            iVar6 = UserIsWddmConnectedSession();

+            *(uint *)(param_1 + 0x14) =

+                 (iVar6 << 3 ^ *(uint *)(param_1 + 0x14)) & 0xfffffff7 ^ iVar6 << 3;

+            iVar6 = UserIsConsoleConnection();

+            *(uint *)(param_1 + 0x14) =

+                 (iVar6 << 4 ^ *(uint *)(param_1 + 0x14)) & 0xffffffef ^ iVar6 << 4;

+            iVar6 = UserIsDisconnectConnection();

+            *(uint *)(param_1 + 0x14) =

+                 (iVar6 << 5 ^ *(uint *)(param_1 + 0x14)) & 0xffffffdf ^ iVar6 << 5;

+            lVar10 = W32GetUserGdiSessionState();

+            uVar11 = *(int *)(lVar10 + 0x1c) << 6;

+            *(uint *)(param_1 + 0x14) = (uVar11 ^ *(uint *)(param_1 + 0x14)) & 0xffffffbf ^ uVar11;

+            cVar5 = UserGetIsSwitchInProgress();

+            *(uint *)(param_1 + 0x14) =

+                 -(uint)(cVar5 != '\0') & 0x80 | *(uint *)(param_1 + 0x14) & 0xffffff7f;

+            lVar10 = W32GetUserSessionState();

+            *(undefined2 *)(param_1 + 0x18) = *(undefined2 *)(lVar10 + 0x10df0);

+            lVar10 = W32GetUserSessionState();

+            *(undefined8 *)(param_1 + 0x1c) = *(undefined8 *)(lVar10 + 0x10db8);

+            return 0;

+          }

+          if (((iVar6 == -0x23) || (iVar6 < -0x25)) || (-0x21 < iVar6)) {

+            if (iVar6 != -0x1e) {

+              return -0x3ffffff3;

+            }

+            goto LAB_0;

+          }

+        }

+      }

+    }

+    else {

+      if (iVar6 == -0x19) {

+        if (*(uint *)(param_1 + 4) < 0x28) {

+          return -0x3fffffdd;

+        }

+        lVar10 = DxDdGetDxgkWin32kInterface();

+        lVar9 = (**(code **)(lVar10 + 0x308))

+                          (*(undefined8 *)(param_1 + 8),*(undefined4 *)(param_1 + 0x10),param_1);

+        return lVar9;

+      }

+      if ((iVar6 + 0x18U & 0xfffffffd) != 0) {

+        if (iVar6 == -0x15) goto LAB_0;

+        if (iVar6 == -0x14) {

+          lVar10 = W32GetUserSessionState();

+          *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(lVar10 + 0x10dc0);

+          uVar8 = UserRemoteConnectedSessionUsingWddm();

+          *(undefined4 *)(param_1 + 0x18) = uVar8;

+          uVar8 = UserRemoteConnectedSessionUsingXddm();

+          *(undefined4 *)(param_1 + 0x1c) = uVar8;

+          uVar8 = UserIsWddmConnectedSession();

+          *(undefined4 *)(param_1 + 0x20) = uVar8;

+          uVar8 = UserIsConsoleConnection();

+          *(undefined4 *)(param_1 + 0x24) = uVar8;

+          uVar8 = UserIsDisconnectConnection();

+          *(undefined4 *)(param_1 + 0x28) = uVar8;

+          lVar10 = W32GetUserSessionState();

+          *(undefined2 *)(param_1 + 0x2c) = *(undefined2 *)(lVar10 + 0x10df0);

+          lVar10 = W32GetUserSessionState();

+          *(undefined8 *)(param_1 + 0x30) = *(undefined8 *)(lVar10 + 0x10db8);

+          return 0;

+        }

+        if (iVar6 == -0xf) {

+          if (*(uint *)(param_1 + 4) < 0x20) {

+            return -0x3fffffdd;

+          }

+          local_res8[0] = 0;

+          lVar10 = DxDdGetDxgkWin32kInterface();

+          lVar9 = (**(code **)(lVar10 + 0x2c0))

+                            (*(undefined8 *)(param_1 + 8),*(undefined4 *)(param_1 + 0x10),

+                             *(undefined4 *)(param_1 + 0x14),local_res8,

+                             *(undefined8 *)(param_1 + 0x18));

+          *(int *)(param_1 + 0x14) = local_res8[0];

+          return lVar9;

+        }

+        if (2 < iVar6 + 0xeU) {

+          return -0x3ffffff3;

+        }

+      }

+    }

+  }

+  else {

+    if (100 < iVar6) {

+      return -0x3ffffff3;

+    }

+    if (iVar6 != 100) {

+      if (iVar6 < 3) {

+        if ((iVar6 != 2) && (iVar6 != -10)) {

+          if (iVar6 == -9) {

+            if (*(uint *)(param_1 + 4) < 0x18) {

+              return -0x3fffffdd;

+            }

+            local_res8[0] = 0;

+            lVar10 = DxDdGetDxgkWin32kInterface();

+            iVar6 = (**(code **)(lVar10 + 0x108))

+                              (*(undefined8 *)(param_1 + 8),*(undefined4 *)(param_1 + 0x10),0,

+                               local_res8,0);

+            if (-1 < iVar6) {

+              *(uint *)(param_1 + 0x14) = (uint)(local_res8[0] == 2);

+              return iVar6;

+            }

+            return iVar6;

+          }

+          if (iVar6 == -8) {

+            if (*(uint *)(param_1 + 4) < 0x518) {

+              return -0x3fffffdd;

+            }

+            lVar10 = DxDdGetDxgkWin32kInterface();

+            lVar9 = (**(code **)(lVar10 + 0x2a0))

+                              (*(undefined8 *)(param_1 + 8),*(undefined4 *)(param_1 + 0x10),0x500,

+                               param_1 + 0x14,param_1 + 0x18);

+            return lVar9;

+          }

+          if (iVar6 == -7) {

+            if (*(uint *)(param_1 + 4) < 0x3b0) {

+              return -0x3fffffdd;

+            }

+            lVar10 = DxDdGetDxgkWin32kInterface();

+            lVar9 = (**(code **)(lVar10 + 0x108))

+                              (*(undefined8 *)(param_1 + 8),*(undefined4 *)(param_1 + 0x10),param_1,

+                               0,0);

+            if (param_2) {

+              GetMonitorBrightnessCaps((_DISPLAYCONFIG_GET_MONITOR_INTERNAL_INFO *)param_1);

+              return lVar9;

+            }

+            return lVar9;

+          }

+          if (iVar6 != -5) {

+            if (iVar6 == -3) {

+              if (*(int *)(param_1 + 4) != 0x20) {

+                return -0x3ffffff3;

+              }

+              lVar9 = DrvDisplayConfigGetScaleFactorOverrides(param_1,0);

+              return lVar9;

+            }

+            if (iVar6 != -2) {

+              if (iVar6 != 1) {

+                return -0x3ffffff3;

+              }

+              lVar10 = W32GetSessionState();

+              lVar10 = *(longlong *)(*(longlong *)(lVar10 + 0x58) + 0x448);

+              if (*(uint *)(param_1 + 4) < 0x54) {

+                return -0x3fffffdd;

+              }

+              if (lVar10 != 0) {

+                do {

+                  if (((*(int *)(param_1 + 8) == *(int *)(lVar10 + 0xf0)) &&

+                      (*(int *)(param_1 + 0xc) == *(int *)(lVar10 + 0xf4))) &&

+                     (*(int *)(lVar10 + 0xf8) == *(int *)(param_1 + 0x10))) break;

+                  lVar10 = *(longlong *)(lVar10 + 0x80);

+                } while (lVar10 != 0);

+                if (lVar10 != 0) {

+                  uVar3 = *(undefined8 *)(lVar10 + 0x48);

+                  *(undefined8 *)(param_1 + 0x14) = *(undefined8 *)(lVar10 + 0x40);

+                  *(undefined8 *)(param_1 + 0x1c) = uVar3;

+                  uVar3 = *(undefined8 *)(lVar10 + 0x58);

+                  *(undefined8 *)(param_1 + 0x24) = *(undefined8 *)(lVar10 + 0x50);

+                  *(undefined8 *)(param_1 + 0x2c) = uVar3;

+                  uVar3 = *(undefined8 *)(lVar10 + 0x68);

+                  *(undefined8 *)(param_1 + 0x34) = *(undefined8 *)(lVar10 + 0x60);

+                  *(undefined8 *)(param_1 + 0x3c) = uVar3;

+                  uVar3 = *(undefined8 *)(lVar10 + 0x78);

+                  *(undefined8 *)(param_1 + 0x44) = *(undefined8 *)(lVar10 + 0x70);

+                  *(undefined8 *)(param_1 + 0x4c) = uVar3;

+                  return 0;

+                }

+              }

+              WdLogSingleEntry0(3);

+              _WdLogGlobalForLineNumber = 0x45ea;

+              return -0x3ffffddb;

+            }

+            goto LAB_0;

+          }

+        }

+      }

+      else if (((((iVar6 != 3) && (iVar6 != 4)) && (iVar6 != 6)) && ((iVar6 != 7 && (iVar6 != 9))))

+              && ((iVar6 != 0xb && ((iVar6 != 0xc && (iVar6 != 0xf)))))) {

+        return -0x3ffffff3;

+      }

+    }

+  }

+  lVar10 = DxDdGetDxgkWin32kInterface();

+  iVar6 = (**(code **)(lVar10 + 0xf8))(1,param_1);

+  if (iVar6 < 0) {

+    WdLogSingleEntry2(3,param_1,(longlong)iVar6);

+    _WdLogGlobalForLineNumber = 0x461a;

+  }

+  return iVar6;

 }
```

## `ValidateHandleSecure`  (modified)

```diff
--- ValidateHandleSecure
+++ ValidateHandleSecure
@@ -1,24 +1,37 @@
 

-uint ValidateHandleSecure(int param_1,longlong param_2,undefined8 param_3,uint param_4)

+undefined8 ValidateHandleSecure(ulonglong param_1,uint param_2)

 

 {

-  char *unaff_RBX;

-  longlong unaff_RBP;

-  int *unaff_RDI;

-  undefined4 in_R11D;

-  undefined4 *unaff_R15;

-  float10 in_ST0;

-  int aiStackX_14 [5];

+  ushort uVar1;

+  int iVar2;

+  tagTHREADINFO *ptVar3;

+  longlong lVar4;

+  longlong lVar5;

+  _HANDLEENTRY *p_Var6;

   

-  *unaff_RBX = *unaff_RBX + (char)((uint)param_1 >> 8);

-  *(short *)unaff_RDI = (short)in_ST0;

-  *unaff_RDI = *unaff_RDI + param_1;

-  **(uint **)(unaff_RBP + 0x5e8) =

-       (aiStackX_14[param_2 * 2] << 5 ^ **(uint **)(unaff_RBP + 0x5e8)) & 0xffffffdf ^

-       aiStackX_14[param_2 * 2] << 5;

-  if (unaff_R15 != (undefined4 *)0x0) {

-    *unaff_R15 = in_R11D;

+                    /* 0x8e4c0  2333  ValidateHandleSecure */

+  ptVar3 = PtiCurrent();

+  lVar4 = W32GetUserSessionState();

+  if ((param_1 & 0xffff) < *(ulonglong *)(*(longlong *)(lVar4 + 0x4e30) + 8)) {

+    lVar4 = W32GetUserSessionState();

+    lVar5 = W32GetUserSessionState();

+    p_Var6 = (_HANDLEENTRY *)

+             ((ulonglong)(uint)((int)(param_1 & 0xffff) * *(int *)(lVar5 + 0x4e48)) +

+             *(longlong *)(lVar4 + 0x4e40));

+    W32GetUserSessionState();

+    uVar1 = (ushort)(param_1 >> 0x10) & 0x7fff;

+    if (((((uVar1 == *(ushort *)(p_Var6 + 0x1a)) || (uVar1 == 0x7fff)) ||

+         (((param_1 & 0x7fff0000) == 0 && (lVar4 = PsGetCurrentProcessWow64Process(), lVar4 != 0))))

+        && (p_Var6[0x18] != (_HANDLEENTRY)0x0)) &&

+       ((((param_2 & 1) == 0 || (iVar2 = IsHandleEntrySecure(param_1,p_Var6), iVar2 != 0)) &&

+        ((param_2 & 2) != 0)))) {

+      if ((ptVar3[0x6ac] != (tagTHREADINFO)0x0) &&

+         (iVar2 = IsHandleEntryAccessibleForIL(p_Var6), iVar2 == 0)) {

+        return 0;

+      }

+      return 1;

+    }

   }

-  return param_4 | (uint)unaff_RDI;

+  return 0;

 }
```

## `IsPointerDeviceAccessible`  (modified)

```diff
--- IsPointerDeviceAccessible
+++ DestroyProcessInfo
@@ -1,110 +1,22 @@
 

-/* WARNING: Instruction at (ram,0x00014015ee61) overlaps instruction at (ram,0x00014015ee60)

-    */

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

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

-

-undefined4 IsPointerDeviceAccessible(void)

+void DestroyProcessInfo(void)

 

 {

-  int *piVar1;

-  uint *puVar2;

-  byte bVar3;

-  byte bVar4;

-  undefined2 uVar5;

-  code *pcVar6;

-  undefined1 uVar7;

-  int iVar8;

-  longlong in_RAX;

-  longlong lVar9;

-  longlong lVar10;

-  int unaff_EBX;

-  undefined8 uVar11;

-  longlong unaff_RDI;

-  undefined4 unaff_R12D;

-  int unaff_R13D;

+  char in_AL;

+  undefined8 *unaff_RBX;

+  longlong unaff_RBP;

+  char unaff_DIL;

+  char in_stack_00000030;

   

-  piVar1 = (int *)(in_RAX + -0x75);

-  iVar8 = *piVar1;

-  *piVar1 = *piVar1 + -1;

-  if (*piVar1 == 0 || SBORROW4(iVar8,1) != *piVar1 < 0) {

-    for (; unaff_RDI != 0; unaff_RDI = *(longlong *)(unaff_RDI + 0x38)) {

-      if ((*(uint *)(*(longlong *)(unaff_RDI + 0x28) + 0x18) & 1) != 0) {

-        lVar9 = GreCreateRectRgnIndirect(*(longlong *)(unaff_RDI + 0x28) + 0x1c);

-        if (lVar9 != 0) {

-          lVar10 = W32GetUserSessionState();

-          uVar11 = *(undefined8 *)(*(longlong *)(lVar10 + 0xdf10) + 0x80);

-          lVar10 = W32GetUserSessionState();

-          unaff_EBX = GreCombineRgn(*(undefined8 *)(*(longlong *)(lVar10 + 0xdf10) + 0x80),uVar11,

-                                    lVar9,2);

-          GreDeleteObject(lVar9);

-        }

-      }

-    }

-    lVar9 = W32GetUserSessionState();

-    *(uint *)(*(longlong *)(lVar9 + 0xdf10) + 0x8c) =

-         (uint)(unaff_EBX == 2) | *(uint *)(*(longlong *)(lVar9 + 0xdf10) + 0x8c) & 0xfffffffe;

-    in_RAX = W32GetUserSessionState();

+  *(char *)(unaff_RBP + 0x33) = *(char *)(unaff_RBP + 0x33) + in_AL;

+  *(undefined1 *)unaff_RBX = 0;

+  RtlInitializeBitMap();

+  LeaveHandleFlagsCrit();

+  PsSetProcessWin32Process(*unaff_RBX,0);

+  GreDeleteFastMutex();

+  if (in_stack_00000030 == unaff_DIL) {

+    ReleaseUserCriticalSection();

   }

-  if ((*(uint *)(*(longlong *)(in_RAX + 0xdf10) + 0x8c) & 1) == 0) {

-    lVar9 = W32GetUserSessionState();

-    uVar11 = *(undefined8 *)(*(longlong *)(lVar9 + 0xdf10) + 0x80);

-  }

-  else {

-    uVar11 = 0;

-  }

-  lVar9 = W32GetUserSessionState();

-  for (lVar9 = *(longlong *)(lVar9 + 0xf8a8); lVar9 != 0; lVar9 = *(longlong *)(lVar9 + 8)) {

-    for (lVar10 = *(longlong *)(lVar9 + 0x10); lVar10 != 0; lVar10 = *(longlong *)(lVar10 + 0x20)) {

-      *(undefined8 *)(*(longlong *)(*(longlong *)(*(longlong *)(lVar10 + 8) + 0x18) + 0x28) + 0xa8)

-           = uVar11;

-    }

-  }

-  lVar9 = W32GetUserSessionState();

-  uVar7 = GreGetDeviceCaps(*(undefined8 *)(*(longlong *)(lVar9 + 0xdf10) + 0x40),0xe);

-  lVar9 = W32GetUserSessionState();

-  *(undefined1 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b5a) = uVar7;

-  lVar9 = W32GetUserSessionState();

-  uVar7 = GreGetDeviceCaps(*(undefined8 *)(*(longlong *)(lVar9 + 0xdf10) + 0x40),0xc);

-  lVar9 = W32GetUserSessionState();

-  *(undefined1 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b5b) = uVar7;

-  lVar9 = W32GetUserSessionState();

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

-  lVar10 = W32GetUserSessionState();

-  bVar3 = *(byte *)(lVar9 + 0x1b5a);

-  bVar4 = *(byte *)(*(longlong *)(lVar10 + 0x4e30) + 0x1b5b);

-  lVar9 = W32GetUserSessionState();

-  *(ushort *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b54) = (ushort)bVar4 * (ushort)bVar3;

-  lVar9 = W32GetUserSessionState();

-  uVar5 = *(undefined2 *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b54);

-  lVar9 = W32GetUserSessionState();

-  *(undefined2 *)(*(longlong *)(lVar9 + 0xdf10) + 0x88) = uVar5;

-  lVar9 = W32GetUserSessionState();

-  if (unaff_R13D == 0) {

-    puVar2 = (uint *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b5c);

-    *puVar2 = *puVar2 & 0xfffffffe;

-  }

-  else {

-    puVar2 = (uint *)(*(longlong *)(lVar9 + 0x4e30) + 0x1b5c);

-    *puVar2 = *puVar2 | 1;

-  }

-  EnforceColorDependentSettings();

-  lVar9 = W32GetWin32kBaseApiSetTable();

-  pcVar6 = *(code **)(*(longlong *)(lVar9 + 0x30) + 0x1d80);

-  if (pcVar6 != (code *)0x0) {

-    iVar8 = (*pcVar6)();

-    if (-1 < iVar8) {

-      lVar9 = W32GetWin32kBaseApiSetTable();

-      pcVar6 = *(code **)(*(longlong *)(lVar9 + 0x30) + 0x1d88);

-      iVar8 = 0;

-      if (pcVar6 != (code *)0x0) {

-        iVar8 = (*pcVar6)();

-      }

-      if (iVar8 == 0) {

-        unaff_R12D = 0xc0000017;

-      }

-    }

-  }

-  return unaff_R12D;

+  return;

 }
```

## `IsHandleEntrySecure`  (modified)

```diff
--- IsHandleEntrySecure
+++ IsHandleEntrySecure
@@ -1,24 +1,51 @@
 

-void IsHandleEntrySecure(longlong param_1,char *param_2)

+undefined8 IsHandleEntrySecure(void *param_1,longlong param_2)

 

 {

-  char in_AL;

-  undefined1 in_AH;

-  undefined6 in_register_00000002;

-  undefined1 *unaff_RBX;

+  bool bVar1;

+  ulong uVar2;

+  ulong uVar3;

+  longlong lVar4;

+  longlong *plVar5;

+  longlong lVar6;

+  longlong *plVar7;

+  ulonglong uVar8;

   

-  *(char *)CONCAT62(in_register_00000002,CONCAT11(in_AH,in_AL)) =

-       *(char *)CONCAT62(in_register_00000002,CONCAT11(in_AH,in_AL)) + in_AL;

-  *(char *)CONCAT62(in_register_00000002,CONCAT11(in_AH,in_AL)) =

-       *(char *)CONCAT62(in_register_00000002,CONCAT11(in_AH,in_AL)) + in_AL;

-  *param_2 = *param_2 + in_AL;

-  *(char *)(param_1 + -0x48) = *(char *)(param_1 + -0x48) + in_AL;

-  *unaff_RBX = *unaff_RBX;

-  unaff_RBX[0x982494] = unaff_RBX[0x982494] + (char)param_1;

-  *(char *)CONCAT62(in_register_00000002,CONCAT11(in_AH,in_AL)) =

-       *(char *)CONCAT62(in_register_00000002,CONCAT11(in_AH,in_AL)) + in_AL;

-  MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert");

-                    /* WARNING: Subroutine does not return */

-  ExRaiseAccessViolation();

+  lVar4 = W32GetUserSessionState();

+  lVar6 = *(longlong *)(lVar4 + 0x4e08);

+  uVar8 = param_2 - *(longlong *)(lVar4 + 0x4e40) >> 5 & 0xffffffff;

+  plVar5 = (longlong *)PsGetCurrentProcessWin32Process();

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

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

+    return 1;

+  }

+  if ((*(ushort *)(&DAT_0 + (ulonglong)*(byte *)(param_2 + 0x18) * 0x18) & 2) == 0) {

+    if ((*(ushort *)(&DAT_0 + (ulonglong)*(byte *)(param_2 + 0x18) * 0x18) & 1) == 0) {

+      return 0;

+    }

+    lVar6 = *(longlong *)(lVar6 + 8 + uVar8 * 0x28);

+    if (lVar6 == 0) {

+      return 0;

+    }

+    plVar7 = *(longlong **)(lVar6 + 0x1d0);

+  }

+  else {

+    plVar7 = *(longlong **)(lVar6 + 8 + uVar8 * 0x28);

+  }

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

+    return 0;

+  }

+  if ((plVar7 != plVar5) &&

+     (lVar6 = W32GetUserGdiSessionState(), *plVar7 != *(longlong *)(lVar6 + 0x28))) {

+    uVar2 = KfGetJobProvidingUILimit(*plVar5,1);

+    uVar3 = KfGetJobProvidingUILimit(*plVar7,1);

+    if (uVar2 != uVar3) {

+      if ((uVar2 != 0) && (bVar1 = Win32JobObject::HasHandleAccess(uVar2,param_1), !bVar1)) {

+        return 0;

+      }

+      return 1;

+    }

+  }

+  return 1;

 }
```

## `EtwTraceQueuePostMessage`  (modified)

```diff
--- EtwTraceQueuePostMessage
+++ GetCallbackCount
@@ -1,22 +1,29 @@
 

-void EtwTraceQueuePostMessage(void)

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

+

+char __cdecl GetCallbackCount(void)

 

 {

-  char in_AL;

-  undefined6 in_register_00000002;

-  uint unaff_EDI;

-  int iStack0000000000000038;

-  int iStack0000000000000040;

-  int iStack0000000000000048;

-  int iStack0000000000000050;

+  char cVar1;

+  char *in_RAX;

+  longlong unaff_RBP;

   

-  *(char *)CONCAT62(in_register_00000002,CONCAT11(9,in_AL)) =

-       *(char *)CONCAT62(in_register_00000002,CONCAT11(9,in_AL)) + in_AL;

-  iStack0000000000000050 = -(uint)((unaff_EDI >> 7 & 1) != 0);

-  iStack0000000000000048 = -(uint)((unaff_EDI >> 4 & 1) != 0);

-  iStack0000000000000040 = -(uint)((unaff_EDI >> 6 & 1) != 0);

-  iStack0000000000000038 = -(uint)((unaff_EDI >> 5 & 1) != 0);

-  McTemplateK0cpttttttpppqq_EtwWriteTransfer(iStack0000000000000040,&EndDelegateInputCallback);

-  return;

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

+  *(char **)(unaff_RBP + 0x40) = in_RAX;

+  *(undefined8 *)(unaff_RBP + -0x78) = 8;

+  *(undefined8 *)(unaff_RBP + -0x68) = 4;

+  *(undefined8 *)(unaff_RBP + -0x58) = 4;

+  *(undefined8 *)(unaff_RBP + -0x48) = 4;

+  *(undefined8 *)(unaff_RBP + -0x38) = 4;

+  *(undefined8 *)(unaff_RBP + -0x28) = 4;

+  *(undefined8 *)(unaff_RBP + -0x18) = 4;

+  *(undefined8 *)(unaff_RBP + -8) = 8;

+  *(undefined8 *)(unaff_RBP + 8) = 8;

+  *(undefined8 *)(unaff_RBP + 0x18) = 8;

+  *(undefined8 *)(unaff_RBP + 0x28) = 4;

+  *(undefined8 *)(unaff_RBP + 0x38) = 4;

+  *(undefined8 *)(unaff_RBP + 0x48) = 4;

+  cVar1 = McGenEventWrite_EtwWriteTransfer();

+  return cVar1;

 }
```

## `RIMIDEValidateInjectionQpcCount`  (modified)

```diff
--- RIMIDEValidateInjectionQpcCount
+++ RIMIDEValidateInjectionQpcCount
@@ -1,60 +1,26 @@
 

-undefined4

-RIMIDEValidateInjectionQpcCount

-          (uint *param_1,uint param_2,uint *param_3,undefined1 *param_4,uint param_5,

-          undefined4 *param_6)

+bool RIMIDEValidateInjectionQpcCount

+               (longlong param_1,longlong param_2,longlong param_3,int param_4,int param_5)

 

 {

-  undefined1 uVar1;

-  ulonglong uVar2;

-  undefined4 uVar3;

-  uint uVar4;

-  uint uVar5;

-  char cVar6;

-  undefined4 uVar7;

+  bool bVar1;

   

-  uVar4 = *param_1;

-  uVar7 = 0;

-  uVar5 = *param_3;

-  if (uVar4 < 2) {

-    uVar3 = 1;

+  if ((((param_4 == 0) || (param_1 != 0)) && ((param_2 != 0 || (param_1 != 0)))) && (param_4 == 0))

+  {

+    if (((param_2 == 0) && (param_1 != 0)) && (param_5 == 0)) {

+      return false;

+    }

+    bVar1 = true;

+    if ((*(int *)(param_3 + 0x18) == 7) && (bVar1 = true, *(int *)(param_3 + 0x110) != 0)) {

+      bVar1 = false;

+    }

+    if (param_1 == param_2) {

+      return false;

+    }

+    if (bVar1) {

+      return (ulonglong)(param_1 - param_2) <= *(ulonglong *)(param_3 + 0x330);

+    }

   }

-  else {

-    if (0x7f < (int)uVar4) {

-      if ((int)uVar4 < 0x8000) {

-        uVar3 = 0x10;

-        cVar6 = '\x01';

-        uVar4 = 2;

-      }

-      else {

-        uVar3 = 0x20;

-        uVar4 = 4;

-        cVar6 = '\x02';

-      }

-      goto LAB_0;

-    }

-    uVar3 = 8;

-  }

-  uVar4 = 1;

-  cVar6 = '\0';

-LAB_0:

-  if (uVar5 + 1 + uVar4 < param_2) {

-    uVar2 = (ulonglong)uVar4;

-    *(char *)((ulonglong)uVar5 + (longlong)param_1) = cVar6 + (&DAT_1)[param_5];

-    uVar5 = uVar5 + 1;

-    do {

-      uVar1 = *param_4;

-      param_4 = param_4 + 1;

-      *(undefined1 *)((ulonglong)uVar5 + (longlong)param_1) = uVar1;

-      uVar5 = uVar5 + 1;

-      uVar2 = uVar2 - 1;

-    } while (uVar2 != 0);

-    if (param_6 != (undefined4 *)0x0) {

-      *param_6 = uVar3;

-    }

-    *param_3 = uVar5;

-    uVar7 = 1;

-  }

-  return uVar7;

+  return true;

 }
```

## `DeleteStringPropertyAtoms`  (modified)

```diff
--- DeleteStringPropertyAtoms
+++ DeleteStringPropertyAtoms
@@ -1,31 +1,60 @@
 

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

 

-void DeleteStringPropertyAtoms

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

+void DeleteStringPropertyAtoms(longlong param_1)

 

 {

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  _tlgWrapperByVal<4> *in_stack_00000050;

-  _tlgWrapperByVal<8> *in_stack_00000058;

-  _tlgWrapperByVal<4> *in_stack_00000060;

+  short *psVar1;

+  longlong *plVar2;

+  undefined8 uVar3;

+  ObjectLock<tagObjLock> *this;

+  ulonglong uVar4;

+  int iVar5;

+  short *psVar6;

+  undefined1 auStack_a8 [32];

+  uint local_88 [2];

+  ObjectLock<tagObjLock> local_80 [48];

+  ObjectLock<tagObjLock> local_50 [48];

+  ulonglong local_20;

   

-  _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

-  ::

-  Write<_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>,_tlgWrapSz<unsigned_short>,_tlgWrapSz<unsigned_short>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>_>

-            (param_1,&DAT_0,param_3,param_4,(_tlgWrapperByVal<4> *)&stack0x0000009c,

-             (_tlgWrapperByVal<4> *)&stack0x000000a0,(_tlgWrapperByVal<4> *)&stack0x000000a4,

-             (_tlgWrapSz<unsigned_short> *)&stack0x000000e8,

-             (_tlgWrapSz<unsigned_short> *)&stack0x000000f0,

-             (_tlgWrapSz<unsigned_short> *)&stack0x000000f8,in_stack_00000050,in_stack_00000058,

-             in_stack_00000060);

-  if (unaff_RDI != 0) {

-    RtlFreeUnicodeString(&stack0x00000130);

+                    /* 0x165220  1030  DeleteStringPropertyAtoms */

+  local_20 = __security_cookie ^ (ulonglong)auStack_a8;

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

+  ObjectLock<tagObjLock>(local_80,*(tagObjLock **)(param_1 + 0x90));

+  this = local_80;

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

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

+    ~ObjectLock<tagObjLock>(this);

+    plVar2 = (longlong *)PsGetCurrentProcessWin32Process();

+    uVar4 = 0;

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

+      uVar4 = (ulonglong)plVar2 & -(ulonglong)(*plVar2 != 0);

+    }

+    if ((*(uint *)(uVar4 + 800) >> 0x1a & 1) != 0) {

+      return;

+    }

+    local_88[0] = 0;

+    uVar3 = GetCurrentProcessAtomTable(local_88);

+    if ((local_88[0] & 0xfffffffd) == 0) {

+      return;

+    }

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

+    ObjectLock<tagObjLock>(local_50,*(tagObjLock **)(param_1 + 0x90));

+    psVar1 = *(short **)(*(longlong *)(param_1 + 0x90) + 0x18);

+    iVar5 = *(int *)(psVar1 + 2);

+    for (; iVar5 != 0; iVar5 = iVar5 + -1) {

+      psVar6 = psVar1 + 8;

+      if (((((psVar1[9] & 2U) != 0) && (*psVar6 != 0)) && ((psVar1[9] & 0x10U) == 0)) &&

+         (*(int *)(psVar1 + 10) == *(int *)(uVar4 + 0x35c))) {

+        UserDeleteAtomFromAtomTable(uVar3);

+        *psVar6 = 0;

+      }

+      psVar1 = psVar6;

+    }

+    this = local_50;

   }

-  if ((unaff_RSI != 0) && (unaff_RDI != unaff_RSI)) {

-    RtlFreeUnicodeString(&stack0x00000140);

-  }

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

+  ~ObjectLock<tagObjLock>(this);

   return;

 }
```

## `HMRemoveHandleForObject`  (modified)

```diff
--- HMRemoveHandleForObject
+++ EtwTraceBeginRetrieveSendMessage
@@ -1,128 +1,38 @@
 

-int HMRemoveHandleForObject(void)

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

+

+void EtwTraceBeginRetrieveSendMessage

+               (_tlgProvider_t *param_1,undefined8 param_2,_GUID *param_3,_GUID *param_4)

 

 {

-  undefined4 *puVar1;

-  int iVar2;

-  int iVar3;

-  longlong lVar4;

-  longlong *plVar5;

-  uint unaff_EBX;

-  undefined4 *unaff_RSI;

-  longlong *unaff_RDI;

-  uint uVar6;

-  uint uVar7;

-  longlong *unaff_R14;

-  undefined4 unaff_R15D;

-  uint in_stack_00000030;

-  uint uStack0000000000000034;

-  longlong *in_stack_00000038;

-  undefined4 in_stack_00000040;

-  uint uStack0000000000000054;

-  undefined4 uStack0000000000000070;

-  undefined4 uStack0000000000000074;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

-  undefined8 in_stack_00000080;

-  undefined4 in_stack_00000088;

-  undefined4 in_stack_000000f0;

-  uint *in_stack_000000f8;

-  void *in_stack_00000100;

-  undefined8 in_stack_00000110;

-  undefined4 *in_stack_00000118;

+  ulonglong in_RAX;

+  int *piVar1;

+  longlong unaff_RSI;

+  longlong unaff_RDI;

+  _tlgWrapSz<unsigned_short> *in_stack_00000048;

+  _tlgWrapSz<unsigned_short> *in_stack_00000050;

+  _tlgWrapperByVal<4> *in_stack_00000058;

+  _tlgWrapperByVal<8> *in_stack_00000060;

+  _tlgWrapperByVal<4> *in_stack_00000068;

+  _tlgWrapperByVal<8> *in_stack_00000070;

   

-  plVar5 = unaff_R14;

-  for (uStack0000000000000034 = 0; uStack0000000000000034 < in_stack_00000030;

-      uStack0000000000000034 = uStack0000000000000034 + 1) {

-    if (*plVar5 < 0) {

-      unaff_EBX = unaff_EBX + 1;

-    }

-    plVar5 = plVar5 + 0x1b;

-    unaff_RDI = in_stack_00000038;

+  piVar1 = (int *)(in_RAX & 0xffffffffffffff00);

+  *piVar1 = *piVar1 + (int)piVar1;

+  *(char *)((longlong)piVar1 + -0x77) = *(char *)((longlong)piVar1 + -0x77) + (char)param_1;

+  _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+  ::

+  Write<_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapSz<unsigned_short>,_tlgWrapSz<unsigned_short>,_tlgWrapSz<unsigned_short>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>_>

+            (param_1,&DAT_0,param_3,param_4,(_tlgWrapperByVal<4> *)&stack0x000000a4,

+             (_tlgWrapperByVal<4> *)&stack0x000000a8,(_tlgWrapperByVal<4> *)&stack0x000000ac,

+             (_tlgWrapperByVal<4> *)&stack0x000000b0,(_tlgWrapSz<unsigned_short> *)&stack0x000000f8,

+             in_stack_00000048,in_stack_00000050,in_stack_00000058,in_stack_00000060,

+             in_stack_00000068,in_stack_00000070);

+  if (unaff_RDI != 0) {

+    RtlFreeUnicodeString(&stack0x00000160);

   }

-  if (in_stack_00000030 != unaff_EBX) {

-                    /* WARNING: Subroutine does not return */

-    ExRaiseStatus(unaff_R15D);

+  if ((unaff_RSI != 0) && (unaff_RDI != unaff_RSI)) {

+    RtlFreeUnicodeString(&stack0x00000170);

   }

-  uVar7 = 0;

-  uStack0000000000000054 = 0;

-  plVar5 = unaff_RDI;

-  for (uVar6 = 0; puVar1 = in_stack_00000118, uStack0000000000000034 = uVar6, uVar6 < unaff_EBX;

-      uVar6 = uVar6 + 1) {

-    if (*unaff_R14 < 0) {

-      if (unaff_EBX <= uVar7) {

-                    /* WARNING: Subroutine does not return */

-        ExRaiseStatus(0xc000000d);

-      }

-      RtlCopyVolatileMemory(unaff_RDI,unaff_R14,0xd8);

-      if (-1 < *unaff_RDI) {

-                    /* WARNING: Subroutine does not return */

-        ExRaiseStatus(0xc0000022);

-      }

-      uVar7 = uVar7 + 1;

-      unaff_RDI = unaff_RDI + 0x1b;

-      uStack0000000000000054 = uVar7;

-    }

-    unaff_R14 = unaff_R14 + 0x1b;

-    plVar5 = in_stack_00000038;

-  }

-  if (uVar7 != unaff_EBX) {

-                    /* WARNING: Subroutine does not return */

-    ExRaiseStatus(0xc000000d);

-  }

-  if (in_stack_00000118 == (undefined4 *)0x0) {

-                    /* WARNING: Subroutine does not return */

-    ExRaiseStatus(0xc000000d);

-  }

-  ProbeForWrite(in_stack_00000118,4,4);

-  if (unaff_RSI != (undefined4 *)0x0) {

-    lVar4 = PsGetCurrentProcessWow64Process();

-    if (((ulonglong)unaff_RSI & (ulonglong)(~-(uint)(lVar4 != 0) & 3)) != 0) {

-                    /* WARNING: Subroutine does not return */

-      ExRaiseDatatypeMisalignment();

-    }

-    if ((*(undefined4 **)MmUserProbeAddress_exref < unaff_RSI + 7) || (unaff_RSI + 7 < unaff_RSI)) {

-      plVar5 = in_stack_00000038;

-    }

-    uStack0000000000000070 = *unaff_RSI;

-    uStack0000000000000074 = unaff_RSI[1];

-    uStack0000000000000078 = unaff_RSI[2];

-    uStack000000000000007c = unaff_RSI[3];

-    in_stack_00000080 = *(undefined8 *)(unaff_RSI + 4);

-    in_stack_00000088 = unaff_RSI[6];

-  }

-  iVar2 = UserIsWddmConnectedSession();

-  if (iVar2 == 0) {

-    iVar2 = -0x3fffffde;

-  }

-  else if (((unaff_RSI == (undefined4 *)0x0) ||

-           (iVar2 = DrvNeedDisplayStateCheck(&stack0x00000070), iVar2 == 0)) ||

-          (iVar2 = DrvIsDisplayStateCurrent(1,&stack0x00000070), iVar2 != 0)) {

-    iVar2 = DrvFunctionalizeDisplayConfig

-                      (&stack0x00000030,plVar5,in_stack_000000f0,in_stack_00000110,&stack0x00000040)

-    ;

-    if (iVar2 == -0x7ffffffb) {

-      iVar2 = -0x3fffffdd;

-    }

-    RtlCopyVolatileMemory(in_stack_00000100,plVar5,(ulonglong)in_stack_00000030 * 0xd8);

-    *in_stack_000000f8 = in_stack_00000030;

-    *puVar1 = in_stack_00000040;

-    if (-1 < iVar2) goto LAB_0;

-  }

-  else {

-    iVar2 = -0x3fe1fcc9;

-  }

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

-      (iVar3 = DrvNeedDisplayStateCheck(&stack0x00000070), iVar3 != 0)) &&

-     (iVar3 = DrvIsDisplayStateCurrent(1,&stack0x00000070), iVar3 == 0)) {

-    iVar2 = -0x3fe1fcc9;

-  }

-LAB_0:

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

-    GreDeleteFastMutex(plVar5);

-    in_stack_00000038 = (longlong *)0x0;

-  }

-  ReleaseUserCriticalSection();

-  return iVar2;

+  return;

 }
```

## `W32AcquirePushLockExclusiveEx`  (modified)

```diff
--- W32AcquirePushLockExclusiveEx
+++ CLastWokenThread::_SetForAsfw
@@ -1,11 +1,45 @@
 

-/* void __cdecl W32AcquirePushLockExclusiveEx(class W32_PUSH_LOCK * __ptr64,unsigned long) */

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

+/* private: void __cdecl CLastWokenThread::_SetForAsfw(struct tagTHREADINFO const * __ptr64,bool)

+   __ptr64 */

 

-void __cdecl W32AcquirePushLockExclusiveEx(W32_PUSH_LOCK *param_1,ulong param_2)

+void __thiscall

+CLastWokenThread::_SetForAsfw(CLastWokenThread *this,tagTHREADINFO *param_1,bool param_2)

 

 {

-  KeEnterCriticalRegion();

-  ExAcquirePushLockExclusiveEx(param_1,param_2);

+  CLastWokenThread *pCVar1;

+  longlong lVar2;

+  longlong lVar3;

+  longlong lVar4;

+  

+  lVar2 = *(longlong *)(this + 8);

+  if (lVar2 == 0) {

+    lVar4 = 0;

+  }

+  else {

+    lVar4 = *(longlong *)(lVar2 + 0x1d0);

+  }

+  lVar3 = *(longlong *)(param_1 + 0x1d0);

+  pCVar1 = this + 0x11;

+  *(tagTHREADINFO **)(this + 8) = param_1;

+  this[0x10] = (CLastWokenThread)param_2;

+  if (lVar4 == lVar3) {

+    if (*pCVar1 != (CLastWokenThread)0x0) {

+      return;

+    }

+  }

+  else if (this[0x11] != (CLastWokenThread)0x0) {

+    ForegroundBoost::`anonymous_namespace'::_SetForegroundPriority

+              (*(undefined8 *)(lVar2 + 0x1d0),0,0x10);

+    *(undefined8 *)(this + 0x18) = 0;

+    *pCVar1 = (CLastWokenThread)0x0;

+  }

+  if (lVar3 != 0) {

+    ForegroundBoost::`anonymous_namespace'::_SetForegroundPriority

+              (*(undefined8 *)(*(longlong *)(this + 8) + 0x1d0),1,0x10);

+    *(undefined8 *)(this + 0x18) = _DAT_0;

+    *pCVar1 = (CLastWokenThread)0x1;

+  }

   return;

 }
```

## `RealInternalSetProp`  (modified)

```diff
--- RealInternalSetProp
+++ xxxUserProcessCallout
@@ -1,43 +1,17 @@
 

-undefined8

-RealInternalSetProp(tagObjLock *param_1,longlong param_2,undefined8 param_3,ushort param_4)

+long xxxUserProcessCallout(_W32PROCESS *param_1,_WIN32_PROCESS_CALLOUT_PARAMETERS *param_2)

 

 {

-  bool bVar1;

-  undefined8 *puVar2;

-  longlong *plVar3;

-  undefined8 uVar4;

-  tagPROCESSINFO *this;

+  long lVar1;

   

-                    /* 0x165360  2169  RealInternalSetProp */

-  if (param_2 == 0) {

-    UserSetLastError(0x57);

-LAB_0:

-    uVar4 = 0;

+                    /* 0x163fc0  2519  xxxUserProcessCallout */

+  if (param_2 == (_WIN32_PROCESS_CALLOUT_PARAMETERS *)0x0) {

+    UserProcessDestroyCallout(param_1);

+    lVar1 = 0;

   }

   else {

-    LockRefactorStagingAssertOwned(param_1);

-    puVar2 = (undefined8 *)_FindProp(param_1,param_2,param_4 & 1);

-    if (puVar2 == (undefined8 *)0x0) {

-      puVar2 = (undefined8 *)CreateProp();

-      if (puVar2 == (undefined8 *)0x0) goto LAB_0;

-      *(short *)(puVar2 + 1) = (short)param_2;

-      *(ushort *)((longlong)puVar2 + 10) = param_4;

-      plVar3 = (longlong *)PsGetCurrentProcessWin32Process();

-      this = (tagPROCESSINFO *)0x0;

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

-        this = (tagPROCESSINFO *)((ulonglong)plVar3 & -(ulonglong)(*plVar3 != 0));

-      }

-      if ((*(uint *)(this + 800) >> 0x1a & 1) == 0) {

-        bVar1 = tagPROCESSINFO::HasUILimit(this,0x20);

-        if (!bVar1) goto LAB_1;

-      }

-      *(ushort *)((longlong)puVar2 + 10) = *(ushort *)((longlong)puVar2 + 10) | 0x10;

-    }

-LAB_1:

-    *puVar2 = param_3;

-    uVar4 = 1;

+    lVar1 = xxxUserProcessInitCallout(param_1,param_2);

   }

-  return uVar4;

+  return lVar1;

 }
```

## `NtHWCursorUpdatePointer`  (modified)

```diff
--- NtHWCursorUpdatePointer
+++ NtHWCursorUpdatePointer
@@ -1,35 +1,146 @@
 

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

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

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

+

+int NtHWCursorUpdatePointer(void *param_1,void *param_2)

 

 {

-  code *pcVar1;

-  char *in_RAX;

-  int unaff_EBX;

-  longlong unaff_RSI;

-  void *unaff_RDI;

-  undefined4 in_stack_00000060;

-  void *in_stack_000000d8;

-  undefined4 *in_stack_000000e8;

+  uint Size;

+  int iVar1;

+  longlong lVar2;

+  void *_Dst;

+  void *_Src;

+  uint uVar3;

+  void *pvVar4;

+  void *_Dst_00;

+  undefined1 auStack_f8 [48];

+  undefined8 local_c8;

+  undefined8 uStack_c0;

+  undefined8 local_b8;

+  void *pvStack_b0;

+  int local_a8;

+  undefined4 local_a0;

+  undefined4 local_9c;

+  undefined4 local_98;

+  uint local_94;

+  undefined4 local_90;

+  undefined4 local_8c;

+  void *local_88;

+  undefined4 local_80;

+  undefined4 local_7c;

+  void *local_78;

+  void *local_70;

+  void *local_68;

+  undefined8 local_60;

+  undefined8 uStack_58;

+  undefined8 local_50;

+  int local_48;

+  undefined4 local_40;

+  undefined4 local_3c;

+  undefined4 local_38;

+  uint local_34;

+  ulonglong local_30;

   

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

-  if ((*(void **)MmUserProbeAddress_exref < (void *)(param_3 + (longlong)in_stack_000000d8)) ||

-     ((void *)(param_3 + (longlong)in_stack_000000d8) <= in_stack_000000d8)) {

-    **(undefined1 **)MmUserProbeAddress_exref = 0;

+                    /* 0x176780  1880  NtHWCursorUpdatePointer */

+  local_30 = __security_cookie ^ (ulonglong)auStack_f8;

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

+    local_60 = 0;

+    uStack_58 = 0;

+    local_50 = 0;

+    local_48 = 0;

+    if (*(void **)MmUserProbeAddress_exref <= param_1) {

+      param_1 = *(void **)MmUserProbeAddress_exref;

+    }

+    RtlCopyVolatileMemory(&local_60,param_1,0x1c);

+    local_40 = (undefined4)uStack_58;

+    local_3c = uStack_58._4_4_;

+    local_38 = (undefined4)local_50;

+    local_34 = 0;

+    if (local_48 == 1) {

+      local_34 = 2;

+    }

+    local_34 = local_50._4_4_ & 1 | local_34;

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

+      lVar2 = DxDdGetDxgkWin32kInterface();

+      iVar1 = (**(code **)(lVar2 + 0x280))(&local_60,&local_40,0);

+      if (-1 < iVar1) {

+        return iVar1;

+      }

+      return -0x3fffffff;

+    }

+    local_c8 = 0;

+    uStack_c0 = 0;

+    local_b8 = 0;

+    pvStack_b0 = (void *)0x0;

+    if (*(void **)MmUserProbeAddress_exref <= param_2) {

+      param_2 = *(void **)MmUserProbeAddress_exref;

+    }

+    RtlCopyVolatileMemory(&local_c8,param_2,0x20);

+    if (((((int)local_c8 - 1U < 2) && (pvStack_b0 != (void *)0x0)) && (uStack_c0._4_4_ < 0x1001)) &&

+       ((local_c8._4_4_ <= uStack_c0._4_4_ >> 2 && ((uint)uStack_c0 < 0x401)))) {

+      uVar3 = local_c8._4_4_ * 4;

+      Size = uVar3 * (uint)uStack_c0;

+      _Dst = PALLOCMEM(Size);

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

+        return -0x3fffffff;

+      }

+      local_68 = _Dst;

+      if (uVar3 == uStack_c0._4_4_) {

+        pvVar4 = pvStack_b0;

+        if (*(void **)MmUserProbeAddress_exref <= pvStack_b0) {

+          pvVar4 = *(void **)MmUserProbeAddress_exref;

+        }

+        RtlCopyVolatileMemory(_Dst,pvVar4,(ulonglong)Size);

+      }

+      else {

+        pvVar4 = pvStack_b0;

+        _Dst_00 = _Dst;

+        for (iVar1 = (uint)uStack_c0; local_78 = pvVar4, local_70 = _Dst_00, iVar1 != 0;

+            iVar1 = iVar1 + -1) {

+          _Src = pvVar4;

+          if (*(void **)MmUserProbeAddress_exref <= pvVar4) {

+            _Src = *(void **)MmUserProbeAddress_exref;

+          }

+          local_a8 = iVar1;

+          RtlCopyVolatileMemory(_Dst_00,_Src,(ulonglong)uVar3);

+          pvVar4 = (void *)((longlong)pvVar4 + (uStack_c0 >> 0x20));

+          _Dst_00 = (void *)((longlong)_Dst_00 + (ulonglong)uVar3);

+        }

+        local_a8 = 0;

+      }

+      local_8c = 0;

+      if ((int)local_c8 == 1) {

+        local_a0 = 2;

+      }

+      else {

+        local_a0 = 0;

+        if ((int)local_c8 == 2) {

+          local_a0 = 4;

+        }

+      }

+      local_9c = local_c8._4_4_;

+      local_98 = (uint)uStack_c0;

+      local_90 = (undefined4)uStack_58;

+      local_94 = uVar3;

+      local_88 = _Dst;

+      iVar1 = Feature_DesktopDWMCursor__private_IsEnabledDeviceUsageNoInline();

+      if (iVar1 == 0) {

+        local_80 = 0;

+        local_7c = 0;

+      }

+      else {

+        local_80 = (undefined4)local_b8;

+        local_7c = local_b8._4_4_;

+      }

+      lVar2 = DxDdGetDxgkWin32kInterface();

+      iVar1 = (**(code **)(lVar2 + 0x288))(&local_60,&local_40,&local_a0,0);

+      GreDeleteFastMutex(_Dst);

+      if (-1 < iVar1) {

+        return iVar1;

+      }

+      return -0x3fffffff;

+    }

   }

-  pcVar1 = MmUserProbeAddress_exref;

-  memmove(in_stack_000000d8,unaff_RDI,param_3);

-  if ((-1 < unaff_EBX) && (in_stack_000000e8 != (undefined4 *)0x0)) {

-    if (*(undefined4 **)pcVar1 <= in_stack_000000e8) {

-      in_stack_000000e8 = *(undefined4 **)pcVar1;

-    }

-    *in_stack_000000e8 = in_stack_00000060;

-  }

-  if (unaff_RSI != 0) {

-    GreDeleteFastMutex();

-  }

-  if (unaff_RDI != (void *)0x0) {

-    GreDeleteFastMutex();

-  }

-  return unaff_EBX;

+  return -0x3ffffff3;

 }
```

## `EtwTraceRetrievePostMessage`  (modified)

```diff
--- EtwTraceRetrievePostMessage
+++ EtwTraceRetrievePostMessage
@@ -1,40 +1,12 @@
 

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

-

-int EtwTraceRetrievePostMessage(void)

+void EtwTraceRetrievePostMessage(void)

 

 {

-  longlong lVar1;

-  int unaff_EDI;

-  longlong unaff_R12;

-  int unaff_R13D;

-  longlong unaff_R14;

-  int in_stack_00000030;

-  

-  _WdLogGlobalForLineNumber = 0x977;

-  WdLogSingleEntry2(2,(longlong)unaff_EDI);

-  _WdLogGlobalForLineNumber = 0x97c;

-  lVar1 = W32GetUserSessionState();

-  if (*(int *)(lVar1 + 0xdf30) == 0) {

-    if (unaff_R13D == 0) {

-      WdLogSingleEntry2(2,(longlong)unaff_EDI,(longlong)in_stack_00000030);

-      _WdLogGlobalForLineNumber = 0x992;

-    }

-    else {

-      *(undefined4 *)(lVar1 + 0xdf30) = 1;

-      DrvCreateLiveDumpWithWdLogs(unaff_EDI,in_stack_00000030);

-    }

+                    /* 0x166d60  1353  EtwTraceRetrievePostMessage */

+  if ((Microsoft_Windows_Win32kEnableBits._1_1_ & 8) != 0) {

+    PsGetCurrentThreadWin32Thread();

+    McTemplateK0cppppqqq_EtwWriteTransfer();

   }

-  else {

-    WdLogSingleEntry2(2,(longlong)unaff_EDI,(longlong)in_stack_00000030);

-    _WdLogGlobalForLineNumber = 0x99a;

-  }

-  if (unaff_R12 != 0) {

-    GreDeleteFastMutex();

-  }

-  if (unaff_R14 != 0) {

-    GreDeleteFastMutex();

-  }

-  return unaff_EDI;

+  return;

 }
```

## `ProcessKeyboardInputWorker`  (modified)

```diff
--- ProcessKeyboardInputWorker
+++ ProcessKeyboardInputWorker
@@ -1,14 +1,256 @@
 

-undefined4 ProcessKeyboardInputWorker(undefined8 param_1,undefined8 param_2,int param_3)

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

+

+void ProcessKeyboardInputWorker(short *param_1,DEVICEINFO *param_2,char param_3)

 

 {

-  longlong unaff_RBX;

-  undefined4 unaff_EDI;

+  byte bVar1;

+  uint uVar2;

+  undefined1 uVar3;

+  char cVar4;

+  byte bVar5;

+  ushort uVar6;

+  undefined2 uVar7;

+  int iVar8;

+  longlong lVar9;

+  longlong lVar10;

+  undefined8 uVar11;

+  DropReason DVar12;

+  byte bVar13;

+  undefined4 uVar14;

+  undefined1 uVar15;

+  undefined1 auStack_98 [32];

+  DEVICEINFO *local_78;

+  undefined8 local_70;

+  byte local_68 [4];

+  undefined4 local_64;

+  undefined4 local_60;

+  undefined4 local_5c;

+  undefined8 local_58;

+  undefined8 local_50;

+  ulonglong uStack_48;

+  ulonglong local_40;

   

-  ApiSetEditionPostRitSound(param_3 + 3);

-  if ((*(byte *)(unaff_RBX + 0x55e6) & *(byte *)(unaff_RBX + 0x55e9)) == 0) {

-    unaff_EDI = 0;

-  }

-  return unaff_EDI;

+  local_40 = __security_cookie ^ (ulonglong)auStack_98;

+  uVar11 = 0;

+  uVar6 = param_1[2];

+  uVar15 = 0;

+  local_60 = 0;

+  local_64 = 0;

+  if (((uVar6 & 0x10) != 0) ||

+     (((param_2 != (DEVICEINFO *)0x0 && ((*(uint *)(param_2 + 0xa8) & 0x2000) != 0)) ||

+      (*param_1 == -2)))) {

+    local_64 = 1;

+  }

+  if (param_2 == (DEVICEINFO *)0x0) {

+    local_58 = 0;

+  }

+  else {

+    local_58 = *(undefined8 *)param_2;

+  }

+  local_50 = *(undefined8 *)param_1;

+  uStack_48 = (ulonglong)*(uint *)(param_1 + 4);

+  local_5c = 0;

+  if ((uVar6 & 0x28) == 0) {

+    lVar9 = W32GetUserSessionState();

+    if ((*(uint *)(lVar9 + 0x3274) & 0x8000) != 0) {

+      lVar9 = W32GetUserSessionState();

+      RemoteSyncToggleKeys(*(ulong *)(lVar9 + 0x3274));

+    }

+    if ((param_1[2] & 2U) == 0) {

+      bVar13 = -((param_1[2] & 4U) != 0) & 0xe1;

+    }

+    else {

+      bVar13 = 0xe0;

+    }

+    local_68[0] = bVar13;

+    if (param_1[1] == 0xff) {

+      ReleaseUserCriticalSection();

+      ApiSetEditionUserBeep();

+      lVar9 = W32GetUserSessionState();

+      lVar10 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                         (lVar9,1,0,

+                          <lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+      *(longlong *)(lVar9 + 0x10) = lVar10;

+      if ((lVar10 != 0) &&

+         (cVar4 = UserCritInternal::`anonymous_namespace'::IsValidGuiContext(lVar10), cVar4 != '\0')

+         ) {

+        DestroySharedUserCritDeferredUnlockList(lVar9 + 0x4d78);

+        DestroyDeferredUnlockObjectAssignmentList(lVar9 + 0x4db0);

+        DestroyDeferredUnlockObjectAssignmentList(lVar9 + 0x4da0);

+      }

+      DVar12 = 6;

+    }

+    else {

+      cVar4 = isChildPartition();

+      if ((cVar4 == '\0') || ((*(byte *)(param_1 + 2) & 0x40) == 0)) {

+        local_60 = CONCAT31(local_60._1_3_,(char)param_1[1]) & 0xffffff7f;

+        if ((param_3 != '\0') &&

+           ((lVar9 = W32GetUserSessionState(), *(longlong *)(lVar9 + 0x3258) != 0 ||

+            (lVar9 = W32GetUserSessionState(), *(longlong *)(lVar9 + 0x3260) != 0)))) {

+          uVar2 = local_60;

+          local_60 = local_60 & 0xffff;

+          if ((*(byte *)(param_1 + 2) & 1) != 0) {

+            local_60._0_2_ = (undefined2)uVar2;

+            local_60 = CONCAT22(0x8000,(undefined2)local_60);

+          }

+          iVar8 = MapScancode((tagKE *)&local_60,local_68,param_2);

+          bVar13 = local_68[0];

+          if (iVar8 == 0) {

+            DVar12 = 7;

+            goto LAB_0;

+          }

+        }

+        bVar5 = VKFromVSC(&local_60,bVar13);

+      }

+      else {

+        local_60 = CONCAT22(param_1[1],(undefined2)local_60);

+        bVar5 = (byte)param_1[1];

+      }

+      lVar9 = W32GetUserSessionState();

+      *(byte *)(lVar9 + 0x36a0) = bVar5;

+      if (bVar5 == 0) {

+        lVar9 = W32GetUserSessionState();

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

+          uVar11 = PtiKbdFromQ();

+        }

+        iVar8 = ApiSetEditionRawInputRequestedForKeyboard(uVar11);

+        if (iVar8 == 0) {

+          DVar12 = 8;

+          goto LAB_0;

+        }

+        uVar3 = 1;

+LAB_1:

+        uVar15 = uVar3;

+        lVar9 = W32GetUserSessionState();

+        if (*(short *)(lVar9 + 0x3270) != 0) {

+          lVar9 = W32GetUserSessionState();

+          if (param_1[1] == *(short *)(lVar9 + 0x3270)) {

+            bVar5 = 0x4c;

+            lVar9 = W32GetUserSessionState();

+            *(undefined1 *)(lVar9 + 0x36a0) = 0x4c;

+            local_60 = CONCAT22(0x4c,(undefined2)local_60);

+          }

+          uVar7 = 0;

+          lVar9 = W32GetUserSessionState();

+          if (((*(uint *)(lVar9 + 0x36b4) & 8) == 0) ||

+             (((*(byte *)(param_1 + 2) & 1) != 0 && ((byte)(bVar5 + 0xa5) < 2))))

+          goto LAB_2;

+        }

+      }

+      else {

+        uVar3 = 0;

+        if ((1 < (byte)(bVar5 + 0xa5)) || ((*(byte *)(param_1 + 2) & 1) != 0)) goto LAB_1;

+        lVar9 = W32GetUserSessionState();

+        if ((*(longlong *)(lVar9 + 0x4a60) == 0) ||

+           (lVar9 = W32GetUserSessionState(),

+           *(longlong *)(*(longlong *)(lVar9 + 0x4a60) + 0x1e0) == 0)) {

+          lVar9 = W32GetUserSessionState();

+          uVar11 = *(undefined8 *)(lVar9 + 0x36e8);

+        }

+        else {

+          lVar9 = W32GetUserSessionState();

+          uVar11 = *(undefined8 *)

+                    (*(longlong *)(*(longlong *)(*(longlong *)(lVar9 + 0x4a60) + 0x1e0) + 0x30) +

+                    0x20);

+        }

+        lVar9 = W32GetUserSessionState();

+        if (*(short *)(lVar9 + 0x3270) == 0) {

+          uVar7 = InternalMapVirtualKeyEx(0x4c,0,uVar11);

+          uVar15 = 0;

+LAB_2:

+          lVar9 = W32GetUserSessionState();

+          *(undefined2 *)(lVar9 + 0x3270) = uVar7;

+        }

+      }

+      if ((*(byte *)(param_1 + 2) & 1) != 0) {

+        uVar6 = GetActiveHKL();

+        if ((local_60._0_1_ == (tagKE)0xf1 || local_60._0_1_ == (tagKE)0xf2) &&

+           ((uVar6 & 0x3ff) == 0x11 || (uVar6 & 0x3ff) == 0x12)) {

+          if ((bVar5 - 0x16 & 0xfb) == 0) {

+            if (bVar13 != 0xe1) goto LAB_3;

+          }

+          else if (bVar13 == 0xe1) {

+            return;

+          }

+        }

+        local_60 = local_60 | 0x80000000;

+      }

+LAB_3:

+      iVar8 = IsRemoteConnection();

+      if (((iVar8 == 0) || (local_60._2_1_ != '[' && local_60._2_1_ != '\\')) ||

+         (lVar9 = W32GetUserSessionState(), *(int *)(lVar9 + 0x36cc) != 0)) {

+        lVar9 = W32GetUserSessionState();

+        lVar10 = W32GetUserSessionState();

+        if (bVar5 == 0x5b) {

+          bVar13 = 0x40;

+        }

+        else if (bVar5 == 0x5c) {

+          bVar13 = 0x80;

+        }

+        else if ((((bVar5 == 0xa0) || (bVar5 == 0xa1)) ||

+                 ((bVar5 == 0xa2 || ((bVar5 == 0xa3 || (bVar5 == 0xa4)))))) || (bVar5 == 0xa5)) {

+          bVar13 = '\x01' << (bVar5 & 0xf);

+        }

+        else {

+          bVar13 = 0;

+        }

+        *(byte *)(lVar9 + 0x55e6) = bVar13;

+        if (bVar13 != 0) {

+          bVar1 = *(byte *)(lVar10 + 0x55e5);

+          if ((*(byte *)(param_1 + 2) & 1) == 0) {

+            if ((bVar1 & bVar13) != bVar13) {

+              *(byte *)(lVar10 + 0x55e5) = bVar1 | bVar13;

+            }

+          }

+          else {

+            *(byte *)(lVar10 + 0x55e5) = ~bVar13 & bVar1;

+          }

+        }

+        if ((bVar5 == 0xd) && ((*(byte *)(param_1 + 2) & 1) == 0)) {

+          PoLatencySensitivityHint(1);

+        }

+        lVar9 = W32GetUserSessionState();

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

+          uVar14 = *(undefined4 *)(param_1 + 4);

+          bVar13 = (byte)local_64;

+        }

+        else {

+          AccessTimeOut();

+          iVar8 = AccessProceduresStream((tagKE *)&local_60,*(ulong *)(param_1 + 4),0);

+          if (iVar8 == 0) {

+            return;

+          }

+          uVar14 = *(undefined4 *)(param_1 + 4);

+          bVar13 = *(byte *)(param_1 + 2) >> 4 & 1;

+        }

+        goto LAB_4;

+      }

+      DVar12 = 9;

+    }

+LAB_0:

+    InputTraceLogging::Keyboard::DropInput(DVar12);

+  }

+  else {

+    if ((uVar6 & 8) != 0) {

+      if ((uVar6 & 0x10) != 0) {

+        *(uint *)(param_1 + 4) = *(uint *)(param_1 + 4) | 0x4000;

+      }

+      RemoteSyncToggleKeys(*(ulong *)(param_1 + 4));

+    }

+    uVar6 = param_1[2];

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

+      return;

+    }

+    bVar13 = (byte)uVar6 >> 4 & 1;

+    uVar15 = 0;

+    local_60 = CONCAT22(uVar6 * -0x8000,param_1[1]) | 0x10e70000;

+    uVar14 = 0;

+LAB_4:

+    local_70 = 0;

+    local_78 = param_2;

+    xxxProcessKeyEvent(&local_60,uVar14,bVar13,uVar15);

+  }

+  return;

 }
```

## `DCompositionCreateLayoutSynchronizationObject`  (modified)

```diff
--- DCompositionCreateLayoutSynchronizationObject
+++ DCompositionCreateLayoutSynchronizationObject
@@ -1,133 +1,75 @@
 

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

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

 

-int DCompositionCreateLayoutSynchronizationObject(void)

+int DCompositionCreateLayoutSynchronizationObject

+              (HWND__ *param_1,SynchronizationObject *param_2,undefined8 *param_3,longlong *param_4)

 

 {

-  longlong *plVar1;

-  char cVar2;

-  int iVar3;

-  undefined8 uVar4;

-  longlong lVar5;

-  int unaff_EBX;

-  uint unaff_ESI;

-  longlong lVar6;

-  ulonglong uVar7;

-  CActivationObject *unaff_R13;

-  longlong unaff_R14;

-  ulonglong in_stack_00000020;

-  undefined4 uVar8;

-  char in_stack_00000040;

-  CActivationObject *in_stack_00000058;

-  longlong in_stack_00000060;

-  longlong in_stack_00000068;

-  undefined8 in_stack_00000078;

-  undefined2 uStack0000000000000090;

-  undefined2 uStack0000000000000092;

-  undefined2 uStack0000000000000094;

-  undefined8 in_stack_000000e0;

-  undefined8 in_stack_000000e8;

-  undefined8 in_stack_000000f0;

-  undefined8 in_stack_000000f8;

-  undefined8 in_stack_00000100;

-  undefined8 in_stack_00000108;

+  LayoutSynchronizationObject *pLVar1;

+  int iVar2;

+  char cVar3;

+  ulong uVar4;

+  char cVar5;

+  longlong *plVar6;

+  void *local_res18;

+  LayoutSynchronizationObject *local_res20;

+  undefined8 local_68;

+  undefined8 local_60;

+  undefined8 local_58;

+  undefined8 local_50;

+  LayoutSynchronizationObject *local_48;

+  undefined8 local_40;

   

-  if (-1 < unaff_EBX) {

-    in_stack_00000068 = UserReferenceDwmApiPort();

-    if (in_stack_00000068 == 0) {

-      unaff_EBX = -0x3fffffff;

+                    /* 0x221730  1014  DCompositionCreateLayoutSynchronizationObject */

+  uVar4 = (ulong)param_3;

+  *param_3 = 0;

+  *param_4 = 0;

+  plVar6 = param_4;

+  iVar2 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+  cVar5 = (char)plVar6;

+  if (iVar2 == 0) {

+    iVar2 = -0x3fffff45;

+  }

+  else {

+    iVar2 = (**(code **)(**(longlong **)(param_2 + 8) + 0x10))();

+    if (iVar2 != 3) {

+      param_2 = (SynchronizationObject *)0x0;

     }

-  }

-  if (-1 < unaff_EBX) {

-    cVar2 = CheckOrAcquireDwmStateLock();

-    in_stack_00000040 = cVar2 != '\0';

-    iVar3 = -0x3fffffff;

-    if ((bool)in_stack_00000040) {

-      iVar3 = unaff_EBX;

+    if (param_2 == (SynchronizationObject *)0x0) {

+      iVar2 = -0x3ffffff3;

     }

-    unaff_EBX = iVar3;

-    if (-1 < iVar3) {

-      unaff_R13 = (CActivationObject *)ReferenceDwmProcess();

-      in_stack_00000058 = unaff_R13;

-      if (unaff_R13 == (CActivationObject *)0x0) {

-        unaff_EBX = -0x3fffffff;

+    else {

+      local_res20 = (LayoutSynchronizationObject *)0x0;

+      cVar3 = '\0';

+      iVar2 = UserAllocDefaultCompositionSecurityDescriptor(0x80000000,&local_res20);

+      pLVar1 = local_res20;

+      if (-1 < iVar2) {

+        local_68 = 0x30;

+        local_50 = 0;

+        local_res18 = (void *)0x0;

+        local_60 = 0;

+        local_58 = 0;

+        local_48 = local_res20;

+        local_40 = 0;

+        iVar2 = DirectComposition::LayoutSynchronizationObject::Create

+                          (cVar3,(_OBJECT_ATTRIBUTES *)&local_68,uVar4,cVar5,param_1,param_2,

+                           &local_res18);

+        if (-1 < iVar2) {

+          local_res20 = (LayoutSynchronizationObject *)0x0;

+          iVar2 = DirectComposition::LayoutSynchronizationObject::ResolveHandle

+                            (local_res18,3,(char)uVar4,&local_res20);

+          if (iVar2 < 0) {

+            ObCloseHandle(local_res18,1);

+          }

+          else {

+            *param_3 = local_res18;

+            *param_4 = (longlong)(local_res20 + 0x18);

+          }

+        }

+        GreDeleteFastMutex(pLVar1);

       }

     }

   }

-  uVar7 = (ulonglong)unaff_ESI;

-  if ((-1 < unaff_EBX) && (unaff_ESI != 0)) {

-    lVar6 = 0;

-    do {

-      plVar1 = *(longlong **)(&stack0x00000048 + lVar6 * 8);

-      if (*plVar1 != 0) {

-        iVar3 = Feature_Capture_WindowExclusionBackport__private_IsEnabledDeviceUsageNoInline();

-        uVar8 = (undefined4)(in_stack_00000020 >> 0x20);

-        lVar5 = *plVar1;

-        in_stack_00000060 = lVar5;

-        if (iVar3 == 0) {

-          uVar4 = PsGetCurrentProcess();

-          in_stack_00000020 = in_stack_00000020 & 0xffffffff00000000;

-        }

-        else {

-          cVar2 = (&stack0x00000044)[lVar6];

-          uVar4 = PsGetCurrentProcess();

-          in_stack_00000020 = CONCAT44(uVar8,-(uint)(cVar2 != '\0')) & 0xffffffff80000000;

-          lVar5 = in_stack_00000060;

-        }

-        unaff_R13 = in_stack_00000058;

-        unaff_EBX = ObDuplicateObject(uVar4,lVar5,in_stack_00000058,plVar1,in_stack_00000020);

-        if (unaff_EBX < 0) {

-          in_stack_000000e0 = 0;

-          in_stack_000000e8 = 0;

-          in_stack_000000f0 = 0;

-          in_stack_000000f8 = 0;

-          in_stack_00000100 = 0;

-          in_stack_00000108 = 0;

-          KeStackAttachProcess(unaff_R13,&stack0x000000e0);

-          while (0 < lVar6) {

-            lVar6 = lVar6 + -1;

-            ObCloseHandle(**(undefined8 **)(&stack0x00000048 + lVar6 * 8),1);

-          }

-          KeUnstackDetachProcess(&stack0x000000e0);

-          break;

-        }

-      }

-      lVar6 = lVar6 + 1;

-      unaff_R13 = in_stack_00000058;

-    } while (lVar6 < (longlong)uVar7);

-  }

-  if (unaff_R13 != (CActivationObject *)0x0) {

-    CActivationObject::Destroy(unaff_R13);

-  }

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

-    GreUnlockDwmState();

-  }

-  lVar6 = in_stack_00000068;

-  if (-1 < unaff_EBX) {

-    in_stack_00000060 = unaff_R14 + 0x28;

-    uStack0000000000000090 = (undefined2)unaff_R14;

-    uStack0000000000000092 = (undefined2)in_stack_00000060;

-    uStack0000000000000094 = 0x8000;

-    unaff_EBX = LpcSendWaitReceivePort

-                          (in_stack_00000068,0x20000,&stack0x00000090,&stack0x00000090,

-                           &stack0x00000060);

-    if ((unaff_EBX == 0xc0) || (unaff_EBX == 0x102)) {

-      unaff_EBX = -0x3fffffff;

-    }

-    if (-1 < unaff_EBX) {

-      if (uVar7 != 0) {

-        lVar5 = 0;

-        do {

-          **(undefined8 **)(&stack0x00000048 + lVar5 * 8) = 0;

-          lVar5 = lVar5 + 1;

-        } while (lVar5 < (longlong)uVar7);

-      }

-      RtlCopyToUser(in_stack_00000078,&stack0x000000b8);

-    }

-  }

-  if (lVar6 != 0) {

-    ObfDereferenceObject(lVar6);

-  }

-  return unaff_EBX;

+  return iVar2;

 }
```

## `RIMIDEGetTimeStampDelta`  (modified)

```diff
--- RIMIDEGetTimeStampDelta
+++ RIMIDEGetTimeStampDelta
@@ -1,15 +1,213 @@
 

-void RIMIDEGetTimeStampDelta(void)

+int RIMIDEGetTimeStampDelta(longlong param_1,longlong param_2,uint *param_3)

 

 {

-  undefined1 *puStack0000000000000028;

-  undefined1 *puStack0000000000000038;

-  undefined1 *puStack0000000000000048;

+  int iVar1;

+  int iVar2;

+  uint uVar3;

+  ulonglong uVar4;

+  longlong lVar5;

+  int iVar6;

+  int iVar7;

+  undefined4 *puVar8;

+  longlong lVar9;

+  longlong *plVar10;

+  longlong lVar11;

+  longlong lVar12;

+  uint uVar13;

+  char cVar14;

+  undefined4 uVar15;

+  undefined8 uVar16;

+  ulonglong uVar17;

+  char cVar18;

+  bool bVar19;

+  bool bVar20;

+  undefined2 uVar21;

+  undefined8 in_stack_ffffffffffffff78;

+  undefined8 in_stack_ffffffffffffff80;

+  undefined4 uVar22;

   

-  puStack0000000000000048 = &stack0x000000d0;

-  puStack0000000000000038 = &stack0x000000c8;

-  puStack0000000000000028 = &stack0x000000c0;

-  WppAutoLogTrace();

-  return;

+  uVar15 = (undefined4)((ulonglong)in_stack_ffffffffffffff78 >> 0x20);

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

+  uVar4 = *(ulonglong *)(param_2 + 0x50);

+  puVar8 = (undefined4 *)(param_1 + 0x100);

+  iVar1 = *(int *)(param_2 + 0x40);

+  cVar18 = '\0';

+  cVar14 = '\x01';

+  if (param_1 == 0) {

+    puVar8 = (undefined4 *)&DAT_0;

+  }

+  if (-1 < (char)*puVar8) {

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

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

+    {

+      cVar18 = '\x01';

+    }

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

+    if ((cVar18 != '\0') || (bVar19)) {

+      lVar9 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar18,bVar19,

+                 *(undefined8 *)(lVar9 + 0x4c18),2,1,0x3c,

+                 &WPP_6794869bd9573b23ff3f3780c9428dd5_Traceguids);

+    }

+    return 0;

+  }

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

+  plVar10 = (longlong *)(param_1 + 0x210);

+  if (param_1 == 0) {

+    plVar10 = (longlong *)&DAT_1;

+  }

+  lVar5 = *(longlong *)(lVar9 + 0x30);

+  iVar2 = *(int *)(lVar9 + 0x1c);

+  lVar12 = *plVar10;

+  bVar19 = false;

+  if (*(int *)(lVar12 + 0x400) == 0) {

+    *(undefined8 *)(lVar9 + 0x14) = 0;

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

+    *(undefined4 *)(lVar9 + 0x24) = 0;

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

+    *(undefined8 *)(lVar9 + 0x30) = 0;

+    *(undefined4 *)(lVar9 + 0x38) = 0;

+  }

+  if ((((iVar1 != 0) && (uVar4 != 0)) || ((*(int *)(lVar9 + 0x14) != 0 && (uVar4 != 0)))) ||

+     ((*(longlong *)(lVar9 + 0x28) != 0 && (iVar1 != 0)))) {

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

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

+    {

+      cVar14 = '\0';

+    }

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

+    if ((cVar14 == '\0') && (!bVar19)) {

+      return 0;

+    }

+    lVar9 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_didi

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,bVar19,

+               *(undefined8 *)(lVar9 + 0x4c18));

+    return 0;

+  }

+  iVar7 = 1;

+  if ((uVar4 == 0) && (*(longlong *)(lVar9 + 0x28) == 0)) {

+    if (((*(int *)(lVar12 + 0x400) != 0) || (bVar19 = true, iVar1 != 0)) &&

+       ((((iVar2 != 0 || (iVar1 != 0)) && (!bVar19)) &&

+        ((((iVar2 == 0 && (iVar1 != 0)) && (*(int *)(lVar9 + 0x24) == 0)) ||

+         ((iVar1 == iVar2 || (*(uint *)(lVar12 + 0x328) < (uint)(iVar1 - iVar2))))))))) {

+      iVar7 = 0;

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

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

+         ) {

+        cVar18 = '\x01';

+      }

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

+      if ((cVar18 != '\0') || (bVar19)) {

+        lVar11 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_Dd

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar18,bVar19,

+                   *(undefined8 *)(lVar11 + 0x4c18),2,1,0x3e,

+                   &WPP_6794869bd9573b23ff3f3780c9428dd5_Traceguids,CONCAT44(uVar15,iVar1),

+                   CONCAT44(uVar22,iVar2));

+      }

+    }

+    bVar19 = true;

+    if (iVar7 == 0) {

+      return 0;

+    }

+    uVar13 = (iVar1 - *(int *)(lVar9 + 0x14)) * 10;

+    iVar6 = RIMIDEGetQpcBasedTouchStackTime();

+    if (*(int *)(lVar12 + 0x400) == 0) {

+      *(int *)(lVar9 + 0x14) = iVar1;

+      *(int *)(lVar9 + 0x18) = iVar6;

+LAB_2:

+      uVar13 = 0;

+      goto LAB_3;

+    }

+    if (uVar13 != 0) goto LAB_3;

+    uVar3 = *(uint *)(lVar9 + 0x20);

+    uVar13 = iVar6 - *(int *)(lVar9 + 0x18);

+    if (uVar3 < uVar13) goto LAB_3;

+    if (uVar3 - uVar13 < 5) {

+      uVar13 = uVar3 + 1;

+      goto LAB_3;

+    }

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

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

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

+      cVar18 = '\0';

+    }

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

+    if ((cVar18 == '\0') && (iVar7 = 0, !bVar20)) goto LAB_3;

+    lVar12 = W32GetUserSessionState();

+    uVar16 = *(undefined8 *)(lVar12 + 0x4c18);

+    uVar21 = 0x40;

+  }

+  else {

+    bVar19 = false;

+    uVar17 = uVar4;

+    iVar7 = RIMIDEValidateInjectionQpcCount

+                      (uVar4,lVar5,lVar12,*(int *)(lVar12 + 0x400) == 0,

+                       *(undefined4 *)(lVar9 + 0x38));

+    if (iVar7 == 0) {

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

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

+         ) {

+        cVar18 = '\x01';

+      }

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

+      if ((cVar18 == '\0') && (!bVar19)) {

+        return 0;

+      }

+      lVar9 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_ii

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar18,bVar19,

+                 *(undefined8 *)(lVar9 + 0x4c18),2,1,0x3f,

+                 &WPP_6794869bd9573b23ff3f3780c9428dd5_Traceguids,uVar4,lVar5);

+      return 0;

+    }

+    iVar7 = 1;

+    if (uVar17 <= *(ulonglong *)(lVar9 + 0x28)) {

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

+      uVar17 = uVar4;

+    }

+    uVar13 = (uint)(((uVar17 - *(longlong *)(lVar9 + 0x28)) * 10000) / gliQpcFreq);

+    if (*(int *)(lVar12 + 0x400) == 0) {

+      *(ulonglong *)(lVar9 + 0x28) = uVar17;

+      goto LAB_2;

+    }

+    if (uVar13 != *(uint *)(lVar9 + 0x20)) goto LAB_3;

+    iVar7 = 0;

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

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

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

+      cVar18 = '\0';

+    }

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

+    if ((cVar18 == '\0') && (!bVar20)) goto LAB_3;

+    lVar12 = W32GetUserSessionState();

+    uVar16 = *(undefined8 *)(lVar12 + 0x4c18);

+    uVar21 = 0x41;

+  }

+  iVar7 = 0;

+  WPP_RECORDER_AND_TRACE_SF_

+            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar18,bVar20,uVar16,2,1,uVar21,

+             &WPP_6794869bd9573b23ff3f3780c9428dd5_Traceguids);

+LAB_3:

+  *(uint *)(lVar9 + 0x20) = uVar13;

+  if (bVar19) {

+    if ((iVar2 == 0) || (uVar15 = 1, iVar1 != 0)) {

+      uVar15 = 0;

+    }

+    *(undefined4 *)(lVar9 + 0x24) = uVar15;

+    *(int *)(lVar9 + 0x1c) = iVar1;

+  }

+  else {

+    if ((lVar5 == 0) || (uVar15 = 1, uVar4 != 0)) {

+      uVar15 = 0;

+    }

+    *(undefined4 *)(lVar9 + 0x38) = uVar15;

+    *(ulonglong *)(lVar9 + 0x30) = uVar4;

+  }

+  *param_3 = uVar13;

+  return iVar7;

 }
```

## `W32CalloutDispatchWorker`  (modified)

```diff
--- W32CalloutDispatchWorker
+++ W32CalloutDispatchWorker
@@ -1,16 +1,293 @@
 

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

 

-undefined4 W32CalloutDispatchWorker(void)

+long W32CalloutDispatchWorker(int param_1,_WIN32_OKAYTOCLOSEMETHOD_PARAMETERS *param_2)

 

 {

-  undefined4 uVar1;

-  longlong in_RAX;

-  longlong unaff_R14;

+  char cVar1;

+  int iVar2;

+  long lVar3;

+  longlong lVar4;

+  undefined8 uVar5;

+  code *pcVar6;

+  longlong lVar7;

+  longlong *plVar8;

+  long lVar9;

+  CTempW32ThreadNonPaged local_c8 [192];

   

-  uVar1 = (**(code **)(in_RAX + 0x78))();

-  ExReleasePushLockSharedEx(unaff_R14 + 8,2);

-  KeLeaveCriticalRegion();

-  return uVar1;

+  CTempW32ThreadNonPaged::CTempW32ThreadNonPaged(local_c8);

+  iVar2 = IsGreIsCurrentProcessSystemCriticalSupported();

+  lVar9 = 0;

+  if (((iVar2 < 0) || (iVar2 = GreIsCurrentProcessSystemCritical(), iVar2 == 0)) || (param_1 == 0))

+  {

+    if (param_1 != 1) {

+      lVar3 = lVar9;

+      if (0x19 < param_1) {

+        if (param_1 < 0x24) {

+          if (param_1 != 0x23) {

+            if (param_1 == 0x1a) {

+              lVar3 = W32pQuerySubsystemProcess

+                                ((_WIN32_SUBSYSTEM_PROCESS_QUERY_CALLOUT_PARAMETERS *)param_2);

+              goto LAB_0;

+            }

+            if ((((param_1 == 0x1b) || (param_1 == 0x1c)) || (param_1 == 0x1d)) || (param_1 == 0x1e)

+               ) {

+              lVar3 = RIMObjectManagerCallout(param_1,param_2);

+              goto LAB_0;

+            }

+            if (param_1 == 0x1f) {

+              lVar4 = W32GetWin32kBaseApiSetTable();

+              pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x9e0);

+              if (pcVar6 != (code *)0x0) {

+                lVar3 = (*pcVar6)();

+                goto LAB_0;

+              }

+              goto LAB_1;

+            }

+            if (param_1 == 0x20) {

+              lVar4 = W32GetUserSessionState();

+              lVar7 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                                (lVar4,1,0,

+                                 <lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+              *(longlong *)(lVar4 + 0x10) = lVar7;

+              if ((lVar7 != 0) &&

+                 (cVar1 = UserCritInternal::`anonymous_namespace'::IsValidGuiContext(lVar7),

+                 cVar1 != '\0')) {

+                DestroySharedUserCritDeferredUnlockList(lVar4 + 0x4d78);

+                DestroyDeferredUnlockObjectAssignmentList(lVar4 + 0x4db0);

+                DestroyDeferredUnlockObjectAssignmentList(lVar4 + 0x4da0);

+              }

+              iVar2 = _IsProcessDwm(*(_EPROCESS **)(param_2 + 0x10));

+              if (iVar2 != 0) {

+                lVar4 = W32GetUserSessionState();

+                *(undefined4 *)(lVar4 + 0x49e8) = 1;

+              }

+LAB_2:

+              ReleaseUserCriticalSection();

+              lVar3 = 0;

+              goto LAB_0;

+            }

+            if ((param_1 != 0x21) && (param_1 != 0x22)) goto LAB_3;

+          }

+        }

+        else if (param_1 != 0x24) {

+          if (((param_1 == 0x25) || (param_1 == 0x26)) || ((param_1 == 0x27 || (param_1 == 0x28))))

+          {

+            if (param_1 == 0x25) {

+              lVar3 = ActivationObjectOpen((_WIN32_OPENMETHOD_PARAMETERS *)param_2);

+            }

+            else if (param_1 == 0x26) {

+              lVar3 = ActivationObjectOkToClose(param_2);

+            }

+            else if (param_1 != 0x27) {

+              if (param_1 == 0x28) {

+                lVar3 = ActivationObjectDelete((_WIN32_DELETEMETHOD_PARAMETERS *)param_2);

+              }

+              else {

+                lVar3 = -0x3ffffff3;

+              }

+            }

+          }

+          else if (param_1 == 0x29) {

+            lVar3 = UserProcessTimerDelayCallout(param_2);

+          }

+          else if (param_1 == 0x2a) {

+            lVar3 = UserProcessTimerStatisticsCallout(param_2);

+          }

+          else if (param_1 == 0x2b) {

+            DxNotifyProcessFreezeCallout(*(undefined8 *)(param_2 + 0x10));

+          }

+          else {

+            if (param_1 != 0x2c) goto LAB_3;

+            DxNotifyProcessThawCallout(*(undefined8 *)(param_2 + 0x10));

+          }

+          goto LAB_0;

+        }

+        lVar3 = CoreMsgObjectCallout(param_1,param_2);

+        goto LAB_0;

+      }

+      if (param_1 == 0x19) {

+        DxGetGpuUsageStatistics(param_2 + 0x10);

+        goto LAB_0;

+      }

+      if (0xc < param_1) {

+        if (param_1 == 0xd) {

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x3a8);

+          if ((pcVar6 != (code *)0x0) && (iVar2 = (*pcVar6)(), -1 < iVar2)) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x3b0);

+            goto LAB_4;

+          }

+        }

+        else if (param_1 == 0xe) {

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x3b8);

+          if ((pcVar6 != (code *)0x0) && (iVar2 = (*pcVar6)(), -1 < iVar2)) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x3c0);

+            goto LAB_4;

+          }

+        }

+        else {

+          if (param_1 == 0xf) {

+            lVar3 = ParseWindowStation(param_2);

+            goto LAB_0;

+          }

+          if (param_1 != 0x10) {

+            if (param_1 == 0x12) {

+              lVar3 = CompositionObject::Open((_WIN32_OPENMETHOD_PARAMETERS *)param_2);

+            }

+            else if (param_1 == 0x13) {

+              lVar3 = CompositionObject::OkToClose(param_2);

+            }

+            else {

+              if (param_1 == 0x14) {

+                plVar8 = *(longlong **)(*(longlong *)(param_2 + 0x18) + 8);

+                pcVar6 = *(code **)(*plVar8 + 0x28);

+              }

+              else {

+                if (param_1 != 0x15) {

+                  if (param_1 != 0x18) goto LAB_3;

+                  DxGetProcessInterferenceCount

+                            (*(undefined8 *)(param_2 + 0x10),*(undefined8 *)(param_2 + 0x18));

+                  goto LAB_0;

+                }

+                plVar8 = *(longlong **)(*(longlong *)(param_2 + 0x10) + 8);

+                if (plVar8 == (longlong *)0x0) goto LAB_0;

+                pcVar6 = *(code **)(*plVar8 + 0x30);

+              }

+              lVar3 = (*pcVar6)(plVar8,param_2);

+            }

+            goto LAB_0;

+          }

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x3c8);

+          if ((pcVar6 != (code *)0x0) && (iVar2 = (*pcVar6)(), -1 < iVar2)) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x3d0);

+            goto LAB_4;

+          }

+        }

+        goto LAB_1;

+      }

+      if (param_1 == 0xc) {

+        lVar4 = W32GetWin32kBaseApiSetTable();

+        pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x310);

+        if ((pcVar6 == (code *)0x0) || (iVar2 = (*pcVar6)(), iVar2 < 0)) goto LAB_1;

+        lVar4 = W32GetWin32kBaseApiSetTable();

+        pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x318);

+LAB_4:

+        if (pcVar6 != (code *)0x0) {

+          lVar3 = (*pcVar6)(param_2);

+          goto LAB_0;

+        }

+      }

+      else {

+        if (param_1 < 8) {

+          if (param_1 == 7) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x18) + 0x9e8);

+            lVar3 = 0;

+            if ((pcVar6 != (code *)0x0) && (iVar2 = (*pcVar6)(), lVar3 = lVar9, -1 < iVar2)) {

+              lVar4 = W32GetWin32kBaseApiSetTable();

+              pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x18) + 0x9f0);

+              if (pcVar6 != (code *)0x0) {

+                (*pcVar6)();

+              }

+            }

+            goto LAB_0;

+          }

+          if (param_1 != 0) {

+            if (param_1 != 2) {

+              if (param_1 == 3) {

+                lVar3 = UserPowerEventCallout(param_2);

+              }

+              else if (param_1 == 4) {

+                lVar3 = UserPowerStateCallout(param_2);

+              }

+              else {

+                if (param_1 != 5) goto LAB_3;

+                lVar3 = UserPowerInfoCallout

+                                  (*(undefined4 *)(param_2 + 0x10),param_2[0x14],

+                                   *(undefined4 *)(param_2 + 0x18),*(undefined8 *)(param_2 + 0x20),

+                                   *(undefined4 *)(param_2 + 0x28),*(undefined8 *)(param_2 + 0x30));

+              }

+              goto LAB_0;

+            }

+            EnterSharedCrit(1);

+            uVar5 = UserGlobalAtomTableCallout();

+            *(undefined8 *)(param_2 + 0x10) = uVar5;

+            goto LAB_2;

+          }

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x238);

+          if ((pcVar6 == (code *)0x0) || (iVar2 = (*pcVar6)(), iVar2 < 0)) {

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

+          }

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x240);

+          goto LAB_4;

+        }

+        if (param_1 == 8) {

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x2d0);

+          if ((pcVar6 != (code *)0x0) && (iVar2 = (*pcVar6)(), -1 < iVar2)) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x2d8);

+            goto LAB_4;

+          }

+        }

+        else if (param_1 == 9) {

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x2e0);

+          if ((pcVar6 != (code *)0x0) && (iVar2 = (*pcVar6)(), -1 < iVar2)) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x2e8);

+            goto LAB_4;

+          }

+        }

+        else if (param_1 == 10) {

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x2f0);

+          if ((pcVar6 != (code *)0x0) && (iVar2 = (*pcVar6)(), -1 < iVar2)) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x2f8);

+            goto LAB_4;

+          }

+        }

+        else {

+          if (param_1 != 0xb) {

+LAB_3:

+            CTempW32ThreadNonPaged::~CTempW32ThreadNonPaged(local_c8);

+            return -0x3fffff45;

+          }

+          lVar4 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x300);

+          if ((pcVar6 != (code *)0x0) && (iVar2 = (*pcVar6)(), -1 < iVar2)) {

+            lVar4 = W32GetWin32kBaseApiSetTable();

+            pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x308);

+            goto LAB_4;

+          }

+        }

+      }

+LAB_1:

+      lVar3 = -0x3fffff45;

+      goto LAB_0;

+    }

+  }

+  else if (param_1 != 1) {

+    lVar3 = -0x3ffff8e4;

+    goto LAB_0;

+  }

+  lVar4 = W32GetWin32kBaseApiSetTable();

+  pcVar6 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x248);

+  if ((pcVar6 == (code *)0x0) || (iVar2 = (*pcVar6)(), iVar2 < 0)) {

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

+  }

+  lVar3 = W32pThreadCallout(*(undefined8 *)(param_2 + 0x10),*(undefined4 *)(param_2 + 0x18));

+LAB_0:

+  CTempW32ThreadNonPaged::~CTempW32ThreadNonPaged(local_c8);

+  return lVar3;

 }
```

## `UserGetDesktopDC`  (modified)

```diff
--- UserGetDesktopDC
+++ UserGetDesktopDC
@@ -1,42 +1,69 @@
 

-HDC UserGetDesktopDC(void)

+HDC UserGetDesktopDC(int param_1,int param_2,int param_3)

 

 {

-  void *pvVar1;

-  char cVar2;

-  int in_EAX;

-  longlong lVar3;

-  longlong lVar4;

-  tagTHREADINFO *ptVar5;

-  HDC pHVar6;

-  int unaff_ESI;

-  undefined8 in_R9;

-  HDC unaff_R12;

-  char in_stack_00000078;

+  undefined8 uVar1;

+  undefined8 *puVar2;

+  void *pvVar3;

+  bool bVar4;

+  char cVar5;

+  int iVar6;

+  tagTHREADINFO *ptVar7;

+  longlong lVar8;

+  longlong lVar9;

+  HDC pHVar10;

+  HDC pHVar11;

+  ReEnterLeaveCrit local_res20 [8];

   

-  if (in_EAX == 0) {

-    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x8a3,in_R9,0x20000);

+  ReEnterLeaveCrit::ReEnterLeaveCrit(local_res20);

+  ptVar7 = PtiCurrent();

+  lVar8 = W32GetUserSessionState();

+  uVar1 = *(undefined8 *)(*(longlong *)(lVar8 + 0xdf10) + 0x30);

+  iVar6 = Feature_LearningModeExpansion__private_IsEnabledDeviceUsageNoInline();

+  pHVar10 = (HDC)0x0;

+  if (iVar6 == 0) {

+    bVar4 = tagPROCESSINFO::HasUILimit(*(tagPROCESSINFO **)(ptVar7 + 0x1d0),1);

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

+      puVar2 = *(undefined8 **)(*(longlong *)(*(longlong *)(ptVar7 + 0x1f0) + 8) + 0x18);

+      pHVar11 = pHVar10;

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

+        pHVar11 = (HDC)*puVar2;

+      }

+      lVar8 = ValidateHwndEx(pHVar11,1,0);

+      if (lVar8 == 0) goto LAB_0;

+    }

   }

-  pvVar1 = SystemReserved1[0xf];

-  if ((unaff_ESI == 0) && (cVar2 = PsIsSystemThread(SystemReserved1[0xf]), cVar2 == '\0')) {

-    lVar3 = W32GetUserGdiSessionState();

-    lVar3 = *(longlong *)(lVar3 + 0x28);

-    lVar4 = PsGetThreadProcess(pvVar1);

-    if (lVar4 != lVar3) {

-      ptVar5 = PtiCurrent();

-      pHVar6 = unaff_R12;

-      if (*(longlong *)(ptVar5 + 0x1f0) != 0) {

-        pHVar6 = _GetDCEx(*(HWND *)(*(longlong *)(*(longlong *)(ptVar5 + 0x1f0) + 8) + 0x18),

-                          (HRGN)0x0,0x80800003);

+  else if (((param_3 != 0) && (param_1 != 2)) &&

+          (bVar4 = tagPROCESSINFO::HasUILimit(*(tagPROCESSINFO **)(ptVar7 + 0x1d0),1), bVar4)) {

+    puVar2 = *(undefined8 **)(*(longlong *)(*(longlong *)(ptVar7 + 0x1f0) + 8) + 0x18);

+    pHVar11 = pHVar10;

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

+      pHVar11 = (HDC)*puVar2;

+    }

+    lVar8 = ValidateHwndEx(pHVar11,1,0);

+    if (lVar8 == 0) {

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

+    }

+  }

+  pvVar3 = SystemReserved1[0xf];

+  if ((param_1 == 0) && (cVar5 = PsIsSystemThread(SystemReserved1[0xf]), cVar5 == '\0')) {

+    lVar8 = W32GetUserGdiSessionState();

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

+    lVar9 = PsGetThreadProcess(pvVar3);

+    if (lVar9 != lVar8) {

+      ptVar7 = PtiCurrent();

+      if (*(longlong *)(ptVar7 + 0x1f0) != 0) {

+        pHVar10 = _GetDCEx(*(HWND *)(*(longlong *)(*(longlong *)(ptVar7 + 0x1f0) + 8) + 0x18),

+                           (HRGN)0x0,0x80800003);

       }

       goto LAB_0;

     }

   }

-  pHVar6 = (HDC)GreCreateDisplayDC();

+  pHVar10 = (HDC)GreCreateDisplayDC(uVar1,param_1,param_2 != 0);

 LAB_0:

-  if (in_stack_00000078 == (char)unaff_R12) {

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

     ReleaseUserCriticalSection();

   }

-  return pHVar6;

+  return pHVar10;

 }
```

## `ReportUsageForAllVelocityKeys`  (modified)

```diff
--- ReportUsageForAllVelocityKeys
+++ ReportUsageForAllVelocityKeys
@@ -1,29 +1,66 @@
+

+/* void __cdecl ReportUsageForAllVelocityKeys(void) */

 

 void __cdecl ReportUsageForAllVelocityKeys(void)

 

 {

-  undefined8 in_RAX;

-  longlong lVar1;

-  int unaff_EBX;

-  longlong unaff_RBP;

-  undefined4 uStack0000000000000030;

-  undefined4 in_stack_00000034;

-  undefined8 uStack0000000000000038;

-  undefined8 uStack0000000000000040;

+  undefined8 uVar1;

   

-  uStack0000000000000030 = (undefined4)in_RAX;

-  uStack0000000000000038 = in_RAX;

-  uStack0000000000000040 = in_RAX;

-  lVar1 = W32GetUserSessionState();

-  if (*(longlong *)(lVar1 + 0xdf10) != 0) {

-    lVar1 = W32GetUserSessionState();

-    tagKERNELDISPLAYINFO::operator=

-              ((tagKERNELDISPLAYINFO *)(unaff_RBP + 0x70),*(tagKERNELDISPLAYINFO **)(lVar1 + 0xdf10)

-              );

-  }

-  DrvCollectDriverFailureData(&stack0x00000030,unaff_RBP + -0x70);

-                    /* WARNING: Subroutine does not return */

-  KeBugCheckEx(0xb4,CONCAT44(in_stack_00000034,uStack0000000000000030),uStack0000000000000038,

-               uStack0000000000000040,(longlong)unaff_EBX);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_N__private_featureState,

+                     &Feature_GE_EssentialsBundle_N__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_N__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_O__private_featureState,

+                     &Feature_GE_EssentialsBundle_O__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_O__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_P__private_featureState,

+                     &Feature_GE_EssentialsBundle_P__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_P__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_Q__private_featureState,

+                     &Feature_GE_EssentialsBundle_Q__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_Q__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_R__private_featureState,

+                     &Feature_GE_EssentialsBundle_R__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_R__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_S__private_featureState,

+                     &Feature_GE_EssentialsBundle_S__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_S__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_T__private_featureState,

+                     &Feature_GE_EssentialsBundle_T__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_T__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_U__private_featureState,

+                     &Feature_GE_EssentialsBundle_U__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_U__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_GE_EssentialsBundle_V__private_featureState,

+                     &Feature_GE_EssentialsBundle_V__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_GE_EssentialsBundle_V__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_VelTest_KM_ControlledByProxy_DBD_2__private_featureState,

+                     &Feature_VelTest_KM_ControlledByProxy_DBD_2__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_VelTest_KM_ControlledByProxy_DBD_2__private_descriptor,uVar1,1,1);

+  uVar1 = wil_details_FeatureStateCache_GetCachedFeatureEnabledState

+                    (&Feature_ApplyWindowActionConvergence__private_featureState,

+                     &Feature_ApplyWindowActionConvergence__private_descriptor);

+  wil_details_FeatureReporting_ReportUsageToService

+            (&Feature_ApplyWindowActionConvergence__private_descriptor,uVar1,1,1);

+  return;

 }
```

## `ApiSetPostPointerDeviceInRangeMessage`  (modified)

```diff
--- ApiSetPostPointerDeviceInRangeMessage
+++ ApiSetPostPointerDeviceInRangeMessage
@@ -1,7 +1,27 @@
 

-void ApiSetPostPointerDeviceInRangeMessage(void)

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

+

+void ApiSetPostPointerDeviceInRangeMessage(undefined8 param_1)

 

 {

+  code *pcVar1;

+  int iVar2;

+  longlong lVar3;

+  

+  EtwTracePointerDeviceInRangeMessageStart();

+  lVar3 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar3 + 0x30) + 0x1138);

+  if (pcVar1 != (code *)0x0) {

+    iVar2 = (*pcVar1)();

+    if (-1 < iVar2) {

+      lVar3 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar3 + 0x30) + 0x1140);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)(param_1,0,0);

+      }

+    }

+  }

+  EtwTracePointerDeviceInRangeMessageStop();

   return;

 }
```

## `CreateKernelIocpWcp`  (modified)

```diff
--- CreateKernelIocpWcp
+++ xxxCreateThreadInfo
@@ -1,24 +1,853 @@
 

-undefined8 CreateKernelIocpWcp(void)

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

+/* WARNING: Removing unreachable block (ram,0x00014015b115) */

+/* WARNING: Heritage AFTER dead removal. Example location: s0xfffffffffffffeb0 : 0x00014015ac2b */

+/* WARNING: Restarted to delay deadcode elimination for space: stack */

+

+tagTHREADINFO * xxxCreateThreadInfo(undefined8 param_1)

 

 {

-  undefined8 local_res8 [4];

-  undefined8 local_38;

-  undefined8 local_30;

-  undefined8 local_28;

-  undefined8 local_20;

-  undefined8 local_18;

-  undefined8 uStack_10;

+  void *_Src;

+  code *pcVar1;

+  tagDESKTOP *ptVar2;

+  char cVar3;

+  undefined4 uVar4;

+  ulong uVar5;

+  uint uVar6;

+  ulong uVar7;

+  int iVar8;

+  LastWokenThreadTestResult LVar9;

+  int iVar10;

+  _EPROCESS *p_Var11;

+  longlong lVar12;

+  longlong *plVar13;

+  undefined8 *puVar14;

+  longlong lVar15;

+  tagTHREADINFO *ptVar16;

+  tagTHREADINFO *ptVar17;

+  undefined8 uVar18;

+  tagQ *ptVar19;

+  tagTHREADINFO **pptVar20;

+  uint *puVar21;

+  ushort *puVar22;

+  undefined8 uVar23;

+  ulonglong uVar24;

+  uint uVar25;

+  tagTHREADINFO *ptVar26;

+  undefined1 uVar27;

+  void *pvVar28;

+  _EPROCESS *p_Var29;

+  tagPROCESSINFO *ptVar30;

+  undefined4 local_res10 [2];

+  undefined8 local_res18;

+  undefined8 local_res20;

+  ulonglong in_stack_fffffffffffffe18;

+  undefined8 in_stack_fffffffffffffe20;

+  undefined4 uVar31;

+  tagDESKTOP *local_1c8;

+  undefined1 local_1a8;

+  undefined8 local_190;

+  undefined8 local_188;

+  void *local_180;

+  code *local_178;

+  AtomicExecutionCheck local_170 [8];

+  longlong local_168;

+  undefined8 local_158;

+  undefined8 local_150;

+  undefined4 local_148;

+  undefined4 local_144;

+  undefined4 local_140;

+  undefined4 local_13c;

+  uint local_138;

+  undefined4 local_134;

+  uint local_130 [2];

+  void *local_128;

+  uint local_120;

+  ushort *local_118;

+  undefined8 local_108;

+  tagDESKTOP *local_100;

+  void *local_f8;

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)> local_f0 [24];

+  tagTHREADINFO *local_d8;

+  undefined8 local_d0;

+  longlong local_c8;

+  undefined8 local_c0;

+  longlong local_b8;

+  undefined8 local_b0;

+  tagTHREADINFO *local_a8;

+  undefined8 local_a0;

+  AtomicExecutionCheck local_98 [8];

+  longlong local_90;

+  undefined8 local_88;

+  undefined8 uStack_80;

+  undefined8 local_78;

+  undefined8 uStack_70;

+  tagDESKTOP *local_68;

+  undefined8 uStack_60;

   

-                    /* 0x15e600  1005  CreateKernelIocpWcp */

-  local_38 = 0x30;

-  local_20 = 0x200;

-  local_30 = 0;

-  local_28 = 0;

-  local_res8[0] = 0;

-  local_18 = 0;

-  uStack_10 = 0;

-  ZwCreateWaitCompletionPacket(local_res8,1,&local_38);

-  return local_res8[0];

+  uVar31 = (undefined4)((ulonglong)in_stack_fffffffffffffe20 >> 0x20);

+  p_Var11 = (_EPROCESS *)PsGetThreadProcess();

+  memset(&local_158,0,0x48);

+  local_1c8 = (tagDESKTOP *)0x0;

+  local_190 = 0;

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>::

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>

+            ((Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)> *)

+             &local_188);

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>::

+  Win32RawOptionalLockedItem<_devicemodeW,&void___cdecl_Win32FreePool(void*___ptr64)>(local_f0);

+  local_f8 = (void *)0x0;

+  local_88 = 0;

+  uStack_80 = 0;

+  local_78 = 0;

+  uStack_70 = 0;

+  local_68 = (tagDESKTOP *)0x0;

+  uStack_60 = 0;

+  if (Microsoft_Windows_Win32kEnableBits._1_1_ < '\0') {

+    McTemplateK0_EtwWriteTransfer();

+  }

+  lVar12 = W32GetUserSessionState();

+  uVar7 = 0;

+  if (((*(int *)(lVar12 + 0x8ec8) != 0) ||

+      (plVar13 = (longlong *)PsGetCurrentProcessWin32Process(), plVar13 == (longlong *)0x0)) ||

+     (((ulonglong)plVar13 & -(ulonglong)(*plVar13 != 0)) == 0)) {

+    Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>::

+    ~Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+              ((Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+                *)local_f0);

+    Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>::

+    ~Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+              ((Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+                *)&local_188);

+    return (tagTHREADINFO *)0xc000010a;

+  }

+  lVar12 = W32GetUserSessionState(-*plVar13);

+  *(int *)(lVar12 + 0x8ed0) = *(int *)(lVar12 + 0x8ed0) + 1;

+  lVar12 = W32GetUserGdiSessionState();

+  uVar6 = 0x2000048;

+  if (p_Var11 != *(_EPROCESS **)(lVar12 + 0x28)) {

+    uVar6 = 0;

+  }

+  puVar14 = (undefined8 *)PsGetThreadWin32Thread(param_1);

+  ptVar16 = (tagTHREADINFO *)0x0;

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

+    ptVar16 = (tagTHREADINFO *)*puVar14;

+  }

+  lVar15 = PsGetProcessPeb(p_Var11);

+  lVar12 = *(longlong *)(lVar15 + 0x20);

+  local_158 = *(undefined8 *)(lVar12 + 0x20);

+  local_150 = *(undefined8 *)(lVar12 + 0x28);

+  local_148 = *(undefined4 *)(lVar12 + 0x88);

+  local_144 = *(undefined4 *)(lVar12 + 0x8c);

+  local_140 = *(undefined4 *)(lVar12 + 0x90);

+  local_13c = *(undefined4 *)(lVar12 + 0x94);

+  local_138 = *(uint *)(lVar12 + 0xa4);

+  local_134 = *(undefined4 *)(lVar12 + 0xa8);

+  puVar21 = (uint *)(lVar12 + 0xc0);

+  if (*(uint **)MmUserProbeAddress_exref <= (uint *)(lVar12 + 0xc0)) {

+    puVar21 = *(uint **)MmUserProbeAddress_exref;

+  }

+  local_130[0] = *puVar21;

+  local_res18._4_4_ = (undefined4)((ulonglong)lVar15 >> 0x20);

+  _Src = *(void **)(puVar21 + 2);

+  if ((ushort)local_130[0] != 0) {

+    local_128 = _Src;

+    local_res18._0_4_ = local_130[0];

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

+                    /* WARNING: Subroutine does not return */

+      ExRaiseDatatypeMisalignment();

+    }

+    pvVar28 = (void *)((longlong)_Src + (ulonglong)(local_130[0] & 0xffff) + 2);

+    if ((pvVar28 <= _Src) || (*(void **)MmUserProbeAddress_exref <= pvVar28)) {

+                    /* WARNING: Subroutine does not return */

+      ExRaiseAccessViolation();

+    }

+    local_res18._2_2_ = (ushort)(local_130[0] >> 0x10);

+    if (local_res18._2_2_ < (ushort)local_130[0]) {

+      if ((local_130[0] & 1) == 0) goto LAB_0;

+    }

+    else if ((local_130[0] & 1) == 0) {

+      pvVar28 = Win32AllocPoolWithQuotaZInitImpl

+                          ((ulonglong)local_130[0],(ulonglong)(local_130[0] & 0xffff),0x79747355);

+      local_128 = pvVar28;

+      local_f8 = pvVar28;

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

+                    /* WARNING: Subroutine does not return */

+        ExRaiseStatus(0xc0000017);

+      }

+      if (local_178 != (code *)0xffffffffffffffff) {

+        ptVar16 = PtiCurrent();

+                    /* WARNING: Subroutine does not return */

+        KeBugCheckEx(0x164,0x12,&local_188,pvVar28,ptVar16);

+      }

+      ptVar17 = PtiCurrent();

+      local_188 = *(undefined8 *)(ptVar17 + 0x180);

+      *(undefined8 **)(ptVar17 + 0x180) = &local_188;

+      local_178 = GreDeleteFastMutex;

+      local_180 = pvVar28;

+      memmove(local_128,_Src,(ulonglong)(ushort)local_130[0]);

+      goto LAB_1;

+    }

+    local_res10[0] = 0x20000;

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

+LAB_0:

+                    /* WARNING: Subroutine does not return */

+    ExRaiseAccessViolation();

+  }

+  local_128 = (void *)0x0;

+LAB_1:

+  puVar21 = (uint *)(lVar12 + 0xd0);

+  if (*(uint **)MmUserProbeAddress_exref <= (uint *)(lVar12 + 0xd0)) {

+    puVar21 = *(uint **)MmUserProbeAddress_exref;

+  }

+  local_120 = *puVar21;

+  local_118 = *(ushort **)(puVar21 + 2);

+  local_res18._0_4_ = local_120;

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

+                    /* WARNING: Subroutine does not return */

+    ExRaiseDatatypeMisalignment();

+  }

+  puVar22 = (ushort *)((ulonglong)(ushort)local_120 + 2 + (longlong)local_118);

+  if ((puVar22 <= local_118) || (*(ushort **)MmUserProbeAddress_exref <= puVar22)) {

+                    /* WARNING: Subroutine does not return */

+    ExRaiseAccessViolation();

+  }

+  local_res18._2_2_ = (ushort)(local_120 >> 0x10);

+  if (local_res18._2_2_ < (ushort)local_120) {

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

+  }

+  else if ((local_120 & 1) == 0) {

+    plVar13 = (longlong *)PsGetCurrentProcessWin32Process();

+    ptVar30 = (tagPROCESSINFO *)0x0;

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

+      ptVar30 = (tagPROCESSINFO *)((ulonglong)plVar13 & -(ulonglong)(*plVar13 != 0));

+    }

+    uVar25 = uVar6 | 0x100;

+    if (((byte)ptVar30[0xc] & 0x80) == 0) {

+      uVar25 = uVar6;

+    }

+    lVar12 = PsGetThreadProcessId(param_1);

+    lVar15 = W32GetUserSessionState();

+    uVar6 = uVar25 | 0x2000000;

+    if (*(longlong *)(lVar15 + 0xf8c0) != lVar12) {

+      uVar6 = uVar25;

+    }

+    local_res18 = CONCAT44(local_res18._4_4_,uVar6);

+    LOCK();

+    *(uint *)(ptVar16 + 0x210) = *(uint *)(ptVar16 + 0x210) | uVar6;

+    UNLOCK();

+    lVar12 = W32GetUserSessionState();

+    if ((char)*(undefined4 *)(lVar12 + 0x10658) < '\0') {

+      lVar12 = W32GetUserSessionState();

+      if (*(longlong *)(lVar12 + 0x37b8) != 0) {

+        lVar12 = W32GetUserSessionState();

+        lVar12 = _HMPheFromObject(*(undefined8 *)(lVar12 + 0x37b8));

+        if ((*(byte *)(lVar12 + 0x19) & 1) != 0) {

+          local_res20 = (tagTHREADINFO *)CONCAT44(local_res20._4_4_,0x20000);

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000);

+        }

+      }

+      lVar12 = W32GetUserSessionState();

+      local_d0 = *(undefined8 *)(lVar12 + 0x37b8);

+      local_d8 = ptVar16 + 0x1e0;

+      pptVar20 = &local_d8;

+    }

+    else {

+      lVar12 = W32GetUserSessionState();

+      if (*(longlong *)(lVar12 + 0x3798) == 0) {

+        lVar12 = W32GetUserSessionState();

+        if (*(longlong *)(lVar12 + 0x37b8) == 0) {

+          lVar12 = W32GetUserSessionState();

+          if (*(longlong *)(lVar12 + 0x3970) == 0) goto LAB_3;

+          lVar12 = W32GetUserSessionState();

+          uVar18 = *(undefined8 *)(lVar12 + 0x3970);

+          local_b8 = W32GetUserSessionState();

+          local_b8 = local_b8 + 0x3798;

+          uVar23 = 0;

+          plVar13 = &local_b8;

+          local_b0 = uVar18;

+        }

+        else {

+          lVar12 = W32GetUserSessionState();

+          uVar18 = *(undefined8 *)(lVar12 + 0x37b8);

+          local_c8 = W32GetUserSessionState();

+          local_c8 = local_c8 + 0x3798;

+          uVar23 = 1;

+          plVar13 = &local_c8;

+          local_c0 = uVar18;

+        }

+        HMAssignmentLock(plVar13,uVar23);

+      }

+LAB_3:

+      lVar12 = W32GetUserSessionState();

+      if (*(longlong *)(lVar12 + 0x3798) != 0) {

+        lVar12 = W32GetUserSessionState();

+        lVar12 = _HMPheFromObject(*(undefined8 *)(lVar12 + 0x3798));

+        if ((*(byte *)(lVar12 + 0x19) & 1) != 0) {

+          local_res20 = (tagTHREADINFO *)CONCAT44(local_res20._4_4_,0x20000);

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTellMeIf",0x20000);

+        }

+      }

+      lVar12 = W32GetUserSessionState();

+      local_a0 = *(undefined8 *)(lVar12 + 0x3798);

+      local_a8 = ptVar16 + 0x1e0;

+      pptVar20 = &local_a8;

+    }

+    HMAssignmentLock(pptVar20,0);

+    *(tagTHREADINFO **)(ptVar16 + 0x1e8) = ptVar16 + 0x448;

+    if ((*(uint *)(ptVar30 + 0xc) & 0x800000) != 0) {

+      LOCK();

+      *(uint *)(ptVar16 + 0x210) = *(uint *)(ptVar16 + 0x210) | 0x2000000;

+      UNLOCK();

+    }

+    *(tagPROCESSINFO **)(ptVar16 + 0x1d0) = ptVar30;

+    *(undefined8 *)(ptVar16 + 0x2c0) = *(undefined8 *)(ptVar30 + 0x148);

+    *(tagTHREADINFO **)(ptVar30 + 0x148) = ptVar16;

+    *(int *)(ptVar30 + 0x178) = *(int *)(ptVar30 + 0x178) + 1;

+    Win32ThreadInfo = (void *)PsGetThreadId(*(undefined8 *)ptVar16);

+    local_1a8 = 0;

+    *(void ***)(ptVar16 + 0x208) = Win32ClientInfo;

+    *(undefined4 *)(*(longlong *)(ptVar16 + 0x208) + 0xe8) = *(undefined4 *)(ptVar16 + 400);

+    *(undefined4 *)(*(longlong *)(ptVar16 + 0x208) + 0xec) = 0;

+    *(longlong *)(ptVar16 + 0x198) = *(longlong *)(ptVar16 + 0x208) + 0xe8;

+    *(undefined4 *)(*(longlong *)(ptVar16 + 0x208) + 0xf0) = *(undefined4 *)(ptVar16 + 0x194);

+    *(undefined4 *)(*(longlong *)(ptVar16 + 0x208) + 0xf4) = 0;

+    *(longlong *)(ptVar16 + 0x1a0) = *(longlong *)(ptVar16 + 0x208) + 0xf0;

+    if ((*(uint *)(ptVar30 + 0xc) & 0x2000000) != 0) {

+      LOCK();

+      *(uint *)(ptVar16 + 0x210) = *(uint *)(ptVar16 + 0x210) | 0x20000000;

+      UNLOCK();

+    }

+    if (*(int *)(ptVar16 + 0x2a0) == 0) {

+      lVar12 = PsGetProcessPeb(p_Var11);

+      if (lVar12 == 0) {

+        *(undefined4 *)(ptVar16 + 0x2a0) = 0x600;

+      }

+      else {

+        uVar18 = PsGetProcessSectionBaseAddress(p_Var11);

+        uVar4 = RtlGetExpWinVer(uVar18);

+        *(undefined4 *)(ptVar16 + 0x2a0) = uVar4;

+      }

+    }

+    lVar12 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x438);

+    if (pcVar1 == (code *)0x0) {

+      iVar8 = -0x3fffff45;

+    }

+    else {

+      iVar8 = (*pcVar1)();

+    }

+    iVar10 = -0x3fffff45;

+    if (-1 < iVar8) {

+      lVar12 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x440);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)();

+      }

+    }

+    uVar24 = local_res18 & 0xc;

+    local_res18 = local_res18 & 0xffffffff0000000c;

+    if (uVar24 == 0) {

+      lVar12 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x448);

+      if (pcVar1 == (code *)0x0) {

+        iVar8 = -0x3fffff45;

+      }

+      else {

+        iVar8 = (*pcVar1)();

+      }

+      if (-1 < iVar8) {

+        lVar12 = W32GetWin32kBaseApiSetTable();

+        pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x450);

+        uVar5 = uVar7;

+        if (pcVar1 != (code *)0x0) {

+          uVar5 = (*pcVar1)(ptVar16);

+        }

+        if (uVar5 != 0) {

+          *(uint *)(ptVar30 + 0xc) = *(uint *)(ptVar30 + 0xc) | 0x1000000;

+        }

+      }

+    }

+    ptVar17 = ptVar16 + 0x2f8;

+    puVar14 = (undefined8 *)(in_stack_fffffffffffffe18 & 0xffffffffffffff00);

+    uVar27 = 0;

+    uVar6 = ZwCreateEvent(ptVar17,0x1f0003,0,1,puVar14);

+    ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+    if (-1 < (int)uVar6) {

+      uVar18 = *(undefined8 *)ExEventObjectType_exref;

+      local_108 = 0;

+      uVar31 = 0;

+      puVar14 = &local_108;

+      uVar6 = ObReferenceObjectByHandle(*(undefined8 *)ptVar17,0x1f0003,uVar18,1,puVar14,0);

+      uVar27 = (undefined1)uVar18;

+      ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+      *(undefined8 *)(ptVar16 + 0x300) = local_108;

+      if ((int)uVar6 < 0) {

+        if (uVar6 != 0xc0000008) {

+          ObCloseHandle(*(undefined8 *)ptVar17);

+        }

+      }

+      else {

+        uVar27 = (undefined1)*(undefined8 *)ExEventObjectType_exref;

+        uVar6 = ProtectHandle(*(undefined8 *)ptVar17);

+        ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+      }

+    }

+    if ((int)ptVar26 < 0) {

+      *(undefined8 *)ptVar17 = 0;

+    }

+    else {

+      local_res20 = ptVar16 + 0x660;

+      p_Var29 = p_Var11;

+      uVar6 = ObDuplicateObject(p_Var11,*(undefined8 *)ptVar17,p_Var11,local_res20,

+                                (ulonglong)puVar14 & 0xffffffff00000000,CONCAT44(uVar31,0x200),2,0);

+      uVar27 = SUB81(p_Var29,0);

+      ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+      if ((int)uVar6 < 0) {

+        *(undefined8 *)local_res20 = 0;

+      }

+      else {

+        uVar6 = InitializeThreadInfoIocp(p_Var11,ptVar16);

+        ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+        if (-1 < (int)uVar6) {

+          uVar6 = *(uint *)(ptVar30 + 0xc);

+          local_res20 = (tagTHREADINFO *)(CONCAT44(local_res20._4_4_,uVar6) & 0xffffffff00004000);

+          *(uint *)(ptVar30 + 0xc) = uVar6 | 0x4000;

+          if ((*(int *)(ptVar30 + 0x300) == 0) && (local_138 != 0)) {

+            *(undefined4 *)(ptVar30 + 0x300) = 0x1c;

+            *(undefined4 *)(ptVar30 + 0x304) = local_148;

+            *(undefined4 *)(ptVar30 + 0x308) = local_144;

+            *(undefined4 *)(ptVar30 + 0x30c) = local_140;

+            *(undefined4 *)(ptVar30 + 0x310) = local_13c;

+            *(uint *)(ptVar30 + 0x314) = local_138;

+            *(undefined2 *)(ptVar30 + 0x318) = (undefined2)local_134;

+          }

+          if ((uVar6 & 0x4000) == 0) {

+            if ((local_138 & 0x200) == 0) {

+              if ((short)local_120 != 0) {

+                uVar7 = ParseReserved(local_118,(ushort *)0x4000);

+              }

+            }

+            else {

+              uVar7 = (ulong)local_158;

+            }

+            uVar18 = local_150;

+            *(ulong *)(ptVar30 + 0x2ac) = uVar7;

+            if (((local_138 & 0x400) != 0) &&

+               (lVar12 = HMValidateSharedHandle(local_150), lVar12 != 0)) {

+              *(undefined8 *)(ptVar30 + 0x2b0) = uVar18;

+            }

+          }

+          ptVar19 = (tagQ *)AllocQueue(0);

+          if (ptVar19 == (tagQ *)0x0) {

+            ptVar26 = (tagTHREADINFO *)0xc0000017;

+          }

+          else {

+            tagTHREADINFO::AssignQueue(ptVar16,ptVar19);

+            *(tagTHREADINFO **)(ptVar19 + 0x68) = ptVar16;

+            *(tagTHREADINFO **)(ptVar19 + 0x60) = ptVar16;

+            ApiSetEditionUpdateRawMouseMode(ptVar19);

+            lVar12 = W32GetUserGdiSessionState();

+            if (p_Var11 == *(_EPROCESS **)(lVar12 + 0x28)) {

+              *(undefined8 *)(ptVar19 + 0x220) = 0x2000;

+            }

+            else {

+              *(undefined4 *)(ptVar19 + 0x220) =

+                   *(undefined4 *)(*(longlong *)(ptVar16 + 0x1d0) + 0x358);

+              *(undefined4 *)(ptVar19 + 0x224) =

+                   *(undefined4 *)(*(longlong *)(ptVar16 + 0x1d0) + 0x35c);

+              *(undefined4 *)(ptVar19 + 0x228) =

+                   *(undefined4 *)(*(longlong *)(ptVar16 + 0x1d0) + 0x360);

+            }

+            LOCK();

+            uVar6 = *(uint *)(ptVar16 + 0x210);

+            if (uVar6 == 0) {

+              *(uint *)(ptVar16 + 0x210) = 0;

+              uVar6 = 0;

+            }

+            UNLOCK();

+            if (((uVar6 & 0xc) == 0) &&

+               (lVar12 = W32GetUserSessionState(), *(longlong *)(lVar12 + 0xf8a8) != 0)) {

+              lVar12 = W32GetWin32kBaseApiSetTable();

+              pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x468);

+              if (pcVar1 == (code *)0x0) {

+                ptVar26 = (tagTHREADINFO *)0xc00000bb;

+              }

+              else {

+                uVar6 = (*pcVar1)();

+                ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+              }

+              if (-1 < (int)ptVar26) {

+                uVar27 = SUB81(&local_190,0);

+                uVar6 = xxxResolveDesktop();

+                ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                if (-1 < (int)uVar6) {

+                  lVar12 = W32GetWin32kBaseApiSetTable();

+                  pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x478);

+                  if (pcVar1 == (code *)0x0) {

+                    ptVar26 = (tagTHREADINFO *)0xc00000bb;

+                  }

+                  else {

+                    uVar6 = (*pcVar1)();

+                    ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                  }

+                  if (-1 < (int)ptVar26) {

+                    AtomicExecutionCheck::AtomicExecutionCheck(local_98);

+                    uVar6 = xxxSetProcessWindowStation(local_190);

+                    ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

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

+                      *(int *)(local_90 + 0x1c) = *(int *)(local_90 + 0x1c) + -1;

+                    }

+                    if (-1 < (int)uVar6) {

+                      uVar18 = *(undefined8 *)ExDesktopObjectType_exref;

+                      local_100 = (tagDESKTOP *)0x0;

+                      uVar6 = ObReferenceObjectByHandle(0,0,uVar18,1,&local_100,0);

+                      ptVar2 = local_100;

+                      uVar27 = (undefined1)uVar18;

+                      ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                      local_1c8 = local_100;

+                      if (-1 < (int)uVar6) {

+                        Win32RawLockedNtObject<tagDESKTOP>::ManualLock

+                                  ((Win32RawLockedNtObject<tagDESKTOP> *)local_f0,local_100);

+                        ObfDereferenceObject(ptVar2);

+                        local_78 = CONCAT44(local_78._4_4_,1);

+                        uStack_70 = PsGetCurrentProcess();

+                        local_68 = ptVar2;

+                        uStack_60 = 0x100000000;

+                        lVar12 = W32GetWin32kBaseApiSetTable();

+                        pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x488);

+                        if (pcVar1 == (code *)0x0) {

+                          ptVar26 = (tagTHREADINFO *)0xc00000bb;

+                        }

+                        else {

+                          uVar6 = (*pcVar1)();

+                          ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                        }

+                        if (-1 < (int)ptVar26) {

+                          lVar12 = W32GetWin32kBaseApiSetTable();

+                          pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x490);

+                          if (pcVar1 == (code *)0x0) {

+                            ptVar26 = (tagTHREADINFO *)0xc00000bb;

+                          }

+                          else {

+                            uVar6 = (*pcVar1)(&local_88);

+                            ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                          }

+                          if (-1 < (int)ptVar26) {

+                            if (*(longlong *)(ptVar30 + 0x180) == 0) {

+                              lVar12 = W32GetUserSessionState();

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

+                              lVar15 = PsGetProcessId(p_Var11);

+                              if (lVar15 != lVar12) {

+                                LockObjectAssignment(ptVar30 + 0x158);

+                                *(undefined8 *)(ptVar30 + 0x180) = 0;

+                              }

+                            }

+                            goto LAB_4;

+                          }

+                        }

+                      }

+                      goto LAB_5;

+                    }

+                  }

+                  CloseProtectedHandle(0);

+                  CloseProtectedHandle(local_190);

+                  local_190 = 0;

+                  goto LAB_5;

+                }

+              }

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

+                ReleaseUserCriticalSection();

+                ZwTerminateProcess(0xffffffffffffffff,0xc000026b);

+                lVar12 = W32GetUserSessionState();

+                uVar27 = 0;

+                lVar15 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                                   (lVar12,1,0,

+                                    <lambda_63b61c2369133a205197eda5bd671ee7>::

+                                    <lambda_invoker_cdecl>);

+                *(longlong *)(lVar12 + 0x10) = lVar15;

+                if ((lVar15 != 0) &&

+                   (cVar3 = UserCritInternal::`anonymous_namespace'::IsValidGuiContext(lVar15),

+                   cVar3 != '\0')) {

+                  DestroySharedUserCritDeferredUnlockList(lVar12 + 0x4d78);

+                  DestroyDeferredUnlockObjectAssignmentList(lVar12 + 0x4db0);

+                  DestroyDeferredUnlockObjectAssignmentList(lVar12 + 0x4da0);

+                }

+              }

+              else {

+                PsGetCurrentProcessId();

+                if (((byte)Microsoft_Windows_Win32kEnableBits & 1) != 0) {

+                  McTemplateK0dq_EtwWriteTransfer();

+                }

+                ptVar26 = (tagTHREADINFO *)0xc0000142;

+              }

+            }

+            else {

+              *(ulonglong *)(ptVar16 + 0x550) = *(ulonglong *)(ptVar16 + 0x550) | 0x10;

+              iVar8 = IsEditionSetProcessWindowStationAtProcessInitSupported();

+              if (-1 < iVar8) {

+                iVar8 = IsEditionSetProcessWindowStationAtProcessInitSupported();

+                ptVar26 = (tagTHREADINFO *)0x0;

+                if (-1 < iVar8) {

+                  uVar6 = EditionSetProcessWindowStationAtProcessInit(local_130);

+                  ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                }

+                if ((int)ptVar26 < 0) goto LAB_5;

+                *(uint *)(ptVar30 + 0xc) = *(uint *)(ptVar30 + 0xc) | 0x40010;

+              }

+              iVar8 = IsEditionSetThreadDesktopAtThreadInitSupported();

+              if ((-1 < iVar8) &&

+                 (iVar8 = IsEditionSetThreadDesktopAtThreadInitSupported(), -1 < iVar8)) {

+                lVar12 = W32GetWin32kBaseApiSetTable();

+                pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x3e0);

+                if (pcVar1 != (code *)0x0) {

+                  (*pcVar1)();

+                }

+              }

+LAB_4:

+              iVar8 = InitClientInfo(ptVar16);

+              if (iVar8 != 0) {

+                AtomicExecutionCheck::AtomicExecutionCheck(local_170);

+                lVar12 = W32GetWin32kBaseApiSetTable();

+                pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x498);

+                if (pcVar1 == (code *)0x0) {

+                  ptVar26 = (tagTHREADINFO *)0xc00000bb;

+                }

+                else {

+                  uVar6 = (*pcVar1)();

+                  ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                }

+                if (-1 < (int)ptVar26) {

+                  uVar27 = local_1a8;

+                  uVar6 = zzzSetDesktop(ptVar16);

+                  ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                  if (-1 < (int)uVar6) {

+                    if (local_170[0] != (AtomicExecutionCheck)0x0) {

+                      *(int *)(local_168 + 0x1c) = *(int *)(local_168 + 0x1c) + -1;

+                    }

+                    W32GetUserSessionState();

+                    if ((int)local_138 < 0) {

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

+                        lVar12 = W32GetUserSessionState();

+                        if (*(longlong *)(lVar12 + 0xf8c0) != 0) {

+                          lVar12 = W32GetUserSessionState();

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

+                          lVar15 = PsGetProcessInheritedFromUniqueProcessId(p_Var11);

+                          if (lVar15 == lVar12) {

+                            lVar12 = W32GetUserSessionState();

+                            *(tagPROCESSINFO **)(lVar12 + 0xf5f0) = ptVar30;

+                            lVar12 = W32GetUserSessionState();

+                            uVar18 = *(undefined8 *)(*(longlong *)(lVar12 + 0x4e30) + 0x1360);

+                            lVar12 = W32GetUserSessionState();

+                            *(undefined8 *)(lVar12 + 0x8e10) = uVar18;

+                            *(uint *)(ptVar30 + 0xc) = *(uint *)(ptVar30 + 0xc) | 0x200000;

+                            EtwTraceScreenSaverProcessEvent(1);

+                            uVar27 = 8;

+                            ForegroundBoost::`anonymous_namespace'::_SetForegroundPriority

+                                      (*(undefined8 *)(ptVar16 + 0x1d0));

+                            *(uint *)(ptVar30 + 0xc) = *(uint *)(ptVar30 + 0xc) | 0x400000;

+                            goto LAB_6;

+                          }

+                        }

+                        local_138 = local_138 & 0x7fffffff;

+                      }

+                      else {

+LAB_6:

+                        LOCK();

+                        *(uint *)(ptVar16 + 0x210) = *(uint *)(ptVar16 + 0x210) | 0x2000000;

+                        UNLOCK();

+                      }

+                    }

+                    LOCK();

+                    uVar6 = *(uint *)(ptVar16 + 0x210);

+                    if (uVar6 == 0) {

+                      *(uint *)(ptVar16 + 0x210) = 0;

+                      uVar6 = 0;

+                    }

+                    UNLOCK();

+                    if (((uVar6 & 0xc) != 0) || ((int)local_res20 != 0)) {

+LAB_7:

+                      ApiSetEditionInitInputHangInfo();

+                      if (*(longlong *)(ptVar16 + 0x1d8) != 0) {

+                        iVar8 = Feature_ConsistentPendingMouse2__private_IsEnabledDeviceUsageNoInline

+                                          ();

+                        if (iVar8 == 0) {

+                          ptVar19 = (tagQ *)(*(longlong *)(ptVar16 + 0x1d8) + 0x214);

+                        }

+                        else {

+                          ptVar19 = ptVar19 + 0x138;

+                        }

+                        SetUnavailableInputSource(ptVar19);

+                      }

+                      if ((*(uint *)(ptVar30 + 0xc) & 0x20000) != 0) {

+                        LOCK();

+                        *(uint *)(ptVar16 + 0x210) = *(uint *)(ptVar16 + 0x210) | 0x4000;

+                        UNLOCK();

+                      }

+                      LOCK();

+                      *(uint *)(ptVar16 + 0x210) = *(uint *)(ptVar16 + 0x210) | 0x1000000;

+                      UNLOCK();

+                      if (((*(uint *)(ptVar30 + 0xc) & 0x140) == 0) &&

+                         (((byte)ptVar30[800] & 0x30) != 0x10)) {

+                        lVar12 = W32GetUserSessionState();

+                        if (((*(longlong *)(lVar12 + 0x4a60) != 0) &&

+                            (*(tagPROCESSINFO **)(*(longlong *)(lVar12 + 0x4a60) + 0x1d0) == ptVar30

+                            )) || (LVar9 = LastWokenThread::Test(ptVar30,false), LVar9 == 3)) {

+                          tagTHREADINFO::SetForegroundActivate(ptVar16,1);

+                        }

+                      }

+                      lVar12 = W32GetUserSessionState();

+                      if ((**(uint **)(lVar12 + 0x4e30) & 4) != 0) {

+                        lVar12 = W32GetWin32kBaseApiSetTable();

+                        pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x4d0);

+                        if (pcVar1 == (code *)0x0) {

+                          iVar8 = -0x3fffff45;

+                        }

+                        else {

+                          iVar8 = (*pcVar1)();

+                        }

+                        if (-1 < iVar8) {

+                          lVar12 = W32GetWin32kBaseApiSetTable();

+                          pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x4d8);

+                          if (pcVar1 != (code *)0x0) {

+                            (*pcVar1)(0);

+                          }

+                        }

+                      }

+                      if ((uint)local_res18 == 0) {

+                        lVar12 = W32GetWin32kBaseApiSetTable();

+                        pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x4e0);

+                        if (pcVar1 == (code *)0x0) {

+                          ptVar26 = (tagTHREADINFO *)0xc00000bb;

+                        }

+                        else {

+                          uVar6 = (*pcVar1)();

+                          ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                        }

+                        if (-1 < (int)ptVar26) {

+                          lVar12 = W32GetWin32kBaseApiSetTable();

+                          pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x4e8);

+                          if (pcVar1 == (code *)0x0) {

+                            ptVar26 = (tagTHREADINFO *)0xc00000bb;

+                          }

+                          else {

+                            uVar6 = (*pcVar1)();

+                            ptVar26 = (tagTHREADINFO *)(ulonglong)uVar6;

+                          }

+                          if (-1 < (int)ptVar26) goto LAB_8;

+                        }

+                        goto LAB_5;

+                      }

+LAB_8:

+                      if (((int)local_res20 == 0) && ((*(uint *)(ptVar30 + 0xc) & 1) == 0)) {

+                        lVar12 = W32GetWin32kBaseApiSetTable();

+                        pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x4f0);

+                        if (pcVar1 != (code *)0x0) {

+                          iVar10 = (*pcVar1)();

+                        }

+                        if (-1 < iVar10) {

+                          lVar12 = W32GetWin32kBaseApiSetTable();

+                          pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x4f8);

+                          if (pcVar1 != (code *)0x0) {

+                            (*pcVar1)(7);

+                          }

+                        }

+                      }

+                      if (local_1c8 != (tagDESKTOP *)0x0) {

+                        if ((*(uint *)(local_1c8 + 0x30) & 8) != 0) goto LAB_9;

+                        Win32RawLockedItemBase<tagDESKTOP,&void___cdecl_UserDereferenceObject(void*___ptr64),1,1,1>

+                        ::UnlockWorker((Win32RawLockedItemBase<tagDESKTOP,&void___cdecl_UserDereferenceObject(void*___ptr64),1,1,1>

+                                        *)local_f0,false,(bool)uVar27);

+                      }

+                      if ((*(ulonglong *)(ptVar16 + 0x550) & 1) != 0) {

+                        *(ulonglong *)(ptVar16 + 0x550) =

+                             *(ulonglong *)(ptVar16 + 0x550) & 0xfffffffffffffffe;

+                      }

+                      goto LAB_10;

+                    }

+                    iVar8 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+                    if (iVar8 == 0) {

+                      lVar12 = W32GetUserSessionState();

+                      *(int *)(lVar12 + 0x11528) = *(int *)(lVar12 + 0x11528) + 1;

+                      iVar8 = IszzzCalcStartCursorHideSupported();

+                      if (-1 < iVar8) {

+                        plVar13 = (longlong *)PsGetProcessWin32Process(p_Var11);

+                        uVar24 = 0;

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

+                          uVar24 = (ulonglong)plVar13 & -(ulonglong)(*plVar13 != 0);

+                        }

+                        zzzCalcStartCursorHide(uVar24);

+                      }

+                      lVar12 = W32GetUserSessionState();

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

+                        uVar27 = 0x11;

+                        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert");

+                      }

+                      lVar12 = W32GetUserSessionState();

+                      *(int *)(lVar12 + 0x11528) = *(int *)(lVar12 + 0x11528) + -1;

+                    }

+                    else {

+                      CWinEventNoopDeferral::CWinEventNoopDeferral

+                                ((CWinEventNoopDeferral *)local_res10);

+                      plVar13 = (longlong *)PsGetProcessWin32Process(p_Var11);

+                      uVar24 = 0;

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

+                        uVar24 = (ulonglong)plVar13 & -(ulonglong)(*plVar13 != 0);

+                      }

+                      lVar12 = W32GetWin32kBaseApiSetTable();

+                      pcVar1 = *(code **)(*(longlong *)(lVar12 + 0x30) + 0x418);

+                      if (pcVar1 != (code *)0x0) {

+                        (*pcVar1)(uVar24);

+                      }

+                      CWinEventNoopDeferral::~CWinEventNoopDeferral

+                                ((CWinEventNoopDeferral *)local_res10);

+                    }

+                    lVar12 = W32GetUserSessionState();

+                    if ((*(longlong *)(lVar12 + 0xf8a8) == 0) ||

+                       (*(longlong *)(ptVar30 + 0x290) != 0)) goto LAB_7;

+                    UserSetLastError(0x3eb);

+LAB_9:

+                    ptVar26 = (tagTHREADINFO *)0xc0000001;

+                    goto LAB_5;

+                  }

+                }

+                if (local_170[0] != (AtomicExecutionCheck)0x0) {

+                  *(int *)(local_168 + 0x1c) = *(int *)(local_168 + 0x1c) + -1;

+                  local_168 = 0;

+                }

+              }

+            }

+          }

+        }

+      }

+    }

+LAB_5:

+    if (local_1c8 != (tagDESKTOP *)0x0) {

+      Win32RawLockedItemBase<tagDESKTOP,&void___cdecl_UserDereferenceObject(void*___ptr64),1,1,1>::

+      UnlockWorker((Win32RawLockedItemBase<tagDESKTOP,&void___cdecl_UserDereferenceObject(void*___ptr64),1,1,1>

+                    *)local_f0,false,(bool)uVar27);

+    }

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

+      Win32RawLockedItemBase<DISPLAYCONFIG_DEVICE_INFO_HEADER,&void___cdecl_Win32FreePool(void*___ptr64),1,1,1>

+      ::UnlockWorker((Win32RawLockedItemBase<DISPLAYCONFIG_DEVICE_INFO_HEADER,&void___cdecl_Win32FreePool(void*___ptr64),1,1,1>

+                      *)&local_188,false,(bool)uVar27);

+    }

+    xxxDestroyThreadInfo();

+LAB_10:

+    Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>::

+    ~Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+              ((Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+                *)local_f0);

+    Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>::

+    ~Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+              ((Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

+                *)&local_188);

+    return ptVar26;

+  }

+  local_res18._0_4_ = 0x20000;

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

+LAB_2:

+                    /* WARNING: Subroutine does not return */

+  ExRaiseAccessViolation();

 }
```

## `RIMIDEAdoptOrphanedRimDevs`  (modified)

```diff
--- RIMIDEAdoptOrphanedRimDevs
+++ RIMIDEAdoptOrphanedRimDevs
@@ -1,91 +1,142 @@
 

-undefined4

-RIMIDEAdoptOrphanedRimDevs

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

-          undefined8 param_5,undefined4 param_6,undefined4 param_7,int param_8,undefined8 param_9)

+void RIMIDEAdoptOrphanedRimDevs(longlong ****param_1)

 

 {

-  int iVar1;

-  undefined4 uVar2;

-  longlong lVar3;

-  char cVar4;

-  char cVar5;

-  bool bVar6;

-  undefined4 in_stack_ffffffffffffffc0;

-  undefined2 uVar8;

-  undefined4 uVar7;

-  undefined8 in_stack_ffffffffffffffc8;

-  ulonglong in_stack_ffffffffffffffd0;

-  ulonglong uVar9;

+  RIMDEV *pRVar1;

+  longlong *****ppppplVar2;

+  longlong ****pppplVar3;

+  longlong *****ppppplVar4;

+  RIMDEV *pRVar5;

+  longlong ***ppplVar6;

+  longlong ***ppplVar7;

+  code *pcVar8;

+  int iVar9;

+  longlong lVar10;

+  longlong ****pppplVar11;

+  longlong ****pppplVar12;

+  ulonglong uVar13;

+  undefined8 *puVar14;

+  longlong *****ppppplVar15;

+  RIMDEV *pRVar16;

+  longlong ****local_48;

+  longlong ****local_40;

   

-  uVar8 = (undefined2)((uint)in_stack_ffffffffffffffc0 >> 0x10);

-  uVar2 = (undefined4)((ulonglong)in_stack_ffffffffffffffc8 >> 0x20);

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

-      (cVar5 = '\x01', (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

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

-    cVar5 = '\0';

-  }

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

-  if ((cVar5 != '\0') || (bVar6)) {

-    lVar3 = W32GetUserSessionState();

-    uVar2 = 1;

-    uVar7 = CONCAT22(uVar8,0x93);

-    WPP_RECORDER_AND_TRACE_SF_

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar6,

-               *(undefined8 *)(lVar3 + 0x10f78),4,1,uVar7,

-               &WPP_b5aeaed2926231c9bd7519af13c65926_Traceguids);

-    uVar8 = (undefined2)((uint)uVar7 >> 0x10);

-  }

-  uVar7 = (undefined4)(in_stack_ffffffffffffffd0 >> 0x20);

-  cVar5 = '\x01';

-  if (param_8 == 0) {

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3))

-    {

-      cVar4 = '\0';

-    }

-    else {

-      cVar4 = '\x01';

-    }

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

-    if ((cVar4 != '\0') || (bVar6)) {

-      lVar3 = W32GetUserSessionState();

-      uVar9 = in_stack_ffffffffffffffd0 & 0xffffffff00000000;

-      uVar2 = CONCAT22(uVar8,0x94);

-      WPP_RECORDER_AND_TRACE_SF_D

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar6,

-                 *(undefined8 *)(lVar3 + 0x10f78),3,1,uVar2,

-                 &WPP_b5aeaed2926231c9bd7519af13c65926_Traceguids,uVar9);

-      uVar8 = (undefined2)((uint)uVar2 >> 0x10);

-      uVar7 = (undefined4)(uVar9 >> 0x20);

-    }

-    uVar2 = 0xc000000d;

-  }

-  else {

-    iVar1 = rimObsCheckForObservationPermissions(param_8);

-    if (iVar1 == 0) {

-      uVar2 = 0xc0000022;

-    }

-    else {

-      uVar2 = rimObsAddInputObserver

-                        (param_1,param_2,param_3,1,param_4,param_6,param_7,CONCAT44(uVar2,param_8),

-                         param_9);

-      uVar8 = (undefined2)((uint)param_7 >> 0x10);

-      uVar7 = (undefined4)((ulonglong)param_9 >> 0x20);

+  lVar10 = W32GetUserSessionState();

+  RIMLockExclusive(lVar10 + 0x30);

+  lVar10 = W32GetUserSessionState();

+  local_40 = (longlong ****)&local_48;

+  local_48 = (longlong ****)&local_48;

+  for (puVar14 = *(undefined8 **)(lVar10 + 0x80); puVar14 != (undefined8 *)(lVar10 + 0x80);

+      puVar14 = (undefined8 *)*puVar14) {

+    uVar13 = -(ulonglong)(puVar14 != (undefined8 *)&DAT_0) & (ulonglong)(puVar14 + 7);

+    pppplVar3 = *(longlong *****)(uVar13 + 0x140);

+    if (((((pppplVar3 != (longlong ****)0x0) &&

+          (*(char *)(*(longlong *)(uVar13 + 0x20) + 0xb) == '\0')) &&

+         (*(char *)((longlong)pppplVar3 + 0x51) != '\0')) &&

+        ((*(uint *)(uVar13 + 0xa8) >> 0xd & 1) != 0)) &&

+       (((*(uint *)(uVar13 + 0xb8) & 4) == 0 || ((*(uint *)(uVar13 + 0xa8) >> 0x1e & 1) != 0)))) {

+      if (pppplVar3 == param_1) {

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

+      }

+      iVar9 = RIMIDEIsCompatibleDevice(param_1,uVar13);

+      if (iVar9 != 0) {

+        ppppplVar15 = (longlong *****)(uVar13 + 0x68);

+        if ((longlong *****)*ppppplVar15 != ppppplVar15) {

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

+        }

+        if ((longlong *****)*local_40 != &local_48) goto LAB_1;

+        *(longlong *****)(uVar13 + 0x70) = local_40;

+        *ppppplVar15 = (longlong ****)&local_48;

+        *local_40 = (longlong ***)ppppplVar15;

+        *(uint *)(uVar13 + 0xb8) = *(uint *)(uVar13 + 0xb8) | 0x10;

+        local_40 = (longlong ****)ppppplVar15;

+      }

     }

   }

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar5 = '\0';

+  lVar10 = W32GetUserSessionState();

+  tagObjLock::UnLockExclusive((tagObjLock *)(lVar10 + 0x30));

+  ppppplVar15 = (longlong *****)local_48;

+  while( true ) {

+    if (ppppplVar15 == &local_48) {

+      return;

+    }

+    pRVar1 = (RIMDEV *)(ppppplVar15 + -0xd);

+    pppplVar3 = ppppplVar15[0x1b];

+    RIMLockExclusive(pppplVar3 + 0xd);

+    ppppplVar4 = (longlong *****)*ppppplVar15;

+    if (((longlong *****)ppppplVar4[1] != ppppplVar15) ||

+       (pppplVar12 = ppppplVar15[1], (longlong *****)*pppplVar12 != ppppplVar15)) break;

+    *pppplVar12 = (longlong ***)ppppplVar4;

+    ppppplVar4[1] = pppplVar12;

+    ppppplVar15[1] = (longlong ****)ppppplVar15;

+    *ppppplVar15 = (longlong ****)ppppplVar15;

+    pRVar16 = (RIMDEV *)(pppplVar3 + 0x35);

+    while (pRVar5 = *(RIMDEV **)pRVar16, pRVar5 != (RIMDEV *)0x0) {

+      if (pRVar5 == pRVar1) {

+        if (ppppplVar15[0x10] != (longlong ****)0x0) {

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

+        }

+        *(longlong *****)pRVar16 = ppppplVar15[-8];

+        break;

+      }

+      pRVar16 = pRVar5 + 0x28;

+    }

+    if (((ulonglong)ppppplVar15[8] & 0x200) != 0) {

+      ppppplVar2 = ppppplVar15 + -2;

+      if ((longlong *****)*ppppplVar2 == ppppplVar2) {

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

+      }

+      pppplVar12 = *ppppplVar2;

+      if (((longlong *****)pppplVar12[1] != ppppplVar2) ||

+         (pppplVar11 = ppppplVar15[-1], (longlong *****)*pppplVar11 != ppppplVar2)) break;

+      *pppplVar11 = (longlong ***)pppplVar12;

+      pppplVar12[1] = (longlong ***)pppplVar11;

+      *(uint *)(ppppplVar15 + 8) = *(uint *)(ppppplVar15 + 8) & 0xfffffdff;

+      ppppplVar15[-1] = (longlong ****)ppppplVar2;

+      *ppppplVar2 = (longlong ****)ppppplVar2;

+      InputTraceLogging::RIM::ResumeDevice(pRVar1);

+    }

+    if ((char)*(undefined4 *)(ppppplVar15 + 10) < '\0') {

+      pppplVar12 = ppppplVar15[0x2c];

+      pppplVar11 = pppplVar12 + 0x74;

+      ppplVar6 = *pppplVar11;

+      if (((longlong ****)ppplVar6[1] != pppplVar11) ||

+         (ppplVar7 = pppplVar12[0x75], (longlong ****)*ppplVar7 != pppplVar11)) break;

+      *ppplVar7 = (longlong **)ppplVar6;

+      ppplVar6[1] = (longlong **)ppplVar7;

+      pppplVar12[0x75] = (longlong ***)pppplVar11;

+      *pppplVar11 = (longlong ***)pppplVar11;

+    }

+    RIMRemoveHoldingFrame(pppplVar3,pRVar1);

+    tagObjLock::UnLockExclusive((tagObjLock *)(pppplVar3 + 0xd));

+    ObfDereferenceObject(pppplVar3);

+    RIMLockExclusive(param_1 + 0xd);

+    iVar9 = ObReferenceObjectByPointer(param_1,3,*(undefined8 *)ExRawInputManagerObjectType_exref,1)

+    ;

+    if (iVar9 < 0) {

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

+    }

+    ppppplVar15[0x1b] = param_1;

+    ppppplVar15[-8] = (longlong ****)param_1[0x35];

+    param_1[0x35] = (longlong ***)pRVar1;

+    if ((char)*(undefined4 *)(ppppplVar15 + 10) < '\0') {

+      pppplVar3 = ppppplVar15[0x2c];

+      ppplVar6 = param_1[0x37];

+      pppplVar12 = pppplVar3 + 0x74;

+      if ((longlong ****)*ppplVar6 != param_1 + 0x36) break;

+      *pppplVar12 = (longlong ***)(param_1 + 0x36);

+      pppplVar3[0x75] = ppplVar6;

+      *ppplVar6 = (longlong **)pppplVar12;

+      param_1[0x37] = (longlong ***)pppplVar12;

+    }

+    tagObjLock::UnLockExclusive((tagObjLock *)(param_1 + 0xd));

+    ppppplVar15 = ppppplVar4;

   }

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

-  if ((cVar5 != '\0') || (bVar6)) {

-    lVar3 = W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_d

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar6,

-               *(undefined8 *)(lVar3 + 0x10f78),4,1,CONCAT22(uVar8,0x95),

-               &WPP_b5aeaed2926231c9bd7519af13c65926_Traceguids,CONCAT44(uVar7,uVar2));

-  }

-  return uVar2;

+LAB_1:

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

+  (*pcVar8)(3);

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

+  (*pcVar8)();

+  return;

 }
```

## `NtUserReportInertia`  (modified)

```diff
--- NtUserReportInertia
+++ NtUserReportInertia
@@ -1,70 +1,458 @@
 

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

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

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

 

-int NtUserReportInertia(longlong param_1,undefined2 param_2,undefined1 param_3)

+longlong NtUserReportInertia(__uint64 param_1,uint param_2,HWND__ *param_3,longlong param_4,

+                            double param_5,longlong param_6)

 

 {

-  byte *pbVar1;

-  undefined1 uVar2;

-  code *pcVar3;

+  char cVar1;

+  undefined *puVar2;

+  uint uVar3;

   int iVar4;

-  char *in_RAX;

   longlong lVar5;

-  int unaff_EBX;

-  int unaff_ESI;

-  undefined1 *unaff_RDI;

-  ulonglong uVar6;

-  ulonglong unaff_R13;

-  longlong unaff_R15;

-  undefined1 *in_stack_00000078;

-  undefined8 in_stack_00000080;

+  longlong lVar6;

+  tagTHREADINFO *ptVar7;

+  CInputDest *pCVar8;

+  tagTHREADINFO *ptVar9;

+  CInertiaManager *this;

+  undefined8 uVar10;

+  tagRECT *ptVar11;

+  uint uVar12;

+  longlong lVar13;

+  char cVar14;

+  bool bVar15;

+  bool bVar16;

+  undefined1 auStackY_2b8 [32];

+  longlong local_248;

+  undefined4 local_240;

+  double local_238;

+  uint local_230;

+  int local_22c;

+  longlong local_228;

+  __uint64 local_220;

+  longlong local_210;

+  undefined4 local_208;

+  undefined8 local_1f8;

+  undefined8 uStack_1f0;

+  undefined8 local_1e8;

+  undefined8 uStack_1e0;

+  undefined8 local_1d8;

+  undefined8 local_1d0;

+  undefined8 uStack_1c8;

+  undefined8 local_1c0;

+  undefined8 uStack_1b8;

+  undefined8 local_1b0;

+  undefined8 uStack_1a8;

+  undefined8 local_198;

+  undefined8 uStack_190;

+  undefined8 local_188;

+  undefined8 uStack_180;

+  undefined8 local_178;

+  int local_168 [23];

+  int local_10c;

+  undefined1 local_f8;

+  undefined8 local_e8;

+  undefined8 uStack_e0;

+  undefined8 local_d8;

+  undefined8 uStack_d0;

+  undefined8 local_c8;

+  undefined8 uStack_c0;

+  CInputDest local_b8 [128];

+  ulonglong local_38;

   

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

-  pbVar1 = (byte *)(param_1 + -0x418bdba4);

-  *pbVar1 = *pbVar1 >> 4 | *pbVar1 << 4;

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

-  *(byte *)(param_1 + 0x44702474) = *(byte *)(param_1 + 0x44702474) | 0x8b;

-  uVar2 = in(param_2);

-  *unaff_RDI = uVar2;

-  if (unaff_ESI != 0x12) {

-    uVar6 = unaff_R13 & 0xffffffff;

-    LogDiagSDC(in_stack_00000080._4_4_,in_stack_00000078,uVar6,unaff_EBX,(int)(unaff_RDI + 1));

-    param_3 = (undefined1)uVar6;

+                    /* 0x16caf0  2028  NtUserReportInertia */

+  local_38 = __security_cookie ^ (ulonglong)auStackY_2b8;

+  local_248 = param_6;

+  local_238 = param_5;

+  local_228 = param_4;

+  local_220 = param_1;

+  lVar5 = W32GetUserSessionState();

+  lVar6 = UserCritInternal::`anonymous_namespace'::EnterCritInternal

+                    (lVar5,0,0,<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>);

+  *(longlong *)(lVar5 + 0x10) = lVar6;

+  bVar16 = false;

+  if (lVar6 != 0) {

+    DestroySharedUserCritDeferredUnlockList(lVar5 + 0x4d78);

+    DestroyDeferredUnlockObjectAssignmentList(lVar5 + 0x4db0);

+    DestroyDeferredUnlockObjectAssignmentList(lVar5 + 0x4da0);

   }

-  if (unaff_EBX < 0) {

-    if (((unaff_R15 != 0) && (iVar4 = DrvNeedDisplayStateCheck(&stack0x00000118), iVar4 != 0)) &&

-       (iVar4 = DrvIsDisplayStateCurrent(0), iVar4 == 0)) {

-      unaff_EBX = -0x3fe1fcc9;

-    }

+  ptVar7 = PtiCurrent();

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

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

+    bVar16 = true;

+  }

+  cVar14 = '\x01';

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

+  if ((bVar16) || (bVar15)) {

+    lVar5 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_iDqqqq

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar16,bVar15,

+               *(undefined8 *)(lVar5 + 0x10f78));

+  }

+  puVar2 = WPP_RECORDER_INITIALIZED;

+  if (local_220 == 0) {

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

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

+    {

+      cVar14 = '\0';

+    }

+    if ((cVar14 != '\0') || ((undefined **)WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED)) {

+      lVar5 = W32GetUserSessionState();

+LAB_0:

+      WPP_RECORDER_AND_TRACE_SF_

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,

+                 (undefined **)puVar2 != &WPP_RECORDER_INITIALIZED,*(undefined8 *)(lVar5 + 0x10f78))

+      ;

+    }

+LAB_1:

+    uVar10 = 0x57;

   }

   else {

-    lVar5 = W32GetWin32kBaseApiSetTable();

-    pcVar3 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0xf70);

-    if (pcVar3 == (code *)0x0) {

-      iVar4 = -0x3fffff45;

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

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

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

+         ) {

+        cVar14 = '\0';

+      }

+      if ((cVar14 == '\0') && ((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED))

+      goto LAB_1;

+      lVar5 = W32GetUserSessionState();

+LAB_2:

+      WPP_RECORDER_AND_TRACE_SF_D

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,

+                 (undefined **)puVar2 != &WPP_RECORDER_INITIALIZED,*(undefined8 *)(lVar5 + 0x10f78))

+      ;

+      goto LAB_1;

+    }

+    local_230 = param_2 & 8;

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

+      if ((param_2 & 2) != 0) goto LAB_3;

+LAB_4:

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

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

+         ) {

+        cVar14 = '\0';

+      }

+      if ((cVar14 == '\0') && ((undefined **)WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED))

+      goto LAB_1;

+      lVar5 = W32GetUserSessionState();

+      goto LAB_2;

+    }

+    cVar1 = cVar14;

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

+LAB_3:

+      cVar1 = '\0';

+      if ((param_2 & 1) != 0) goto LAB_4;

+    }

+    if ((param_2 & 4) == 0) {

+LAB_5:

+      lVar5 = W32GetUserSessionState();

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

+        memset(local_168,0,0x70);

+        lVar6 = local_228;

+        uVar12 = 0;

+        local_f8 = 0;

+        if (local_238 == 0.0) {

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

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

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

+            cVar14 = '\0';

+          }

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

+          if ((cVar14 != '\0') || (uVar12 = 0, bVar16)) {

+            lVar5 = W32GetUserSessionState();

+LAB_6:

+            WPP_RECORDER_AND_TRACE_SF_

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,bVar16,

+                       *(undefined8 *)(lVar5 + 0x10f78));

+            uVar12 = 0;

+          }

+LAB_7:

+          uVar10 = 0x57;

+        }

+        else {

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

+            local_22c = 1;

+            lVar13 = local_248;

+            if (local_248 != 0) {

+LAB_8:

+              uVar12 = *(uint *)(ptVar7 + 0x550);

+              local_248 = 0;

+              local_240 = 0;

+              local_198 = 0;

+              uStack_190 = 0;

+              local_188 = 0;

+              uStack_180 = 0;

+              local_178 = 0;

+              local_e8 = 0;

+              uStack_e0 = 0;

+              local_d8 = 0;

+              uStack_d0 = 0;

+              local_c8 = 0;

+              uStack_c0 = 0;

+              local_210 = 0;

+              local_208 = 0;

+              RtlCopyFromUser(&local_210,local_238,0xc);

+              local_248 = local_210;

+              local_240 = local_208;

+              if (lVar13 != 0) {

+                local_1f8 = 0;

+                uStack_1f0 = 0;

+                local_1e8 = 0;

+                uStack_1e0 = 0;

+                local_1d8 = 0;

+                RtlCopyFromUser(&local_1f8,lVar13,0x28);

+                local_198 = local_1f8;

+                uStack_190 = uStack_1f0;

+                local_188 = local_1e8;

+                uStack_180 = uStack_1e0;

+                local_178 = local_1d8;

+              }

+              if (lVar6 != 0) {

+                local_1d0 = 0;

+                uStack_1c8 = 0;

+                local_1c0 = 0;

+                uStack_1b8 = 0;

+                local_1b0 = 0;

+                uStack_1a8 = 0;

+                RtlCopyFromUser(&local_1d0,lVar6,0x30);

+                local_e8 = local_1d0;

+                uStack_e0 = uStack_1c8;

+                local_d8 = local_1c0;

+                uStack_d0 = uStack_1b8;

+                local_c8 = local_1b0;

+                uStack_c0 = uStack_1a8;

+              }

+              this = (CInertiaManager *)local_b8;

+              memset(this,0,0x40);

+              local_238 = 0.0;

+              ptVar11 = (tagRECT *)(-(ulonglong)(lVar13 != 0) & (ulonglong)&local_198);

+              bVar16 = CInertiaManager::ValidateInertiaInfo

+                                 (this,(INERTIA_INFO *)&local_248,(INERTIA_REGION *)ptVar11,

+                                  (_D3DMATRIX *)local_b8,&local_238);

+              if (bVar16) {

+                pCVar8 = (CInputDest *)local_168;

+                if (local_22c != 0) {

+                  pCVar8 = (CInputDest *)0x0;

+                }

+                bVar16 = CInertiaManager::AddInertiaInfo

+                                   ((CInertiaManager *)(lVar5 + 0x4218),ptVar7,local_220,pCVar8,

+                                    (tagInputRoutingInfo *)

+                                    (-(ulonglong)(local_228 != 0) & (ulonglong)&local_e8),

+                                    uVar12 >> 0x11 & 1,local_22c,(uint)(local_230 != 0),

+                                    (INERTIA_INFO *)&local_248,local_238,ptVar11,

+                                    (_D3DMATRIX *)(-(ulonglong)(lVar13 != 0) & (ulonglong)local_b8))

+                ;

+                if (bVar16) {

+                  CInputDest::~CInputDest((CInputDest *)local_168);

+                  goto LAB_9;

+                }

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

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

+                   (pCVar8 = (CInputDest *)0x1, (byte)WPP_GLOBAL_Control[0x29] < 2)) {

+                  pCVar8 = (CInputDest *)0x0;

+                }

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

+                if (((char)pCVar8 != '\0') || (bVar16)) {

+                  lVar5 = W32GetUserSessionState();

+                  WPP_RECORDER_AND_TRACE_SF_

+                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),pCVar8,bVar16,

+                             *(undefined8 *)(lVar5 + 0x10f78));

+                }

+                uVar10 = 5;

+              }

+              else {

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

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

+                   (cVar1 = cVar14, (byte)WPP_GLOBAL_Control[0x29] < 2)) {

+                  cVar1 = '\0';

+                }

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

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

+                  lVar5 = W32GetUserSessionState();

+                  WPP_RECORDER_AND_TRACE_SF_

+                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar1,bVar16,

+                             *(undefined8 *)(lVar5 + 0x10f78));

+                }

+                uVar10 = 0x57;

+              }

+              uVar12 = 0;

+              UserSetLastError(uVar10);

+              CInputDest::~CInputDest((CInputDest *)local_168);

+              goto LAB_10;

+            }

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

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

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

+              cVar14 = '\0';

+            }

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

+            if ((cVar14 != '\0') || (bVar16)) {

+              lVar5 = W32GetUserSessionState();

+              goto LAB_6;

+            }

+            goto LAB_7;

+          }

+          local_22c = 0;

+          pCVar8 = (CInputDest *)CInputDest::CInputDest(local_b8,param_3,2 - (local_228 != 0),2);

+          CInputDest::operator=((CInputDest *)local_168,pCVar8);

+          CInputDest::~CInputDest(local_b8);

+          uVar12 = 0;

+          if (local_168[0] == 0) {

+LAB_11:

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

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

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

+              cVar14 = (char)uVar12;

+            }

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

+            if ((cVar14 != '\0') || (bVar16)) {

+              lVar5 = W32GetUserSessionState();

+              WPP_RECORDER_AND_TRACE_SF_q

+                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,bVar16,

+                         *(undefined8 *)(lVar5 + 0x10f78));

+              uVar12 = 0;

+            }

+            uVar10 = 0x578;

+          }

+          else {

+            uVar12 = 0;

+            bVar16 = CInputDest::TestWindowFlag((CInputDest *)local_168,0x480);

+            if (bVar16) goto LAB_11;

+            bVar16 = CInputDest::TestWindowFlag((CInputDest *)local_168,0x380);

+            if (bVar16) goto LAB_11;

+            uVar3 = uVar12;

+            if ((local_230 == uVar12) && (local_10c == 2)) {

+              bVar16 = CInputDest::IsCompositionInput((CInputDest *)local_168);

+              uVar12 = 0;

+              uVar3 = 0;

+              if ((bVar16) && (local_248 == 0)) {

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

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

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

+                  cVar14 = '\0';

+                }

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

+                if ((cVar14 != '\0') || (bVar16)) {

+                  lVar5 = W32GetUserSessionState();

+                  goto LAB_6;

+                }

+                goto LAB_7;

+              }

+            }

+            uVar12 = uVar3;

+            lVar13 = local_248;

+            ptVar9 = CInputDest::GetThreadInfo((CInputDest *)local_168);

+            if ((ptVar7 != ptVar9) &&

+               (ptVar9 = CInputDest::GetDelegateThreadInfo((CInputDest *)local_168),

+               ptVar7 != ptVar9)) {

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

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

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

+                cVar14 = (char)uVar12;

+              }

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

+              if ((cVar14 != '\0') || (bVar16)) {

+                lVar5 = W32GetUserSessionState();

+                goto LAB_6;

+              }

+              goto LAB_7;

+            }

+            if ((uint)((int)((ulonglong)_DAT_12 * _DAT_fffff78000000320 >> 0x18) -

+                      *(int *)(ptVar7 + 0x5f0)) < 0x7d1) goto LAB_8;

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

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

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

+              cVar14 = (char)uVar12;

+            }

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

+            if ((cVar14 != '\0') || (bVar16)) {

+              lVar5 = W32GetUserSessionState();

+              WPP_RECORDER_AND_TRACE_SF_Dd

+                        (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,bVar16,

+                         *(undefined8 *)(lVar5 + 0x10f78));

+              uVar12 = 0;

+            }

+            uVar10 = 5;

+          }

+        }

+        UserSetLastError(uVar10);

+        CInputDest::~CInputDest((CInputDest *)local_168);

+        goto LAB_13;

+      }

+      bVar16 = CInertiaManager::InvalidateInertiaInfo

+                         ((CInertiaManager *)(lVar5 + 0x4218),*(__uint64 *)(ptVar7 + 0x1d0),

+                          local_220);

+      if (bVar16) {

+LAB_9:

+        uVar12 = 1;

+LAB_10:

+        if (uVar12 == 0) {

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

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

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

+            cVar14 = '\0';

+          }

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

+          if ((cVar14 != '\0') || (bVar16)) {

+            UserGetLastError();

+            lVar5 = W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_D

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,bVar16,

+                       *(undefined8 *)(lVar5 + 0x10f78));

+          }

+        }

+        goto LAB_13;

+      }

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

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

+         ) {

+        cVar14 = '\0';

+      }

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

+      if ((cVar14 != '\0') || (bVar16)) {

+        lVar5 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,bVar16,

+                   *(undefined8 *)(lVar5 + 0x10f78));

+      }

     }

     else {

-      iVar4 = (*pcVar3)();

-    }

-    if (-1 < iVar4) {

-      lVar5 = W32GetWin32kBaseApiSetTable();

-      pcVar3 = *(code **)(*(longlong *)(lVar5 + 0x30) + 0xf78);

-      if (pcVar3 != (code *)0x0) {

-        (*pcVar3)();

-      }

-    }

+      if (param_3 != (HWND__ *)0x0) {

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

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

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

+          cVar14 = '\0';

+        }

+        if ((cVar14 != '\0') ||

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

+          lVar5 = W32GetUserSessionState();

+          goto LAB_0;

+        }

+        goto LAB_1;

+      }

+      iVar4 = IsCurrentProcessDwm();

+      if (iVar4 != 0) goto LAB_5;

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

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

+         ) {

+        cVar14 = '\0';

+      }

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

+      if ((cVar14 != '\0') || (bVar16)) {

+        lVar5 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar14,bVar16,

+                   *(undefined8 *)(lVar5 + 0x10f78));

+      }

+    }

+    uVar10 = 5;

   }

-  if (in_stack_00000078 != unaff_RDI + 1) {

-    Win32RawLockedItemBase<tagDESKTOP,&void___cdecl_UserDereferenceObject(void*___ptr64),1,1,1>::

-    UnlockWorker((Win32RawLockedItemBase<tagDESKTOP,&void___cdecl_UserDereferenceObject(void*___ptr64),1,1,1>

-                  *)&stack0x000000b8,false,(bool)param_3);

-  }

+  uVar12 = 0;

+  UserSetLastError(uVar10);

+LAB_13:

   ReleaseUserCriticalSection();

-  Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>::

-  ~Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

-            ((Win32RawOptionalLockedItem<_UNICODE_STRING,&void___cdecl_Win32FreePool(void*___ptr64)>

-              *)&stack0x000000b8);

-  return unaff_EBX;

+  return (longlong)(int)uVar12;

 }
```

## `ApiSetPostPointerDeviceOutOfRangeMessage`  (modified)

```diff
--- ApiSetPostPointerDeviceOutOfRangeMessage
+++ ApiSetPostPointerDeviceOutOfRangeMessage
@@ -1,9 +1,27 @@
 

-undefined4 ApiSetPostPointerDeviceOutOfRangeMessage(void)

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

+

+void ApiSetPostPointerDeviceOutOfRangeMessage(undefined8 param_1)

 

 {

-  undefined4 unaff_EBX;

+  code *pcVar1;

+  int iVar2;

+  longlong lVar3;

   

-  return unaff_EBX;

+  EtwTracePointerDeviceOutOfRangeMessageStart();

+  lVar3 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar3 + 0x30) + 0x1168);

+  if (pcVar1 != (code *)0x0) {

+    iVar2 = (*pcVar1)();

+    if (-1 < iVar2) {

+      lVar3 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar3 + 0x30) + 0x1170);

+      if (pcVar1 != (code *)0x0) {

+        (*pcVar1)(param_1,0,0);

+      }

+    }

+  }

+  EtwTracePointerDeviceOutOfRangeMessageStop();

+  return;

 }
```

## `InvokeMouseCursorPositionCallout`  (modified)

```diff
--- InvokeMouseCursorPositionCallout
+++ InvokeMouseCursorPositionCallout
@@ -1,160 +1,47 @@
 

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

 

-CInputDest * InvokeMouseCursorPositionCallout(void *param_1,ulong param_2,tagINPUTDEST *param_3)

+void InvokeMouseCursorPositionCallout

+               (undefined4 param_1,undefined8 param_2,undefined4 param_3,undefined8 param_4)

 

 {

-  bool bVar1;

-  int iVar2;

-  longlong lVar3;

-  longlong lVar4;

-  char cVar5;

-  longlong unaff_RBX;

-  tagINPUTDEST *unaff_RBP;

-  char cVar6;

-  undefined8 uVar7;

-  undefined8 *unaff_R12;

-  CInputDest *unaff_R13;

-  byte bVar8;

-  int unaff_R14D;

-  undefined4 extraout_XMM0_Da;

-  undefined4 extraout_XMM0_Da_00;

-  undefined4 uVar9;

-  undefined8 uVar10;

-  undefined8 in_stack_00000070;

-  CInputDest *in_stack_00000078;

+  char cVar1;

+  longlong lVar2;

+  undefined1 auStack_108 [32];

+  undefined4 local_e8;

+  ThreadLockedPerfRegion local_e0 [8];

+  undefined4 local_d8;

+  undefined4 local_d4;

+  undefined8 local_d0;

+  undefined4 local_c8;

+  undefined8 local_c0;

+  undefined4 local_b8;

+  ulonglong local_38;

   

-  unaff_RBP[(longlong)param_1 * 4 + 0x45] =

-       (tagINPUTDEST)((char)unaff_RBP[(longlong)param_1 * 4 + 0x45] + (char)param_1);

-  *(char *)(unaff_RBX + -0x3074b72d) = *(char *)(unaff_RBX + -0x3074b72d) + (char)param_1;

-  bVar1 = CSpatialProcessor::ResolveInputSinkToINPUTDEST(param_1,param_2,param_3);

-  cVar6 = '\x01';

-  if (bVar1) {

-    if (((byte)*unaff_RBP & 4) == 0) {

-      MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xb1);

+                    /* 0x1867e0  1721  InvokeMouseCursorPositionCallout */

+  local_38 = __security_cookie ^ (ulonglong)auStack_108;

+  InputTraceLogging::ThreadLockedPerfRegion::ThreadLockedPerfRegion

+            (local_e0,"MouseCursorPosCallout",(ThreadLockedPerfRegion *)0x0);

+  cVar1 = IsInputThread();

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

+    cVar1 = IsKSTThread();

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

+      local_e8 = 0x20000;

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

     }

-    lVar3 = 0;

-    iVar2 = IsMessageOnlyWindow(*(undefined8 *)(unaff_RBP + 0x50));

-    uVar9 = extraout_XMM0_Da;

-    if (iVar2 != 0) {

-      if (*(int *)(unaff_RBP + 0x5c) != unaff_R14D) {

-        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xbc);

-      }

-      lVar3 = HMValidateHandleNoSecure(*unaff_R12);

-      if ((lVar3 == 0) || (*(char *)(*(longlong *)(lVar3 + 0x28) + 0x13) < '\0')) {

-        memset(unaff_RBP + -0x70,0,0x70);

-        *(undefined8 *)unaff_RBP = *(undefined8 *)(unaff_RBP + -0x70);

-        *(undefined8 *)(unaff_RBP + 8) = *(undefined8 *)(unaff_RBP + -0x68);

-        *(undefined8 *)(unaff_RBP + 0x20) = *(undefined8 *)(unaff_RBP + -0x50);

-        *(undefined8 *)(unaff_RBP + 0x28) = *(undefined8 *)(unaff_RBP + -0x48);

-        *(undefined8 *)(unaff_RBP + 0x10) = *(undefined8 *)(unaff_RBP + -0x60);

-        *(undefined8 *)(unaff_RBP + 0x18) = *(undefined8 *)(unaff_RBP + -0x58);

-        *(undefined8 *)(unaff_RBP + 0x40) = *(undefined8 *)(unaff_RBP + -0x30);

-        *(undefined8 *)(unaff_RBP + 0x48) = *(undefined8 *)(unaff_RBP + -0x28);

-        uVar9 = *(undefined4 *)(unaff_RBP + -0x10);

-        *(undefined8 *)(unaff_RBP + 0x30) = *(undefined8 *)(unaff_RBP + -0x40);

-        *(undefined8 *)(unaff_RBP + 0x38) = *(undefined8 *)(unaff_RBP + -0x38);

-        *(undefined4 *)(unaff_RBP + 0x60) = uVar9;

-        *(undefined4 *)(unaff_RBP + 100) = *(undefined4 *)(unaff_RBP + -0xc);

-        *(undefined4 *)(unaff_RBP + 0x68) = *(undefined4 *)(unaff_RBP + -8);

-        *(undefined4 *)(unaff_RBP + 0x6c) = *(undefined4 *)(unaff_RBP + -4);

-        *(undefined4 *)(unaff_RBP + 0x50) = *(undefined4 *)(unaff_RBP + -0x20);

-        *(undefined4 *)(unaff_RBP + 0x54) = *(undefined4 *)(unaff_RBP + -0x1c);

-        *(undefined4 *)(unaff_RBP + 0x58) = *(undefined4 *)(unaff_RBP + -0x18);

-        *(undefined4 *)(unaff_RBP + 0x5c) = *(undefined4 *)(unaff_RBP + -0x14);

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

-           (((byte)((byte)unaff_R14D & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0 ||

-            (cVar5 = cVar6, (byte)WPP_GLOBAL_Control[0x29] < 3)))) {

-          cVar5 = '\0';

-        }

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

-        if ((cVar5 != '\0') || (bVar1)) {

-          lVar4 = W32GetUserSessionState();

-          uVar7 = *(undefined8 *)(lVar4 + 0x10f78);

-          uVar10 = 3;

-          goto LAB_0;

-        }

-      }

-      else {

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

-            ((byte)((byte)unaff_R14D & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-           (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-          cVar5 = '\0';

-        }

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

-        if ((cVar5 != '\0') || (uVar9 = extraout_XMM0_Da_00, bVar1)) {

-          lVar4 = W32GetUserSessionState();

-          uVar7 = *(undefined8 *)(lVar4 + 0x10f78);

-          uVar10 = 4;

-LAB_0:

-          uVar9 = WPP_RECORDER_AND_TRACE_SF_q

-                            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar1,uVar7,uVar10);

-        }

-      }

-      unaff_R14D = 2;

-    }

-    bVar8 = (byte)unaff_R14D;

-    if (*(uint *)unaff_RBP != 0) {

-      if ((*(uint *)unaff_RBP & 4) == 0) {

-        uVar9 = MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0xd3);

-      }

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

-          ((bVar8 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-         (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < 4)) {

-        cVar5 = '\0';

-      }

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

-      if ((cVar5 != '\0') || (bVar1)) {

-        lVar4 = W32GetUserSessionState();

-        uVar9 = WPP_RECORDER_AND_TRACE_SF_qq

-                          (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar1,

-                           *(undefined8 *)(lVar4 + 0x10f78),4);

-      }

-      ApiSetEditionUpdateInputTransformFromHitTest

-                (uVar9,lVar3,in_stack_00000070,-(uint)((*(uint *)(unaff_RBP + 0x10) & 1) != 0),

-                 unaff_R12 + 2);

-      unaff_R14D = 2;

-      unaff_R13 = in_stack_00000078;

-      goto LAB_1;

-    }

-LAB_2:

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

-        ((bVar8 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-       (cVar5 = '\x01', (byte)WPP_GLOBAL_Control[0x29] < bVar8)) {

-      cVar5 = '\0';

-    }

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

-    if ((cVar5 != '\0') || (bVar1)) {

-      lVar3 = W32GetUserSessionState();

-      WPP_RECORDER_AND_TRACE_SF_q

-                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar5,bVar1,

-                 *(undefined8 *)(lVar3 + 0x10f78),2);

-    }

-    unaff_R13 = in_stack_00000078;

-    if (*(int *)unaff_RBP == 0) goto LAB_3;

   }

-  else {

-LAB_1:

-    bVar8 = (byte)unaff_R14D;

-    if (*(int *)unaff_RBP == 0) goto LAB_2;

-  }

-  *(undefined8 *)(unaff_RBP + 0x60) = unaff_R12[0xb];

-  *(undefined4 *)(unaff_RBP + 0x68) = *(undefined4 *)(unaff_R12 + 0xc);

-  *(undefined4 *)(unaff_RBP + 4) = *(undefined4 *)((longlong)unaff_R12 + 100);

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

-    cVar6 = '\0';

-  }

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

-  in_stack_00000078 = unaff_R13;

-  if ((cVar6 != '\0') || (bVar1)) {

-    lVar3 = W32GetUserSessionState();

-    WPP_RECORDER_AND_TRACE_SF_qdd

-              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar6,bVar1,

-               *(undefined8 *)(lVar3 + 0x10f78),4);

-  }

-LAB_3:

-  CInputDest::CInputDest(in_stack_00000078,unaff_RBP);

-  return in_stack_00000078;

+  memset(&local_d8,0,0xa0);

+  local_d4 = 3;

+  local_d8 = 0;

+  local_d0 = param_2;

+  local_c8 = param_1;

+  local_c0 = param_4;

+  local_b8 = param_3;

+  lVar2 = W32GetUserSessionState();

+  InputExtensibilityCallout::CallUserModeLockFree

+            (*(InputExtensibilityCallout **)(lVar2 + 0x4010),

+             (_CLIENT_DEVICE_NOTIFICATION *)&local_d8);

+  InputTraceLogging::ThreadLockedPerfRegion::~ThreadLockedPerfRegion(local_e0);

+  return;

 }
```

## `ReferenceDwmProcess`  (modified)

```diff
--- ReferenceDwmProcess
+++ OpenDwmHandle
@@ -1,16 +1,51 @@
 

-longlong ReferenceDwmProcess(void)

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

+

+undefined4

+OpenDwmHandle(undefined8 param_1,undefined8 param_2,undefined4 param_3,undefined8 param_4,

+             undefined8 param_5,undefined8 *param_6)

 

 {

-  longlong lVar1;

+  char cVar1;

+  undefined4 uVar2;

+  CActivationObject *pCVar3;

+  undefined1 auStack_a8 [32];

+  undefined8 local_88;

+  undefined1 local_80;

+  undefined8 *local_78;

+  undefined8 local_68;

+  undefined8 uStack_60;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  undefined8 local_48;

+  undefined8 uStack_40;

+  ulonglong local_38;

   

-                    /* 0x4f3d0  2173  ReferenceDwmProcess

-                       0x4f3d0  2309  UserReferenceDwmProcess */

-  lVar1 = W32GetUserSessionState();

-  lVar1 = *(longlong *)(lVar1 + 0x114f8);

-  if (lVar1 != 0) {

-    ObReferenceObjectByPointer(lVar1,0x1fffff,*(undefined8 *)PsProcessType_exref,0);

+  local_38 = __security_cookie ^ (ulonglong)auStack_a8;

+  cVar1 = CheckOrAcquireDwmStateLock();

+  *param_6 = 0xffffffffffffffff;

+  pCVar3 = (CActivationObject *)ReferenceDwmProcess();

+  if (pCVar3 == (CActivationObject *)0x0) {

+    uVar2 = 0xc0000001;

   }

-  return lVar1;

+  else {

+    local_68 = 0;

+    uStack_60 = 0;

+    local_58 = 0;

+    uStack_50 = 0;

+    local_48 = 0;

+    uStack_40 = 0;

+    KeStackAttachProcess(pCVar3,&local_68);

+    local_78 = param_6;

+    local_80 = 0;

+    local_88 = param_2;

+    uVar2 = ObOpenObjectByPointer(param_1,0x40,0,param_3);

+    KeUnstackDetachProcess(&local_68);

+    CActivationObject::Destroy(pCVar3);

+  }

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

+    GreUnlockDwmState();

+  }

+  return uVar2;

 }
```

## `GreUnlockDwmState`  (modified)

```diff
--- GreUnlockDwmState
+++ ReleaseUserCriticalSection
@@ -1,10 +1,8 @@
 

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

-

-void GreUnlockDwmState(void)

+void ReleaseUserCriticalSection(undefined8 param_1,undefined8 param_2)

 

 {

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

-  halt_baddata();

+                    /* WARNING: Subroutine does not return */

+  KeBugCheckEx(0x160,param_2,0,0);

 }
```

## `ApiSetEditionShowSystemCursor`  (modified)

```diff
--- ApiSetEditionShowSystemCursor
+++ DirectComposition::CSynchronizationInfo::Close
@@ -1,234 +1,31 @@
 

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

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

+/* protected: virtual long __cdecl DirectComposition::CSynchronizationInfo::Close(struct

+   _WIN32_CLOSEMETHOD_PARAMETERS * __ptr64) __ptr64 */

 

-long ApiSetEditionShowSystemCursor(SynchronizationObject *param_1)

+long __thiscall

+DirectComposition::CSynchronizationInfo::Close

+          (CSynchronizationInfo *this,_WIN32_CLOSEMETHOD_PARAMETERS *param_1)

 

 {

-  ulonglong uVar1;

-  undefined4 uVar2;

-  code *pcVar3;

-  SynchronizationObject *pSVar4;

-  CApplicationChannel *pCVar5;

-  longlong lVar6;

-  char cVar7;

-  int iVar8;

-  int iVar9;

-  SynchronizationObject *pSVar10;

-  undefined4 *puVar11;

-  __uint64 _Var12;

-  SynchronizationObject *pSVar13;

-  long unaff_ESI;

-  undefined1 *puVar14;

-  longlong unaff_R12;

-  SynchronizationObject *unaff_R14;

-  bool bVar15;

-  longlong in_XMM0_Qa;

-  undefined4 in_XMM0_Dc;

-  undefined4 in_XMM0_Dd;

-  undefined1 uStack0000000000000040;

-  undefined4 uStack0000000000000044;

-  uint in_stack_00000048;

-  SynchronizationObject *in_stack_00000050;

-  CMilProtocolBlock *in_stack_00000058;

-  SynchronizationObject *in_stack_00000060;

-  longlong lStack0000000000000070;

-  uint *in_stack_00000078;

-  CApplicationChannel *in_stack_00000088;

-  longlong in_stack_00000090;

-  longlong lStack00000000000000a0;

-  undefined8 uStack00000000000000a8;

-  SynchronizationObject *in_stack_000000b0;

-  longlong in_stack_000000d0;

-  undefined8 in_stack_000000d8;

-  SynchronizationObject *in_stack_000000e0;

-  undefined4 *in_stack_00000138;

-  undefined1 *in_stack_00000140;

-  uint in_stack_00000148;

-  uint in_stack_00000168;

+  CSynchronizationInfo *pCVar1;

+  int iVar2;

   

-  uStack00000000000000a8 = CONCAT44(in_XMM0_Dd,in_XMM0_Dc);

-  lStack00000000000000a0 = in_XMM0_Qa;

-  do {

-    lVar6 = lStack00000000000000a0;

-    lStack0000000000000070 = lStack00000000000000a0;

-    if (unaff_ESI < 0) {

-joined_r0x000140192147:

-      while (in_stack_00000058 != (CMilProtocolBlock *)0x0) {

-        in_stack_00000058 = *(CMilProtocolBlock **)in_stack_00000058;

-        GreDeleteFastMutex();

-      }

-      if (in_stack_00000078 != (uint *)0x0) {

-        GreDeleteFastMutex(in_stack_00000078);

-      }

-      return unaff_ESI;

-    }

-    if (lStack00000000000000a0 == unaff_R12) {

-      if (unaff_ESI < 0) goto joined_r0x000140192147;

-      if ((in_stack_00000050 != (SynchronizationObject *)0x0) && (in_stack_00000168 != 0)) {

-        uVar1 = (ulonglong)in_stack_00000168 * 4;

-        if (uVar1 < in_stack_00000168) {

-          unaff_ESI = -0x3ffffff3;

-          goto joined_r0x000140192147;

-        }

-        in_stack_00000078 = Win32AllocPoolWithQuotaImpl((__uint64)param_1,uVar1,0x66624344);

-        if (in_stack_00000078 == (uint *)0x0) {

-          unaff_ESI = -0x3fffffe9;

-          goto joined_r0x000140192147;

-        }

-        RtlCopyFromUser(in_stack_00000078,in_stack_00000050,uVar1);

-      }

-      if ((-1 < unaff_ESI) &&

-         (unaff_ESI = DirectComposition::CApplicationChannel::ReferenceHandleAndLock

-                                (in_stack_00000048,&stack0x00000088), -1 < unaff_ESI)) {

-        pSVar10 = unaff_R14;

-        if (in_stack_00000090 != 0) {

-          in_stack_00000060 = unaff_R14;

-          iVar8 = ObReferenceObjectByHandle

-                            (in_stack_00000090,1,*(undefined8 *)ExCompositionObjectType_exref,1,

-                             &stack0x00000060);

-          pSVar4 = in_stack_00000060;

-          if (-1 < iVar8) {

-            cVar7 = (**(code **)**(undefined8 **)(in_stack_00000060 + 8))();

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

-              iVar8 = -0x3ffffff8;

-            }

-            else {

-              iVar9 = (**(code **)(**(longlong **)(pSVar4 + 8) + 0x10))();

-              pSVar10 = pSVar4;

-              if (iVar9 != 3) {

-                iVar8 = -0x3fffffdc;

-                pSVar10 = unaff_R14;

-              }

-              if (-1 < iVar8) goto LAB_0;

-            }

-            ObfDereferenceObject(pSVar4);

-          }

-LAB_0:

-          if (iVar8 < 0) {

-            pSVar10 = unaff_R14;

-          }

-          iVar9 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

-          if ((iVar9 != 0) && (iVar8 < 0)) {

-            in_stack_00000050 = unaff_R14;

-            iVar8 = ObReferenceObjectByHandle

-                              (in_stack_00000090,1,*(undefined8 *)ExCompositionObjectType_exref,1,

-                               &stack0x00000050);

-            pSVar4 = in_stack_00000050;

-            pSVar13 = unaff_R14;

-            if (iVar8 < 0) {

-LAB_1:

-              bVar15 = iVar8 < 0;

-            }

-            else {

-              cVar7 = (**(code **)**(undefined8 **)(in_stack_00000050 + 8))();

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

-                iVar8 = -0x3ffffff8;

-LAB_2:

-                ObfDereferenceObject(pSVar4);

-                goto LAB_1;

-              }

-              iVar9 = (**(code **)(**(longlong **)(pSVar4 + 8) + 0x10))();

-              pSVar13 = pSVar4;

-              if (iVar9 != 7) {

-                iVar8 = -0x3fffffdc;

-                pSVar13 = unaff_R14;

-              }

-              bVar15 = false;

-              if (iVar8 < 0) goto LAB_2;

-            }

-            if (bVar15) {

-              pSVar13 = unaff_R14;

-            }

-            if (-1 < iVar8) {

-              pSVar10 = *(SynchronizationObject **)(pSVar13 + 0x30);

-              if (pSVar10 != (SynchronizationObject *)0x0) {

-                ObReferenceObjectByPointer(pSVar10,3,*(undefined8 *)ExCompositionObjectType_exref);

-              }

-              ObfDereferenceObject(pSVar13);

-            }

-          }

-        }

-        pCVar5 = in_stack_00000088;

-        unaff_ESI = DirectComposition::CApplicationChannel::Commit

-                              (in_stack_00000088,(bool *)&stack0x00000040,

-                               (bool)((byte)in_stack_00000148 & 1),

-                               (bool)((byte)(in_stack_00000148 >> 1) & 1),pSVar10,in_stack_00000058,

-                               in_stack_00000078,in_stack_00000168);

-        if (-1 < unaff_ESI) {

-          iVar8 = Feature_DCompkRacyAccess__private_IsEnabledDeviceUsageNoInline();

-          if (iVar8 == 0) {

-            uStack0000000000000044 = *(undefined4 *)(pCVar5 + 0x1ac);

-          }

-          else {

-            ExAcquirePushLockSharedEx(pCVar5 + 0x198,0);

-            pCVar5[0x1a0] = (CApplicationChannel)0x0;

-            uVar2 = *(undefined4 *)(pCVar5 + 0x1ac);

-            ExReleasePushLockSharedEx(pCVar5 + 0x198,0);

-            uStack0000000000000044 = uVar2;

-          }

-        }

-        if (pSVar10 != (SynchronizationObject *)0x0) {

-          ObfDereferenceObject(pSVar10);

-        }

-        (*(code *)**(undefined8 **)in_stack_00000088)(in_stack_00000088);

-        pcVar3 = MmUserProbeAddress_exref;

-        if (-1 < unaff_ESI) {

-          if (in_stack_00000138 != (undefined4 *)0x0) {

-            puVar11 = in_stack_00000138;

-            if (*(undefined4 **)MmUserProbeAddress_exref <= in_stack_00000138) {

-              puVar11 = *(undefined4 **)MmUserProbeAddress_exref;

-            }

-            *puVar11 = uStack0000000000000044;

-          }

-          puVar14 = in_stack_00000140;

-          if (*(undefined1 **)pcVar3 <= in_stack_00000140) {

-            puVar14 = *(undefined1 **)pcVar3;

-          }

-          *puVar14 = uStack0000000000000040;

-        }

-      }

-      goto joined_r0x000140192147;

-    }

-    lStack00000000000000a0 = 0;

-    uStack00000000000000a8 = 0;

-    in_stack_000000b0 = (SynchronizationObject *)0x0;

-    in_stack_000000d0 = 0;

-    in_stack_000000d8 = 0;

-    in_stack_000000e0 = (SynchronizationObject *)0x0;

-    lStack0000000000000070 = lVar6;

-    RtlCopyFromUser(&stack0x000000d0,lVar6,0x18);

-    lStack00000000000000a0 = in_stack_000000d0;

-    uStack00000000000000a8 = in_stack_000000d8;

-    in_stack_000000b0 = in_stack_000000e0;

-    if ((-1 < unaff_ESI) &&

-       ((((ulonglong)in_stack_000000e0 >> 0x20 & 3) != 0 ||

-        ((uint)((ulonglong)in_stack_000000e0 >> 0x20) < 8)))) {

-      unaff_ESI = -0x3ffffff3;

-    }

-    param_1 = in_stack_000000e0;

-    if (-1 < unaff_ESI) {

-      _Var12 = ((ulonglong)in_stack_000000e0 >> 0x20) + 0x18;

-      if (_Var12 < 0x18) {

-        unaff_ESI = -0x3ffffff3;

-      }

-      else if (-1 < unaff_ESI) {

-        pSVar10 = Win32AllocPoolWithQuotaImpl((__uint64)in_stack_000000e0,_Var12,0x66624344);

-        if (pSVar10 == (SynchronizationObject *)0x0) {

-          unaff_ESI = -0x3fffffe9;

-        }

-        else if (-1 < unaff_ESI) {

-          *(SynchronizationObject **)in_stack_00000060 = pSVar10;

-          *(SynchronizationObject **)pSVar10 = unaff_R14;

-          *(SynchronizationObject **)(pSVar10 + 8) = unaff_R14;

-          *(int *)(pSVar10 + 0x10) = (int)unaff_R14;

-          *(undefined4 *)(pSVar10 + 0x14) = in_stack_000000b0._4_4_;

-          param_1 = pSVar10 + 0x18;

-          in_stack_00000060 = pSVar10;

-          RtlCopyFromUser(param_1,lVar6 + 0x18,in_stack_000000b0._4_4_);

-        }

+  iVar2 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 != 0) {

+    iVar2 = _IsProcessDwm(*(_EPROCESS **)(param_1 + 0x10));

+    if (iVar2 != 0) {

+      LOCK();

+      pCVar1 = this + 0x14;

+      iVar2 = *(int *)pCVar1;

+      *(int *)pCVar1 = *(int *)pCVar1 + -1;

+      UNLOCK();

+      EtwTraceDCompSyncInfoEndDwmLayoutEvent(this,iVar2 + -1);

+      if (iVar2 + -1 == 0) {

+        this[9] = (CSynchronizationInfo)0x1;

+        EtwTraceDCompSyncInfoCommitEvent(this);

       }

     }

-  } while( true );

+  }

+  return 0;

 }
```

## `UserJobCallout`  (modified)

```diff
--- UserJobCallout
+++ <lambda_c820352fe8162641e9666e92528d8056>::<lambda_invoker_cdecl>
@@ -1,26 +1,17 @@
 

-void UserJobCallout(undefined8 param_1,longlong param_2,ulonglong param_3,ulonglong *param_4,

-                   undefined1 *param_5,longlong *param_6,ulonglong *param_7)

+bool <lambda_c820352fe8162641e9666e92528d8056>::<lambda_invoker_cdecl>(longlong param_1)

 

 {

-  undefined1 uVar1;

-  char in_AL;

-  ulonglong unaff_RSI;

-  longlong unaff_RDI;

-  ulonglong in_R10;

-  ulonglong in_R11;

+  int iVar1;

+  bool bVar2;

   

-  if (*(char *)(param_2 + 0x1c) != in_AL) {

-    unaff_RDI = unaff_RDI + (param_3 - in_R10);

+  iVar1 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar1 == 0) {

+    bVar2 = 0x1fff < *(uint *)(param_1 + 0x358);

   }

-  uVar1 = *(undefined1 *)(param_2 + 0x1c);

-  if (((unaff_RSI & 0x10) != 0) && (unaff_RDI = *(longlong *)(param_2 + 0x20), in_R11 <= param_3)) {

-    in_R10 = param_3;

+  else {

+    bVar2 = UIPrivilegeIsolation::MeetsUIPIThreshold((tagUIPI_INFO *)(param_1 + 0x358),0x2000);

   }

-  *param_4 = in_R11;

-  *param_5 = uVar1;

-  *param_6 = unaff_RDI;

-  *param_7 = in_R10;

-  return;

+  return bVar2;

 }
```

## `ModerncoreAtomTable`  (modified)

```diff
--- ModerncoreAtomTable
+++ DisableImeForProcess
@@ -1,54 +1,17 @@
 

-ulonglong ModerncoreAtomTable(undefined8 param_1,undefined8 param_2,undefined8 param_3,char param_4,

-                             byte param_5)

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

+

+void DisableImeForProcess(undefined8 param_1)

 

 {

-  char in_AL;

-  char cVar1;

-  byte bVar2;

-  uint uVar3;

-  undefined8 unaff_RBX;

-  ulonglong uVar4;

-  uint unaff_EBP;

-  char unaff_SIL;

-  char *unaff_RDI;

-  longlong in_R10;

-  byte *in_R11;

-  char in_CF;

+  code *pcVar1;

+  longlong lVar2;

   

-  uVar4 = CONCAT62((int6)((ulonglong)unaff_RBX >> 0x10),CONCAT11(0xf8,(char)unaff_RBX));

-  uVar3 = unaff_EBP;

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

-    uVar3 = 4;

-    in_R11 = in_R11 + (-(ulonglong)

-                        (*(char *)(CONCAT71((int7)((ulonglong)param_1 >> 8),

-                                            (char)param_1 + *unaff_RDI +

-                                            (0xf0 < (byte)(in_AL + -0x15 + in_CF))) + 10) != '\0') &

-                      4) + 4;

+  lVar2 = W32GetWin32kBaseApiSetTable();

+  pcVar1 = *(code **)(*(longlong *)(lVar2 + 0x30) + 600);

+  if (pcVar1 != (code *)0x0) {

+    (*pcVar1)(param_1);

   }

-  if (uVar3 < (uint)unaff_RDI) {

-    do {

-      cVar1 = (char)unaff_EBP;

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

-LAB_0:

-        bVar2 = *in_R11;

-        if ((0x40 < bVar2) && (bVar2 < 0x5b)) {

-          bVar2 = bVar2 + 0x20;

-        }

-        uVar4 = (ulonglong)((uint)bVar2 + (uint)param_5 * (int)uVar4);

-      }

-      else {

-        if (((*(ushort *)(in_R10 + 0x1a) != 0) && (*(ushort *)(in_R10 + 0x1a) <= uVar3)) &&

-           (uVar3 <= *(ushort *)(in_R10 + 0x1c))) {

-          cVar1 = '\x01';

-        }

-        if ((((*(ushort *)(in_R10 + 0x1e) == 0) || (uVar3 < *(ushort *)(in_R10 + 0x1e))) ||

-            (*(ushort *)(in_R10 + 0x20) < uVar3)) && (cVar1 == '\0')) goto LAB_0;

-      }

-      in_R11 = in_R11 + (ulonglong)(*(char *)(in_R10 + 10) != '\0') + 1;

-      uVar3 = uVar3 + 1;

-    } while (uVar3 < (uint)unaff_RDI);

-  }

-  return uVar4 & 0xffffffff;

+  return;

 }
```

## `McTemplateK0pp_EtwWriteTransfer`  (modified)

```diff
--- McTemplateK0pp_EtwWriteTransfer
+++ McTemplateK0xxqqqqq_EtwWriteTransfer
@@ -1,7 +1,48 @@
 

-void McTemplateK0pp_EtwWriteTransfer(void)

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

+

+void McTemplateK0xxqqqqq_EtwWriteTransfer

+               (undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4)

 

 {

+  undefined8 local_res20;

+  undefined1 auStack_c8 [32];

+  undefined1 *local_a8;

+  undefined1 local_98 [16];

+  undefined8 *local_88;

+  undefined8 local_80;

+  undefined1 *local_78;

+  undefined8 local_70;

+  undefined1 *local_68;

+  undefined8 local_60;

+  undefined1 *local_58;

+  undefined8 local_50;

+  undefined1 *local_48;

+  undefined8 local_40;

+  undefined1 *local_38;

+  undefined8 local_30;

+  undefined1 *local_28;

+  undefined8 local_20;

+  ulonglong local_18;

+  

+  local_18 = __security_cookie ^ (ulonglong)auStack_c8;

+  local_60 = 4;

+  local_88 = &local_res20;

+  local_80 = 8;

+  local_78 = &stack0x00000028;

+  local_70 = 8;

+  local_68 = &stack0x00000030;

+  local_50 = 4;

+  local_58 = &stack0x00000038;

+  local_48 = &stack0x00000040;

+  local_38 = &stack0x00000048;

+  local_28 = &stack0x00000050;

+  local_a8 = local_98;

+  local_40 = 4;

+  local_30 = 4;

+  local_20 = 4;

+  local_res20 = param_4;

+  McGenEventWrite_EtwWriteTransfer(param_1,&CompositionTargetGlitch,&W32kControlGuid);

   return;

 }
```

## `_IsProcessDwm`  (modified)

```diff
--- _IsProcessDwm
+++ ApiSetEditionWindowBeginLayoutForDCompk
@@ -1,9 +1,29 @@
 

-int __cdecl _IsProcessDwm(_EPROCESS *param_1)

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

+

+undefined4 ApiSetEditionWindowBeginLayoutForDCompk(undefined8 param_1)

 

 {

-  int in_EAX;

+  code *pcVar1;

+  int iVar2;

+  undefined4 uVar3;

+  longlong lVar4;

   

-  return in_EAX;

+  iVar2 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+  if (iVar2 != 0) {

+    lVar4 = W32GetWin32kBaseApiSetTable();

+    pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x1d00);

+    if ((pcVar1 != (code *)0x0) && (iVar2 = (*pcVar1)(), -1 < iVar2)) {

+      lVar4 = W32GetWin32kBaseApiSetTable();

+      pcVar1 = *(code **)(*(longlong *)(lVar4 + 0x30) + 0x1d08);

+      if (pcVar1 == (code *)0x0) {

+        return 0;

+      }

+      uVar3 = (*pcVar1)(param_1);

+      return uVar3;

+    }

+  }

+  UserSetLastError(0x32);

+  return 0;

 }
```

## `CloseWin32InputRelatedObHandles`  (modified)

```diff
--- CloseWin32InputRelatedObHandles
+++ CBaseInput::RemoveInjectionDevicesForSessionUninitialize
@@ -1,18 +1,46 @@
 

-undefined4 CloseWin32InputRelatedObHandles(undefined4 param_1)

+/* public: static void __cdecl CBaseInput::RemoveInjectionDevicesForSessionUninitialize(void) */

+

+void __cdecl CBaseInput::RemoveInjectionDevicesForSessionUninitialize(void)

 

 {

-  int in_EAX;

-  uint uVar1;

-  undefined8 unaff_RBX;

-  uint *unaff_RSI;

-  undefined8 *unaff_R14;

-  byte in_CF;

+  longlong lVar1;

+  longlong lVar2;

+  longlong lVar3;

+  longlong lVar4;

+  ulonglong uVar5;

   

-  uVar1 = in_EAX + (uint)in_CF;

-  *(char *)(ulonglong)uVar1 = *(char *)(ulonglong)uVar1 + (char)uVar1;

-  *unaff_RSI = uVar1;

-  *unaff_R14 = unaff_RBX;

-  return param_1;

+  lVar2 = W32GetUserSessionState();

+  W32AcquirePushLockExclusiveEx((W32_PUSH_LOCK *)(lVar2 + 0xbf8),0);

+  lVar3 = W32GetUserSessionState();

+  lVar4 = *(longlong *)(lVar3 + 0xc00);

+  while (lVar4 != 0) {

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

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

+    }

+    *(undefined8 *)(lVar3 + 0xc00) = *(undefined8 *)(*(longlong *)(lVar3 + 0xc00) + 0x38);

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

+    uVar5 = -(ulonglong)(lVar4 != 0) & lVar4 - 0x48U;

+    ObfDereferenceObject(uVar5);

+    if ((char)*(undefined4 *)(lVar4 + 0xb8) < '\0') {

+      lVar1 = *(longlong *)(lVar4 + 0x1c8);

+      HMUnlockObject(lVar1);

+      if (*(int *)(lVar1 + 8) != 0) {

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

+      }

+      HMMarkObjectDestroy(lVar1);

+      HMRemoveHandleForObject(lVar1);

+    }

+    HMMarkObjectDestroy(lVar4);

+    HMRemoveHandleForObject(lVar4);

+    lVar4 = uVar5 + 0x48;

+    if (uVar5 == 0) {

+      lVar4 = 0;

+    }

+    rimDereferenceDev(lVar4);

+    lVar4 = *(longlong *)(lVar3 + 0xc00);

+  }

+  W32ReleasePushLockExclusiveEx((W32_PUSH_LOCK *)(lVar2 + 0xbf8),0);

+  return;

 }
```

## `PTPEngineTraceProducer::OnEngineOutput`  (modified)

```diff
--- PTPEngineTraceProducer::OnEngineOutput
+++ PTPEngineTraceProducer::OnEngineOutput
@@ -1,2 +1,44 @@
-Failed to decompile win32kbase.sys - .ProgramDB PTPEngineTraceProducer::OnEngineOutput : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* public: virtual void __cdecl PTPEngineTraceProducer::OnEngineOutput(struct PTPEngineOutput const

+   * __ptr64) __ptr64 */

+

+void __thiscall

+PTPEngineTraceProducer::OnEngineOutput(PTPEngineTraceProducer *this,PTPEngineOutput *param_1)

+

+{

+  _GUID *in_R9;

+  undefined4 local_res8 [2];

+  undefined8 local_res10;

+  PTPEngineOutput *local_18;

+  undefined2 local_10;

+  

+  if (((5 < DAT_0) && (((byte)DAT_14029aed0 & 5) != 0)) &&

+     ((_GUID *)(ulonglong)((uint)DAT_1 & 5) == DAT_1)) {

+    local_10 = 0x14;

+    local_res10 = *(undefined8 *)(this + 0xc0);

+    local_res8[0] = 2;

+    local_18 = param_1;

+    _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>,_tlgWrapperBinary>

+              ((_tlgProvider_t *)this,&DAT_2,DAT_14029aed8,in_R9,

+               (_tlgWrapperByVal<8> *)&local_res10,(_tlgWrapperByVal<4> *)local_res8,

+               (_tlgWrapperBinary *)&local_18);

+  }

+  if (((*(int *)(param_1 + 0x10) != 0) && (5 < DAT_0)) &&

+     ((((byte)DAT_3 & 5) != 0 &&

+      ((_GUID *)(ulonglong)((uint)DAT_1 & 5) == DAT_1)))) {

+    local_18 = param_1 + 0x14;

+    local_res8[0] = 1;

+    local_res10 = *(undefined8 *)(this + 0xc0);

+    local_10 = (undefined2)((uint)*(ushort *)(param_1 + 0x10) * 0x90);

+    _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>,_tlgWrapperBinary>

+              ((_tlgProvider_t *)(ulonglong)((uint)*(ushort *)(param_1 + 0x10) * 0x90),

+               &DAT_4,DAT_14029aed8,in_R9,(_tlgWrapperByVal<8> *)&local_res10,

+               (_tlgWrapperByVal<4> *)local_res8,(_tlgWrapperBinary *)&local_18);

+  }

+  (**(code **)**(undefined8 **)(this + 0x10))(*(undefined8 **)(this + 0x10),param_1);

+  return;

+}

+
```

## `DispConfigTypes::GetGetterTypeSize`  (modified)

```diff
--- DispConfigTypes::GetGetterTypeSize
+++ DispConfigTypes::GetGetterTypeSize
@@ -1,2 +1,100 @@
-Failed to decompile win32kbase.sys - .ProgramDB DispConfigTypes::GetGetterTypeSize : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* unsigned long __cdecl DispConfigTypes::GetGetterTypeSize(enum DISPLAYCONFIG_DEVICE_INFO_TYPE) */

+

+ulong __cdecl DispConfigTypes::GetGetterTypeSize(DISPLAYCONFIG_DEVICE_INFO_TYPE param_1)

+

+{

+  int iVar1;

+  ulong uVar2;

+  

+  if (100 < (int)param_1) goto switchD_140167543_caseD_ffffffd5;

+  if (param_1 == 100) {

+switchD_140167543_caseD_ffffffd3:

+    uVar2 = 0x18;

+  }

+  else {

+    switch(param_1) {

+    case 1:

+      uVar2 = 0x54;

+      break;

+    case 2:

+      uVar2 = 0x1a4;

+      break;

+    case 3:

+      uVar2 = 0x50;

+      break;

+    case 4:

+      uVar2 = 0x114;

+      break;

+    case 0xffffffd1:

+    case 0xffffffe8:

+    case 0xfffffff1:

+    case 0xfffffffd:

+    case 9:

+      uVar2 = 0x20;

+      break;

+    case 0xffffffd2:

+      iVar1 = Feature_ScalarMultiplierForBrightness__private_IsEnabledDeviceUsageNoInline();

+      if (iVar1 != 0) {

+        return 0x10c;

+      }

+    default:

+switchD_140167543_caseD_ffffffd5:

+      uVar2 = 0;

+      break;

+    case 0xffffffd3:

+    case 0xffffffdc:

+    case 0xffffffe6:

+    case 0xfffffff4:

+    case 0xfffffff7:

+    case 6:

+    case 7:

+    case 0xb:

+    case 0xc:

+      goto switchD_140167543_caseD_ffffffd3;

+    case 0xffffffd4:

+    case 0xffffffea:

+    case 0xfffffff6:

+    case 0xfffffffb:

+      uVar2 = 0x1c;

+      break;

+    case 0xffffffd6:

+      uVar2 = 0x108;

+      break;

+    case 0xffffffd9:

+    case 0xfffffff3:

+    case 0xf:

+      uVar2 = 0x24;

+      break;

+    case 0xffffffdb:

+      uVar2 = 0x2c;

+      break;

+    case 0xffffffde:

+      uVar2 = 0x308;

+      break;

+    case 0xffffffdf:

+      uVar2 = 0x178;

+      break;

+    case 0xffffffe2:

+    case 0xffffffeb:

+    case 0xfffffff5:

+    case 0xfffffffe:

+      uVar2 = 0x808;

+      break;

+    case 0xffffffe7:

+    case 0xfffffff2:

+      uVar2 = 0x28;

+      break;

+    case 0xffffffec:

+      uVar2 = 0x38;

+      break;

+    case 0xfffffff8:

+      uVar2 = 0x518;

+      break;

+    case 0xfffffff9:

+      uVar2 = 0x3b0;

+    }

+  }

+  return uVar2;

+}

+
```

## `CPTPEngine::ProcessGestureFrame`  (modified)

```diff
--- CPTPEngine::ProcessGestureFrame
+++ CPTPEngine::ProcessGestureFrame
@@ -1,2 +1,232 @@
-Failed to decompile win32kbase.sys - .ProgramDB CPTPEngine::ProcessGestureFrame : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* private: void __cdecl CPTPEngine::ProcessGestureFrame(struct PTPInput * __ptr64,int,int *

+   __ptr64) __ptr64 */

+

+void __thiscall

+CPTPEngine::ProcessGestureFrame(CPTPEngine *this,PTPInput *param_1,int param_2,int *param_3)

+

+{

+  undefined1 auVar1 [16];

+  undefined1 auVar2 [16];

+  undefined4 uVar3;

+  undefined4 uVar4;

+  undefined4 uVar5;

+  longlong lVar6;

+  longlong lVar7;

+  longlong lVar8;

+  longlong lVar9;

+  bool bVar10;

+  bool bVar11;

+  longlong *plVar12;

+  int iVar13;

+  longlong lVar14;

+  uint uVar15;

+  longlong *plVar16;

+  PTPInput *pPVar17;

+  CPTPEngine *pCVar18;

+  int iVar19;

+  PTPEnginePointerNode *pPVar20;

+  uint *puVar21;

+  ulonglong uVar22;

+  char cVar23;

+  char cVar24;

+  int iVar25;

+  uint uVar26;

+  ulonglong uVar27;

+  undefined1 auStackY_438 [32];

+  PTPEnginePointerNode *local_400;

+  longlong local_3e8 [6];

+  ulonglong local_3b8;

+  PTPEnginePointerNode aPStack_3b0 [4];

+  uint auStack_3ac [2];

+  uint auStack_3a4 [215];

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStackY_438;

+  lVar14 = 7;

+  plVar12 = local_3e8;

+  do {

+    pPVar17 = param_1;

+    plVar16 = plVar12;

+    lVar6 = *(longlong *)(pPVar17 + 8);

+    lVar7 = *(longlong *)(pPVar17 + 0x10);

+    lVar8 = *(longlong *)(pPVar17 + 0x18);

+    *plVar16 = *(longlong *)pPVar17;

+    plVar16[1] = lVar6;

+    lVar6 = *(longlong *)(pPVar17 + 0x20);

+    lVar9 = *(longlong *)(pPVar17 + 0x28);

+    plVar16[2] = lVar7;

+    plVar16[3] = lVar8;

+    lVar7 = *(longlong *)(pPVar17 + 0x30);

+    lVar8 = *(longlong *)(pPVar17 + 0x38);

+    plVar16[4] = lVar6;

+    plVar16[5] = lVar9;

+    lVar6 = *(longlong *)(pPVar17 + 0x40);

+    lVar9 = *(longlong *)(pPVar17 + 0x48);

+    plVar16[6] = lVar7;

+    uVar22 = local_3b8;

+    plVar16[7] = lVar8;

+    lVar7 = *(longlong *)(pPVar17 + 0x50);

+    lVar8 = *(longlong *)(pPVar17 + 0x58);

+    plVar16[8] = lVar6;

+    plVar16[9] = lVar9;

+    lVar6 = *(longlong *)(pPVar17 + 0x60);

+    lVar9 = *(longlong *)(pPVar17 + 0x68);

+    plVar16[10] = lVar7;

+    plVar16[0xb] = lVar8;

+    lVar7 = *(longlong *)(pPVar17 + 0x70);

+    lVar8 = *(longlong *)(pPVar17 + 0x78);

+    plVar16[0xc] = lVar6;

+    plVar16[0xd] = lVar9;

+    plVar16[0xe] = lVar7;

+    plVar16[0xf] = lVar8;

+    lVar14 = lVar14 + -1;

+    plVar12 = plVar16 + 0x10;

+    param_1 = pPVar17 + 0x80;

+  } while (lVar14 != 0);

+  uVar3 = *(undefined4 *)(pPVar17 + 0x84);

+  uVar4 = *(undefined4 *)(pPVar17 + 0x88);

+  uVar5 = *(undefined4 *)(pPVar17 + 0x8c);

+  lVar14 = *(longlong *)(pPVar17 + 0x90);

+  pPVar20 = aPStack_3b0;

+  pCVar18 = (CPTPEngine *)0x0;

+  *(undefined4 *)(plVar16 + 0x10) = *(undefined4 *)(pPVar17 + 0x80);

+  *(undefined4 *)((longlong)plVar16 + 0x84) = uVar3;

+  *(undefined4 *)(plVar16 + 0x11) = uVar4;

+  *(undefined4 *)((longlong)plVar16 + 0x8c) = uVar5;

+  plVar16[0x12] = lVar14;

+  iVar25 = 0;

+  bVar10 = false;

+  local_400 = (PTPEnginePointerNode *)0x0;

+  iVar19 = (int)local_3b8;

+  if (iVar19 != 0) {

+    uVar27 = local_3b8 & 0xffffffff;

+    bVar10 = false;

+    do {

+      pCVar18 = this + ((ulonglong)*(uint *)(pPVar20 + 4) % (ulonglong)*(uint *)(this + 0x10)) *

+                       0x148 + 0x450;

+      uVar15 = *(uint *)pCVar18;

+      if (((uVar15 & 1) != 0) && ((uVar15 >> 0xb & 1) == 0)) {

+        iVar25 = iVar25 + 1;

+        *(uint *)pCVar18 = uVar15 & 0x7fffffff;

+        iVar13 = Feature_TouchpadSingleFingerPanning__private_IsEnabledDeviceUsageNoInline();

+        local_400 = pPVar20;

+        if ((iVar13 != 0) && (((byte)*pCVar18 & 2) != 0)) {

+          bVar10 = true;

+        }

+      }

+      pPVar20 = pPVar20 + 0x90;

+      uVar27 = uVar27 - 1;

+    } while (uVar27 != 0);

+  }

+  if (((param_2 != 0) || (*(uint *)(this + 0xc18) < 3)) ||

+     (bVar11 = true, auVar1._8_8_ = 0,

+     auVar1._0_8_ = (ulonglong)*(uint *)(this + 0xdc0) * *(longlong *)(this + 0x60),

+     lVar14 = SUB168(ZEXT816(0x624dd2f1a9fbe77) * auVar1,8),

+     ((ulonglong)*(uint *)(this + 0xdc0) * *(longlong *)(this + 0x60) - lVar14 >> 1) + lVar14 >> 9

+     <= (ulonglong)(local_3e8[0] - *(longlong *)(this + 0xcc8)))) {

+    bVar11 = false;

+  }

+  iVar13 = Feature_TouchpadSingleFingerPanning__private_IsEnabledDeviceUsageNoInline();

+  if (iVar13 == 0) {

+    if (iVar25 != 1) goto LAB_0;

+    uVar15 = *(uint *)(local_400 + 0xc) & 0x40000;

+LAB_1:

+    if ((uVar15 != 0) || (*(int *)(this + 0x18) != 0)) goto LAB_0;

+    bVar10 = true;

+    if ((*(uint *)pCVar18 & 0x40000) == 0) {

+      *(uint *)pCVar18 = *(uint *)pCVar18 | 0x40000;

+      *(longlong *)(this + 0xcb0) = local_3e8[0];

+    }

+    auVar2._8_8_ = 0;

+    auVar2._0_8_ = (ulonglong)*(uint *)(this + 0xd70) * *(longlong *)(this + 0x60);

+    lVar14 = SUB168(ZEXT816(0x624dd2f1a9fbe77) * auVar2,8);

+    if ((ulonglong)(local_3e8[0] - *(longlong *)(this + 0xcb0)) <

+        ((ulonglong)*(uint *)(this + 0xd70) * *(longlong *)(this + 0x60) - lVar14 >> 1) + lVar14 >>

+        9) goto LAB_2;

+    *(uint *)pCVar18 = *(uint *)pCVar18 & 0xfffbfbff;

+    *(uint *)(pCVar18 + 4) = *(uint *)(pCVar18 + 4) | 2;

+  }

+  else {

+    if ((bVar10) && (iVar19 != 0)) {

+      puVar21 = auStack_3ac;

+      uVar22 = uVar22 & 0xffffffff;

+      do {

+        pCVar18 = this + ((ulonglong)*puVar21 % (ulonglong)*(uint *)(this + 0x10)) * 0x148 + 0x450;

+        if (((*(uint *)pCVar18 & 1) != 0) && ((*(uint *)pCVar18 >> 0xb & 1) == 0)) {

+          *(uint *)(pCVar18 + 4) = *(uint *)(pCVar18 + 4) & 0xffffffdf;

+        }

+        puVar21 = puVar21 + 0x24;

+        uVar22 = uVar22 - 1;

+      } while (uVar22 != 0);

+    }

+    if ((iVar25 == 1) && ((*(uint *)(local_400 + 0xc) & 0x40000) == 0)) {

+      uVar15 = *(uint *)(pCVar18 + 4) & 0x20;

+      goto LAB_1;

+    }

+LAB_0:

+    bVar10 = false;

+LAB_2:

+    if (!bVar11) {

+      cVar24 = '\0';

+      goto LAB_3;

+    }

+  }

+  cVar24 = '\x01';

+LAB_3:

+  bVar11 = true;

+  uVar22 = 0;

+  cVar23 = '\0';

+  uVar26 = 0;

+  uVar15 = 0;

+  if (iVar19 != 0) {

+    puVar21 = auStack_3a4;

+    bVar11 = true;

+    do {

+      lVar14 = ((ulonglong)puVar21[-2] % (ulonglong)*(uint *)(this + 0x10)) * 0x148;

+      uVar15 = *(uint *)(this + lVar14 + 0x450);

+      if ((((uVar15 & 1) != 0) && (cVar24 != '\0')) && ((uVar15 & 2) != 0)) {

+        uVar15 = uVar15 | 0x800;

+        *(uint *)(this + lVar14 + 0x450) = uVar15;

+      }

+      if (((uVar15 & 1) == 0) || ((uVar15 >> 0xb & 1) != 0)) {

+        *puVar21 = 0;

+        puVar21[7] = 0;

+        puVar21[8] = 0;

+      }

+      else {

+        if (((uVar15 >> 0x1e & 1) == 0) && ((*puVar21 & 0x2000) == 0)) {

+          iVar19 = 0;

+        }

+        else {

+          iVar19 = 1;

+        }

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

+          *puVar21 = *puVar21 & 0xfffdffff | 0x10000;

+        }

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

+          *puVar21 = 0x40000;

+        }

+        uVar22 = uVar22 & 0xff;

+        if ((*puVar21 & 0x40000) == 0) {

+          uVar22 = 1;

+        }

+        FixupGestureContact(this,(PTPEnginePointerNode *)(puVar21 + -3),iVar19);

+        bVar11 = false;

+        if (!bVar10) {

+          *(uint *)(this + lVar14 + 0x450) = *(uint *)(this + lVar14 + 0x450) & 0xfffbffff;

+        }

+      }

+      cVar23 = (char)uVar22;

+      uVar15 = (uint)local_3b8;

+      uVar26 = uVar26 + 1;

+      puVar21 = puVar21 + 0x24;

+    } while (uVar26 < uVar15);

+  }

+  if ((((cVar24 == '\0') && (!bVar11)) && (cVar23 != '\0')) || (*param_3 = 1, !bVar11)) {

+    CBasePTPEngine::SendGestureOutput((CBasePTPEngine *)this,3,param_2,uVar15,aPStack_3b0);

+  }

+  return;

+}

+
```

## `NSInstrumentation::CTypeIsolation<909312,3552>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<909312,3552>::Allocate
+++ NSInstrumentation::CTypeIsolation<909312,3552>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kbase.sys - .ProgramDB NSInstrumentation::CTypeIsolation<909312,3552>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<909312,3552>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<909312,3552>::Allocate(CTypeIsolation<909312,3552> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<909312,3552> *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<909312,3552>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    GreAcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<909312,3552> **)this; pCVar6 != (CSectionEntry<909312,3552> *)this

+        ; pCVar6 = *(CSectionEntry<909312,3552> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<909312,3552>::Allocate

+                            (*(CSectionBitmapAllocator<909312,3552> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<909312,3552>::Create();

+    if (pCVar6 != (CSectionEntry<909312,3552> *)0x0) {

+      _Dst = CSectionBitmapAllocator<909312,3552>::Allocate

+                       (*(CSectionBitmapAllocator<909312,3552> **)(pCVar6 + 0x20));

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

+        CSectionEntry<49152,192>::Destroy((CSectionEntry<49152,192> *)pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<909312,3552> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<909312,3552> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<909312,3552> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xde;

+          *(CSectionEntry<909312,3552> **)this = pCVar6;

+          GreReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

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

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<909312,3552> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x140071ec6;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x140071ed2;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<909312,3552> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<909312,3552> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<909312,3552> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<909312,3552> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<909312,3552> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<909312,3552> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x140071f0a;

+          GreReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x140071f14;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0xde0);

+    }

+  }

+  return _Dst;

+}

+
```

## `NSInstrumentation::CTypeIsolation<180224,704>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<180224,704>::Allocate
+++ NSInstrumentation::CTypeIsolation<180224,704>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kbase.sys - .ProgramDB NSInstrumentation::CTypeIsolation<180224,704>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<180224,704>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<180224,704>::Allocate(CTypeIsolation<180224,704> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<180224,704> *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<180224,704>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    GreAcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<180224,704> **)this; pCVar6 != (CSectionEntry<180224,704> *)this;

+        pCVar6 = *(CSectionEntry<180224,704> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<180224,704>::Allocate

+                            (*(CSectionBitmapAllocator<180224,704> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<180224,704>::Create();

+    if (pCVar6 != (CSectionEntry<180224,704> *)0x0) {

+      _Dst = CSectionBitmapAllocator<180224,704>::Allocate

+                       (*(CSectionBitmapAllocator<180224,704> **)(pCVar6 + 0x20));

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

+        CSectionEntry<180224,704>::Destroy(pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<180224,704> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<180224,704> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<180224,704> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xdc;

+          *(CSectionEntry<180224,704> **)this = pCVar6;

+          GreReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

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

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<180224,704> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x14011a3ee;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x14011a3fa;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<180224,704> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<180224,704> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<180224,704> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<180224,704> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<180224,704> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<180224,704> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x14011a432;

+          GreReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x14011a43c;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0x2c0);

+    }

+  }

+  return _Dst;

+}

+
```

## `tagPROCESSINFO::GetPsProcessWindowState`  (modified)

```diff
--- tagPROCESSINFO::GetPsProcessWindowState
+++ tagPROCESSINFO::GetPsProcessWindowState
@@ -1,2 +1,48 @@
-Failed to decompile win32kbase.sys - .ProgramDB tagPROCESSINFO::GetPsProcessWindowState : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: enum _PS_PROCESS_WINDOW_STATE __cdecl tagPROCESSINFO::GetPsProcessWindowState(enum

+   tagPROCESSINFO::GetWindowStatePolicy)const __ptr64 */

+

+_PS_PROCESS_WINDOW_STATE __thiscall

+tagPROCESSINFO::GetPsProcessWindowState(tagPROCESSINFO *this,GetWindowStatePolicy param_1)

+

+{

+  undefined4 uVar1;

+  int iVar2;

+  longlong lVar3;

+  tagWINDOWSTATION *ptVar4;

+  _PS_PROCESS_WINDOW_STATE _Var5;

+  char cVar6;

+  bool bVar7;

+  

+  iVar2 = IsCurrentSessionServiceSession();

+  if (iVar2 == 0) {

+    _Var5 = *(_PS_PROCESS_WINDOW_STATE *)(&DAT_0 + (longlong)*(int *)(this + 0x484) * 4);

+    if ((param_1 == 0) &&

+       (((ptVar4 = tagWINDOWSTATION::GetIOWinsta(), ptVar4 == (tagWINDOWSTATION *)0x0 ||

+         ((*(uint *)(ptVar4 + 0x100) & 2) == 0)) && (0 < (int)_Var5)))) {

+      _Var5 = 1;

+    }

+  }

+  else {

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

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

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

+      cVar6 = '\0';

+    }

+    else {

+      cVar6 = '\x01';

+    }

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

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

+      uVar1 = *(undefined4 *)(this + 0x38);

+      lVar3 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_D

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

+                 *(undefined8 *)(lVar3 + 0x10f78),4,0xe,0x11,

+                 &WPP_536aae663e7432d573f615f591067f33_Traceguids,uVar1);

+    }

+    _Var5 = 0;

+  }

+  return _Var5;

+}

+
```

## `DispConfigTypes::GetSetterTypeSize`  (modified)

```diff
--- DispConfigTypes::GetSetterTypeSize
+++ DispConfigTypes::GetSetterTypeSize
@@ -1,2 +1,43 @@
-Failed to decompile win32kbase.sys - .ProgramDB DispConfigTypes::GetSetterTypeSize : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* unsigned long __cdecl DispConfigTypes::GetSetterTypeSize(enum DISPLAYCONFIG_DEVICE_INFO_TYPE) */

+

+ulong __cdecl DispConfigTypes::GetSetterTypeSize(DISPLAYCONFIG_DEVICE_INFO_TYPE param_1)

+

+{

+  if ((int)param_1 < -0xf) {

+    if (param_1 == 0xfffffff0) {

+      return 0x44;

+    }

+    if (((param_1 + 0x2b & 0xfffffffc) != 0) || (param_1 == 0xffffffd6)) {

+      if (param_1 == 0xffffffda) {

+        return 0x1c;

+      }

+      if ((param_1 + 0x23 & 0xfffffff7) != 0) {

+        if (param_1 == 0xffffffe9) {

+          return 0x30;

+        }

+        if (param_1 != 0xffffffed) {

+          if (param_1 == 0xffffffee) {

+            return 0x1c;

+          }

+          return 0;

+        }

+      }

+    }

+  }

+  else {

+    if (param_1 == 0xfffffffa) {

+      return 0x1c;

+    }

+    if ((0xe < param_1 + 4) || ((0x5201U >> (param_1 + 4 & 0x1f) & 1) == 0)) {

+      if (param_1 == 0xd) {

+        return 0x138;

+      }

+      if (1 < param_1 - 0x10) {

+        return 0;

+      }

+    }

+  }

+  return 0x18;

+}

+
```

## `DirectComposition::CLayoutSynchronizationInfo::Open`  (modified)

```diff
--- DirectComposition::CLayoutSynchronizationInfo::Open
+++ DirectComposition::CLayoutSynchronizationInfo::Open
@@ -1,2 +1,26 @@
-Failed to decompile win32kbase.sys - .ProgramDB DirectComposition::CLayoutSynchronizationInfo::Open : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: virtual long __cdecl DirectComposition::CLayoutSynchronizationInfo::Open(struct

+   _WIN32_OPENMETHOD_PARAMETERS * __ptr64) __ptr64 */

+

+long __thiscall

+DirectComposition::CLayoutSynchronizationInfo::Open

+          (CLayoutSynchronizationInfo *this,_WIN32_OPENMETHOD_PARAMETERS *param_1)

+

+{

+  int iVar1;

+  

+  if (this[9] == (CLayoutSynchronizationInfo)0x0) {

+    iVar1 = _IsProcessDwm(*(_EPROCESS **)(param_1 + 0x18));

+    if (iVar1 == 0) {

+      if (((byte)Microsoft_Windows_Win32kEnableBits & 1) != 0) {

+        McTemplateK0xx_EtwWriteTransfer();

+      }

+      ApiSetEditionWindowBeginLayoutForDCompk(*(undefined8 *)(this + 0x10));

+    }

+  }

+  else {

+    this[9] = (CLayoutSynchronizationInfo)0x0;

+  }

+  return 0;

+}

+
```

## `IOCPDispatcher::Dispatch`  (modified)

```diff
--- IOCPDispatcher::Dispatch
+++ IOCPDispatcher::Dispatch
@@ -1,2 +1,22 @@
-Failed to decompile win32kbase.sys - .ProgramDB IOCPDispatcher::Dispatch : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl IOCPDispatcher::Dispatch(enum WaitCompletionPacketPurpose,unsigned long)

+   __ptr64 */

+

+void __thiscall

+IOCPDispatcher::Dispatch(IOCPDispatcher *this,WaitCompletionPacketPurpose param_1,ulong param_2)

+

+{

+                    /* 0xb4070  106

+                       ?Dispatch@IOCPDispatcher@@QEAAXW4WaitCompletionPacketPurpose@@K@Z */

+  if (param_1 == 0x80000000) {

+    HandleSensorDispatcherSignal(this,param_2);

+  }

+  else if (param_1 == 0x80000001) {

+    HandleThreadDispatcherSignal(this,param_2);

+  }

+  else {

+    DbgkWerCaptureLiveKernelDump(L"win32kbase.sys",400,(longlong)(int)param_1,param_2,0,0,0,0,0);

+  }

+  return;

+}

+
```

## `CQoSReport::ReportProcess`  (modified)

```diff
--- CQoSReport::ReportProcess
+++ CQoSReport::ReportProcess
@@ -1,2 +1,85 @@
-Failed to decompile win32kbase.sys - .ProgramDB CQoSReport::ReportProcess : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl CQoSReport::ReportProcess(struct tagPROCESSINFO * __ptr64) __ptr64 */

+

+void __thiscall CQoSReport::ReportProcess(CQoSReport *this,tagPROCESSINFO *param_1)

+

+{

+  CQoSReport *pCVar1;

+  tagPROCESSINFO *ptVar2;

+  longlong lVar3;

+  tagPROCESSINFO *ptVar4;

+  longlong *plVar5;

+  code *pcVar6;

+  char cVar7;

+  _PS_PROCESS_WINDOW_STATE _Var8;

+  _GUID *in_R8;

+  _GUID *in_R9;

+  _tlgWrapperByVal<1> local_res8 [8];

+  uint local_res18 [2];

+  undefined8 local_18;

+  _PS_PROCESS_WINDOW_STATE local_10;

+  undefined4 local_c;

+  

+  if (*this == (CQoSReport)0x0) {

+    _Var8 = tagPROCESSINFO::GetPsProcessWindowState(param_1,0);

+    if (5 < DAT_0) {

+      cVar7 = _tlgKeywordOn(&DAT_0,0x200000000004);

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

+        local_res18[0] = *(uint *)(param_1 + 0x38);

+        local_res8[0] = SUB41(_Var8,0);

+        _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+        ::Write<_tlgWrapperByVal<4>,_tlgWrapperByVal<1>_>

+                  ((_tlgProvider_t *)(ulonglong)local_res18[0],&DAT_1,in_R8,in_R9,

+                   (_tlgWrapperByVal<4> *)local_res18,local_res8);

+      }

+    }

+    local_18 = *(undefined8 *)param_1;

+    local_c = 0;

+    local_10 = _Var8;

+    PsSetProcessesWindowState(1,&local_18);

+  }

+  else {

+    ptVar2 = param_1 + 0x458;

+    if (*(tagPROCESSINFO **)ptVar2 == ptVar2) {

+      pCVar1 = this + 8;

+      lVar3 = *(longlong *)pCVar1;

+      if (*(CQoSReport **)(lVar3 + 8) != pCVar1) goto LAB_2;

+      *(longlong *)ptVar2 = lVar3;

+      *(CQoSReport **)(param_1 + 0x460) = pCVar1;

+      *(tagPROCESSINFO **)(lVar3 + 8) = ptVar2;

+      *(tagPROCESSINFO **)pCVar1 = ptVar2;

+    }

+  }

+  _Var8 = tagPROCESSINFO::GetPsProcessWindowState(param_1,1);

+  ptVar2 = param_1 + 0x468;

+  ptVar4 = *(tagPROCESSINFO **)ptVar2;

+  if (ptVar4 == ptVar2) {

+    if (_Var8 != 0) {

+      pCVar1 = this + 0x18;

+      lVar3 = *(longlong *)pCVar1;

+      if (*(CQoSReport **)(lVar3 + 8) != pCVar1) {

+LAB_2:

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

+        (*pcVar6)(3);

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

+        (*pcVar6)();

+        return;

+      }

+      *(longlong *)ptVar2 = lVar3;

+      *(CQoSReport **)(param_1 + 0x470) = pCVar1;

+      *(tagPROCESSINFO **)(lVar3 + 8) = ptVar2;

+      *(tagPROCESSINFO **)pCVar1 = ptVar2;

+    }

+  }

+  else if (_Var8 == 0) {

+    if ((*(tagPROCESSINFO **)(ptVar4 + 8) != ptVar2) ||

+       (plVar5 = *(longlong **)(param_1 + 0x470), (tagPROCESSINFO *)*plVar5 != ptVar2))

+    goto LAB_2;

+    *plVar5 = (longlong)ptVar4;

+    *(longlong **)(ptVar4 + 8) = plVar5;

+    *(tagPROCESSINFO **)(param_1 + 0x470) = ptVar2;

+    *(tagPROCESSINFO **)ptVar2 = ptVar2;

+  }

+  return;

+}

+
```

## `tagPROCESSINFO::CanPerformUIOperation`  (modified)

```diff
--- tagPROCESSINFO::CanPerformUIOperation
+++ tagPROCESSINFO::CanPerformUIOperation
@@ -1,2 +1,41 @@
-Failed to decompile win32kbase.sys - .ProgramDB tagPROCESSINFO::CanPerformUIOperation : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: bool __cdecl tagPROCESSINFO::CanPerformUIOperation(enum UIOperation)const __ptr64 */

+

+bool __thiscall tagPROCESSINFO::CanPerformUIOperation(tagPROCESSINFO *this,UIOperation param_1)

+

+{

+  bool bVar1;

+  int iVar2;

+  longlong lVar3;

+  char cVar4;

+  bool bVar5;

+  

+                    /* 0x1a07b0  58  ?CanPerformUIOperation@tagPROCESSINFO@@QEBA_NW4UIOperation@@@Z

+                        */

+  bVar1 = HasUILimit(this,param_1);

+  if (bVar1) {

+    iVar2 = Feature_LearningModeExpansion__private_IsEnabledDeviceUsageNoInline();

+    bVar1 = false;

+    if (iVar2 != 0) {

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

+          (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

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

+        cVar4 = '\0';

+      }

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

+      bVar1 = false;

+      if ((cVar4 != '\0') || (bVar5)) {

+        KfGetProcessEffectiveUILimits(*(undefined8 *)this);

+        lVar3 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_DDD

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar5,

+                   *(undefined8 *)(lVar3 + 0x10f78));

+      }

+    }

+  }

+  else {

+    bVar1 = true;

+  }

+  return bVar1;

+}

+
```

## `tagTERMINAL::ClearDTEThread`  (modified)

```diff
--- tagTERMINAL::ClearDTEThread
+++ tagTERMINAL::ClearDTEThread
@@ -1,2 +1,12 @@
-Failed to decompile win32kbase.sys - .ProgramDB tagTERMINAL::ClearDTEThread : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl tagTERMINAL::ClearDTEThread(void) __ptr64 */

+

+void __thiscall tagTERMINAL::ClearDTEThread(tagTERMINAL *this)

+

+{

+                    /* 0x15e6d0  72  ?ClearDTEThread@tagTERMINAL@@QEAAXXZ */

+  *(undefined8 *)(this + 0x40) = 0;

+  *(uint *)this = *(uint *)this | 0x20;

+  return;

+}

+
```

## `NSInstrumentation::CTypeIsolation<28672,112>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<28672,112>::Allocate
+++ NSInstrumentation::CTypeIsolation<28672,112>::Allocate
@@ -1,2 +1,184 @@
-Failed to decompile win32kbase.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)

+

+{

+  CTypeIsolation<28672,112> *pCVar1;

+  undefined8 uVar2;

+  ulonglong uVar3;

+  longlong lVar4;

+  longlong *plVar5;

+  code *pcVar6;

+  uint uVar7;

+  int iVar8;

+  CSectionEntry<28672,112> *pCVar9;

+  undefined8 *puVar10;

+  ulonglong uVar11;

+  undefined8 uVar12;

+  undefined1 *puVar13;

+  ulonglong uVar14;

+  void *pvVar15;

+  uint uVar16;

+  ulonglong *local_res10;

+  undefined1 auStack_68 [8];

+  undefined1 auStack_60 [32];

+  

+  puVar13 = auStack_68;

+  if (this[0x24] == (CTypeIsolation<28672,112>)0x0) {

+    uVar12 = *(undefined8 *)(this + 0x10);

+    KeEnterCriticalRegion();

+    ExAcquirePushLockSharedEx(uVar12,0);

+    for (pCVar1 = *(CTypeIsolation<28672,112> **)this; pCVar1 != this;

+        pCVar1 = *(CTypeIsolation<28672,112> **)pCVar1) {

+      puVar10 = *(undefined8 **)(pCVar1 + 0x20);

+      uVar2 = *puVar10;

+      KeEnterCriticalRegion();

+      ExAcquirePushLockExclusiveEx(uVar2,0);

+      uVar14 = puVar10[3] ^ puVar10[2];

+      uVar7 = *(uint *)(puVar10 + 4);

+      if (0xfb < *(uint *)(puVar10 + 4)) {

+        uVar7 = 0;

+      }

+      uVar7 = RtlFindClearBits(uVar14,1,uVar7);

+      if (uVar7 == 0xffffffff) {

+LAB_0:

+        ExReleasePushLockExclusiveEx(uVar2);

+        KeLeaveCriticalRegion();

+      }

+      else {

+        uVar16 = uVar7 / 0x24;

+        if ((*(uint *)((longlong)puVar10 + 0x24) < 7) &&

+           (*(uint *)((longlong)puVar10 + 0x24) <= uVar16)) {

+          uVar11 = (ulonglong)(uVar16 << 0xc);

+          pvVar15 = (void *)((puVar10[2] ^ puVar10[1]) + uVar11);

+          iVar8 = MmCommitSessionMappedView(pvVar15);

+          if (iVar8 < 0) goto LAB_0;

+          memset(pvVar15,0,0x1000);

+          *(int *)((longlong)puVar10 + 0x24) = *(int *)((longlong)puVar10 + 0x24) + 1;

+        }

+        else {

+          uVar11 = (ulonglong)(uVar16 << 0xc);

+        }

+        local_res10 = puVar10 + 1;

+        RtlTestBit(uVar14,uVar7);

+        RtlSetBit(uVar14);

+        *(int *)(puVar10 + 4) = *(int *)(puVar10 + 4) + 1;

+        if (0xfb < *(uint *)(puVar10 + 4)) {

+          *(undefined4 *)(puVar10 + 4) = 0;

+        }

+        uVar14 = puVar10[2];

+        uVar3 = *local_res10;

+        ExReleasePushLockExclusiveEx(uVar2);

+        KeLeaveCriticalRegion();

+        pvVar15 = (void *)((ulonglong)((uVar7 % 0x24) * 0x70) + (uVar14 ^ uVar3) + uVar11);

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

+          if (pCVar1 == *(CTypeIsolation<28672,112> **)this) goto LAB_1;

+          ExReleasePushLockSharedEx(uVar12,0);

+          KeLeaveCriticalRegion();

+          uVar12 = *(undefined8 *)(this + 0x10);

+          KeEnterCriticalRegion();

+          ExAcquirePushLockExclusiveEx(uVar12,0);

+          lVar4 = *(longlong *)pCVar1;

+          if ((*(CTypeIsolation<28672,112> **)(lVar4 + 8) != pCVar1) ||

+             (plVar5 = *(longlong **)(pCVar1 + 8), (CTypeIsolation<28672,112> *)*plVar5 != pCVar1))

+          goto LAB_2;

+          *plVar5 = lVar4;

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

+          lVar4 = *(longlong *)this;

+          if (*(CTypeIsolation<28672,112> **)(lVar4 + 8) != this) goto LAB_2;

+          *(longlong *)pCVar1 = lVar4;

+          *(CTypeIsolation<28672,112> **)(pCVar1 + 8) = this;

+          *(CTypeIsolation<28672,112> **)(lVar4 + 8) = pCVar1;

+          *(CTypeIsolation<28672,112> **)this = pCVar1;

+          goto LAB_3;

+        }

+      }

+    }

+    pvVar15 = (void *)0x0;

+    ExReleasePushLockSharedEx(uVar12,0);

+    KeLeaveCriticalRegion();

+    pCVar9 = CSectionEntry<28672,112>::Create();

+    if (pCVar9 != (CSectionEntry<28672,112> *)0x0) {

+      pvVar15 = CSectionBitmapAllocator<28672,112>::Allocate

+                          (*(CSectionBitmapAllocator<28672,112> **)(pCVar9 + 0x20));

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

+        plVar5 = *(longlong **)(pCVar9 + 0x20);

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

+          if ((plVar5[3] ^ plVar5[2]) != 0) {

+            RtlFindSetBits(plVar5[3] ^ plVar5[2],1);

+          }

+          if (*plVar5 != 0) {

+            ExFreePoolWithTag(*plVar5,0);

+          }

+          if ((plVar5[3] ^ plVar5[2]) != 0) {

+            ExFreePoolWithTag(plVar5[3] ^ plVar5[2],0);

+          }

+          ExFreePoolWithTag(plVar5,0);

+          *(undefined8 *)(pCVar9 + 0x20) = 0;

+        }

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

+          MmUnmapViewInSessionSpace();

+          *(undefined8 *)(pCVar9 + 0x18) = 0;

+        }

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

+          ObfDereferenceObject();

+          *(undefined8 *)(pCVar9 + 0x10) = 0;

+        }

+        ExFreePoolWithTag(pCVar9,0);

+      }

+      else {

+        uVar12 = *(undefined8 *)(this + 0x10);

+        KeEnterCriticalRegion();

+        ExAcquirePushLockExclusiveEx(uVar12,0);

+        lVar4 = *(longlong *)this;

+        if (*(CTypeIsolation<28672,112> **)(lVar4 + 8) == this) {

+          *(longlong *)pCVar9 = lVar4;

+          *(CTypeIsolation<28672,112> **)(pCVar9 + 8) = this;

+          *(CSectionEntry<28672,112> **)(lVar4 + 8) = pCVar9;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xfc;

+          *(CSectionEntry<28672,112> **)this = pCVar9;

+LAB_3:

+          ExReleasePushLockExclusiveEx(uVar12,0);

+          puVar13 = auStack_68;

+        }

+        else {

+LAB_2:

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

+          (*pcVar6)(3);

+          puVar13 = auStack_60;

+LAB_1:

+          *(undefined8 *)(puVar13 + -8) = 0x140027c6a;

+          ExReleasePushLockSharedEx();

+        }

+        *(undefined8 *)(puVar13 + -8) = 0x140027b87;

+        KeLeaveCriticalRegion();

+      }

+    }

+  }

+  else {

+    puVar10 = (undefined8 *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

+    pvVar15 = (void *)0x0;

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

+      *puVar10 = 0;

+      puVar10[1] = 0;

+      puVar10[2] = 0;

+      puVar10[3] = 0;

+      puVar10[4] = 0;

+      puVar10[5] = 0;

+      puVar10[6] = 0;

+      puVar10[7] = 0;

+      puVar10[8] = 0;

+      puVar10[9] = 0;

+      puVar10[10] = 0;

+      puVar10[0xb] = 0;

+      puVar10[0xc] = 0;

+      puVar10[0xd] = 0;

+      return puVar10;

+    }

+  }

+  return pvVar15;

+}

+
```

## `CQoSReport::~CQoSReport`  (modified)

```diff
--- CQoSReport::~CQoSReport
+++ CQoSReport::~CQoSReport
@@ -1,2 +1,15 @@
-Failed to decompile win32kbase.sys - .ProgramDB CQoSReport::~CQoSReport : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: __cdecl CQoSReport::~CQoSReport(void) __ptr64 */

+

+void __thiscall CQoSReport::~CQoSReport(CQoSReport *this)

+

+{

+  if (*(CQoSReport **)(this + 8) != this + 8) {

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

+  }

+  if (*(CQoSReport **)(this + 0x18) != this + 0x18) {

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

+  }

+  return;

+}

+
```

## `DirectComposition::CVisualMarshaler::SetReferenceProperty`  (modified)

```diff
--- DirectComposition::CVisualMarshaler::SetReferenceProperty
+++ DirectComposition::CVisualMarshaler::SetReferenceProperty
@@ -1,2 +1,163 @@
-Failed to decompile win32kbase.sys - .ProgramDB DirectComposition::CVisualMarshaler::SetReferenceProperty : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: virtual long __cdecl DirectComposition::CVisualMarshaler::SetReferenceProperty(class

+   DirectComposition::CApplicationChannel * __ptr64,unsigned int,class

+   DirectComposition::CResourceMarshaler * __ptr64,bool * __ptr64) __ptr64 */

+

+long __thiscall

+DirectComposition::CVisualMarshaler::SetReferenceProperty

+          (CVisualMarshaler *this,CApplicationChannel *param_1,uint param_2,

+          CResourceMarshaler *param_3,bool *param_4)

+

+{

+  uint uVar1;

+  MIL_RESOURCE_TYPE MVar2;

+  bool bVar3;

+  long lVar4;

+  CVisualMarshaler *pCVar5;

+  

+  *param_4 = false;

+  if (param_2 == 4) {

+    lVar4 = 0;

+    if (param_3 != (CResourceMarshaler *)0x0) {

+      uVar1 = *(uint *)(param_3 + 0x24);

+      while( true ) {

+        if (0xc1 < uVar1) {

+          return -0x3ffffff3;

+        }

+        if (uVar1 == 0xaf) break;

+        uVar1 = *(uint *)(&DAT_0 + (ulonglong)uVar1 * 4);

+      }

+    }

+    if ((param_3 != *(CResourceMarshaler **)(this + 0x88)) &&

+       (lVar4 = CApplicationChannel::ReplaceResource<DirectComposition::CResourceMarshaler>

+                          (param_1,(CResourceMarshaler **)(this + 0x88),param_3,

+                           (CResourceMarshaler *)0x0), lVar4 < 0)) {

+      return lVar4;

+    }

+    *(uint *)(this + 0x10) = *(uint *)(this + 0x10) | 0x100;

+  }

+  else {

+    if (param_2 == 5) {

+LAB_1:

+      if (param_3 != (CResourceMarshaler *)0x0) {

+        for (MVar2 = *(MIL_RESOURCE_TYPE *)(param_3 + 0x24); MVar2 < 0xc2;

+            MVar2 = *(MIL_RESOURCE_TYPE *)(&DAT_0 + (ulonglong)MVar2 * 4)) {

+          if (MVar2 == 0xb8) goto LAB_2;

+        }

+        if ((param_2 == 5) ||

+           (bVar3 = CResourceMarshaler::IsDerivedResourceType

+                              (*(MIL_RESOURCE_TYPE *)(param_3 + 0x24),0xbc), !bVar3)) {

+          return -0x3ffffff3;

+        }

+      }

+LAB_2:

+      lVar4 = SetTransformParent(this,param_1,param_3,param_2 == 0x27,param_4);

+      return lVar4;

+    }

+    if (param_2 == 6) {

+      lVar4 = 0;

+      pCVar5 = this + 0x98;

+      if ((param_3 != (CResourceMarshaler *)0x0) &&

+         (lVar4 = 0,

+         bVar3 = CResourceMarshaler::IsDerivedResourceType

+                           (*(MIL_RESOURCE_TYPE *)(param_3 + 0x24),0x38), !bVar3)) {

+        return -0x3ffffff3;

+      }

+      if ((param_3 != *(CResourceMarshaler **)pCVar5) &&

+         (lVar4 = CApplicationChannel::ReplaceResource<DirectComposition::CResourceMarshaler>

+                            (param_1,(CResourceMarshaler **)pCVar5,param_3,(CResourceMarshaler *)0x0

+                            ), lVar4 < 0)) {

+        return lVar4;

+      }

+      *(uint *)(this + 0x10) = *(uint *)(this + 0x10) | 0x400;

+    }

+    else if (param_2 == 7) {

+      if (param_3 != (CResourceMarshaler *)0x0) {

+        uVar1 = *(uint *)(param_3 + 0x24);

+        while( true ) {

+          if (0xc1 < uVar1) {

+            return -0x3ffffff3;

+          }

+          if (uVar1 == 0x43) break;

+          uVar1 = *(uint *)(&DAT_0 + (ulonglong)uVar1 * 4);

+        }

+      }

+      if (param_3 != *(CResourceMarshaler **)(this + 0xa0)) {

+        if (param_3 != (CResourceMarshaler *)0x0) {

+          CResourceMarshaler::AddRef(param_3);

+        }

+        CApplicationChannel::ReleaseResource(param_1,*(CResourceMarshaler **)(this + 0xa0));

+        *(CResourceMarshaler **)(this + 0xa0) = param_3;

+      }

+      *(uint *)(this + 0x10) = *(uint *)(this + 0x10) | 0x1000;

+      lVar4 = 0;

+    }

+    else if (param_2 == 0xb) {

+      lVar4 = 0;

+      pCVar5 = this + 0xa8;

+      if ((param_3 != (CResourceMarshaler *)0x0) &&

+         (lVar4 = 0,

+         bVar3 = CResourceMarshaler::IsDerivedResourceType

+                           (*(MIL_RESOURCE_TYPE *)(param_3 + 0x24),0x2f), !bVar3)) {

+        return -0x3ffffff3;

+      }

+      if ((param_3 != *(CResourceMarshaler **)pCVar5) &&

+         (lVar4 = CApplicationChannel::ReplaceResource<DirectComposition::CResourceMarshaler>

+                            (param_1,(CResourceMarshaler **)pCVar5,param_3,(CResourceMarshaler *)0x0

+                            ), lVar4 < 0)) {

+        return lVar4;

+      }

+      *(uint *)(this + 0x10) = *(uint *)(this + 0x10) | 0x800;

+    }

+    else if (param_2 == 0x17) {

+      if (Microsoft_Windows_Win32kEnableBits._4_1_ < '\0') {

+        McTemplateK0qqqxx_EtwWriteTransfer();

+      }

+      lVar4 = 0;

+      pCVar5 = this + 0xd8;

+      if ((param_3 != (CResourceMarshaler *)0x0) &&

+         (lVar4 = 0,

+         bVar3 = CResourceMarshaler::IsDerivedResourceType

+                           (*(MIL_RESOURCE_TYPE *)(param_3 + 0x24),0x59), !bVar3)) {

+        return -0x3ffffff3;

+      }

+      if ((param_3 != *(CResourceMarshaler **)pCVar5) &&

+         (lVar4 = CApplicationChannel::ReplaceResource<DirectComposition::CResourceMarshaler>

+                            (param_1,(CResourceMarshaler **)pCVar5,param_3,(CResourceMarshaler *)0x0

+                            ), lVar4 < 0)) {

+        return lVar4;

+      }

+      *(uint *)(this + 0x10) = *(uint *)(this + 0x10) | 0x100000;

+    }

+    else {

+      if (param_2 == 0x27) goto LAB_1;

+      if (param_2 != 0x28) {

+        if (param_2 != 0x31) {

+          return -0x3ffffff3;

+        }

+        lVar4 = CResourceMarshaler::SetReferencePropertyHelper

+                          ((CResourceMarshaler *)this,param_1,(CResourceMarshaler **)(this + 0xe8),

+                           param_3,1,0xbe,(ulong *)(this + 0x168),4,0,param_4);

+        return lVar4;

+      }

+      lVar4 = 0;

+      pCVar5 = this + 0xe0;

+      if ((param_3 != (CResourceMarshaler *)0x0) &&

+         (lVar4 = 0,

+         bVar3 = CResourceMarshaler::IsDerivedResourceType

+                           (*(MIL_RESOURCE_TYPE *)(param_3 + 0x24),0x11), !bVar3)) {

+        return -0x3ffffff3;

+      }

+      if ((param_3 != *(CResourceMarshaler **)pCVar5) &&

+         (lVar4 = CApplicationChannel::ReplaceResource<DirectComposition::CResourceMarshaler>

+                            (param_1,(CResourceMarshaler **)pCVar5,param_3,(CResourceMarshaler *)0x0

+                            ), lVar4 < 0)) {

+        return lVar4;

+      }

+      *(uint *)(this + 0x10) = *(uint *)(this + 0x10) | 0x4000000;

+    }

+  }

+  *param_4 = true;

+  return lVar4;

+}

+
```

## `CInertiaManager::AddInertiaInfo`  (modified)

```diff
--- CInertiaManager::AddInertiaInfo
+++ CInertiaManager::AddInertiaInfo
@@ -1,2 +1,105 @@
-Failed to decompile win32kbase.sys - .ProgramDB CInertiaManager::AddInertiaInfo : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: bool __cdecl CInertiaManager::AddInertiaInfo(struct tagTHREADINFO * __ptr64,unsigned

+   __int64,class CInputDest * __ptr64,struct tagInputRoutingInfo * __ptr64,int,int,int,struct

+   INERTIA_INFO const & __ptr64,double,struct tagRECT const * __ptr64,struct _D3DMATRIX const *

+   __ptr64) __ptr64 */

+

+bool __thiscall

+CInertiaManager::AddInertiaInfo

+          (CInertiaManager *this,tagTHREADINFO *param_1,__uint64 param_2,CInputDest *param_3,

+          tagInputRoutingInfo *param_4,int param_5,int param_6,int param_7,INERTIA_INFO *param_8,

+          double param_9,tagRECT *param_10,_D3DMATRIX *param_11)

+

+{

+  INERTIA_INFO_INTERNAL *pIVar1;

+  longlong lVar2;

+  undefined8 uVar3;

+  longlong lVar4;

+  longlong lVar5;

+  HWND__ *pHVar6;

+  tagTHREADINFO *ptVar7;

+  uint uVar8;

+  longlong lVar9;

+  uint uVar10;

+  

+  lVar2 = *(longlong *)(param_1 + 0x1d0);

+  lVar4 = KeQueryPerformanceCounter(0);

+  lVar5 = W32GetUserSessionState();

+  if (*(longlong *)(lVar5 + 0x4308) == 0) {

+    lVar9 = gliQpcFreq * 100;

+    lVar5 = W32GetUserSessionState();

+    *(longlong *)(lVar5 + 0x4308) = lVar9 / 1000;

+  }

+  if (((((*(uint *)(this + 0xc0) & 1) != 0) && (*(longlong *)(this + 8) == lVar2)) &&

+      (lVar5 = W32GetUserSessionState(),

+      (ulonglong)(lVar4 - *(longlong *)(this + 0xb8)) <= *(ulonglong *)(lVar5 + 0x4308))) &&

+     ((param_7 == 0 && (param_9 < *(double *)(this + 0x28) || param_9 == *(double *)(this + 0x28))))

+     ) {

+    return false;

+  }

+  pIVar1 = (INERTIA_INFO_INTERNAL *)(this + 8);

+  *(longlong *)pIVar1 = lVar2;

+  *(__uint64 *)(this + 0x10) = param_2;

+  *(undefined8 *)(this + 0x18) = *(undefined8 *)param_8;

+  *(undefined4 *)(this + 0x20) = *(undefined4 *)(param_8 + 8);

+  *(double *)(this + 0x28) = param_9;

+  *(longlong *)(this + 0xb8) = lVar4;

+  uVar10 = (param_5 * 8 ^ *(uint *)(this + 0xc0)) & 0xffffffc7 ^

+           (param_7 << 5 ^ param_6 << 4) & 0xffffffdfU ^ (param_6 << 4 ^ param_5 * 8) & 0xffffffcfU

+           ^ param_7 << 5;

+  *(uint *)(this + 0xc0) = uVar10;

+  if ((param_6 == 0) && (param_3 != (CInputDest *)0x0)) {

+    pHVar6 = CInputDest::GetWindowHandle(param_3);

+    *(HWND__ **)(this + 0x80) = pHVar6;

+    ptVar7 = CInputDest::GetDelegateThreadInfo(param_3);

+    uVar8 = 2;

+    if (param_1 != ptVar7) {

+      uVar8 = 0;

+    }

+    uVar8 = uVar8 | uVar10 & 0xfffffffd;

+  }

+  else {

+    *(undefined8 *)(this + 0x80) = 0;

+    uVar8 = uVar10 & 0xfffffffd;

+  }

+  *(uint *)(this + 0xc0) = uVar8;

+  if (param_10 == (tagRECT *)0x0) {

+    uVar8 = uVar8 & 0xfffffffb;

+  }

+  else {

+    uVar3 = *(undefined8 *)&param_10->right;

+    uVar8 = uVar8 | 4;

+    *(undefined8 *)(this + 0x30) = *(undefined8 *)param_10;

+    *(undefined8 *)(this + 0x38) = uVar3;

+    uVar3 = *(undefined8 *)(param_11 + 8);

+    *(undefined8 *)(this + 0x40) = *(undefined8 *)param_11;

+    *(undefined8 *)(this + 0x48) = uVar3;

+    uVar3 = *(undefined8 *)(param_11 + 0x18);

+    *(undefined8 *)(this + 0x50) = *(undefined8 *)(param_11 + 0x10);

+    *(undefined8 *)(this + 0x58) = uVar3;

+    uVar3 = *(undefined8 *)(param_11 + 0x28);

+    *(undefined8 *)(this + 0x60) = *(undefined8 *)(param_11 + 0x20);

+    *(undefined8 *)(this + 0x68) = uVar3;

+    uVar3 = *(undefined8 *)(param_11 + 0x38);

+    *(undefined8 *)(this + 0x70) = *(undefined8 *)(param_11 + 0x30);

+    *(undefined8 *)(this + 0x78) = uVar3;

+  }

+  *(uint *)(this + 0xc0) = uVar8;

+  if (param_4 != (tagInputRoutingInfo *)0x0) {

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

+    uVar8 = uVar8 | 0x40;

+    *(undefined8 *)(this + 0x88) = *(undefined8 *)param_4;

+    *(undefined8 *)(this + 0x90) = uVar3;

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

+    *(undefined8 *)(this + 0x98) = *(undefined8 *)(param_4 + 0x10);

+    *(undefined8 *)(this + 0xa0) = uVar3;

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

+    *(undefined8 *)(this + 0xa8) = *(undefined8 *)(param_4 + 0x20);

+    *(undefined8 *)(this + 0xb0) = uVar3;

+  }

+  *(uint *)(this + 0xc0) = uVar8 | 1;

+  InputTraceLogging::Inertia::AddInertiaInfo(pIVar1);

+  ApiSetEditionEdgyProcessInertia(pIVar1);

+  return true;

+}

+
```

## `Win32JobObject::RemoveHandle`  (modified)

```diff
--- Win32JobObject::RemoveHandle
+++ Win32JobObject::RemoveHandle
@@ -1,32 +1,37 @@
 

-void __cdecl

-<lambda_3cf49cee9a6682970a5610bc379494ad>::RemoveHandle(void *param_1,_HANDLEENTRY *param_2)

+/* void __cdecl Win32JobObject::RemoveHandle(void * __ptr64,struct _HANDLEENTRY * __ptr64) */

+

+void __cdecl Win32JobObject::RemoveHandle(void *param_1,_HANDLEENTRY *param_2)

 

 {

-  _tlgWrapperByVal<4> *unaff_RBP;

-  _GUID *in_R8;

-  _GUID *in_R9;

-  undefined8 in_R10;

-  undefined8 in_R11;

+  longlong *_Dst;

+  uint uVar1;

+  longlong lVar2;

+  uint uVar3;

+  ulonglong uVar4;

+  undefined8 *puVar5;

   

-  *(undefined4 *)(unaff_RBP + 0xc) = *(undefined4 *)(unaff_RBP + 0x50);

-  *(undefined4 *)(unaff_RBP + 8) = 0;

-  *(undefined8 *)(unaff_RBP + 0x10) = in_R10;

-  *(undefined8 *)(unaff_RBP + 0x18) = in_R11;

-  _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<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>_>

-            ((_tlgProvider_t *)&DAT_0,&DAT_14027504a,in_R8,in_R9,

-             (_tlgWrapperByVal<8> *)(unaff_RBP + 0x18),(_tlgWrapperByVal<8> *)(unaff_RBP + 0x10),

-             unaff_RBP + 0xc,unaff_RBP + 8,unaff_RBP + 4,unaff_RBP,unaff_RBP + -4,unaff_RBP + -8,

-             unaff_RBP + -0xc,unaff_RBP + -0x10,unaff_RBP + -0x14,unaff_RBP + -0x18,

-             unaff_RBP + -0x1c,unaff_RBP + -0x20,unaff_RBP + -0x24,unaff_RBP + -0x28,

-             unaff_RBP + -0x2c,unaff_RBP + -0x30,unaff_RBP + -0x34,unaff_RBP + -0x38,

-             unaff_RBP + -0x3c,unaff_RBP + -0x40,unaff_RBP + -0x44,unaff_RBP + -0x48,

-             unaff_RBP + -0x4c,unaff_RBP + -0x50,unaff_RBP + -0x54,unaff_RBP + -0x58,

-             unaff_RBP + -0x5c,unaff_RBP + -0x60,unaff_RBP + -100,unaff_RBP + -0x68,

-             unaff_RBP + -0x6c,unaff_RBP + -0x70,unaff_RBP + -0x74,unaff_RBP + -0x78,

-             unaff_RBP + -0x7c,unaff_RBP + -0x80);

+  if (((byte)param_2[0x19] & 0x20) != 0) {

+    lVar2 = W32GetUserSessionState();

+    for (puVar5 = *(undefined8 **)(lVar2 + 0x10f48); puVar5 != (undefined8 *)0x0;

+        puVar5 = (undefined8 *)*puVar5) {

+      uVar1 = *(uint *)(puVar5 + 3);

+      uVar4 = 0;

+      if (uVar1 != 0) {

+        do {

+          _Dst = (longlong *)(puVar5[4] + uVar4 * 8);

+          if ((void *)*_Dst == param_1) {

+            memmove(_Dst,_Dst + 1,(ulonglong)((uVar1 - (int)uVar4) - 1) << 3);

+            *(int *)(puVar5 + 3) = *(int *)(puVar5 + 3) + -1;

+            break;

+          }

+          uVar3 = (int)uVar4 + 1;

+          uVar4 = (ulonglong)uVar3;

+        } while (uVar3 < uVar1);

+      }

+    }

+    param_2[0x19] = (_HANDLEENTRY)((byte)param_2[0x19] & 0xdf);

+  }

   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 win32kbase.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;

+    GreAcquirePushLockShared(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<49152,192>::Destroy((CSectionEntry<49152,192> *)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;

+          GreReleasePushLockExclusive(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) = 0x1401071ce;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x1401071da;

+              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) = 0x140107212;

+          GreReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x14010721c;

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

+}

+
```

## `LastWokenThread::Clear`  (modified)

```diff
--- LastWokenThread::Clear
+++ LastWokenThread::Clear
@@ -1,2 +1,25 @@
-Failed to decompile win32kbase.sys - .ProgramDB LastWokenThread::Clear : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* void __cdecl LastWokenThread::Clear(void) */

+

+void __cdecl LastWokenThread::Clear(void)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  _tagWIN32KUSERSESSIONSTATE *p_Var2;

+  

+                    /* 0x855c0  69  ?Clear@LastWokenThread@@YAXXZ */

+  p_Var2 = GetCurrentProcessUserGlobals();

+  pWVar1 = *(W32_PUSH_LOCK **)(p_Var2 + 0xbe8);

+  W32AcquirePushLockExclusiveEx(pWVar1,0);

+  if (pWVar1[0x11] != (W32_PUSH_LOCK)0x0) {

+    ForegroundBoost::`anonymous_namespace'::_SetForegroundPriority

+              (*(undefined8 *)(*(longlong *)(pWVar1 + 8) + 0x1d0),0,0x10);

+    *(undefined8 *)(pWVar1 + 0x18) = 0;

+    pWVar1[0x11] = (W32_PUSH_LOCK)0x0;

+  }

+  *(undefined8 *)(pWVar1 + 8) = 0;

+  pWVar1[0x10] = (W32_PUSH_LOCK)0x0;

+  W32ReleasePushLockExclusiveEx(pWVar1,0);

+  return;

+}

+
```

## `CPTPProcessor::ProcessInput`  (modified)

```diff
--- CPTPProcessor::ProcessInput
+++ CPTPProcessor::ProcessInput
@@ -1,2 +1,282 @@
-Failed to decompile win32kbase.sys - .ProgramDB CPTPProcessor::ProcessInput : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl CPTPProcessor::ProcessInput(void * __ptr64,void * __ptr64,unsigned

+   long,int,int,bool * __ptr64) __ptr64 */

+

+void __thiscall

+CPTPProcessor::ProcessInput

+          (CPTPProcessor *this,void *param_1,void *param_2,ulong param_3,int param_4,int param_5,

+          bool *param_6)

+

+{

+  RIMCOMPLETEFRAME *pRVar1;

+  uint uVar2;

+  tagHID_POINTER_DEVICE_INFO *ptVar3;

+  undefined8 uVar4;

+  undefined8 uVar5;

+  undefined8 uVar6;

+  RIMCOMPLETEFRAME *pRVar7;

+  CPTPProcessor *pCVar8;

+  int iVar9;

+  int iVar10;

+  uint uVar11;

+  longlong lVar12;

+  undefined8 uVar13;

+  CPointerInputFrame *pCVar14;

+  longlong lVar15;

+  longlong lVar16;

+  ulonglong uVar17;

+  CPTPProcessor *pCVar18;

+  ulonglong uVar19;

+  ulonglong uVar20;

+  CPTPProcessor *pCVar21;

+  CPTPProcessor *pCVar22;

+  ulonglong uVar23;

+  char cVar24;

+  uint uVar25;

+  ulonglong uVar26;

+  undefined8 *puVar27;

+  bool bVar28;

+  

+  this[0xa04] = (CPTPProcessor)0x0;

+  this[0x28] = (CPTPProcessor)0x0;

+  *param_6 = false;

+  lVar12 = HMValidateHandleNoSecure(param_1,0x13);

+  pRVar1 = (RIMCOMPLETEFRAME *)((longlong)param_2 + 0xf0);

+  pRVar7 = param_2;

+  do {

+    if ((RIMCOMPLETEFRAME *)((ulonglong)param_3 + (longlong)param_2) < pRVar1) {

+      if (pRVar7 != (RIMCOMPLETEFRAME *)((ulonglong)param_3 + (longlong)param_2)) {

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

+      }

+      *param_6 = (bool)this[0x28];

+      return;

+    }

+    uVar2 = *(uint *)pRVar7;

+    uVar13 = KeQueryPerformanceCounter(0);

+    *(undefined8 *)(this + 0xa58) = uVar13;

+    *(undefined8 *)(pRVar7 + 0x40) = *(undefined8 *)(lVar12 + 0x8e0);

+    *(undefined8 *)(pRVar7 + 0x48) = uVar13;

+    InputTraceLogging::TelemetryDebug::Pointer::ProcessInput

+              ((TELEMETRY_POINTER_FRAME_TIMES *)(pRVar7 + 0x30));

+    pCVar14 = CTouchProcessor::CommitRimCompleteFrame((CTouchProcessor *)this,pRVar7,true,false);

+    if (pCVar14 == (CPointerInputFrame *)0x0) {

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

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

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

+        cVar24 = '\0';

+      }

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

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

+        lVar15 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar24,bVar28,

+                   *(undefined8 *)(lVar15 + 0x10f78),2,4,10,

+                   &WPP_7c711e10e8573c9b62699b0e312edbbc_Traceguids);

+      }

+    }

+    else {

+      iVar10 = *(int *)(pRVar7 + 0xc4);

+      InputTraceLogging::PTP::EngineInput(pCVar14,iVar10 != 0);

+      ptVar3 = *(tagHID_POINTER_DEVICE_INFO **)(lVar12 + 0x1c8);

+      lVar15 = W32GetUserSessionState();

+      bVar28 = *(uint *)(this + 0x23c) !=

+               (uint)(*(int *)(*(longlong *)(lVar15 + 0x4e30) + 0x7c4) != 0);

+      if (bVar28) {

+        lVar15 = W32GetUserSessionState();

+        *(uint *)(this + 0x23c) = (uint)(*(int *)(*(longlong *)(lVar15 + 0x4e30) + 0x7c4) != 0);

+      }

+      if ((*(int *)(ptVar3 + 0x10c) == 0) ||

+         ((lVar15 = W32GetUserSessionState(), *(longlong *)(lVar15 + 0x4a60) != 0 &&

+          (lVar15 = W32GetUserSessionState(),

+          *(char *)(*(longlong *)(*(longlong *)(lVar15 + 0x4a60) + 0x1d0) + 800) < '\0')))) {

+        iVar9 = 0;

+      }

+      else {

+        iVar9 = 1;

+      }

+      if (iVar9 == *(int *)(this + 0x234)) {

+        if (bVar28) goto LAB_0;

+      }

+      else {

+        *(int *)(this + 0x234) = iVar9;

+LAB_0:

+        UpdateEnvironment(this,0,ptVar3);

+      }

+      pCVar22 = this + 0x2d4;

+      *(void **)(this + 0x210) = param_1;

+      *(int *)(this + 0x220) = param_4;

+      *(int *)(this + 0x224) = param_5;

+      *(CPointerInputFrame **)(this + 0x218) = pCVar14;

+      memset(pCVar22,0,0x398);

+      *(longlong *)pCVar22 = *(longlong *)(*(longlong *)(pCVar14 + 0xf0) + 0xf8);

+      lVar16 = KeQueryPerformanceCounter(0);

+      uVar23 = 0;

+      lVar15 = **(longlong **)(this + 0xa18);

+      if (lVar15 != *(longlong *)(this + 0xa20)) {

+        *(longlong *)(this + 0xa20) = lVar15;

+        if (lVar15 == 0) {

+          *(undefined8 *)(this + 0xa30) = 0;

+        }

+        else {

+          uVar26 = (*(longlong *)pCVar22 - lVar16) + lVar15;

+          uVar19 = *(longlong *)pCVar22 - 1;

+          uVar17 = uVar26;

+          if (uVar19 <= uVar26) {

+            uVar17 = uVar19;

+          }

+          uVar20 = *(longlong *)(this + 0x66c) + 1U;

+          if ((*(longlong *)(this + 0x66c) + 1U < uVar17) && (uVar20 = uVar19, uVar26 < uVar19)) {

+            uVar20 = uVar26;

+          }

+          *(ulonglong *)(this + 0xa30) = uVar20;

+        }

+      }

+      lVar15 = (*(longlong **)(this + 0xa18))[1];

+      if (lVar15 != *(longlong *)(this + 0xa28)) {

+        *(longlong *)(this + 0xa28) = lVar15;

+        if (lVar15 == 0) {

+          *(undefined8 *)(this + 0xa38) = 0;

+        }

+        else {

+          uVar26 = (*(longlong *)pCVar22 - lVar16) + lVar15;

+          uVar19 = *(longlong *)pCVar22 - 1;

+          uVar17 = uVar26;

+          if (uVar19 <= uVar26) {

+            uVar17 = uVar19;

+          }

+          uVar20 = *(longlong *)(this + 0x66c) + 1U;

+          if ((*(longlong *)(this + 0x66c) + 1U < uVar17) && (uVar20 = uVar19, uVar26 < uVar19)) {

+            uVar20 = uVar26;

+          }

+          *(ulonglong *)(this + 0xa38) = uVar20;

+        }

+      }

+      *(undefined8 *)(this + 0x2dc) = *(undefined8 *)(this + 0xa30);

+      *(undefined8 *)(this + 0x2e4) = *(undefined8 *)(this + 0xa38);

+      *(undefined4 *)(this + 0x2ec) = *(undefined4 *)(*(longlong *)(pCVar14 + 0xf0) + 0xe8);

+      lVar15 = W32GetUserSessionState();

+      uVar11 = 0;

+      *(undefined8 *)(this + 0x2f0) = *(undefined8 *)(lVar15 + 0x4b80);

+      *(uint *)(this + 0x2f8) = (uint)(iVar10 != 0);

+      if ((*(uint *)(this + 0x184) & 1) == 0) {

+        lVar15 = W32GetUserSessionState();

+        bVar28 = CInertiaManager::QueryInertiaStatus((CInertiaManager *)(lVar15 + 0x4218));

+        uVar25 = uVar11;

+        if (bVar28) goto LAB_1;

+      }

+      else {

+LAB_1:

+        uVar25 = 1;

+      }

+      *(uint *)(this + 0x2fc) = uVar25;

+      *(uint *)(this + 0x308) = -(uint)((*(uint *)(this + 0x184) >> 1 & 1) != 0);

+      *(undefined4 *)(this + 0x300) = *(undefined4 *)(pCVar14 + 0x28);

+      *(undefined4 *)(this + 0x304) = *(undefined4 *)(pCVar14 + 0x30);

+      if (*(int *)(pCVar14 + 0x30) != 0) {

+        do {

+          iVar10 = Feature_PTPEngineFullTouchInfo__private_IsEnabledDeviceUsageNoInline();

+          lVar16 = uVar23 * 0x1e0;

+          lVar15 = uVar23 * 0x90;

+          pCVar22 = this + lVar15 + 0x30c;

+          puVar27 = (undefined8 *)(lVar16 + 0xa8 + *(longlong *)(pCVar14 + 0xf0));

+          uVar13 = puVar27[1];

+          *(undefined8 *)pCVar22 = *puVar27;

+          *(undefined8 *)(pCVar22 + 8) = uVar13;

+          uVar13 = puVar27[3];

+          *(undefined8 *)(pCVar22 + 0x10) = puVar27[2];

+          *(undefined8 *)(pCVar22 + 0x18) = uVar13;

+          uVar13 = puVar27[5];

+          *(undefined8 *)(pCVar22 + 0x20) = puVar27[4];

+          *(undefined8 *)(pCVar22 + 0x28) = uVar13;

+          uVar13 = puVar27[7];

+          *(undefined8 *)(pCVar22 + 0x30) = puVar27[6];

+          *(undefined8 *)(pCVar22 + 0x38) = uVar13;

+          uVar13 = puVar27[9];

+          *(undefined8 *)(pCVar22 + 0x40) = puVar27[8];

+          *(undefined8 *)(pCVar22 + 0x48) = uVar13;

+          uVar13 = puVar27[0xb];

+          *(undefined8 *)(pCVar22 + 0x50) = puVar27[10];

+          *(undefined8 *)(pCVar22 + 0x58) = uVar13;

+          if (iVar10 != 0) {

+            uVar13 = puVar27[0xd];

+            *(undefined8 *)(pCVar22 + 0x60) = puVar27[0xc];

+            *(undefined8 *)(pCVar22 + 0x68) = uVar13;

+            uVar13 = puVar27[0xf];

+            *(undefined8 *)(pCVar22 + 0x70) = puVar27[0xe];

+            *(undefined8 *)(pCVar22 + 0x78) = uVar13;

+            uVar13 = puVar27[0x11];

+            *(undefined8 *)(pCVar22 + 0x80) = puVar27[0x10];

+            *(undefined8 *)(pCVar22 + 0x88) = uVar13;

+          }

+          uVar25 = (int)uVar23 + 1;

+          uVar23 = (ulonglong)uVar25;

+          *(uint *)(this + lVar15 + 0x310) =

+               (uint)*(ushort *)(lVar16 + 0xa0 + *(longlong *)(pCVar14 + 0xf0));

+        } while (uVar25 != *(uint *)(pCVar14 + 0x30));

+      }

+      iVar10 = Feature_TouchpadFeedbackSuppression__private_IsEnabledDeviceUsageNoInline();

+      if (iVar10 != 0) {

+        if (*(int *)(this + 0x304) != 0) {

+          uVar11 = *(uint *)(this + 0x318) & 0x70;

+        }

+        *(uint *)(this + 0xa08) = uVar11;

+      }

+      PTPEngineTraceProducer::OnInput

+                (*(PTPEngineTraceProducer **)(this + 0x228),(PTPInput *)(this + 0x2d4),

+                 *(tagTPAAPSTATE **)(this + 0xa18));

+      lVar15 = 7;

+      pCVar22 = this + 0x2d4;

+      pCVar8 = this + 0x66c;

+      do {

+        pCVar21 = pCVar8;

+        pCVar18 = pCVar22;

+        uVar13 = *(undefined8 *)(pCVar18 + 8);

+        uVar4 = *(undefined8 *)(pCVar18 + 0x10);

+        uVar5 = *(undefined8 *)(pCVar18 + 0x18);

+        *(undefined8 *)pCVar21 = *(undefined8 *)pCVar18;

+        *(undefined8 *)(pCVar21 + 8) = uVar13;

+        uVar13 = *(undefined8 *)(pCVar18 + 0x20);

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

+        *(undefined8 *)(pCVar21 + 0x10) = uVar4;

+        *(undefined8 *)(pCVar21 + 0x18) = uVar5;

+        uVar4 = *(undefined8 *)(pCVar18 + 0x30);

+        uVar5 = *(undefined8 *)(pCVar18 + 0x38);

+        *(undefined8 *)(pCVar21 + 0x20) = uVar13;

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

+        uVar13 = *(undefined8 *)(pCVar18 + 0x40);

+        uVar6 = *(undefined8 *)(pCVar18 + 0x48);

+        *(undefined8 *)(pCVar21 + 0x30) = uVar4;

+        *(undefined8 *)(pCVar21 + 0x38) = uVar5;

+        uVar4 = *(undefined8 *)(pCVar18 + 0x50);

+        uVar5 = *(undefined8 *)(pCVar18 + 0x58);

+        *(undefined8 *)(pCVar21 + 0x40) = uVar13;

+        *(undefined8 *)(pCVar21 + 0x48) = uVar6;

+        uVar13 = *(undefined8 *)(pCVar18 + 0x60);

+        uVar6 = *(undefined8 *)(pCVar18 + 0x68);

+        *(undefined8 *)(pCVar21 + 0x50) = uVar4;

+        *(undefined8 *)(pCVar21 + 0x58) = uVar5;

+        uVar4 = *(undefined8 *)(pCVar18 + 0x70);

+        uVar5 = *(undefined8 *)(pCVar18 + 0x78);

+        *(undefined8 *)(pCVar21 + 0x60) = uVar13;

+        *(undefined8 *)(pCVar21 + 0x68) = uVar6;

+        *(undefined8 *)(pCVar21 + 0x70) = uVar4;

+        *(undefined8 *)(pCVar21 + 0x78) = uVar5;

+        lVar15 = lVar15 + -1;

+        pCVar22 = pCVar18 + 0x80;

+        pCVar8 = pCVar21 + 0x80;

+      } while (lVar15 != 0);

+      uVar4 = *(undefined8 *)(pCVar18 + 0x88);

+      uVar13 = *(undefined8 *)(pCVar18 + 0x90);

+      *(undefined8 *)(pCVar21 + 0x80) = *(undefined8 *)(pCVar18 + 0x80);

+      *(undefined8 *)(pCVar21 + 0x88) = uVar4;

+      *(undefined8 *)(pCVar21 + 0x90) = uVar13;

+      if (*(longlong *)(this + 0x218) != 0) {

+        CTouchProcessor::FreeFrame((CTouchProcessor *)this,pCVar14,true);

+        *(undefined8 *)(this + 0x218) = 0;

+      }

+    }

+    pRVar1 = pRVar7 + uVar2 + 0xf0;

+    pRVar7 = pRVar7 + uVar2;

+  } while( true );

+}

+
```

## `RGNOBJ::bCopy`  (modified)

```diff
--- RGNOBJ::bCopy
+++ RGNOBJ::bCopy
@@ -1,2 +1,49 @@
-Failed to decompile win32kbase.sys - .ProgramDB RGNOBJ::bCopy : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: int __cdecl RGNOBJ::bCopy(class RGNOBJ & __ptr64) __ptr64 */

+

+int __thiscall RGNOBJ::bCopy(RGNOBJ *this,RGNOBJ *param_1)

+

+{

+  longlong lVar1;

+  longlong lVar2;

+  bool bVar3;

+  int iVar4;

+  ulonglong local_res18;

+  ulonglong local_res20;

+  ulonglong local_18 [2];

+  

+                    /* 0x25d30  432  ?bCopy@RGNOBJ@@QEAAHAEAV1@@Z */

+  lVar1 = *(longlong *)param_1;

+  lVar2 = *(longlong *)this;

+  if (DAT_0 != 0) {

+    bVar3 = Win32kRS::RegionCore_bCopy

+                      ((REGION_CORE *)(-(ulonglong)(lVar2 != 0) & lVar2 + 0x18U),

+                       (REGION_CORE *)(-(ulonglong)(lVar1 != 0) & lVar1 + 0x18U));

+    return (uint)bVar3;

+  }

+  local_res20 = -(ulonglong)(lVar1 != 0) & lVar1 + 0x18U;

+  local_res18 = local_res18 & 0xffffffff00000000;

+  local_18[0] = -(ulonglong)(lVar2 != 0) & lVar2 + 0x18U;

+  bVar3 = RGNCOREOBJ::bIsResizeRequiredBeforeCopyingRegion

+                    ((RGNCOREOBJ *)local_18,(RGNCOREOBJ *)&local_res20,(ulong *)&local_res18);

+  if (bVar3) {

+    if (**(longlong **)this == 0) {

+      RGNMEMOBJTMP::RGNMEMOBJTMP((RGNMEMOBJTMP *)&local_res18,(ulong)local_res18);

+      if (local_res18 != 0) {

+        vSwap(this,(RGNOBJ *)&local_res18);

+        RGNMEMOBJTMP::~RGNMEMOBJTMP((RGNMEMOBJTMP *)&local_res18);

+        goto LAB_1;

+      }

+      RGNMEMOBJTMP::~RGNMEMOBJTMP((RGNMEMOBJTMP *)&local_res18);

+    }

+    iVar4 = 0;

+  }

+  else {

+LAB_1:

+    local_res18 = -(ulonglong)(*(longlong *)this != 0) & *(longlong *)this + 0x18U;

+    RGNCOREOBJ::vCopy((RGNCOREOBJ *)&local_res18,(RGNCOREOBJ *)&local_res20);

+    iVar4 = 1;

+  }

+  return iVar4;

+}

+
```

## `NSInstrumentation::CTypeIsolation<81920,320>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<81920,320>::Allocate
+++ NSInstrumentation::CTypeIsolation<81920,320>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kbase.sys - .ProgramDB NSInstrumentation::CTypeIsolation<81920,320>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<81920,320>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<81920,320>::Allocate(CTypeIsolation<81920,320> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<81920,320> *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<81920,320>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    GreAcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<81920,320> **)this; pCVar6 != (CSectionEntry<81920,320> *)this;

+        pCVar6 = *(CSectionEntry<81920,320> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<81920,320>::Allocate

+                            (*(CSectionBitmapAllocator<81920,320> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<81920,320>::Create();

+    if (pCVar6 != (CSectionEntry<81920,320> *)0x0) {

+      _Dst = CSectionBitmapAllocator<81920,320>::Allocate

+                       (*(CSectionBitmapAllocator<81920,320> **)(pCVar6 + 0x20));

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

+        CSectionEntry<49152,192>::Destroy((CSectionEntry<49152,192> *)pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<81920,320> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<81920,320> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<81920,320> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xf0;

+          *(CSectionEntry<81920,320> **)this = pCVar6;

+          GreReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

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

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<81920,320> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x140083062;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x14008306e;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<81920,320> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<81920,320> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<81920,320> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<81920,320> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<81920,320> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<81920,320> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x1400830a6;

+          GreReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x1400830b0;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0x140);

+    }

+  }

+  return _Dst;

+}

+
```

## `UserCritInternal::`anonymous_namespace'::EnterCritInternal`  (modified)

```diff
--- UserCritInternal::`anonymous_namespace'::EnterCritInternal
+++ UserProcessDestroyCallout
@@ -1,49 +1,7 @@
 

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

-/* WARNING: Instruction at (ram,0x0001401b2f03) overlaps instruction at (ram,0x0001401b2f02)

-    */

-

-void `D3DXMatrixDeterminant'::__l1::EnterCritInternal

-               (undefined4 param_1,undefined2 param_2,undefined8 param_3)

+void __cdecl UserProcessDestroyCallout(_W32PROCESS *param_1)

 

 {

-  int *piVar1;

-  char cVar2;

-  undefined1 uVar3;

-  code *pcVar4;

-  byte in_AL;

-  char cVar5;

-  undefined7 in_register_00000001;

-  byte bVar6;

-  char *unaff_RSI;

-  undefined1 *unaff_RDI;

-  bool in_CF;

-  bool in_ZF;

-  

-  if (in_CF || in_ZF) {

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

-    (*pcVar4)();

-    return;

-  }

-  bVar6 = (byte)((uint)param_1 >> 8);

-  cVar5 = in_AL + bVar6;

-  uVar3 = in(param_2);

-  *unaff_RDI = uVar3;

-  if (!CARRY1(in_AL,bVar6)) {

-    piVar1 = (int *)(CONCAT71(in_register_00000001,cVar5) + -0x7d);

-    *piVar1 = *piVar1 + -1;

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

-    halt_baddata();

-  }

-  LOCK();

-  cVar2 = *unaff_RSI;

-  *unaff_RSI = (char)param_1;

-  UNLOCK();

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

-       *(char *)CONCAT71(in_register_00000001,cVar5) + cVar2;

-  if (*(char *)CONCAT71(in_register_00000001,cVar5) != '\0') {

-    McTemplateK0q_EtwWriteTransfer(cVar2,&ScreenSaverProcessEvent,param_3,cVar2);

-  }

   return;

 }
```

## `NSInstrumentation::CTypeIsolation<40960,160>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<40960,160>::Allocate
+++ NSInstrumentation::CTypeIsolation<40960,160>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kbase.sys - .ProgramDB NSInstrumentation::CTypeIsolation<40960,160>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<40960,160>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<40960,160>::Allocate(CTypeIsolation<40960,160> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<40960,160> *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<40960,160>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    GreAcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<40960,160> **)this; pCVar6 != (CSectionEntry<40960,160> *)this;

+        pCVar6 = *(CSectionEntry<40960,160> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<40960,160>::Allocate

+                            (*(CSectionBitmapAllocator<40960,160> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<40960,160>::Create();

+    if (pCVar6 != (CSectionEntry<40960,160> *)0x0) {

+      _Dst = CSectionBitmapAllocator<40960,160>::Allocate

+                       (*(CSectionBitmapAllocator<40960,160> **)(pCVar6 + 0x20));

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

+        CSectionEntry<49152,192>::Destroy((CSectionEntry<49152,192> *)pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<40960,160> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<40960,160> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<40960,160> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xfa;

+          *(CSectionEntry<40960,160> **)this = pCVar6;

+          GreReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

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

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<40960,160> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x14006f4a2;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x14006f4ae;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<40960,160> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<40960,160> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<40960,160> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<40960,160> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<40960,160> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<40960,160> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x14006f4e6;

+          GreReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x14006f4f0;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0xa0);

+    }

+  }

+  return _Dst;

+}

+
```

## `CoreMessagingK::ConnectionTargetInfo::OnDelete`  (modified)

```diff
--- CoreMessagingK::ConnectionTargetInfo::OnDelete
+++ CoreMessagingK::ConnectionTargetInfo::OnDelete
@@ -1,2 +1,18 @@
-Failed to decompile win32kbase.sys - .ProgramDB CoreMessagingK::ConnectionTargetInfo::OnDelete : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: static void __cdecl CoreMessagingK::ConnectionTargetInfo::OnDelete(struct

+   CoreMessagingK::ObjectImpl * __ptr64) */

+

+void __cdecl CoreMessagingK::ConnectionTargetInfo::OnDelete(ObjectImpl *param_1)

+

+{

+  int iVar1;

+  

+  Log::TraceConnectionTargetInfoDelete((ConnectionTargetInfo *)param_1);

+  iVar1 = Feature_CoreMsgConnectionTargetNullCheck__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar1 == 0) || (*(ClientPortInfo **)(param_1 + 0x10) != (ClientPortInfo *)0x0)) {

+    ClientPortInfo::Release(*(ClientPortInfo **)(param_1 + 0x10));

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

+  }

+  return;

+}

+
```

## `NSInstrumentation::CTypeIsolation<81920,160>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<81920,160>::Allocate
+++ NSInstrumentation::CTypeIsolation<81920,160>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kbase.sys - .ProgramDB NSInstrumentation::CTypeIsolation<81920,160>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<81920,160>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<81920,160>::Allocate(CTypeIsolation<81920,160> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<81920,160> *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<81920,160>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    GreAcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<81920,160> **)this; pCVar6 != (CSectionEntry<81920,160> *)this;

+        pCVar6 = *(CSectionEntry<81920,160> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<81920,160>::Allocate

+                            (*(CSectionBitmapAllocator<81920,160> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<81920,160>::Create();

+    if (pCVar6 != (CSectionEntry<81920,160> *)0x0) {

+      _Dst = CSectionBitmapAllocator<81920,160>::Allocate

+                       (*(CSectionBitmapAllocator<81920,160> **)(pCVar6 + 0x20));

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

+        CSectionEntry<49152,192>::Destroy((CSectionEntry<49152,192> *)pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<81920,160> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<81920,160> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<81920,160> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 500;

+          *(CSectionEntry<81920,160> **)this = pCVar6;

+          GreReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

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

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<81920,160> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x1400415da;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x1400415e6;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<81920,160> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<81920,160> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<81920,160> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<81920,160> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<81920,160> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<81920,160> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x14004161e;

+          GreReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x140041628;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0xa0);

+    }

+  }

+  return _Dst;

+}

+
```

## `DirectComposition::CLayoutSynchronizationInfo::Close`  (modified)

```diff
--- DirectComposition::CLayoutSynchronizationInfo::Close
+++ DirectComposition::CLayoutSynchronizationInfo::Close
@@ -1,2 +1,23 @@
-Failed to decompile win32kbase.sys - .ProgramDB DirectComposition::CLayoutSynchronizationInfo::Close : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: virtual long __cdecl DirectComposition::CLayoutSynchronizationInfo::Close(struct

+   _WIN32_CLOSEMETHOD_PARAMETERS * __ptr64) __ptr64 */

+

+long __thiscall

+DirectComposition::CLayoutSynchronizationInfo::Close

+          (CLayoutSynchronizationInfo *this,_WIN32_CLOSEMETHOD_PARAMETERS *param_1)

+

+{

+  int iVar1;

+  undefined4 local_res10 [6];

+  

+  iVar1 = _IsProcessDwm(*(_EPROCESS **)(param_1 + 0x10));

+  if (iVar1 == 0) {

+    if (((byte)Microsoft_Windows_Win32kEnableBits & 1) != 0) {

+      McTemplateK0xx_EtwWriteTransfer();

+    }

+    local_res10[0] = 0;

+    ApiSetEditionWindowLayoutCompleteForDCompk(*(undefined8 *)(this + 0x10),local_res10);

+  }

+  return 0;

+}

+
```

## `DirectComposition::CConnection::BeginFrame`  (modified)

```diff
--- DirectComposition::CConnection::BeginFrame
+++ DirectComposition::CConnection::BeginFrame
@@ -1,2 +1,135 @@
-Failed to decompile win32kbase.sys - .ProgramDB DirectComposition::CConnection::BeginFrame : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* public: long __cdecl DirectComposition::CConnection::BeginFrame(struct COMPOSITION_FRAME_INFO

+   const & __ptr64,unsigned __int64 * __ptr64) __ptr64 */

+

+long __thiscall

+DirectComposition::CConnection::BeginFrame

+          (CConnection *this,COMPOSITION_FRAME_INFO *param_1,__uint64 *param_2)

+

+{

+  undefined4 uVar1;

+  undefined4 uVar2;

+  undefined4 uVar3;

+  undefined8 uVar4;

+  bool bVar5;

+  int iVar6;

+  long lVar7;

+  longlong lVar8;

+  __uint64 _Var9;

+  longlong *local_res8;

+  CBatch *local_res10;

+  

+  *param_2 = 0;

+  CCriticalSection::AcquireShared(*(CCriticalSection **)(this + 0x10));

+  iVar6 = Feature_DCompkRacyAccess__private_IsEnabledDeviceUsageNoInline();

+  if (iVar6 == 0) {

+    if ((*(int *)(param_1 + 0x80) == 0) || (bVar5 = true, *(int *)(this + 0x170) != 0)) {

+      bVar5 = false;

+    }

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

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

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

+    *(undefined4 *)(this + 0x160) = *(undefined4 *)(param_1 + 0x70);

+    *(undefined4 *)(this + 0x164) = uVar1;

+    *(undefined4 *)(this + 0x168) = uVar2;

+    *(undefined4 *)(this + 0x16c) = uVar3;

+    *(undefined4 *)(this + 0x170) = *(undefined4 *)(param_1 + 0x80);

+  }

+  else {

+    if (((*(longlong *)(this + 0x160) == *(longlong *)(param_1 + 0x70)) &&

+        (*(longlong *)(this + 0x168) == *(longlong *)(param_1 + 0x78))) &&

+       (*(int *)(this + 0x170) == *(int *)(param_1 + 0x80))) goto LAB_0;

+    if ((*(int *)(param_1 + 0x80) == 0) || (bVar5 = true, *(int *)(this + 0x170) != 0)) {

+      bVar5 = false;

+    }

+    ExAcquirePushLockExclusiveEx((CPushLockCriticalSection *)(this + 200),0);

+    this[0xd0] = (CConnection)0x1;

+    uVar4 = *(undefined8 *)(param_1 + 0x78);

+    *(undefined8 *)(this + 0x160) = *(undefined8 *)(param_1 + 0x70);

+    *(undefined8 *)(this + 0x168) = uVar4;

+    *(undefined4 *)(this + 0x170) = *(undefined4 *)(param_1 + 0x80);

+    CPushLockCriticalSection::Release((CPushLockCriticalSection *)(this + 200));

+  }

+  if (bVar5) {

+    ExAcquirePushLockSharedEx((CPushLockCriticalSection *)(this + 200),0);

+    this[0xd0] = (CConnection)0x0;

+    if ((this[0xfc] == (CConnection)0x0) && (*(int *)(this + 0xf8) != 0)) {

+      CCriticalSection::AcquireExclusive(*(CCriticalSection **)(*(longlong *)(this + 0x98) + 0x20));

+      lVar7 = CSystemChannel::BoostCompositorClock(*(CSystemChannel **)(this + 0x98),true);

+      this[0xfc] = (CConnection)((byte)((uint)lVar7 >> 0x1f) ^ 1);

+      CChannel::Unlock(*(CChannel **)(this + 0x98));

+    }

+    CPushLockCriticalSection::Release((CPushLockCriticalSection *)(this + 200));

+  }

+LAB_0:

+  if (((*(int *)(this + 0xd8) != *(int *)(param_1 + 0x20)) ||

+      (*(int *)(this + 0xdc) != *(int *)(param_1 + 0x24))) ||

+     (*(int *)(this + 0xe8) != *(int *)(param_1 + 0x30))) {

+    ExAcquirePushLockExclusiveEx((CPushLockCriticalSection *)(this + 200),0);

+    this[0xd0] = (CConnection)0x1;

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

+    *(undefined8 *)(this + 0xd8) = *(undefined8 *)(param_1 + 0x20);

+    *(undefined8 *)(this + 0xe0) = uVar4;

+    *(undefined8 *)(this + 0xe8) = *(undefined8 *)(param_1 + 0x30);

+    *(undefined4 *)(this + 0xf0) = *(undefined4 *)(param_1 + 0x38);

+    CPushLockCriticalSection::Release((CPushLockCriticalSection *)(this + 200));

+  }

+  lVar8 = W32GetDCompSessionState();

+  iVar6 = UserIsCurrentProcessDwm();

+  if ((iVar6 != 0) && (*(longlong *)(lVar8 + 8) == 0)) {

+    *(void **)(lVar8 + 8) = SystemReserved1[0xf];

+  }

+  if (*(int *)(this + 0x94) == 0) {

+    iVar6 = -0x3ffffdf4;

+  }

+  else if ((*(longlong *)(this + 0xc0) != 0) ||

+          (iVar6 = (**(code **)(**(longlong **)(this + 0x128) + 0xb8))(), -1 < iVar6)) {

+    local_res8 = (longlong *)0x0;

+    iVar6 = (**(code **)(**(longlong **)(this + 0x128) + 0xc0))

+                      (*(longlong **)(this + 0x128),param_1,&local_res8);

+    if (-1 < iVar6) {

+      *(undefined8 *)(this + 0x110) = *(undefined8 *)(param_1 + 0x88);

+      *(undefined8 *)(this + 0x118) = *(undefined8 *)(param_1 + 0x90);

+      *(undefined4 *)(this + 0x120) = *(undefined4 *)(param_1 + 0x98);

+      local_res10 = (CBatch *)0x0;

+      (**(code **)(**(longlong **)(this + 0x128) + 0x10))();

+      iVar6 = Feature_SynchronizedLayoutPublicApi__private_IsEnabledDeviceUsageNoInline();

+      if (iVar6 != 0) {

+        (**(code **)(**(longlong **)(this + 0x128) + 0x58))(*(longlong **)(this + 0x128),param_1);

+      }

+      *(undefined8 *)(this + 0xa0) = *(undefined8 *)param_1;

+      _Var9 = (**(code **)(*local_res8 + 0x48))();

+      iVar6 = GetReadyBatches(this,_Var9,&local_res10);

+      if (-1 < iVar6) {

+        *(undefined8 *)(this + 0xa8) = *(undefined8 *)(param_1 + 8);

+        *(undefined8 *)(this + 0xb0) = *(undefined8 *)(param_1 + 0x10);

+        if (local_res10 != (CBatch *)0x0) {

+          (**(code **)(*local_res8 + 0x38))(local_res8,local_res10 + 0x78);

+        }

+        (**(code **)(**(longlong **)(this + 0x128) + 0x50))(*(longlong **)(this + 0x128),local_res8)

+        ;

+        (**(code **)(**(longlong **)(this + 0xc0) + 0x10))(*(longlong **)(this + 0xc0),local_res8);

+      }

+      (**(code **)(**(longlong **)(this + 0x128) + 0x18))();

+      if (iVar6 < 0) {

+        (**(code **)(*local_res8 + 0x20))();

+      }

+      else {

+        _Var9 = (**(code **)(*local_res8 + 0x48))();

+        ExAcquirePushLockExclusiveEx((CPushLockCriticalSection *)(this + 0x178),0);

+        this[0x180] = (CConnection)0x1;

+        *(__uint64 *)(this + 400) = _Var9;

+        CPushLockCriticalSection::Release((CPushLockCriticalSection *)(this + 0x178));

+        *param_2 = _Var9;

+      }

+      (**(code **)(*local_res8 + 8))();

+      *(undefined8 *)(this + 0x118) = 0;

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

+    }

+  }

+  ExReleaseResourceLite(*(undefined8 *)(this + 0x10));

+  KeLeaveCriticalRegion();

+  return iVar6;

+}

+
```

## `<lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>`  (modified)

```diff
--- <lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl>
+++ UserGlobalAtomTableCallout_Old
@@ -1,2 +1,32 @@
-Failed to decompile win32kbase.sys - .ProgramDB <lambda_63b61c2369133a205197eda5bd671ee7>::<lambda_invoker_cdecl> : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+

+void * __cdecl UserGlobalAtomTableCallout_Old(void)

+

+{

+  uint uVar1;

+  undefined8 in_R8;

+  undefined8 in_R9;

+  undefined8 uStack0000000000000028;

+  undefined8 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  undefined8 uStack0000000000000040;

+  undefined8 uStack0000000000000048;

+  ulonglong uStack0000000000000050;

+  

+  uStack0000000000000050 = (ulonglong)(uint)__security_cookie ^ (ulonglong)&stack0x00000000;

+  uVar1 = PsAcquireProcessExitSynchronization();

+  if (-1 < (int)uVar1) {

+    uStack0000000000000028 = 0;

+    uStack0000000000000030 = 0;

+    uStack0000000000000038 = 0;

+    uStack0000000000000040 = 0;

+    uStack0000000000000048 = 0;

+    KeStackAttachProcess(0,&stack0x00000020,in_R8,in_R9,0);

+    uVar1 = <lambda_32f3cb84696a90cec3124b3263005914>::operator()();

+    KeUnstackDetachProcess(&stack0x00000020);

+    PsReleaseProcessExitSynchronization();

+  }

+  return (void *)(ulonglong)uVar1;

+}

+
```

## `DirectComposition::CBatch::ShouldDefer`  (modified)

```diff
--- DirectComposition::CBatch::ShouldDefer
+++ DirectComposition::CBatch::ShouldDefer
@@ -1,38 +1,73 @@
 

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

+/* public: bool __cdecl DirectComposition::CBatch::ShouldDefer(unsigned __int64,bool * __ptr64,enum

+   DirectComposition::CBatch::DeferReason * __ptr64) __ptr64 */

 

 bool __thiscall

-InputTraceLogging::TelemetryDebug::ShouldDefer

+DirectComposition::CBatch::ShouldDefer

           (CBatch *this,__uint64 param_1,bool *param_2,DeferReason *param_3)

 

 {

-  char *in_RAX;

-  undefined8 uVar1;

-  undefined8 *unaff_RSI;

-  undefined4 unaff_EDI;

-  undefined4 *unaff_R14;

-  undefined1 *puStack0000000000000028;

-  undefined4 uStack0000000000000050;

-  undefined4 uStack0000000000000054;

+  longlong lVar1;

+  bool bVar2;

   

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

-  uVar1 = PsGetProcessCreateTimeQuadPart(**(undefined8 **)(this + 0x1d0));

-  uStack0000000000000050 = (undefined4)uVar1;

-  uStack0000000000000054 = (undefined4)((ulonglong)uVar1 >> 0x20);

-  if (unaff_R14 != (undefined4 *)0x0) {

-    *unaff_R14 = unaff_EDI;

+  if (((byte)this[0x20] & 1) == 0) {

+    lVar1 = *(longlong *)(*(longlong *)(this + 8) + 0xae8);

+    *(undefined8 *)(*(longlong *)(this + 8) + 0xae8) = 0;

+    if (lVar1 != 0) {

+      *(longlong *)(this + 0x60) = lVar1;

+    }

   }

-  if (unaff_RSI != (undefined8 *)0x0) {

-    *unaff_RSI = uVar1;

+  if (*(int *)(this + 0x14) != 5) {

+    if (*(char *)(*(longlong *)(this + 8) + 0x31) != '\0') {

+      *param_3 = 1;

+      return true;

+    }

+    if (*(char *)(*(longlong *)(this + 8) + 0x10a) == '\0') {

+      if ((((((byte)this[0x20] & 9) == 0) && (*(ulonglong *)(this + 0x38) != 0)) && (param_1 != 0))

+         && (param_1 < *(ulonglong *)(this + 0x38))) {

+        *param_3 = 3;

+      }

+      else {

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

+        {

+          *param_3 = 4;

+          return true;

+        }

+        bVar2 = WaitingForEffectCompile(this);

+        if (bVar2) {

+          *param_3 = 9;

+          return true;

+        }

+        bVar2 = CApplicationChannel::IsWaitingForChannelEvent(*(CApplicationChannel **)(this + 8));

+        if (bVar2) {

+          *param_3 = 8;

+          return true;

+        }

+        bVar2 = ShouldDeferUntilEventsSignaled(this);

+        if (bVar2) {

+          *param_3 = 5;

+        }

+        else {

+          if ((*(longlong *)(this + 0x50) == 0) ||

+             (bVar2 = CSynchronizationInfo::IsReady

+                                ((CSynchronizationInfo *)(*(longlong *)(this + 0x50) + 0x18)), bVar2

+             )) goto LAB_0;

+          lVar1 = *(longlong *)(this + 0x50);

+          *param_3 = 6;

+          if (*(char *)(lVar1 + 0x21) != '\0') {

+            return true;

+          }

+        }

+      }

+    }

+    else {

+      *param_3 = 2;

+    }

+    *param_2 = true;

+    return true;

   }

-  if (((((W32kEtwEnabledKeyword & 0x8000000000020000) != 0) && (2 < (byte)(DAT_0 - 1U))) &&

-      ((_DAT_1 & 0x8000000000020000) != 0)) &&

-     (((DAT_2 & 0x8000000000020000) == DAT_2 &&

-      (((byte)Microsoft_Windows_Win32kEnableBits & 0x20) != 0)))) {

-    W32GetCurrentWin32kSessionId();

-    puStack0000000000000028 = (undefined1 *)&stack0x00000050;

-    func_0x0001400dc4d0();

-  }

-  return true;

+LAB_0:

+  *param_3 = 0;

+  return false;

 }
```

## `DirectComposition::CLayoutSynchronizationInfo::Delete`  (modified)

```diff
--- DirectComposition::CLayoutSynchronizationInfo::Delete
+++ DirectComposition::CLayoutSynchronizationInfo::Delete
@@ -1,2 +1,23 @@
-Failed to decompile win32kbase.sys - .ProgramDB DirectComposition::CLayoutSynchronizationInfo::Delete : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: virtual long __cdecl DirectComposition::CLayoutSynchronizationInfo::Delete(struct

+   _WIN32_DELETEMETHOD_PARAMETERS * __ptr64) __ptr64 */

+

+long __thiscall

+DirectComposition::CLayoutSynchronizationInfo::Delete

+          (CLayoutSynchronizationInfo *this,_WIN32_DELETEMETHOD_PARAMETERS *param_1)

+

+{

+  longlong lVar1;

+  undefined8 in_R8;

+  

+  lVar1 = *(longlong *)(this + 0x18);

+  if (lVar1 != 0) {

+    if (((byte)Microsoft_Windows_Win32kEnableBits & 1) != 0) {

+      McTemplateK0xx_EtwWriteTransfer(lVar1,&DCompLayoutSyncDestroyEvent,in_R8,this,lVar1 + 0x18);

+    }

+    ObfDereferenceObject(*(undefined8 *)(this + 0x18));

+    *(undefined8 *)(this + 0x18) = 0;

+  }

+  return 0;

+}

+
```

## `CPTPProcessor::SendShellAction`  (modified)

```diff
--- CPTPProcessor::SendShellAction
+++ CPTPProcessor::SendShellAction
@@ -1,2 +1,21 @@
-Failed to decompile win32kbase.sys - .ProgramDB CPTPProcessor::SendShellAction : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void __cdecl CPTPProcessor::SendShellAction(enum

+   PTPEngineOutput::Payload::Shell::Action) __ptr64 */

+

+void __thiscall CPTPProcessor::SendShellAction(CPTPProcessor *this,Action param_1)

+

+{

+  undefined8 local_18;

+  Action local_10;

+  undefined4 local_c;

+  

+  local_c = 0;

+  if (*(longlong *)(this + 0x210) == 0) {

+    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20002,0x5cd);

+  }

+  local_18 = *(undefined8 *)(this + 0x210);

+  local_10 = param_1;

+  SendMessageTo(0x15,&local_18);

+  return;

+}

+
```

## `ForegroundBoost::SetForegroundPriority`  (modified)

```diff
--- ForegroundBoost::SetForegroundPriority
+++ ForegroundBoost::SetForegroundPriority
@@ -1,68 +1,16 @@
+

+/* void __cdecl ForegroundBoost::SetForegroundPriority(struct tagTHREADINFO const * __ptr64,enum

+   ForegroundBoost::ForegroundPriorityClass,enum ForegroundBoost::ForegroundBoostSource) */

 

 void __cdecl

-<lambda_0e67b526681aa6a0208369450a9126fb>::SetForegroundPriority

+ForegroundBoost::SetForegroundPriority

           (tagTHREADINFO *param_1,ForegroundPriorityClass param_2,ForegroundBoostSource param_3)

 

 {

-  undefined4 in_register_00000014;

-  longlong unaff_RBP;

-  undefined4 in_register_00000084;

-  _GUID *in_R9;

-  _tlgWrapSz<char> *in_stack_00000038;

-  _tlgWrapperByVal<8> *in_stack_00000040;

-  _tlgWrapperByVal<4> *in_stack_00000048;

-  _tlgWrapperByVal<4> *in_stack_00000050;

-  _tlgWrapperByVal<8> *in_stack_00000058;

-  _tlgWrapperByVal<8> *in_stack_00000060;

-  _tlgWrapperByRef<16> *in_stack_00000068;

-  _tlgWrapSz<char> *in_stack_00000070;

-  _tlgWrapperByVal<8> *in_stack_00000078;

-  _tlgWrapperByVal<4> *in_stack_00000080;

-  _tlgWrapperByVal<4> *in_stack_00000088;

-  _tlgWrapperByVal<8> *in_stack_00000090;

-  _tlgWrapperByVal<8> *in_stack_00000098;

-  _tlgWrapperByRef<16> *in_stack_000000a0;

-  _tlgWrapSz<char> *in_stack_000000a8;

-  _tlgWrapperByVal<8> *in_stack_000000b0;

-  _tlgWrapperByVal<4> *in_stack_000000b8;

-  _tlgWrapperByVal<4> *in_stack_000000c0;

-  _tlgWrapperByVal<8> *in_stack_000000c8;

-  _tlgWrapperByVal<8> *in_stack_000000d0;

-  _tlgWrapperByRef<16> *in_stack_000000d8;

-  _tlgWrapSz<char> *in_stack_000000e0;

-  _tlgWrapperByVal<8> *in_stack_000000e8;

-  _tlgWrapperByVal<4> *in_stack_000000f0;

-  _tlgWrapperByVal<4> *in_stack_000000f8;

-  _tlgWrapperByVal<8> *in_stack_00000100;

-  _tlgWrapperByVal<8> *in_stack_00000108;

-  _tlgWrapperByRef<16> *in_stack_00000110;

-  _tlgWrapSz<char> *in_stack_00000118;

-  _tlgWrapperByVal<8> *in_stack_00000120;

-  _tlgWrapperByVal<4> *in_stack_00000128;

-  _tlgWrapperByVal<4> *in_stack_00000130;

-  _tlgWrapperByVal<8> *in_stack_00000138;

-  _tlgWrapperByVal<8> *in_stack_00000140;

-  _tlgWrapperByRef<16> *in_stack_00000148;

-  _tlgWrapSz<unsigned_short> *in_stack_00000150;

-  _tlgWrapSz<unsigned_short> *in_stack_00000158;

-  

-  _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<8>,_tlgWrapperByVal<4>,_tlgWrapSz<char>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<8>,_tlgWrapperByRef<16>,_tlgWrapSz<char>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<8>,_tlgWrapperByRef<16>,_tlgWrapSz<char>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<8>,_tlgWrapperByRef<16>,_tlgWrapSz<char>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<8>,_tlgWrapperByRef<16>,_tlgWrapSz<char>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<8>,_tlgWrapperByVal<8>,_tlgWrapperByRef<16>,_tlgWrapSz<unsigned_short>,_tlgWrapSz<unsigned_short>_>

-            ((_tlgProvider_t *)&DAT_0,(void *)CONCAT44(in_register_00000014,param_2),

-             (_GUID *)CONCAT44(in_register_00000084,param_3),in_R9,

-             (_tlgWrapperByVal<8> *)(unaff_RBP + 0x88),(_tlgWrapperByVal<8> *)(unaff_RBP + 0x80),

-             (_tlgWrapperByVal<4> *)(unaff_RBP + -0x60),in_stack_00000038,in_stack_00000040,

-             in_stack_00000048,in_stack_00000050,in_stack_00000058,in_stack_00000060,

-             in_stack_00000068,in_stack_00000070,in_stack_00000078,in_stack_00000080,

-             in_stack_00000088,in_stack_00000090,in_stack_00000098,in_stack_000000a0,

-             in_stack_000000a8,in_stack_000000b0,in_stack_000000b8,in_stack_000000c0,

-             in_stack_000000c8,in_stack_000000d0,in_stack_000000d8,in_stack_000000e0,

-             in_stack_000000e8,in_stack_000000f0,in_stack_000000f8,in_stack_00000100,

-             in_stack_00000108,in_stack_00000110,in_stack_00000118,in_stack_00000120,

-             in_stack_00000128,in_stack_00000130,in_stack_00000138,in_stack_00000140,

-             in_stack_00000148,in_stack_00000150,in_stack_00000158);

-  ObfDereferenceObject();

+                    /* 0x12e6d0  356

+                       ?SetForegroundPriority@ForegroundBoost@@YAXPEBUtagTHREADINFO@@W4ForegroundPriorityClass@1@W4ForegroundBoostSource@1@@Z

+                        */

+  `anonymous_namespace'::_SetForegroundPriority(*(undefined8 *)(param_1 + 0x1d0));

   return;

 }
```

## `NSInstrumentation::CTypeIsolation<106496,416>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<106496,416>::Allocate
+++ NSInstrumentation::CTypeIsolation<106496,416>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kbase.sys - .ProgramDB NSInstrumentation::CTypeIsolation<106496,416>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<106496,416>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<106496,416>::Allocate(CTypeIsolation<106496,416> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<106496,416> *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<106496,416>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    GreAcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<106496,416> **)this; pCVar6 != (CSectionEntry<106496,416> *)this;

+        pCVar6 = *(CSectionEntry<106496,416> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<106496,416>::Allocate

+                            (*(CSectionBitmapAllocator<106496,416> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<106496,416>::Create();

+    if (pCVar6 != (CSectionEntry<106496,416> *)0x0) {

+      _Dst = CSectionBitmapAllocator<106496,416>::Allocate

+                       (*(CSectionBitmapAllocator<106496,416> **)(pCVar6 + 0x20));

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

+        CSectionEntry<49152,192>::Destroy((CSectionEntry<49152,192> *)pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<106496,416> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<106496,416> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<106496,416> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xea;

+          *(CSectionEntry<106496,416> **)this = pCVar6;

+          GreReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

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

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<106496,416> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x14010d47a;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x14010d486;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<106496,416> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<106496,416> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<106496,416> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<106496,416> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<106496,416> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<106496,416> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x14010d4be;

+          GreReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x14010d4c8;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0x1a0);

+    }

+  }

+  return _Dst;

+}

+
```

## `ForegroundBoost::`anonymous_namespace'::SetProcessPriorityByClass`  (modified)

```diff
--- ForegroundBoost::`anonymous_namespace'::SetProcessPriorityByClass
+++ ForegroundBoost::`anonymous_namespace'::SetProcessPriorityByClass
@@ -1,233 +1,109 @@
 

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

-

-void <lambda_ca433e1d2bf82ece4758afe8c3ed56fe>::SetProcessPriorityByClass

-               (undefined8 param_1,longlong *param_2)

+void ForegroundBoost::`anonymous_namespace'::SetProcessPriorityByClass

+               (longlong param_1,int param_2,_GUID *param_3,_GUID *param_4)

 

 {

-  code *pcVar1;

-  COPM *this;

-  longlong *plVar2;

-  CoreMessagingKPort *this_00;

-  CQoSReport *this_01;

-  _DRIVER_OBJECT *p_Var3;

-  bool bVar4;

+  undefined4 uVar1;

+  char cVar2;

+  byte bVar3;

+  int iVar4;

   int iVar5;

   longlong lVar6;

-  longlong *plVar7;

-  longlong lVar8;

-  uint uVar9;

-  void *pvVar10;

-  longlong unaff_RSI;

+  undefined8 uVar7;

+  ulonglong uVar8;

+  bool bVar9;

+  uint local_res8 [2];

+  undefined4 local_res20 [2];

+  undefined8 in_stack_ffffffffffffffb0;

+  undefined4 uVar10;

   

-  lVar6 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x100);

-  if (pcVar1 != (code *)0x0) {

-    (*pcVar1)();

+  uVar10 = (undefined4)((ulonglong)in_stack_ffffffffffffffb0 >> 0x20);

+  uVar8 = (ulonglong)param_3 & 0xffffffff;

+  iVar5 = 0;

+  if ((*(ulonglong *)(param_1 + 800) >> 0x2a & 1) != 0) {

+    cVar2 = IsProcessBackground();

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

+      return;

+    }

+    local_res8[0] = 0x20000;

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

+    return;

   }

-  lVar6 = W32GetDCompSessionState();

-  if (*(CConnection **)(lVar6 + 0x10) != (CConnection *)0x0) {

-    DirectComposition::CConnection::_scalar_deleting_destructor_

-              (*(CConnection **)(lVar6 + 0x10),(uint)param_2);

+  iVar4 = (int)param_3;

+  if (param_2 == 0) {

+    iVar4 = RemoveProcessBoostSource(param_1,uVar8);

+    if (iVar4 != 1) goto LAB_0;

+    uVar7 = 0;

+LAB_1:

+    iVar5 = SetProcessPriorityByClassWithPolicy(param_1,uVar7);

   }

-  if (*(longlong *)(lVar6 + 0x20) != 0) {

-    ExDeleteResourceLite();

-    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x20));

-    *(longlong *)(lVar6 + 0x20) = unaff_RSI;

-  }

-  lVar6 = W32GetDCompSessionState();

-  if (*(CSynchronizationManager **)(lVar6 + 0x18) != (CSynchronizationManager *)0x0) {

-    DirectComposition::CSynchronizationManager::_scalar_deleting_destructor_

-              (*(CSynchronizationManager **)(lVar6 + 0x18),(uint)param_2);

-  }

-  lVar6 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x118);

-  if (pcVar1 != (code *)0x0) {

-    iVar5 = (*pcVar1)();

-    if (-1 < iVar5) {

-      lVar6 = W32GetWin32kBaseApiSetTable();

-      pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x120);

-      if (pcVar1 != (code *)0x0) {

-        (*pcVar1)();

+  else {

+    if (param_2 == 1) {

+      cVar2 = IsProcessBackground();

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

+        if (iVar4 != 0) goto LAB_2;

+      }

+      else if (iVar4 == 0) {

+        local_res8[0] = 0x20000;

+        param_3 = (_GUID *)0x114;

+        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+      }

+      iVar5 = SetProcessPriorityByClassWithPolicy(param_1,1);

+      if (iVar4 == 0) goto LAB_0;

+    }

+    else {

+      if (param_2 != 2) goto LAB_0;

+      cVar2 = IsProcessForegroundBoostedNoSpin();

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

+        if (iVar4 != 0) {

+          local_res8[0] = 0x20000;

+          param_3 = (_GUID *)0x138;

+          MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+        }

+        uVar7 = 2;

+        goto LAB_1;

+      }

+      if (iVar4 == 0) {

+        local_res8[0] = 0x20000;

+        param_3 = (_GUID *)0x13e;

+        MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000);

+      }

+      cVar2 = IsProcessBackground(param_1);

+      if ((cVar2 != '\0') && (iVar5 = SetProcessPriorityByClassWithPolicy(param_1,1), iVar5 == 1)) {

+        iVar5 = SetProcessPriorityByClassWithPolicy(param_1,2);

       }

     }

+LAB_2:

+    AddProcessBoostSource(param_1,uVar8);

   }

-  bVar4 = Gre::Base::IsSessionGlobalsAreaAllocated();

-  if (bVar4) {

-    lVar6 = W32GetSessionState();

-    lVar6 = *(longlong *)(lVar6 + 0x58);

-    this = *(COPM **)(lVar6 + 0xe40);

-    if (this != (COPM *)0x0) {

-      COPM::~COPM(this);

-      OPM::OPMFreeMemory(this);

-    }

-    *(longlong *)(lVar6 + 0xe40) = unaff_RSI;

+LAB_0:

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

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

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

+    cVar2 = '\0';

   }

-  HYDRA_HINT(0x80);

-  MultiUserNtGreCleanup();

-  HYDRA_HINT(0x100);

-  W32UnregisterSessionProcess();

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xdf10) != unaff_RSI) {

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

+  if ((cVar2 != '\0') || (bVar9)) {

+    uVar8 = *(ulonglong *)(param_1 + 800);

+    uVar1 = *(undefined4 *)(param_1 + 0x38);

     lVar6 = W32GetUserSessionState();

-    plVar7 = (longlong *)(*(longlong *)(lVar6 + 0xdf10) + 0x18);

-    if ((longlong *)*plVar7 != plVar7) {

-      lVar6 = W32GetUserSessionState();

-      plVar7 = *(longlong **)(*(longlong *)(lVar6 + 0xdf10) + 0x18);

-      lVar6 = W32GetUserSessionState();

-      param_2 = (longlong *)(*(longlong *)(lVar6 + 0xdf10) + 0x18);

-      if (plVar7 != param_2) {

-        do {

-          plVar2 = (longlong *)*plVar7;

-          GreDeleteFastMutex(plVar7);

-          lVar6 = W32GetUserSessionState();

-          plVar7 = plVar2;

-        } while (plVar2 != (longlong *)(*(longlong *)(lVar6 + 0xdf10) + 0x18));

-      }

-      lVar6 = W32GetUserSessionState();

-      lVar8 = *(longlong *)(lVar6 + 0xdf10) + 0x18;

-      *(longlong *)(*(longlong *)(lVar6 + 0xdf10) + 0x20) = lVar8;

-      *(longlong *)lVar8 = lVar8;

-    }

+    param_3 = (_GUID *)CONCAT71((int7)((ulonglong)param_3 >> 8),bVar9);

+    param_4 = *(_GUID **)(lVar6 + 0x10f78);

+    WPP_RECORDER_AND_TRACE_SF_Dd

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar2,param_3,param_4,4,

+               CONCAT44(uVar10,0xd),0xc,&WPP_99f9277e32b639c701cbac7f5cadfaca_Traceguids,uVar1,

+               (uint)(uVar8 >> 0x1e) & 0xff);

   }

-  InputUnInitialize();

-  Win32kNtUserCleanup();

-  DestroyHandleTableObjects();

-  CleanupDomainLocks();

-  HYDRA_HINT(0x200);

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xa6e0) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    param_2 = *(longlong **)(lVar6 + 0xa6e0);

-    lVar6 = W32GetUserSessionState();

-    NSInstrumentation::CLeakTrackingAllocator::FreePagedLookasideList

-              ((CLeakTrackingAllocator *)(lVar6 + 0x11ac0),param_2);

+  if (((iVar5 == 1) && (5 < DAT_3)) &&

+     (cVar2 = _tlgKeywordOn(&DAT_3,4), cVar2 != '\0')) {

+    bVar3 = HasBoostSource(param_1,0);

+    local_res8[0] = (uint)bVar3;

+    local_res20[0] = *(undefined4 *)(param_1 + 0x38);

+    _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+    ::Write<_tlgWrapperByVal<4>,_tlgWrapperByVal<4>_>

+              ((_tlgProvider_t *)&DAT_3,&DAT_1402753e9,param_3,param_4,

+               (_tlgWrapperByVal<4> *)local_res20,(_tlgWrapperByVal<4> *)local_res8);

   }

-  UninitializeUserTypeIsolation();

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0x117d8) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x117d8));

-    lVar6 = W32GetUserSessionState();

-    *(longlong *)(lVar6 + 0x117d8) = unaff_RSI;

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0x4e10) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

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

-    lVar6 = W32GetUserSessionState();

-    if (*(longlong *)(lVar6 + 20000) != unaff_RSI) {

-      lVar6 = W32GetUserSessionState();

-      RtlDestroyHeap(*(undefined8 *)(lVar6 + 0x4e28));

-      lVar6 = W32GetUserSessionState();

-      MmUnmapViewInSessionSpace(*(undefined8 *)(lVar6 + 20000));

-    }

-    lVar6 = W32GetUserSessionState();

-    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x4e10));

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xdf10) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0xdf10));

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xf650) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0xf650));

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0x4e18) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    if (*(longlong *)(lVar6 + 0x4e08) != unaff_RSI) {

-      lVar6 = W32GetUserSessionState();

-      MmUnmapViewInSessionSpace(*(undefined8 *)(lVar6 + 0x4e08));

-    }

-    lVar6 = W32GetUserSessionState();

-    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x4e18));

-  }

-  lVar6 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x128);

-  if (pcVar1 != (code *)0x0) {

-    iVar5 = (*pcVar1)();

-    if (-1 < iVar5) {

-      lVar6 = W32GetUserSessionState();

-      lVar8 = W32GetWin32kBaseApiSetTable();

-      param_2 = *(longlong **)(lVar8 + 0x30);

-      if ((code *)param_2[0x26] != (code *)0x0) {

-        (*(code *)param_2[0x26])(lVar6 + 0x10280);

-      }

-    }

-  }

-  uVar9 = (uint)param_2;

-  lVar6 = W32GetUserSessionState();

-  if (*(int *)(lVar6 + 0x11248) != (int)unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    pvVar10 = *(void **)(lVar6 + 0x4c20);

-    if (pvVar10 != (void *)0x0) {

-      lVar8 = W32GetUserSessionState();

-      NSInstrumentation::CLeakTrackingAllocator::FreePagedLookasideList

-                ((CLeakTrackingAllocator *)(lVar8 + 0x11ac0),pvVar10);

-      uVar9 = (uint)pvVar10;

-      *(longlong *)(lVar6 + 0x4c20) = unaff_RSI;

-    }

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0x3898) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    if (*(CAsyncKeyEventMonitor **)(lVar6 + 0x3898) != (CAsyncKeyEventMonitor *)0x0) {

-      CAsyncKeyEventMonitor::_scalar_deleting_destructor_

-                (*(CAsyncKeyEventMonitor **)(lVar6 + 0x3898),uVar9);

-    }

-    lVar6 = W32GetUserSessionState();

-    *(longlong *)(lVar6 + 0x3898) = unaff_RSI;

-  }

-  lVar6 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x138);

-  if (pcVar1 != (code *)0x0) {

-    iVar5 = (*pcVar1)();

-    if (-1 < iVar5) {

-      lVar6 = W32GetWin32kBaseApiSetTable();

-      pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x140);

-      if (pcVar1 != (code *)0x0) {

-        (*pcVar1)();

-      }

-    }

-  }

-  lVar6 = W32GetUserSessionState();

-  this_00 = *(CoreMessagingKPort **)(lVar6 + 0x11b58);

-  if (this_00 != (CoreMessagingKPort *)0x0) {

-    CoreMessagingKPort::CloseCoreMsgPort(this_00);

-    GreDeleteFastMutex(this_00);

-  }

-  CoreMsgUninitialize();

-  RIMUnInitialize();

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xa6c8) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    ExFreePoolWithTag(*(undefined8 *)(lVar6 + 0xa6c8),0);

-    lVar6 = W32GetUserSessionState();

-    *(longlong *)(lVar6 + 0xa6c8) = unaff_RSI;

-  }

-  FreeWin32KSyscallFilter();

-  lVar6 = W32GetUserSessionState();

-  this_01 = *(CQoSReport **)(lVar6 + 0xa1f8);

-  if (this_01 != (CQoSReport *)0x0) {

-    CQoSReport::~CQoSReport(this_01);

-    GreDeleteFastMutex(this_01);

-  }

-  *(longlong *)(lVar6 + 0xa1f8) = unaff_RSI;

-  UninitializeWin32PoolTracking();

-  UninitializeWin32SiloGlobals();

-  p_Var3 = gpWin32kDriverObject;

-  if (gpWin32kDriverObject != (_DRIVER_OBJECT *)0x0) {

-    UninitializeBaseWppLog();

-    EditionUninitializeWppLogging(p_Var3);

-  }

-  lVar6 = W32GetSessionState();

-  FreePerSessionWin32kCall(lVar6 + 0x98);

-  lVar6 = W32GetSessionState();

-  FreeWin32kApiSetTable(lVar6 + 0x98);

-  CTempW32ThreadNonPaged::~CTempW32ThreadNonPaged((CTempW32ThreadNonPaged *)&stack0x00000040);

   return;

 }
```

## `tagPROCESSINFO::DwsUnlinkAllWindows`  (modified)

```diff
--- tagPROCESSINFO::DwsUnlinkAllWindows
+++ tagPROCESSINFO::DwsUnlinkAllWindows
@@ -1,2 +1,84 @@
-Failed to decompile win32kbase.sys - .ProgramDB tagPROCESSINFO::DwsUnlinkAllWindows : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl tagPROCESSINFO::DwsUnlinkAllWindows(void) __ptr64 */

+

+void __thiscall tagPROCESSINFO::DwsUnlinkAllWindows(tagPROCESSINFO *this)

+

+{

+  tagPROCESSINFO *ptVar1;

+  tagPROCESSINFO *ptVar2;

+  uint *puVar3;

+  tagPROCESSINFO *ptVar4;

+  longlong *plVar5;

+  longlong *plVar6;

+  code *pcVar7;

+  longlong lVar8;

+  char cVar9;

+  bool bVar10;

+  

+  ptVar2 = this + 0x458;

+  ptVar4 = *(tagPROCESSINFO **)ptVar2;

+  if (ptVar4 == ptVar2) {

+LAB_0:

+    ptVar2 = this + 0x468;

+    ptVar4 = *(tagPROCESSINFO **)ptVar2;

+    if (ptVar4 != ptVar2) {

+      if ((*(tagPROCESSINFO **)(ptVar4 + 8) != ptVar2) ||

+         (plVar5 = *(longlong **)(this + 0x470), (tagPROCESSINFO *)*plVar5 != ptVar2))

+      goto LAB_1;

+      *plVar5 = (longlong)ptVar4;

+      *(longlong **)(ptVar4 + 8) = plVar5;

+      *(tagPROCESSINFO **)(this + 0x470) = ptVar2;

+      *(tagPROCESSINFO **)ptVar2 = ptVar2;

+    }

+    ptVar2 = this + 0x488;

+    while (ptVar4 = *(tagPROCESSINFO **)ptVar2, ptVar4 != ptVar2) {

+      if ((*(tagPROCESSINFO **)(ptVar4 + 8) != ptVar2) ||

+         (lVar8 = *(longlong *)ptVar4, *(tagPROCESSINFO **)(lVar8 + 8) != ptVar4))

+      goto LAB_1;

+      *(longlong *)ptVar2 = lVar8;

+      *(tagPROCESSINFO **)(lVar8 + 8) = ptVar2;

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

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

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

+        cVar9 = '\0';

+      }

+      else {

+        cVar9 = '\x01';

+      }

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

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

+        lVar8 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_Dq

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

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

+      }

+      ptVar1 = ptVar4 + -0x10;

+      plVar5 = *(longlong **)ptVar1;

+      if (((tagPROCESSINFO *)plVar5[1] != ptVar1) ||

+         (plVar6 = *(longlong **)(ptVar4 + -8), (tagPROCESSINFO *)*plVar6 != ptVar1))

+      goto LAB_1;

+      *plVar6 = (longlong)plVar5;

+      plVar5[1] = (longlong)plVar6;

+      if (plVar6 == plVar5) {

+        puVar3 = (uint *)(*(longlong *)(ptVar4 + -0x28) + 0x17c);

+        *puVar3 = *puVar3 & 0xf7ffffff;

+      }

+      GreDeleteFastMutex(ptVar4 + -0x28);

+    }

+  }

+  else {

+    if ((*(tagPROCESSINFO **)(ptVar4 + 8) == ptVar2) &&

+       (plVar5 = *(longlong **)(this + 0x460), (tagPROCESSINFO *)*plVar5 == ptVar2)) {

+      *plVar5 = (longlong)ptVar4;

+      *(longlong **)(ptVar4 + 8) = plVar5;

+      *(tagPROCESSINFO **)(this + 0x460) = ptVar2;

+      *(tagPROCESSINFO **)ptVar2 = ptVar2;

+      goto LAB_0;

+    }

+LAB_1:

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

+    (*pcVar7)(3);

+  }

+  return;

+}

+
```

## `<lambda_a418699817c89276d1581a788dfe45e0>::<lambda_invoker_cdecl>`  (modified)

```diff
--- <lambda_a418699817c89276d1581a788dfe45e0>::<lambda_invoker_cdecl>
+++ <lambda_a418699817c89276d1581a788dfe45e0>::<lambda_invoker_cdecl>
@@ -1,2 +1,20 @@
-Failed to decompile win32kbase.sys - .ProgramDB <lambda_a418699817c89276d1581a788dfe45e0>::<lambda_invoker_cdecl> : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+void <lambda_a418699817c89276d1581a788dfe45e0>::<lambda_invoker_cdecl>(void)

+

+{

+  longlong lVar1;

+  int iVar2;

+  undefined4 local_res18 [4];

+  

+  lVar1 = W32GetUserSessionState();

+  SendPositionChanged(*(longlong *)(lVar1 + 0x4e30) + 0x1360,1);

+  lVar1 = W32GetUserSessionState();

+  SendCrosshairEnabledStatusChanged(*(int *)(lVar1 + 0x10810) != 0);

+  local_res18[0] = 0;

+  iVar2 = ReadPointerDeviceSettings(0xb2,local_res18);

+  if (iVar2 != 0) {

+    SendCrosshairPropertiesChanged(local_res18[0]);

+  }

+  return;

+}

+
```

## `ForegroundBoost::SetForegroundPriority`  (modified)

```diff
--- ForegroundBoost::SetForegroundPriority
+++ ForegroundBoost::SetForegroundPriority
@@ -1,254 +1,16 @@
 

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

+/* void __cdecl ForegroundBoost::SetForegroundPriority(struct tagPROCESSINFO * __ptr64,enum

+   ForegroundBoost::ForegroundPriorityClass,enum ForegroundBoost::ForegroundBoostSource) */

 

 void __cdecl

-<lambda_0e67b526681aa6a0208369450a9126fb>::SetForegroundPriority

+ForegroundBoost::SetForegroundPriority

           (tagPROCESSINFO *param_1,ForegroundPriorityClass param_2,ForegroundBoostSource param_3)

 

 {

-  code *pcVar1;

-  COPM *this;

-  longlong *plVar2;

-  CoreMessagingKPort *this_00;

-  CQoSReport *this_01;

-  _DRIVER_OBJECT *p_Var3;

-  bool bVar4;

-  int iVar5;

-  code *in_RAX;

-  longlong lVar6;

-  longlong *plVar7;

-  longlong lVar8;

-  uint uVar9;

-  longlong *plVar10;

-  void *pvVar11;

-  longlong unaff_RSI;

-  

-  plVar10 = (longlong *)(ulonglong)param_2;

-  if ((int)in_RAX != 0) {

-    iVar5 = (*in_RAX)();

-    if (-1 < iVar5) {

-      lVar6 = W32GetWin32kBaseApiSetTable();

-      pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x10b8);

-      if (pcVar1 != (code *)0x0) {

-        (*pcVar1)();

-      }

-    }

-  }

-  lVar6 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0xf8);

-  if (pcVar1 != (code *)0x0) {

-    iVar5 = (*pcVar1)();

-    if (-1 < iVar5) {

-      lVar6 = W32GetWin32kBaseApiSetTable();

-      pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x100);

-      if (pcVar1 != (code *)0x0) {

-        (*pcVar1)();

-      }

-    }

-  }

-  lVar6 = W32GetDCompSessionState();

-  if (*(CConnection **)(lVar6 + 0x10) != (CConnection *)0x0) {

-    DirectComposition::CConnection::_scalar_deleting_destructor_

-              (*(CConnection **)(lVar6 + 0x10),(uint)plVar10);

-  }

-  if (*(longlong *)(lVar6 + 0x20) != 0) {

-    ExDeleteResourceLite();

-    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0x20));

-    *(longlong *)(lVar6 + 0x20) = unaff_RSI;

-  }

-  lVar6 = W32GetDCompSessionState();

-  if (*(CSynchronizationManager **)(lVar6 + 0x18) != (CSynchronizationManager *)0x0) {

-    DirectComposition::CSynchronizationManager::_scalar_deleting_destructor_

-              (*(CSynchronizationManager **)(lVar6 + 0x18),(uint)plVar10);

-  }

-  lVar6 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x118);

-  if (pcVar1 != (code *)0x0) {

-    iVar5 = (*pcVar1)();

-    if (-1 < iVar5) {

-      lVar6 = W32GetWin32kBaseApiSetTable();

-      pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x120);

-      if (pcVar1 != (code *)0x0) {

-        (*pcVar1)();

-      }

-    }

-  }

-  bVar4 = Gre::Base::IsSessionGlobalsAreaAllocated();

-  if (bVar4) {

-    lVar6 = W32GetSessionState();

-    lVar6 = *(longlong *)(lVar6 + 0x58);

-    this = *(COPM **)(lVar6 + 0xe40);

-    if (this != (COPM *)0x0) {

-      COPM::~COPM(this);

-      OPM::OPMFreeMemory(this);

-    }

-    *(longlong *)(lVar6 + 0xe40) = unaff_RSI;

-  }

-  HYDRA_HINT(0x80);

-  MultiUserNtGreCleanup();

-  HYDRA_HINT(0x100);

-  W32UnregisterSessionProcess();

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xdf10) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    plVar7 = (longlong *)(*(longlong *)(lVar6 + 0xdf10) + 0x18);

-    if ((longlong *)*plVar7 != plVar7) {

-      lVar6 = W32GetUserSessionState();

-      plVar7 = *(longlong **)(*(longlong *)(lVar6 + 0xdf10) + 0x18);

-      lVar6 = W32GetUserSessionState();

-      plVar10 = (longlong *)(*(longlong *)(lVar6 + 0xdf10) + 0x18);

-      if (plVar7 != plVar10) {

-        do {

-          plVar2 = (longlong *)*plVar7;

-          GreDeleteFastMutex(plVar7);

-          lVar6 = W32GetUserSessionState();

-          plVar7 = plVar2;

-        } while (plVar2 != (longlong *)(*(longlong *)(lVar6 + 0xdf10) + 0x18));

-      }

-      lVar6 = W32GetUserSessionState();

-      lVar8 = *(longlong *)(lVar6 + 0xdf10) + 0x18;

-      *(longlong *)(*(longlong *)(lVar6 + 0xdf10) + 0x20) = lVar8;

-      *(longlong *)lVar8 = lVar8;

-    }

-  }

-  InputUnInitialize();

-  Win32kNtUserCleanup();

-  DestroyHandleTableObjects();

-  CleanupDomainLocks();

-  HYDRA_HINT(0x200);

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xa6e0) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    plVar10 = *(longlong **)(lVar6 + 0xa6e0);

-    lVar6 = W32GetUserSessionState();

-    NSInstrumentation::CLeakTrackingAllocator::FreePagedLookasideList

-              ((CLeakTrackingAllocator *)(lVar6 + 0x11ac0),plVar10);

-  }

-  UninitializeUserTypeIsolation();

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0x117d8) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x117d8));

-    lVar6 = W32GetUserSessionState();

-    *(longlong *)(lVar6 + 0x117d8) = unaff_RSI;

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0x4e10) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

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

-    lVar6 = W32GetUserSessionState();

-    if (*(longlong *)(lVar6 + 20000) != unaff_RSI) {

-      lVar6 = W32GetUserSessionState();

-      RtlDestroyHeap(*(undefined8 *)(lVar6 + 0x4e28));

-      lVar6 = W32GetUserSessionState();

-      MmUnmapViewInSessionSpace(*(undefined8 *)(lVar6 + 20000));

-    }

-    lVar6 = W32GetUserSessionState();

-    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x4e10));

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xdf10) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0xdf10));

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xf650) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    GreDeleteFastMutex(*(undefined8 *)(lVar6 + 0xf650));

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0x4e18) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    if (*(longlong *)(lVar6 + 0x4e08) != unaff_RSI) {

-      lVar6 = W32GetUserSessionState();

-      MmUnmapViewInSessionSpace(*(undefined8 *)(lVar6 + 0x4e08));

-    }

-    lVar6 = W32GetUserSessionState();

-    ObfDereferenceObject(*(undefined8 *)(lVar6 + 0x4e18));

-  }

-  lVar6 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x128);

-  if (pcVar1 != (code *)0x0) {

-    iVar5 = (*pcVar1)();

-    if (-1 < iVar5) {

-      lVar6 = W32GetUserSessionState();

-      lVar8 = W32GetWin32kBaseApiSetTable();

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

-      if ((code *)plVar10[0x26] != (code *)0x0) {

-        (*(code *)plVar10[0x26])(lVar6 + 0x10280);

-      }

-    }

-  }

-  uVar9 = (uint)plVar10;

-  lVar6 = W32GetUserSessionState();

-  if (*(int *)(lVar6 + 0x11248) != (int)unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    pvVar11 = *(void **)(lVar6 + 0x4c20);

-    if (pvVar11 != (void *)0x0) {

-      lVar8 = W32GetUserSessionState();

-      NSInstrumentation::CLeakTrackingAllocator::FreePagedLookasideList

-                ((CLeakTrackingAllocator *)(lVar8 + 0x11ac0),pvVar11);

-      uVar9 = (uint)pvVar11;

-      *(longlong *)(lVar6 + 0x4c20) = unaff_RSI;

-    }

-  }

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0x3898) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    if (*(CAsyncKeyEventMonitor **)(lVar6 + 0x3898) != (CAsyncKeyEventMonitor *)0x0) {

-      CAsyncKeyEventMonitor::_scalar_deleting_destructor_

-                (*(CAsyncKeyEventMonitor **)(lVar6 + 0x3898),uVar9);

-    }

-    lVar6 = W32GetUserSessionState();

-    *(longlong *)(lVar6 + 0x3898) = unaff_RSI;

-  }

-  lVar6 = W32GetWin32kBaseApiSetTable();

-  pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x138);

-  if (pcVar1 != (code *)0x0) {

-    iVar5 = (*pcVar1)();

-    if (-1 < iVar5) {

-      lVar6 = W32GetWin32kBaseApiSetTable();

-      pcVar1 = *(code **)(*(longlong *)(lVar6 + 0x30) + 0x140);

-      if (pcVar1 != (code *)0x0) {

-        (*pcVar1)();

-      }

-    }

-  }

-  lVar6 = W32GetUserSessionState();

-  this_00 = *(CoreMessagingKPort **)(lVar6 + 0x11b58);

-  if (this_00 != (CoreMessagingKPort *)0x0) {

-    CoreMessagingKPort::CloseCoreMsgPort(this_00);

-    GreDeleteFastMutex(this_00);

-  }

-  CoreMsgUninitialize();

-  RIMUnInitialize();

-  lVar6 = W32GetUserSessionState();

-  if (*(longlong *)(lVar6 + 0xa6c8) != unaff_RSI) {

-    lVar6 = W32GetUserSessionState();

-    ExFreePoolWithTag(*(undefined8 *)(lVar6 + 0xa6c8),0);

-    lVar6 = W32GetUserSessionState();

-    *(longlong *)(lVar6 + 0xa6c8) = unaff_RSI;

-  }

-  FreeWin32KSyscallFilter();

-  lVar6 = W32GetUserSessionState();

-  this_01 = *(CQoSReport **)(lVar6 + 0xa1f8);

-  if (this_01 != (CQoSReport *)0x0) {

-    CQoSReport::~CQoSReport(this_01);

-    GreDeleteFastMutex(this_01);

-  }

-  *(longlong *)(lVar6 + 0xa1f8) = unaff_RSI;

-  UninitializeWin32PoolTracking();

-  UninitializeWin32SiloGlobals();

-  p_Var3 = gpWin32kDriverObject;

-  if (gpWin32kDriverObject != (_DRIVER_OBJECT *)0x0) {

-    UninitializeBaseWppLog();

-    EditionUninitializeWppLogging(p_Var3);

-  }

-  lVar6 = W32GetSessionState();

-  FreePerSessionWin32kCall(lVar6 + 0x98);

-  lVar6 = W32GetSessionState();

-  FreeWin32kApiSetTable(lVar6 + 0x98);

-  CTempW32ThreadNonPaged::~CTempW32ThreadNonPaged((CTempW32ThreadNonPaged *)&stack0x00000040);

+                    /* 0x12ebf0  355

+                       ?SetForegroundPriority@ForegroundBoost@@YAXPEAUtagPROCESSINFO@@W4ForegroundPriorityClass@1@W4ForegroundBoostSource@1@@Z

+                        */

+  `anonymous_namespace'::_SetForegroundPriority();

   return;

 }
```

## `IOCPDispatcher::RegisterInputDispatcherObjects`  (modified)

```diff
--- IOCPDispatcher::RegisterInputDispatcherObjects
+++ IOCPDispatcher::RegisterInputDispatcherObjects
@@ -1,2 +1,63 @@
-Failed to decompile win32kbase.sys - .ProgramDB IOCPDispatcher::RegisterInputDispatcherObjects : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: virtual long __cdecl IOCPDispatcher::RegisterInputDispatcherObjects(void *

+   __ptr64,unsigned int,struct InputDispatcherObject * __ptr64) __ptr64 */

+

+long __thiscall

+IOCPDispatcher::RegisterInputDispatcherObjects

+          (IOCPDispatcher *this,void *param_1,uint param_2,InputDispatcherObject *param_3)

+

+{

+  InputDispatcherObject *pIVar1;

+  long lVar2;

+  int iVar3;

+  void *pvVar4;

+  ulonglong uVar5;

+  SensorIOCPWCP *this_00;

+  InputDispatcherObject *pIVar6;

+  int iVar7;

+  ulonglong uVar8;

+  

+                    /* 0x184350  325

+                       ?RegisterInputDispatcherObjects@IOCPDispatcher@@UEAAJPEAXIPEAUInputDispatcherObject@@@Z

+                        */

+  if (*(int *)(this + 0xa08) + param_2 < 0x40) {

+    uVar8 = 0;

+    if (param_2 != 0) {

+      pIVar6 = param_3 + 8;

+      do {

+        iVar7 = (int)uVar8;

+        uVar5 = (ulonglong)(uint)(*(int *)(this + 0xa08) + iVar7);

+        pvVar4 = SetupIOCPForDispatcherHandle

+                           (this,(void *)0x0,*(void **)pIVar6,0x80000000,

+                            *(int *)(this + 0xa08) + iVar7);

+        iVar3 = Feature_NoBugcheckForSetupIOCP__private_IsEnabledDeviceUsageNoInline();

+        if ((iVar3 != 0) && (pvVar4 == (void *)0x0)) {

+          if (iVar7 != 0) {

+            this_00 = (SensorIOCPWCP *)(this + 8);

+            do {

+              SensorIOCPWCP::Cleanup(this_00);

+              this_00 = this_00 + 0x28;

+              uVar8 = uVar8 - 1;

+            } while (uVar8 != 0);

+          }

+          return -0x3fffff66;

+        }

+        *(void **)(this + uVar5 * 0x28 + 0x18) = pvVar4;

+        uVar8 = (ulonglong)(iVar7 + 1U);

+        *(undefined8 *)(this + uVar5 * 0x28 + 0x10) = *(undefined8 *)(pIVar6 + -8);

+        *(undefined8 *)(this + uVar5 * 0x28 + 8) = *(undefined8 *)pIVar6;

+        pIVar1 = pIVar6 + 8;

+        pIVar6 = pIVar6 + 0x18;

+        *(undefined8 *)(this + uVar5 * 0x28 + 0x20) = *(undefined8 *)pIVar1;

+        *(void **)(this + uVar5 * 0x28 + 0x28) = param_1;

+      } while (iVar7 + 1U < param_2);

+    }

+    *(uint *)(this + 0xa08) = *(int *)(this + 0xa08) + param_2;

+    lVar2 = 0;

+  }

+  else {

+    lVar2 = -0x3ffffff3;

+  }

+  return lVar2;

+}

+
```

## `IOCPDispatcher::RegisterThreadDispatcherObject`  (modified)

```diff
--- IOCPDispatcher::RegisterThreadDispatcherObject
+++ IOCPDispatcher::RegisterThreadDispatcherObject
@@ -1,2 +1,28 @@
-Failed to decompile win32kbase.sys - .ProgramDB IOCPDispatcher::RegisterThreadDispatcherObject : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: long __cdecl IOCPDispatcher::RegisterThreadDispatcherObject(void * __ptr64) __ptr64 */

+

+long __thiscall IOCPDispatcher::RegisterThreadDispatcherObject(IOCPDispatcher *this,void *param_1)

+

+{

+  uint uVar1;

+  int iVar2;

+  long lVar3;

+  void *pvVar4;

+  

+                    /* 0x20b790  327  ?RegisterThreadDispatcherObject@IOCPDispatcher@@QEAAJPEAX@Z */

+  pvVar4 = SetupIOCPForDispatcherHandle(this,(void *)0x0,param_1,0x80000001,*(uint *)(this + 0xb50))

+  ;

+  iVar2 = Feature_NoBugcheckForSetupIOCP__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar2 == 0) || (pvVar4 != (void *)0x0)) {

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

+    *(void **)(this + (ulonglong)uVar1 * 0x20 + 0xa10) = param_1;

+    *(void **)(this + (ulonglong)uVar1 * 0x20 + 0xa18) = pvVar4;

+    *(int *)(this + 0xb50) = *(int *)(this + 0xb50) + 1;

+    lVar3 = 0;

+  }

+  else {

+    lVar3 = -0x3fffff66;

+  }

+  return lVar3;

+}

+
```

## `IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback`  (modified)

```diff
--- IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback
+++ IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback
@@ -1,2 +1,35 @@
-Failed to decompile win32kbase.sys - .ProgramDB IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: long __cdecl IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback(void *

+   __ptr64,void (__cdecl*)(void * __ptr64),void * __ptr64) __ptr64 */

+

+long __thiscall

+IOCPDispatcher::RegisterThreadDispatcherObjectWithCallback

+          (IOCPDispatcher *this,void *param_1,_func_void_void_ptr *param_2,void *param_3)

+

+{

+  int iVar1;

+  long lVar2;

+  void *pvVar3;

+  longlong lVar4;

+  

+                    /* 0x20b810  328

+                       ?RegisterThreadDispatcherObjectWithCallback@IOCPDispatcher@@QEAAJPEAXP6AX0@Z0@Z

+                        */

+  pvVar3 = SetupIOCPForDispatcherHandle(this,(void *)0x0,param_1,0x80000001,*(uint *)(this + 0xb50))

+  ;

+  iVar1 = Feature_NoBugcheckForSetupIOCP__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar1 == 0) || (pvVar3 != (void *)0x0)) {

+    lVar4 = (ulonglong)*(uint *)(this + 0xb50) * 0x20;

+    *(void **)(this + lVar4 + 0xa10) = param_1;

+    *(void **)(this + lVar4 + 0xa18) = pvVar3;

+    *(_func_void_void_ptr **)(this + lVar4 + 0xa20) = param_2;

+    *(void **)(this + lVar4 + 0xa28) = param_3;

+    *(int *)(this + 0xb50) = *(int *)(this + 0xb50) + 1;

+    lVar2 = 0;

+  }

+  else {

+    lVar2 = -0x3fffff66;

+  }

+  return lVar2;

+}

+
```

## `tagTERMINAL::SetDTEThread`  (modified)

```diff
--- tagTERMINAL::SetDTEThread
+++ tagTERMINAL::SetDTEThread
@@ -1,2 +1,15 @@
-Failed to decompile win32kbase.sys - .ProgramDB tagTERMINAL::SetDTEThread : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl tagTERMINAL::SetDTEThread(void) __ptr64 */

+

+void __thiscall tagTERMINAL::SetDTEThread(tagTERMINAL *this)

+

+{

+  undefined8 uVar1;

+  

+                    /* 0x15e6e0  351  ?SetDTEThread@tagTERMINAL@@QEAAXXZ */

+  uVar1 = **(undefined8 **)(this + 0x10);

+  *(uint *)this = *(uint *)this | 4;

+  *(undefined8 *)(this + 0x40) = uVar1;

+  return;

+}

+
```

## `CActivationObject::Destroy`  (modified)

```diff
--- CActivationObject::Destroy
+++ ReferenceDwmProcess
@@ -1,16 +1,21 @@
 

-/* public: static void __cdecl CActivationObject::Destroy(class CActivationObject * __ptr64) */

-

-void __cdecl CActivationObject::Destroy(CActivationObject *param_1)

+void ReferenceDwmProcess(_tlgProvider_t *param_1,void *param_2,_GUID *param_3,_GUID *param_4,

+                        undefined8 param_5,_tlgWrapperByVal<8> *param_6,_tlgWrapperByVal<4> *param_7

+                        )

 

 {

-                    /* 0x4f450  1031  DereferenceDwmApiPort

-                       0x4f450  1032  DereferenceDwmProcess

-                       0x4f450  2262  UserDereferenceDwmApiPort

-                       0x4f450  2263  UserDereferenceDwmProcess */

-  if (param_1 != (CActivationObject *)0x0) {

-    ObfDereferenceObject();

-  }

+  ulonglong in_RAX;

+  _tlgWrapperByVal<8> *p_Var1;

+  _GUID *p_Stack0000000000000068;

+  

+  p_Var1 = (_tlgWrapperByVal<8> *)(in_RAX & 0xffffffffffffff78);

+  *(int *)p_Var1 = *(int *)p_Var1 + (int)p_Var1;

+  *p_Var1 = (_tlgWrapperByVal<8>)((char)*p_Var1 + (char)p_Var1);

+  p_Stack0000000000000068 = param_3;

+  _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<8>,_tlgWrapperByVal<8>,_tlgWrapperByVal<4>_>

+            (param_1,param_2,param_3,param_4,(_tlgWrapperByVal<8> *)&stack0x00000048,p_Var1,param_6,

+             param_7);

   return;

 }
```

## `DirectComposition::CConnection::UpdateStats`  (modified)

```diff
--- DirectComposition::CConnection::UpdateStats
+++ DirectComposition::CConnection::UpdateStats
@@ -1,2 +1,187 @@
-Failed to decompile win32kbase.sys - .ProgramDB DirectComposition::CConnection::UpdateStats : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* private: void __cdecl DirectComposition::CConnection::UpdateStats(struct

+   tagCOMPOSITION_CONFIRM_FRAME_INFO * __ptr64) __ptr64 */

+

+void __thiscall

+DirectComposition::CConnection::UpdateStats

+          (CConnection *this,tagCOMPOSITION_CONFIRM_FRAME_INFO *param_1)

+

+{

+  undefined8 *puVar1;

+  longlong *plVar2;

+  undefined8 uVar3;

+  bool bVar4;

+  int iVar5;

+  CConnection *pCVar6;

+  CFrameStats *this_00;

+  longlong lVar7;

+  ulonglong uVar8;

+  uint uVar9;

+  ulonglong uVar10;

+  longlong lVar11;

+  uint uVar12;

+  CConnection CVar13;

+  ulonglong uVar14;

+  longlong *local_res8;

+  

+  uVar8 = 0;

+  uVar14 = 0;

+  ExAcquirePushLockExclusiveEx(this + 0x178,0);

+  CVar13 = (CConnection)0x1;

+  this[0x180] = (CConnection)0x1;

+  *(undefined8 *)(this + 0x198) = *(undefined8 *)param_1;

+  uVar9 = (uint)(*(ulonglong *)param_1 % 300);

+  *(uint *)(this + 0x188) = uVar9;

+  uVar12 = 299;

+  if ((uVar9 == 0) || (uVar14 = uVar8, uVar12 = uVar9 - 1, uVar9 - 1 != uVar9)) {

+    do {

+      this_00 = (CFrameStats *)(this + (ulonglong)uVar12 * 0x210 + 0x1a8);

+      bVar4 = CFrameStats::UpdateCompletedStats(this_00,param_1,this);

+      if (!bVar4) {

+        uVar14 = *(ulonglong *)(this_00 + 8);

+      }

+      if (*(ulonglong *)(this_00 + 8) <= *(ulonglong *)(this + 0x1a0)) break;

+      uVar9 = 299;

+      if (uVar12 != 0) {

+        uVar9 = uVar12 - 1;

+      }

+      uVar12 = uVar9;

+    } while (uVar12 != *(uint *)(this + 0x188));

+  }

+  uVar12 = *(uint *)(this + 0x188);

+  if ((this[(ulonglong)uVar12 * 0x210 + 0x1a9] == (CConnection)0x0) &&

+     (*(__uint64 *)(this + (ulonglong)uVar12 * 0x210 + 0x1b0) != 0)) {

+    DiscardFrame(this,*(__uint64 *)(this + (ulonglong)uVar12 * 0x210 + 0x1b0));

+  }

+  this[(ulonglong)uVar12 * 0x210 + 0x1a9] = (CConnection)0x0;

+  pCVar6 = *(CConnection **)(this + (ulonglong)uVar12 * 0x210 + 0x1d0);

+  if ((pCVar6 != (CConnection *)0x0) && (pCVar6 != this + (ulonglong)uVar12 * 0x210 + 0x1d8)) {

+    GreDeleteFastMutex();

+    *(longlong *)(this + (ulonglong)uVar12 * 0x210 + 0x1d0) = 0;

+  }

+  *(undefined8 *)(this + (ulonglong)uVar12 * 0x210 + 0x1b0) = *(undefined8 *)param_1;

+  uVar3 = *(undefined8 *)(param_1 + 0x10);

+  *(undefined8 *)(this + (ulonglong)uVar12 * 0x210 + 0x1b8) = *(undefined8 *)(param_1 + 8);

+  *(undefined8 *)(this + (ulonglong)uVar12 * 0x210 + 0x1c0) = uVar3;

+  *(undefined8 *)(this + (ulonglong)uVar12 * 0x210 + 0x1c8) = *(undefined8 *)(param_1 + 0x18);

+  uVar9 = *(uint *)(param_1 + 0x28);

+  *(uint *)(this + (ulonglong)uVar12 * 0x210 + 0x1ac) = uVar9;

+  if (uVar9 < 5) {

+    uVar10 = uVar8;

+    if (uVar9 != 0) {

+      do {

+        uVar9 = (int)uVar10 + 1;

+        lVar7 = uVar10 * 0x78;

+        lVar11 = *(longlong *)(param_1 + 0x30);

+        uVar3 = ((undefined8 *)(lVar7 + lVar11))[1];

+        *(undefined8 *)(this + lVar7 + 0x1d8 + (ulonglong)uVar12 * 0x210) =

+             *(undefined8 *)(lVar7 + lVar11);

+        *(undefined8 *)(this + lVar7 + 0x1d8 + (ulonglong)uVar12 * 0x210 + 8) = uVar3;

+        puVar1 = (undefined8 *)(lVar7 + 0x10 + lVar11);

+        uVar3 = puVar1[1];

+        *(undefined8 *)(this + lVar7 + 0x1e8 + (ulonglong)uVar12 * 0x210) = *puVar1;

+        *(undefined8 *)(this + lVar7 + 0x1e8 + (ulonglong)uVar12 * 0x210 + 8) = uVar3;

+        puVar1 = (undefined8 *)(lVar7 + 0x20 + lVar11);

+        uVar3 = puVar1[1];

+        *(undefined8 *)(this + lVar7 + 0x1f8 + (ulonglong)uVar12 * 0x210) = *puVar1;

+        *(undefined8 *)(this + lVar7 + 0x1f8 + (ulonglong)uVar12 * 0x210 + 8) = uVar3;

+        puVar1 = (undefined8 *)(lVar7 + 0x30 + lVar11);

+        uVar3 = puVar1[1];

+        *(undefined8 *)(this + lVar7 + 0x208 + (ulonglong)uVar12 * 0x210) = *puVar1;

+        *(undefined8 *)(this + lVar7 + 0x208 + (ulonglong)uVar12 * 0x210 + 8) = uVar3;

+        puVar1 = (undefined8 *)(lVar7 + 0x40 + lVar11);

+        uVar3 = puVar1[1];

+        *(undefined8 *)(this + lVar7 + 0x218 + (ulonglong)uVar12 * 0x210) = *puVar1;

+        *(undefined8 *)(this + lVar7 + 0x218 + (ulonglong)uVar12 * 0x210 + 8) = uVar3;

+        puVar1 = (undefined8 *)(lVar7 + 0x50 + lVar11);

+        uVar3 = puVar1[1];

+        *(undefined8 *)(this + lVar7 + 0x228 + (ulonglong)uVar12 * 0x210) = *puVar1;

+        *(undefined8 *)(this + lVar7 + 0x228 + (ulonglong)uVar12 * 0x210 + 8) = uVar3;

+        puVar1 = (undefined8 *)(lVar7 + 0x60 + lVar11);

+        uVar3 = puVar1[1];

+        *(undefined8 *)(this + lVar7 + 0x238 + (ulonglong)uVar12 * 0x210) = *puVar1;

+        *(undefined8 *)(this + lVar7 + 0x238 + (ulonglong)uVar12 * 0x210 + 8) = uVar3;

+        *(undefined8 *)(this + lVar7 + 0x248 + (ulonglong)uVar12 * 0x210) =

+             *(undefined8 *)(lVar7 + 0x70 + lVar11);

+        uVar10 = (ulonglong)uVar9;

+      } while (uVar9 < *(uint *)(this + (ulonglong)uVar12 * 0x210 + 0x1ac));

+    }

+    pCVar6 = this + (ulonglong)uVar12 * 0x210 + 0x1d8;

+  }

+  else {

+    pCVar6 = *(CConnection **)(param_1 + 0x30);

+  }

+  *(CConnection **)(this + (ulonglong)uVar12 * 0x210 + 0x1d0) = pCVar6;

+  uVar10 = uVar8;

+  if (*(int *)(this + (ulonglong)uVar12 * 0x210 + 0x1ac) != 0) {

+    do {

+      lVar7 = uVar10 * 0x78;

+      lVar11 = *(longlong *)(this + (ulonglong)uVar12 * 0x210 + 0x1d0);

+      if (((*(longlong *)(lVar7 + 0x28 + lVar11) == 0) ||

+          (uVar9 = *(uint *)(lVar7 + 0x38 + lVar11), uVar9 == 0)) ||

+         (*(uint *)(lVar7 + 0x58 + lVar11) < uVar9)) {

+        *(undefined4 *)(lVar7 + 0x58 + lVar11) = 0;

+        *(undefined4 *)(*(longlong *)(this + (ulonglong)uVar12 * 0x210 + 0x1d0) + 0x5c + lVar7) = 0;

+        *(undefined4 *)(*(longlong *)(this + (ulonglong)uVar12 * 0x210 + 0x1d0) + 0x60 + lVar7) = 0;

+        *(undefined8 *)(*(longlong *)(this + (ulonglong)uVar12 * 0x210 + 0x1d0) + 0x68 + lVar7) = 0;

+      }

+      else if ((int)uVar10 == 0) {

+        RetireFrame(this,*(__uint64 *)(this + (ulonglong)uVar12 * 0x210 + 0x1b0),

+                    (tagCOMPOSITION_STATS_2 *)(lVar11 + 0x58));

+        this[(ulonglong)uVar12 * 0x210 + 0x1a9] = (CConnection)0x1;

+      }

+      uVar9 = (int)uVar10 + 1;

+      uVar10 = (ulonglong)uVar9;

+    } while (uVar9 < *(uint *)(this + (ulonglong)uVar12 * 0x210 + 0x1ac));

+    if ((*(uint *)(this + (ulonglong)uVar12 * 0x210 + 0x1ac) != 0) &&

+       (*(longlong *)(*(longlong *)(this + (ulonglong)uVar12 * 0x210 + 0x1d0) + 0x28) != 0))

+    goto LAB_0;

+  }

+  plVar2 = *(longlong **)(this + 0xc0);

+  uVar3 = *(undefined8 *)(this + (ulonglong)uVar12 * 0x210 + 0x1b0);

+  local_res8 = (longlong *)0x0;

+  if ((plVar2 != (longlong *)0x0) &&

+     (iVar5 = (**(code **)(*plVar2 + 0x20))(plVar2,uVar3,&local_res8), -1 < iVar5)) {

+    (**(code **)(*local_res8 + 0x20))();

+    (**(code **)(*local_res8 + 8))();

+    (**(code **)(**(longlong **)(this + 0xc0) + 0x18))(*(longlong **)(this + 0xc0),uVar3);

+  }

+  this[(ulonglong)uVar12 * 0x210 + 0x1a9] = (CConnection)0x1;

+LAB_0:

+  do {

+    if (*(uint *)(this + (ulonglong)uVar12 * 0x210 + 0x1ac) <= (uint)uVar8) {

+LAB_1:

+      this[(ulonglong)uVar12 * 0x210 + 0x1a8] = CVar13;

+      if (uVar14 == 0) {

+        lVar11 = *(longlong *)(this + 0x198);

+        if (CVar13 == (CConnection)0x0) {

+          lVar11 = *(longlong *)(this + 0x198) + -1;

+        }

+      }

+      else {

+        lVar11 = uVar14 - 1;

+      }

+      *(longlong *)(this + 0x1a0) = lVar11;

+      if (*(longlong **)(this + 0xc0) != (longlong *)0x0) {

+        (**(code **)(**(longlong **)(this + 0xc0) + 0x28))();

+      }

+      if (this[0x180] == (CConnection)0x0) {

+        ExReleasePushLockSharedEx(this + 0x178,0);

+      }

+      else {

+        ExReleasePushLockExclusiveEx();

+      }

+      return;

+    }

+    lVar7 = uVar8 * 0x78;

+    lVar11 = *(longlong *)(this + (ulonglong)uVar12 * 0x210 + 0x1d0);

+    if (((*(longlong *)(lVar7 + 0x28 + lVar11) != 0) && (*(int *)(lVar7 + 0x38 + lVar11) != 0)) &&

+       (*(int *)(lVar7 + 0x58 + lVar11) == 0)) {

+      CVar13 = (CConnection)0x0;

+      goto LAB_1;

+    }

+    uVar8 = (ulonglong)((uint)uVar8 + 1);

+  } while( true );

+}

+
```

## `UserCritInternal::`anonymous_namespace'::IsValidGuiContext`  (modified)

```diff
--- UserCritInternal::`anonymous_namespace'::IsValidGuiContext
+++ UserProcessImmersiveType
@@ -1,22 +1,107 @@
 

-undefined8 UserCritInternal::`anonymous_namespace'::IsValidGuiContext(longlong param_1)

+/* long __cdecl UserProcessImmersiveType(struct _WIN32_PROCESS_CALLOUT_PARAMETERS * __ptr64,void *

+   __ptr64,enum _PROCESS_IMMERSIVE_TYPE * __ptr64,unsigned long * __ptr64,struct _PS_PKG_CLAIM *

+   __ptr64) */

+

+long __cdecl

+UserProcessImmersiveType

+          (_WIN32_PROCESS_CALLOUT_PARAMETERS *param_1,void *param_2,_PROCESS_IMMERSIVE_TYPE *param_3

+          ,ulong *param_4,_PS_PKG_CLAIM *param_5)

 

 {

-  uint uVar1;

-  longlong *plVar2;

+  ushort uVar1;

+  bool bVar2;

+  ushort uVar3;

+  uint uVar4;

+  uint uVar5;

+  int iVar6;

+  undefined8 uVar7;

+  longlong lVar8;

+  AppModelPolicy_Type AVar9;

+  byte bVar10;

+  bool bVar11;

+  char local_res18 [8];

+  char local_res20 [8];

+  uint local_60;

+  AppModelPolicy_PolicyValue local_5c;

+  longlong local_58;

+  ulonglong local_50;

+  __uint64 local_48;

+  undefined8 local_40 [3];

   

-  LOCK();

-  uVar1 = *(uint *)(param_1 + 0x210);

-  if (uVar1 == 0) {

-    *(uint *)(param_1 + 0x210) = 0;

-    uVar1 = 0;

+  bVar10 = 0;

+  local_res20[0] = '\0';

+  local_60 = 0;

+  local_5c = 0;

+  local_res18[0] = '\0';

+  bVar2 = false;

+  *param_3 = 0;

+  *param_4 = 0;

+  *(undefined8 *)param_5 = 0;

+  uVar4 = SeQueryInformationToken(param_2,0x20,param_4);

+  if (-1 < (int)uVar4) {

+    AVar9 = 0x19;

+    uVar4 = SeQueryInformationToken(param_2,0x19,&local_60);

+    if (-1 < (int)uVar4) {

+      local_48 = 0;

+      local_40[0] = 0;

+      uVar5 = AppModelPolicy_GetPolicy_Internal

+                        (param_2,AVar9,&local_5c,(_PS_PKG_CLAIM *)local_40,&local_48);

+      uVar4 = 0;

+      if ((uVar5 & 0xffff) != 0) {

+        uVar4 = uVar5 & 0xffff | 0xc0070000;

+      }

+      if (-1 < (int)uVar4) {

+        PsQueryProcessAttributesByToken(param_2,0,local_res18);

+        if (local_res18[0] != '\0') {

+          bVar2 = false;

+          iVar6 = RtlQueryPackageClaims(param_2,0,0,0,0,0,param_5,0);

+          if (iVar6 < 0) {

+            return iVar6;

+          }

+          bVar10 = (byte)(*(uint *)param_5 >> 0xb) & 1;

+          if ((*(uint *)param_5 >> 9 & 1) != 0) {

+            bVar2 = true;

+          }

+        }

+        PsQueryProcessAttributesByToken(param_2,local_res20,0);

+        bVar11 = local_res20[0] != '\0';

+        if ((*(uint *)(param_1 + 0x18) & 2) != 0) {

+          uVar7 = PsGetProcessSectionBaseAddress(*(undefined8 *)(param_1 + 0x10));

+          local_58 = RtlImageNtHeader(uVar7);

+          if (local_58 == 0) {

+            return -0x3fffffff;

+          }

+          local_50 = (ulonglong)*(ushort *)(local_58 + 0x14) + local_58 + 0x18;

+          uVar1 = *(ushort *)(local_58 + 6);

+          for (uVar3 = 0; uVar3 < uVar1; uVar3 = uVar3 + 1) {

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

+                    /* WARNING: Subroutine does not return */

+              ExRaiseDatatypeMisalignment();

+            }

+            lVar8 = RtlCompareMemory(local_50,".imrsiv",8);

+            if (lVar8 == 8) {

+              if (*param_4 != 0) {

+                *param_3 = 1;

+                return 0;

+              }

+              if (local_60 < 0x2000) {

+                return -0x3fffffff;

+              }

+              *param_3 = 2;

+              return 0;

+            }

+            local_50 = local_50 + 0x28;

+          }

+        }

+        if (((bVar11) && (((bVar10 != 0 || (*param_4 != 0)) && (local_5c != 0x30000)))) && (!bVar2))

+        {

+          *param_3 = 1;

+        }

+        uVar4 = 0;

+      }

+    }

   }

-  UNLOCK();

-  if (((((uVar1 >> 0x18 & 1) != 0) && (-1 < *(char *)(param_1 + 0x550))) &&

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

-     ((*plVar2 != 0 && ((char)plVar2[0x95] == '\x01')))) {

-    return 1;

-  }

-  return 0;

+  return uVar4;

 }
```

## `CLastWokenThread::DeBoostIfTime`  (modified)

```diff
--- CLastWokenThread::DeBoostIfTime
+++ CLastWokenThread::DeBoostIfTime
@@ -1,2 +1,19 @@
-Failed to decompile win32kbase.sys - .ProgramDB CLastWokenThread::DeBoostIfTime : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* public: void __cdecl CLastWokenThread::DeBoostIfTime(__int64) __ptr64 */

+

+void __thiscall CLastWokenThread::DeBoostIfTime(CLastWokenThread *this,__int64 param_1)

+

+{

+  KeEnterCriticalRegion();

+  ExAcquirePushLockExclusiveEx(this,0);

+  if ((this[0x11] != (CLastWokenThread)0x0) && (*(longlong *)(this + 0x18) < param_1)) {

+    ForegroundBoost::`anonymous_namespace'::_SetForegroundPriority

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

+    *(undefined8 *)(this + 0x18) = 0;

+    this[0x11] = (CLastWokenThread)0x0;

+  }

+  ExReleasePushLockExclusiveEx(this,0);

+  KeLeaveCriticalRegion();

+  return;

+}

+
```

## `CInertiaManager::PostInertiaMessage`  (modified)

```diff
--- CInertiaManager::PostInertiaMessage
+++ CInertiaManager::PostInertiaMessage
@@ -1,2 +1,217 @@
-Failed to decompile win32kbase.sys - .ProgramDB CInertiaManager::PostInertiaMessage : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* public: bool __cdecl CInertiaManager::PostInertiaMessage(unsigned int,struct

+   INERTIA_INFO_INTERNAL const * __ptr64,struct tagPOINT,struct tagPOINT)const __ptr64 */

+

+bool __thiscall

+CInertiaManager::PostInertiaMessage

+          (CInertiaManager *this,uint param_1,INERTIA_INFO_INTERNAL *param_2,tagPOINT param_3,

+          tagPOINT param_4)

+

+{

+  int iVar1;

+  longlong lVar2;

+  CInertiaManager *this_00;

+  CInputDest *this_01;

+  ulonglong uVar3;

+  char cVar4;

+  bool bVar5;

+  bool bVar6;

+  undefined1 auStackY_198 [32];

+  uint local_138;

+  undefined4 uStack_134;

+  undefined8 uStack_130;

+  undefined8 local_128;

+  undefined8 uStack_120;

+  undefined4 local_118;

+  undefined4 uStack_114;

+  undefined4 uStack_110;

+  undefined4 uStack_10c;

+  undefined4 local_108;

+  undefined4 uStack_104;

+  undefined4 uStack_100;

+  undefined4 uStack_fc;

+  undefined4 local_f8;

+  undefined4 uStack_f4;

+  undefined4 uStack_f0;

+  undefined4 uStack_ec;

+  undefined4 local_e8;

+  undefined4 uStack_e4;

+  undefined4 uStack_e0;

+  undefined4 uStack_dc;

+  undefined4 local_d8;

+  undefined4 uStack_d4;

+  undefined4 uStack_d0;

+  undefined4 uStack_cc;

+  undefined8 local_b8;

+  undefined8 uStack_b0;

+  undefined8 local_a8;

+  undefined8 uStack_a0;

+  undefined4 local_98;

+  undefined4 uStack_94;

+  undefined4 uStack_90;

+  undefined4 uStack_8c;

+  undefined4 local_88;

+  undefined4 uStack_84;

+  undefined4 uStack_80;

+  undefined4 uStack_7c;

+  undefined4 local_78;

+  undefined4 uStack_74;

+  undefined4 uStack_70;

+  undefined4 uStack_6c;

+  undefined4 local_68;

+  undefined4 uStack_64;

+  undefined4 uStack_60;

+  undefined4 uStack_5c;

+  undefined4 local_58;

+  undefined4 uStack_54;

+  undefined4 uStack_50;

+  undefined4 uStack_4c;

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStackY_198;

+  bVar6 = true;

+  if (1 < param_1 - 0x23b) {

+    return false;

+  }

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

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 2) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)) {

+    cVar4 = '\0';

+  }

+  else {

+    cVar4 = '\x01';

+  }

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

+  if ((cVar4 != '\0') || (bVar5)) {

+    lVar2 = W32GetUserSessionState();

+    WPP_RECORDER_AND_TRACE_SF_s

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar4,bVar5,

+               *(undefined8 *)(lVar2 + 0x10f78));

+  }

+  this_00 = (CInertiaManager *)(ulonglong)param_1;

+  InputTraceLogging::Inertia::PostInertiaMessage(param_1,param_2,param_3);

+  if ((*(uint *)(param_2 + 0xb8) & 0x10) != 0) {

+    RouteSyntheticTouchpadToMT(this_00,param_1,param_3,param_4,*(__uint64 *)(param_2 + 8));

+    return true;

+  }

+  this_01 = (CInputDest *)&local_138;

+  CInputDest::CInputDest

+            (this_01,*(HWND__ **)(param_2 + 0x78),2 - ((*(uint *)(param_2 + 0xb8) & 0x40) != 0),1);

+  bVar5 = ValidateInertiaDest((CInertiaManager *)this_01,(CInputDest *)&local_138);

+  if (bVar5) {

+    uVar3 = (ulonglong)*(uint *)(param_2 + 0xb8);

+    iVar1 = -(uint)((*(uint *)(param_2 + 0xb8) >> 1 & 1) != 0);

+    if ((iVar1 == 0) || (bVar5 = CInputDest::HasDelegationThread((CInputDest *)&local_138), bVar5))

+    {

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

+        local_118 = *(undefined4 *)(param_2 + 0x80);

+        uStack_114 = *(undefined4 *)(param_2 + 0x84);

+        uStack_110 = *(undefined4 *)(param_2 + 0x88);

+        uStack_10c = *(undefined4 *)(param_2 + 0x8c);

+        uStack_120 = 0;

+        local_108 = *(undefined4 *)(param_2 + 0x90);

+        uStack_104 = *(undefined4 *)(param_2 + 0x94);

+        uStack_100 = *(undefined4 *)(param_2 + 0x98);

+        uStack_fc = *(undefined4 *)(param_2 + 0x9c);

+        local_138 = local_138 | 2;

+        local_f8 = *(undefined4 *)(param_2 + 0xa0);

+        uStack_f4 = *(undefined4 *)(param_2 + 0xa4);

+        uStack_f0 = *(undefined4 *)(param_2 + 0xa8);

+        uStack_ec = *(undefined4 *)(param_2 + 0xac);

+      }

+      local_b8 = CONCAT44(uStack_134,local_138);

+      uStack_b0 = uStack_130;

+      local_a8 = local_128;

+      uStack_a0 = uStack_120;

+      local_68 = local_e8;

+      uStack_64 = uStack_e4;

+      uStack_60 = uStack_e0;

+      uStack_5c = uStack_dc;

+      local_58 = local_d8;

+      uStack_54 = uStack_d4;

+      uStack_50 = uStack_d0;

+      uStack_4c = uStack_cc;

+      local_98 = local_118;

+      uStack_94 = uStack_114;

+      uStack_90 = uStack_110;

+      uStack_8c = uStack_10c;

+      local_88 = local_108;

+      uStack_84 = uStack_104;

+      uStack_80 = uStack_100;

+      uStack_7c = uStack_fc;

+      local_78 = local_f8;

+      uStack_74 = uStack_f4;

+      uStack_70 = uStack_f0;

+      uStack_6c = uStack_ec;

+      if (iVar1 != 0) {

+        CInputDest::GetDelegateThreadInfo((CInputDest *)&local_138);

+        iVar1 = ApiSetEditionPostInertiaMessage

+                          (&local_b8,param_1,*(undefined8 *)(param_2 + 8),

+                           ((ulonglong)param_3 >> 0x20 & 0xffff) << 0x10 |

+                           (ulonglong)param_3 & 0xffff);

+        if (iVar1 == 0) {

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

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

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

+            bVar6 = false;

+          }

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

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

+            lVar2 = W32GetUserSessionState();

+            WPP_RECORDER_AND_TRACE_SF_

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

+                       *(undefined8 *)(lVar2 + 0x10f78));

+          }

+        }

+        CInputDest::~CInputDest((CInputDest *)&local_138);

+        return iVar1 != 0;

+      }

+      iVar1 = ApiSetEditionPostInertiaMessage

+                        (&local_b8,param_1,*(undefined8 *)(param_2 + 8),(~(uint)uVar3 & 0x20) >> 5);

+      if (iVar1 == 0) {

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

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

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

+          cVar4 = '\0';

+        }

+        else {

+          cVar4 = '\x01';

+        }

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

+        if ((cVar4 != '\0') || (bVar6)) {

+          lVar2 = W32GetUserSessionState();

+          WPP_RECORDER_AND_TRACE_SF_

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

+                     *(undefined8 *)(lVar2 + 0x10f78));

+        }

+      }

+      CInputDest::~CInputDest((CInputDest *)&local_138);

+      return true;

+    }

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

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

+    {

+      bVar6 = false;

+    }

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

+    if ((!bVar6) && (!bVar5)) goto LAB_0;

+    lVar2 = W32GetUserSessionState();

+  }

+  else {

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

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

+    {

+      bVar6 = false;

+    }

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

+    if ((bVar6 == false) && (!bVar5)) goto LAB_0;

+    lVar2 = W32GetUserSessionState();

+  }

+  WPP_RECORDER_AND_TRACE_SF_

+            (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),bVar6,bVar5,*(undefined8 *)(lVar2 + 0x10f78)

+            );

+LAB_0:

+  CInputDest::~CInputDest((CInputDest *)&local_138);

+  return false;

+}

+
```

## `ForegroundBoost::LogProcessInformation`  (modified)

```diff
--- ForegroundBoost::LogProcessInformation
+++ ForegroundBoost::LogProcessInformation
@@ -1,18 +1,97 @@
 

-void __cdecl <lambda_0e67b526681aa6a0208369450a9126fb>::LogProcessInformation(void)

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

+/* void __cdecl ForegroundBoost::LogProcessInformation(void) */

+

+void __cdecl ForegroundBoost::LogProcessInformation(void)

 

 {

-  int iVar1;

-  undefined8 *unaff_RBX;

-  undefined8 unaff_RBP;

-  undefined4 uStack00000000000000a0;

+  undefined8 uVar1;

+  char cVar2;

+  char cVar3;

+  int iVar4;

+  int iVar5;

+  _PS_PROCESS_WINDOW_STATE _Var6;

+  tagPROCESSINFO *this;

+  longlong lVar7;

+  undefined4 uVar8;

+  undefined1 auStack_c8 [32];

+  longlong *local_a8;

+  undefined1 *local_a0;

+  undefined1 local_98 [4];

+  undefined4 local_94;

+  undefined4 local_90 [2];

+  longlong local_88;

+  undefined8 local_80;

+  undefined1 local_78 [32];

+  undefined4 *local_58;

+  undefined4 local_50;

+  undefined4 local_4c;

+  undefined4 *local_48;

+  undefined4 local_40;

+  undefined4 local_3c;

+  undefined1 *local_38;

+  undefined4 local_30;

+  undefined4 local_2c;

+  ulonglong local_28;

   

-  *unaff_RBX = unaff_RBP;

-  iVar1 = ZwPowerInformation((int)unaff_RBP + 0x57);

-  if (iVar1 < 0) {

-    uStack00000000000000a0 = 0x20000;

-    MicrosoftTelemetryAssertTriggeredArgsKM("IXPTelAssert",0x20000,0x298);

+  local_28 = __security_cookie ^ (ulonglong)auStack_c8;

+  iVar4 = W32GetCurrentWin32kSessionId();

+  iVar5 = IsServiceSession(iVar4);

+  if (iVar5 == 0) {

+    cVar2 = `anonymous_namespace'::IsBoostAllowed();

+    lVar7 = 0;

+    while( true ) {

+      local_88 = 0;

+      local_a8 = &local_88;

+      iVar5 = ZwGetNextProcess(lVar7,0x400,0x200,0);

+      if (lVar7 != 0) {

+        ZwClose(lVar7);

+      }

+      lVar7 = local_88;

+      if (iVar5 < 0) break;

+      local_a0 = (undefined1 *)0x0;

+      local_80 = 0;

+      local_a8 = &local_80;

+      iVar5 = ObReferenceObjectByHandle(local_88,0x400,*(undefined8 *)PsProcessType_exref);

+      uVar1 = local_80;

+      if (-1 < iVar5) {

+        iVar5 = PsGetProcessSessionIdEx(local_80);

+        if (iVar4 == iVar5) {

+          this = (tagPROCESSINFO *)PsGetProcessWin32Process(uVar1);

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

+            if ((cVar2 == '\0') || ((*(ulonglong *)(this + 800) & 0xffffffffc0000000) == 0)) {

+              uVar8 = 0;

+            }

+            else {

+              uVar8 = 1;

+            }

+            if (5 < DAT_0) {

+              cVar3 = _tlgKeywordOn(&DAT_0);

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

+                _Var6 = tagPROCESSINFO::GetPsProcessWindowState(this,0);

+                local_2c = 0;

+                local_3c = 0;

+                local_4c = 0;

+                local_98[0] = (undefined1)_Var6;

+                local_90[0] = *(undefined4 *)(this + 0x38);

+                local_38 = local_98;

+                local_48 = &local_94;

+                local_58 = local_90;

+                local_a0 = local_78;

+                local_a8 = (longlong *)CONCAT44(local_a8._4_4_,5);

+                local_30 = 1;

+                local_40 = 4;

+                local_50 = 4;

+                local_94 = uVar8;

+                _tlgWriteTransfer_EtwWriteTransfer(&DAT_0,&DAT_140275393,0);

+              }

+            }

+          }

+        }

+        ObfDereferenceObject(uVar1);

+      }

+    }

   }

   return;

 }
```

## `tagTERMINAL::ClearDTEThread`  (modified)

```diff
--- tagTERMINAL::ClearDTEThread
+++ xxxInitProcessInfo
@@ -1,12 +1,326 @@
 

-/* public: void __cdecl tagTERMINAL::ClearDTEThread(void) __ptr64 */

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

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

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

 

-void __thiscall tagTERMINAL::ClearDTEThread(tagTERMINAL *this)

+int xxxInitProcessInfo(_W32PROCESS *param_1,void *param_2,_PROCESS_IMMERSIVE_TYPE param_3,

+                      ulong param_4,_PS_PKG_CLAIM *param_5)

 

 {

-                    /* 0x15e6d0  72  ?ClearDTEThread@tagTERMINAL@@QEAAXXZ */

-  *(undefined8 *)(this + 0x40) = 0;

-  *(uint *)this = *(uint *)this | 0x20;

-  return;

+  undefined4 uVar1;

+  undefined4 uVar2;

+  undefined4 uVar3;

+  undefined4 uVar4;

+  undefined8 uVar5;

+  code *pcVar6;

+  ulonglong uVar7;

+  undefined1 auVar8 [16];

+  byte bVar9;

+  long lVar10;

+  int iVar11;

+  int iVar12;

+  ulong uVar13;

+  longlong lVar14;

+  ulonglong uVar15;

+  ulonglong uVar16;

+  char cVar17;

+  int iVar18;

+  bool bVar19;

+  undefined1 auStack_f8 [32];

+  undefined1 local_d8;

+  undefined4 local_d0;

+  undefined2 local_c8;

+  undefined *local_c0;

+  undefined8 local_b8;

+  undefined4 local_b0;

+  undefined4 local_a8;

+  undefined4 local_a0;

+  CWinEventNoopDeferral local_98;

+  char local_97;

+  AtomicExecutionCheck local_90 [8];

+  longlong local_88;

+  int local_80;

+  undefined4 local_7c;

+  longlong *local_78;

+  _PROCESS_IMMERSIVE_TYPE local_70;

+  void *local_68;

+  _PS_PKG_CLAIM *local_60;

+  int local_58;

+  ulong uStack_54;

+  undefined4 local_50;

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStack_f8;

+  local_60 = param_5;

+  local_58 = 0;

+  uStack_54 = 0;

+  local_50 = 0;

+  iVar18 = 1;

+  local_80 = 0;

+  local_78 = (longlong *)0x0;

+  local_7c = 0;

+  cVar17 = '\x01';

+  if (param_1[0x4a8] == (_W32PROCESS)0x1) {

+    return 0x4000001b;

+  }

+  local_70 = param_3;

+  local_68 = param_2;

+  if (Microsoft_Windows_Win32kEnableBits._1_1_ < '\0') {

+    McTemplateK0_EtwWriteTransfer(param_1,&InitiateGuiProcessExecution,&W32kControlGuid);

+  }

+  lVar10 = xxxCheckProcessAndSessionState(param_1);

+  if (lVar10 < 0) {

+    return lVar10;

+  }

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

+  local_88 = 0;

+  AtomicExecutionCheck::Arm(local_90);

+  param_1[0x4a8] = (_W32PROCESS)0x1;

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

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

+  *(undefined4 *)(param_1 + 0x2a4) = 3;

+  *(undefined4 *)(param_1 + 0x2a8) = 3;

+  *(undefined4 *)(param_1 + 0x140) = 0;

+  iVar11 = Feature_UIPIModernization__private_IsEnabledDeviceUsageNoInline();

+  if (iVar11 == 0) {

+    uStack_54 = param_4;

+    iVar11 = SeQueryInformationToken(param_2,0x19,&local_58);

+    if (iVar11 < 0) {

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

+          (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

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

+        iVar18 = 0;

+      }

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

+      if (((char)iVar18 != '\0') || (bVar19)) {

+        uVar4 = *(undefined4 *)(param_1 + 0x38);

+        lVar14 = W32GetUserSessionState();

+        local_b8 = CONCAT44(local_b8._4_4_,iVar11);

+        local_c0 = &WPP_b06217f02fa23d0547d0463ee5a41ed3_Traceguids;

+        local_c8 = 0x1c;

+        local_d0 = 8;

+        local_d8 = 3;

+        local_b0 = uVar4;

+        WPP_RECORDER_AND_TRACE_SF_dD

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)iVar18,bVar19,

+                   *(undefined8 *)(lVar14 + 0x10f78));

+      }

+      if (local_90[0] == (AtomicExecutionCheck)0x0) {

+        return iVar11;

+      }

+      *(int *)(local_88 + 0x1c) = *(int *)(local_88 + 0x1c) + -1;

+      return iVar11;

+    }

+    if ((uStack_54 != 0) && (local_58 != 0x1000)) {

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

+         ((-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c) ||

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

+        iVar18 = 0;

+      }

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

+      if (((char)iVar18 != '\0') || (bVar19)) {

+        uVar4 = *(undefined4 *)(param_1 + 0x38);

+        lVar14 = W32GetUserSessionState();

+        local_b8 = CONCAT44(local_b8._4_4_,uVar4);

+        local_c0 = &WPP_b06217f02fa23d0547d0463ee5a41ed3_Traceguids;

+        local_c8 = 0x1d;

+        local_d0 = 8;

+        local_d8 = 3;

+        WPP_RECORDER_AND_TRACE_SF_D

+                  (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)iVar18,bVar19,

+                   *(undefined8 *)(lVar14 + 0x10f78));

+      }

+      if (local_90[0] != (AtomicExecutionCheck)0x0) {

+        *(int *)(local_88 + 0x1c) = *(int *)(local_88 + 0x1c) + -1;

+      }

+      return -0x3fffffff;

+    }

+    *(ulong *)(param_1 + 0x35c) = uStack_54;

+    *(int *)(param_1 + 0x358) = local_58;

+    iVar11 = PsIsProtectedProcess(*(undefined8 *)param_1);

+    if (iVar11 != 0) {

+      bVar9 = PsGetProcessProtection(*(undefined8 *)param_1);

+      *(uint *)(param_1 + 0x360) =

+           ((bVar9 >> 3 & 1 | (bVar9 & 7) << 8) << 8 | (uint)(bVar9 >> 4)) << 8;

+    }

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

+        (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

+       (local_97 = cVar17, (byte)WPP_GLOBAL_Control[0x29] < 4)) {

+      local_97 = '\0';

+    }

+    local_98 = (CWinEventNoopDeferral)

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

+    if ((local_97 != '\0') || ((bool)local_98)) {

+      uVar4 = *(undefined4 *)(param_1 + 0x360);

+      uVar1 = *(undefined4 *)(param_1 + 0x35c);

+      uVar2 = *(undefined4 *)(param_1 + 0x358);

+      uVar3 = *(undefined4 *)(param_1 + 0x38);

+      lVar14 = W32GetUserSessionState();

+      local_b8 = CONCAT44(local_b8._4_4_,uVar3);

+      local_c0 = &WPP_b06217f02fa23d0547d0463ee5a41ed3_Traceguids;

+      local_c8 = 0x1e;

+      local_d0 = 8;

+      local_b0 = uVar2;

+      local_a8 = uVar1;

+      local_a0 = uVar4;

+      WPP_RECORDER_AND_TRACE_SF_DDDD

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),local_97,local_98,

+                 *(undefined8 *)(lVar14 + 0x10f78));

+      param_2 = local_68;

+    }

+  }

+  else {

+    lVar10 = InitProcessUipiInfo((tagPROCESSINFO *)param_1,param_2,param_4);

+    if (lVar10 < 0) {

+      if (local_90[0] == (AtomicExecutionCheck)0x0) {

+        return lVar10;

+      }

+      *(int *)(local_88 + 0x1c) = *(int *)(local_88 + 0x1c) + -1;

+      return lVar10;

+    }

+  }

+  iVar11 = SeQueryInformationToken(param_2,0x1a,&local_80);

+  if (local_80 != 0) {

+    *(uint *)(param_1 + 0xc) = *(uint *)(param_1 + 0xc) | 0x80080000;

+    *(ulonglong *)(param_1 + 800) = *(ulonglong *)(param_1 + 800) | 2;

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

+        (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

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

+      cVar17 = '\0';

+    }

+    local_98 = (CWinEventNoopDeferral)

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

+    if ((cVar17 != '\0') || (param_2 = local_68, (bool)local_98)) {

+      uVar4 = *(undefined4 *)(param_1 + 0x38);

+      uVar5 = *(undefined8 *)param_1;

+      lVar14 = W32GetUserSessionState();

+      local_c0 = &WPP_b06217f02fa23d0547d0463ee5a41ed3_Traceguids;

+      local_c8 = 0x1f;

+      local_d0 = 8;

+      local_b8 = uVar5;

+      local_b0 = uVar4;

+      WPP_RECORDER_AND_TRACE_SF_qD

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar17,local_98,

+                 *(undefined8 *)(lVar14 + 0x10f78));

+      param_2 = local_68;

+    }

+  }

+  SetProcessType((tagPROCESSINFO *)param_1,param_2,local_70,local_60);

+  SetProcessInitialCapabilities((tagPROCESSINFO *)param_1);

+  if (-1 < iVar11) {

+    iVar11 = SeQueryInformationToken(param_2,0x1f,&local_78);

+    uVar16 = 0;

+    if (-1 < iVar11) {

+      if ((*local_78 == 0) || (iVar12 = RtlGetAppContainerSidType(*local_78,&local_7c), iVar12 < 0))

+      {

+        *(undefined4 *)(param_1 + 0x364) = 0;

+      }

+      else {

+        *(undefined4 *)(param_1 + 0x364) = local_7c;

+      }

+      ExFreePoolWithTag(local_78,0);

+      local_78 = (longlong *)0x0;

+      uVar13 = GetSpriteFillColorOverrideForCurrentProcess();

+      *(ulong *)(param_1 + 0x42c) = uVar13;

+      lVar14 = PsGetProcessWow64Process(*(undefined8 *)param_1);

+      if (lVar14 != 0) {

+        *(uint *)(param_1 + 0xc) = *(uint *)(param_1 + 0xc) | 0x80;

+      }

+      *(undefined8 *)(param_1 + 0x370) = 0xffffffffffffffff;

+      *(undefined8 *)(param_1 + 0x378) = 0xffffffffffffffff;

+      if ((*(uint *)(param_1 + 0xc) & 0x20) == 0) {

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

+        lVar14 = W32GetUserSessionState();

+        *(uint *)(lVar14 + 0x10650) = *(uint *)(lVar14 + 0x10650) | 0x8000000;

+        iVar12 = Feature_StartGlassModern__private_IsEnabledDeviceUsageNoInline();

+        *(uint *)(param_1 + 0xc) = *(uint *)(param_1 + 0xc) | 2;

+        if ((iVar12 == 0) && (iVar12 = IszzzCalcStartCursorHideSupported(), -1 < iVar12)) {

+          CWinEventNoopDeferral::CWinEventNoopDeferral(&local_98);

+          zzzCalcStartCursorHide(0,0);

+          CWinEventNoopDeferral::~CWinEventNoopDeferral(&local_98);

+        }

+      }

+      lVar14 = W32GetUserSessionState();

+      *(undefined8 *)(param_1 + 0x170) = *(undefined8 *)(lVar14 + 0x8ea8);

+      lVar14 = W32GetUserSessionState();

+      *(_W32PROCESS **)(lVar14 + 0x8ea8) = param_1;

+      lVar14 = W32GetWin32kBaseApiSetTable();

+      pcVar6 = *(code **)(*(longlong *)(lVar14 + 0x30) + 0x1448);

+      if (pcVar6 != (code *)0x0) {

+        (*pcVar6)(param_1);

+      }

+      GetProcessLuid(0,param_1 + 0x2f8);

+      lVar14 = W32GetUserSessionState();

+      *(undefined4 *)(param_1 + 0x188) = *(undefined4 *)(lVar14 + 0xa204);

+      *(undefined4 *)(param_1 + 0x2f0) = 0;

+      CitProcessCallout(param_1,1);

+      uVar7 = *(ulonglong *)(param_1 + 800);

+      uVar15 = uVar7 & 0xffffffffffbe7fff;

+      *(undefined4 *)(param_1 + 0x10c) = 0x6010;

+      *(ulonglong *)(param_1 + 800) = uVar15;

+      *(undefined2 *)(param_1 + 0x110) = 0x60;

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

+        *(ulonglong *)(param_1 + 800) = uVar15 | 0x100000;

+      }

+      iVar12 = PsGetWin32KFilterSet();

+      if (iVar12 == 5) {

+        uVar16 = 0x1000000;

+      }

+      *(ulonglong *)(param_1 + 800) = uVar16 | *(ulonglong *)(param_1 + 800) & 0xfffffffff6ffffff;

+      lVar14 = W32GetUserSessionState();

+      if (*(short *)(*(longlong *)(lVar14 + 0x4e30) + 0x1b56) != 0) {

+        lVar14 = W32GetWin32kBaseApiSetTable();

+        pcVar6 = *(code **)(*(longlong *)(lVar14 + 0x30) + 1000);

+        if ((pcVar6 == (code *)0x0) || (iVar12 = (*pcVar6)(), iVar12 < 0)) {

+          lVar14 = W32GetUserSessionState();

+          *(undefined2 *)(param_1 + 0x110) =

+               *(undefined2 *)(*(longlong *)(lVar14 + 0x4e30) + 0x1b56);

+        }

+        else {

+          lVar14 = W32GetWin32kBaseApiSetTable();

+          pcVar6 = *(code **)(*(longlong *)(lVar14 + 0x30) + 0x3f0);

+          if (pcVar6 != (code *)0x0) {

+            (*pcVar6)(param_1);

+          }

+        }

+      }

+      Feature_WebThreatDefenseToggle__private_IsEnabledPreCheck();

+      lVar14 = W32GetUserSessionState();

+      iVar12 = 0;

+      if ((*(int *)(lVar14 + 0xa6d8) != 0) &&

+         (lVar14 = W32GetInputMonitorSessionState(), iVar12 = iVar18, lVar14 == 0)) {

+        MicrosoftTelemetryAssertTriggeredNoArgsKM();

+      }

+      *(uint *)(param_1 + 0x114) = iVar12 * 4 | *(uint *)(param_1 + 0x114) & 0xfffffffb;

+      auVar8._8_8_ = 0;

+      auVar8._0_8_ = _DAT_0 << 8;

+      *(longlong *)(param_1 + 0x438) = SUB168(auVar8 * (ZEXT416(_DAT_1) << 0x20),8);

+      goto LAB_2;

+    }

+  }

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

+      (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

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

+    iVar18 = 0;

+  }

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

+  if (((char)iVar18 != '\0') || (bVar19)) {

+    uVar4 = *(undefined4 *)(param_1 + 0x38);

+    lVar14 = W32GetUserSessionState();

+    local_b8 = CONCAT44(local_b8._4_4_,iVar11);

+    local_c0 = &WPP_b06217f02fa23d0547d0463ee5a41ed3_Traceguids;

+    local_c8 = 0x20;

+    local_d0 = 8;

+    local_d8 = 3;

+    local_b0 = uVar4;

+    WPP_RECORDER_AND_TRACE_SF_dD

+              (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(char)iVar18,bVar19,

+               *(undefined8 *)(lVar14 + 0x10f78));

+  }

+LAB_2:

+  if (local_90[0] != (AtomicExecutionCheck)0x0) {

+    *(int *)(local_88 + 0x1c) = *(int *)(local_88 + 0x1c) + -1;

+  }

+  return iVar11;

 }
```

## `ForegroundBoost::OnProcessDestroyed`  (modified)

```diff
--- ForegroundBoost::OnProcessDestroyed
+++ ForegroundBoost::OnProcessDestroyed
@@ -1,11 +1,32 @@
 

-void __cdecl <lambda_0e67b526681aa6a0208369450a9126fb>::OnProcessDestroyed(tagPROCESSINFO *param_1)

+/* void __cdecl ForegroundBoost::OnProcessDestroyed(struct tagPROCESSINFO * __ptr64) */

+

+void __cdecl ForegroundBoost::OnProcessDestroyed(tagPROCESSINFO *param_1)

 

 {

-  code *pcVar1;

+  tagPROCESSINFO *ptVar1;

+  char cVar2;

+  longlong lVar3;

+  longlong lVar4;

+  tagPROCESSINFO *ptVar5;

   

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

-  (*pcVar1)();

+  lVar3 = W32GetUserSessionState();

+  W32AcquirePushLockExclusiveEx((W32_PUSH_LOCK *)(lVar3 + 0x4a30),0);

+  cVar2 = `anonymous_namespace'::IsProcessBackground(param_1);

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

+    *(ulonglong *)(param_1 + 800) = *(ulonglong *)(param_1 + 800) & 0xffffffc03fffffff;

+    lVar4 = W32GetUserSessionState();

+    ptVar5 = (tagPROCESSINFO *)(lVar4 + 0x8eb0);

+    while (ptVar1 = *(tagPROCESSINFO **)ptVar5, ptVar1 != (tagPROCESSINFO *)0x0) {

+      if (ptVar1 == param_1) {

+        *(longlong *)ptVar5 = *(longlong *)(param_1 + 0x450);

+        break;

+      }

+      ptVar5 = ptVar1 + 0x450;

+    }

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

+  }

+  W32ReleasePushLockExclusiveEx((W32_PUSH_LOCK *)(lVar3 + 0x4a30),0);

   return;

 }
```

## `DirectComposition::LayoutSynchronizationObject::ObjectInit`  (modified)

```diff
--- DirectComposition::LayoutSynchronizationObject::ObjectInit
+++ DirectComposition::LayoutSynchronizationObject::ObjectInit
@@ -1,2 +1,35 @@
-Failed to decompile win32kbase.sys - .ProgramDB DirectComposition::LayoutSynchronizationObject::ObjectInit : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: static long __cdecl DirectComposition::LayoutSynchronizationObject::ObjectInit(struct

+   CompositionObject * __ptr64,void * __ptr64,class ICompositionObject * __ptr64 * __ptr64) */

+

+long __cdecl

+DirectComposition::LayoutSynchronizationObject::ObjectInit

+          (CompositionObject *param_1,void *param_2,ICompositionObject **param_3)

+

+{

+  CompositionObject *pCVar1;

+  undefined8 uVar2;

+  undefined8 uVar3;

+  code *pcVar4;

+  

+  pCVar1 = param_1 + 0x18;

+  if (pCVar1 != (CompositionObject *)0x0) {

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

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

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

+    *(undefined ***)pCVar1 = &CLayoutSynchronizationInfo::_vftable_;

+  }

+  *param_3 = (ICompositionObject *)pCVar1;

+  pcVar4 = ExCompositionObjectType_exref;

+  uVar2 = *(undefined8 *)((longlong)param_2 + 8);

+  uVar3 = *(undefined8 *)param_2;

+  *(undefined2 *)(param_1 + 0x20) = 0x101;

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

+  *(undefined8 *)(param_1 + 0x30) = uVar2;

+  ObReferenceObjectByPointer(uVar2,3,*(undefined8 *)pcVar4);

+  if (((byte)Microsoft_Windows_Win32kEnableBits & 1) != 0) {

+    McTemplateK0xx_EtwWriteTransfer();

+  }

+  return 0;

+}

+
```

## `CPTPProcessor::CopyPointersIntoFrame`  (modified)

```diff
--- CPTPProcessor::CopyPointersIntoFrame
+++ CPTPProcessor::CopyPointersIntoFrame
@@ -1,2 +1,80 @@
-Failed to decompile win32kbase.sys - .ProgramDB CPTPProcessor::CopyPointersIntoFrame : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void __cdecl CPTPProcessor::CopyPointersIntoFrame(struct CPointerInputFrame *

+   __ptr64,unsigned int,struct PTPEnginePointerNode const * __ptr64,bool) __ptr64 */

+

+void __thiscall

+CPTPProcessor::CopyPointersIntoFrame

+          (CPTPProcessor *this,CPointerInputFrame *param_1,uint param_2,

+          PTPEnginePointerNode *param_3,bool param_4)

+

+{

+  RIMDEV *pRVar1;

+  undefined8 uVar2;

+  int iVar3;

+  undefined8 *puVar4;

+  tagPOINTEREVENTINT *ptVar5;

+  uint uVar6;

+  uint uVar7;

+  

+  uVar6 = 0;

+  uVar7 = 0;

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

+    puVar4 = (undefined8 *)(*(longlong *)(param_1 + 0xf0) + 0xa8);

+    do {

+      *(undefined2 *)(puVar4 + -1) = *(undefined2 *)(param_3 + 4);

+      iVar3 = Feature_PTPEngineFullTouchInfo__private_IsEnabledDeviceUsageNoInline();

+      uVar2 = *(undefined8 *)(param_3 + 8);

+      *puVar4 = *(undefined8 *)param_3;

+      puVar4[1] = uVar2;

+      uVar2 = *(undefined8 *)(param_3 + 0x18);

+      puVar4[2] = *(undefined8 *)(param_3 + 0x10);

+      puVar4[3] = uVar2;

+      uVar2 = *(undefined8 *)(param_3 + 0x28);

+      puVar4[4] = *(undefined8 *)(param_3 + 0x20);

+      puVar4[5] = uVar2;

+      uVar2 = *(undefined8 *)(param_3 + 0x38);

+      puVar4[6] = *(undefined8 *)(param_3 + 0x30);

+      puVar4[7] = uVar2;

+      uVar2 = *(undefined8 *)(param_3 + 0x48);

+      puVar4[8] = *(undefined8 *)(param_3 + 0x40);

+      puVar4[9] = uVar2;

+      uVar2 = *(undefined8 *)(param_3 + 0x58);

+      puVar4[10] = *(undefined8 *)(param_3 + 0x50);

+      puVar4[0xb] = uVar2;

+      if (iVar3 != 0) {

+        uVar2 = *(undefined8 *)(param_3 + 0x68);

+        puVar4[0xc] = *(undefined8 *)(param_3 + 0x60);

+        puVar4[0xd] = uVar2;

+        uVar2 = *(undefined8 *)(param_3 + 0x78);

+        puVar4[0xe] = *(undefined8 *)(param_3 + 0x70);

+        puVar4[0xf] = uVar2;

+        uVar2 = *(undefined8 *)(param_3 + 0x88);

+        puVar4[0x10] = *(undefined8 *)(param_3 + 0x80);

+        puVar4[0x11] = uVar2;

+      }

+      *(undefined4 *)((longlong)puVar4 + 4) = 0;

+      if (param_4) {

+        puVar4[10] = puVar4[10] + 1;

+        *(undefined8 *)(param_1 + 0xd8) = puVar4[10];

+      }

+      *(uint *)((longlong)puVar4 + -0xa4) = *(uint *)((longlong)puVar4 + -0xa4) | 0x1000;

+      param_3 = param_3 + 0x90;

+      puVar4 = puVar4 + 0x3c;

+      uVar7 = uVar7 + 1;

+    } while (uVar7 < *(uint *)(param_1 + 0x30));

+  }

+  if (param_4) {

+    pRVar1 = *(RIMDEV **)(*(longlong *)(param_1 + 0x100) + 0x10);

+    InputTraceLogging::Pointer::CommitFrame(pRVar1,param_1);

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

+      ptVar5 = (tagPOINTEREVENTINT *)(*(longlong *)(param_1 + 0xf0) + 0xa0);

+      do {

+        InputTraceLogging::Pointer::CommitFramePointer(pRVar1,param_1,ptVar5);

+        uVar6 = uVar6 + 1;

+        ptVar5 = ptVar5 + 0x1e0;

+      } while (uVar6 < *(uint *)(param_1 + 0x30));

+    }

+  }

+  return;

+}

+
```

## `CPTPEngine::FindGestureAndMarkGesturingContactsAsNonResting`  (modified)

```diff
--- CPTPEngine::FindGestureAndMarkGesturingContactsAsNonResting
+++ CPTPEngine::FindGestureAndMarkGesturingContactsAsNonResting
@@ -1,2 +1,58 @@
-Failed to decompile win32kbase.sys - .ProgramDB CPTPEngine::FindGestureAndMarkGesturingContactsAsNonResting : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void __cdecl CPTPEngine::FindGestureAndMarkGesturingContactsAsNonResting(struct PTPInput

+   const * __ptr64) __ptr64 */

+

+void __thiscall

+CPTPEngine::FindGestureAndMarkGesturingContactsAsNonResting(CPTPEngine *this,PTPInput *param_1)

+

+{

+  uint uVar1;

+  int iVar2;

+  int iVar3;

+  uint uVar4;

+  uint uVar5;

+  ulonglong uVar6;

+  CContactState *pCVar7;

+  CContactState *pCVar8;

+  

+  if ((*(uint *)(this + 0xdf8) & 4) != 0) {

+    uVar1 = *(uint *)(param_1 + 0x30);

+    uVar6 = 0;

+    while (uVar5 = (uint)uVar6, uVar5 < uVar1) {

+      if ((*(uint *)(param_1 + uVar6 * 0x90 + 0x44) != 0) &&

+         (uVar4 = uVar5, (*(uint *)(param_1 + uVar6 * 0x90 + 0x44) >> 0x12 & 1) == 0)) {

+        while( true ) {

+          uVar4 = uVar4 + 1;

+          if (uVar1 <= uVar4) break;

+          if ((*(uint *)(param_1 + (ulonglong)uVar4 * 0x90 + 0x44) != 0) &&

+             ((*(uint *)(param_1 + (ulonglong)uVar4 * 0x90 + 0x44) >> 0x12 & 1) == 0)) {

+            pCVar8 = (CContactState *)

+                     (this + ((ulonglong)*(uint *)(param_1 + uVar6 * 0x90 + 0x3c) %

+                             (ulonglong)*(uint *)(this + 0x10)) * 0x148 + 0x450);

+            pCVar7 = (CContactState *)

+                     (this + ((ulonglong)*(uint *)(param_1 + (ulonglong)uVar4 * 0x90 + 0x3c) %

+                             (ulonglong)*(uint *)(this + 0x10)) * 0x148 + 0x450);

+            if (((((*(uint *)pCVar8 & 0x100000) != 0) &&

+                 ((((*(uint *)pCVar7 & 0x100000) != 0 && ((*(uint *)(pCVar8 + 4) & 1) != 0)) &&

+                  ((*(uint *)(pCVar7 + 4) & 1) != 0)))) &&

+                (((*(int *)(this + 0xc28) != 2 ||

+                  (pCVar7 == (CContactState *)

+                             (this + (ulonglong)*(uint *)(this + 0xc00) * 0x148 + 0x450))) ||

+                 (pCVar8 == (CContactState *)

+                            (this + (ulonglong)*(uint *)(this + 0xc00) * 0x148 + 0x450))))) &&

+               (((iVar3 = AreTheseTwoContactsAPan(this,pCVar8,pCVar7), iVar3 == 0 &&

+                 (iVar2 = AreTheseTwoContactsAZoom(this,pCVar8,pCVar7), iVar2 != 0)) || (iVar3 != 0)

+                ))) {

+              SetContactRestingState(this,pCVar8,false);

+              SetContactRestingState(this,pCVar7,false);

+              return;

+            }

+          }

+        }

+      }

+      uVar6 = (ulonglong)(uVar5 + 1);

+    }

+  }

+  return;

+}

+
```

## `IOCPDispatcher::SetupIOCPForDispatcherHandle`  (modified)

```diff
--- IOCPDispatcher::SetupIOCPForDispatcherHandle
+++ IOCPDispatcher::SetupIOCPForDispatcherHandle
@@ -1,2 +1,83 @@
-Failed to decompile win32kbase.sys - .ProgramDB IOCPDispatcher::SetupIOCPForDispatcherHandle : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void * __ptr64 __cdecl IOCPDispatcher::SetupIOCPForDispatcherHandle(void * __ptr64,void

+   * __ptr64,enum WaitCompletionPacketPurpose,unsigned int) __ptr64 */

+

+void * __thiscall

+IOCPDispatcher::SetupIOCPForDispatcherHandle

+          (IOCPDispatcher *this,void *param_1,void *param_2,WaitCompletionPacketPurpose param_3,

+          uint param_4)

+

+{

+  char cVar1;

+  int iVar2;

+  int iVar3;

+  void *pvVar4;

+  longlong lVar5;

+  _GUID *p_Var6;

+  undefined4 in_register_0000008c;

+  _GUID *p_Var7;

+  bool bVar8;

+  int local_res10 [2];

+  ulonglong in_stack_ffffffffffffffb0;

+  ulonglong uVar9;

+  undefined4 uVar10;

+  undefined8 local_28 [2];

+  

+  p_Var7 = (_GUID *)CONCAT44(in_register_0000008c,param_3);

+  iVar2 = -0x3fffffff;

+  pvVar4 = param_1;

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

+    p_Var6 = param_2;

+    pvVar4 = (void *)CreateKernelIocpWcp();

+    uVar10 = (undefined4)(in_stack_ffffffffffffffb0 >> 0x20);

+    if (pvVar4 == (void *)0x0) goto LAB_0;

+  }

+  uVar9 = in_stack_ffffffffffffffb0 & 0xffffffff00000000;

+  p_Var7 = (_GUID *)(ulonglong)param_4;

+  iVar2 = ZwAssociateWaitCompletionPacket

+                    (pvVar4,*(undefined8 *)(this + 0xb58),param_2,p_Var7,(longlong)(int)param_3,

+                     uVar9,0,0);

+  uVar10 = (undefined4)(uVar9 >> 0x20);

+  p_Var6 = param_2;

+  if (-1 < iVar2) {

+    return pvVar4;

+  }

+LAB_0:

+  iVar3 = Feature_NoBugcheckForSetupIOCP__private_IsEnabledDeviceUsageNoInline();

+  if (iVar3 != 0) {

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

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

+    {

+      cVar1 = '\0';

+    }

+    else {

+      cVar1 = '\x01';

+    }

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

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

+      lVar5 = W32GetUserSessionState();

+      p_Var6 = (_GUID *)CONCAT71((int7)((ulonglong)p_Var6 >> 8),bVar8);

+      p_Var7 = *(_GUID **)(lVar5 + 0x10f78);

+      WPP_RECORDER_AND_TRACE_SF_d

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),cVar1,p_Var6,p_Var7,2,CONCAT44(uVar10,2)

+                 ,0x1b,&WPP_e707f73c5ff83dc2c29746b23add0a6c_Traceguids,iVar2);

+    }

+    UserLogError(0xc00002bf);

+    if ((5 < DAT_1) && (cVar1 = _tlgKeywordOn(&DAT_1,0x400000000000), cVar1 != '\0')

+       ) {

+      local_28[0] = 0x1000000;

+      local_res10[0] = iVar2;

+      _tlgWriteTemplate<long___cdecl(_tlgProvider_t_const*___ptr64,void_const*___ptr64,_GUID_const*___ptr64,_GUID_const*___ptr64,unsigned_int,_EVENT_DATA_DESCRIPTOR*___ptr64),&long___cdecl__tlgWriteTransfer_EtwWriteTransfer(struct__tlgProvider_t_const*___ptr64,void_const*___ptr64,struct__GUID_const*___ptr64,struct__GUID_const*___ptr64,unsigned_int,struct__EVENT_DATA_DESCRIPTOR*___ptr64),_GUID_const*___ptr64,_GUID_const*___ptr64>

+      ::Write<_tlgWrapperByVal<4>,_tlgWrapperByVal<8>_>

+                ((_tlgProvider_t *)&DAT_1,&DAT_14027d5cf,p_Var6,p_Var7,

+                 (_tlgWrapperByVal<4> *)local_res10,(_tlgWrapperByVal<8> *)local_28);

+    }

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

+      ZwClose(pvVar4);

+    }

+    return (void *)0x0;

+  }

+                    /* WARNING: Subroutine does not return */

+  KeBugCheck(0x164);

+}

+
```

## `IsProcessWin32kLockedOut`  (modified)

```diff
--- IsProcessWin32kLockedOut
+++ IOCPDispatcher::RegisterThreadDispatcherObject
@@ -1,21 +1,2 @@
-

-void IsProcessWin32kLockedOut

-               (longlong param_1,undefined8 param_2,undefined8 param_3,undefined4 param_4)

-

-{

-  char *pcVar1;

-  char in_AL;

-  uint7 in_register_00000001;

-  undefined4 in_R10D;

-  

-  pcVar1 = (char *)(param_1 * 5 + -0x7f);

-  *pcVar1 = *pcVar1 + in_AL;

-  *(undefined1 *)((ulonglong)in_register_00000001 << 8) =

-       *(undefined1 *)((ulonglong)in_register_00000001 << 8);

-  *(undefined4 *)(param_1 + 0xc4) = in_R10D;

-  *(undefined4 *)(param_1 + 200) = param_4;

-  *(undefined4 *)(param_1 + 0xcc) = 2000;

-  *(undefined4 *)(param_1 + 0xd0) = 0x3fe;

-  return;

-}

-

+Failed to decompile win32kbase.sys - .ProgramDB IOCPDispatcher::RegisterThreadDispatcherObject : Error: Decompile error: 
+Marshaling error: Did not see expected closing element
```

## `CPTPEngine::SendInitialGestureFrame`  (modified)

```diff
--- CPTPEngine::SendInitialGestureFrame
+++ CPTPEngine::SendInitialGestureFrame
@@ -1,2 +1,135 @@
-Failed to decompile win32kbase.sys - .ProgramDB CPTPEngine::SendInitialGestureFrame : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* private: int __cdecl CPTPEngine::SendInitialGestureFrame(struct PTPInput * __ptr64,struct

+   CContactState * __ptr64,int) __ptr64 */

+

+int __thiscall

+CPTPEngine::SendInitialGestureFrame

+          (CPTPEngine *this,PTPInput *param_1,CContactState *param_2,int param_3)

+

+{

+  longlong lVar1;

+  longlong lVar2;

+  longlong lVar3;

+  longlong lVar4;

+  longlong *plVar5;

+  longlong lVar6;

+  longlong *plVar7;

+  CPTPEngine *pCVar8;

+  PTPInput *pPVar9;

+  int iVar10;

+  uint *puVar11;

+  uint uVar12;

+  undefined8 uVar13;

+  uint uVar14;

+  PTPEnginePointerNode *pPVar15;

+  uint uVar16;

+  undefined1 auStackY_408 [32];

+  longlong local_3c8 [3];

+  undefined8 uStack_3ac;

+  undefined8 local_398;

+  PTPEnginePointerNode aPStack_390 [12];

+  uint auStack_384 [215];

+  ulonglong local_28;

+  

+  local_28 = __security_cookie ^ (ulonglong)auStackY_408;

+  iVar10 = 0;

+  lVar6 = 7;

+  plVar5 = local_3c8;

+  do {

+    pPVar9 = param_1;

+    plVar7 = plVar5;

+    lVar1 = *(longlong *)(pPVar9 + 8);

+    lVar2 = *(longlong *)(pPVar9 + 0x10);

+    lVar3 = *(longlong *)(pPVar9 + 0x18);

+    *plVar7 = *(longlong *)pPVar9;

+    plVar7[1] = lVar1;

+    lVar1 = *(longlong *)(pPVar9 + 0x20);

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

+    plVar7[2] = lVar2;

+    plVar7[3] = lVar3;

+    lVar2 = *(longlong *)(pPVar9 + 0x30);

+    lVar3 = *(longlong *)(pPVar9 + 0x38);

+    plVar7[4] = lVar1;

+    plVar7[5] = lVar4;

+    lVar1 = *(longlong *)(pPVar9 + 0x40);

+    lVar4 = *(longlong *)(pPVar9 + 0x48);

+    plVar7[6] = lVar2;

+    plVar7[7] = lVar3;

+    lVar2 = *(longlong *)(pPVar9 + 0x50);

+    lVar3 = *(longlong *)(pPVar9 + 0x58);

+    plVar7[8] = lVar1;

+    plVar7[9] = lVar4;

+    lVar1 = *(longlong *)(pPVar9 + 0x60);

+    lVar4 = *(longlong *)(pPVar9 + 0x68);

+    plVar7[10] = lVar2;

+    plVar7[0xb] = lVar3;

+    lVar2 = *(longlong *)(pPVar9 + 0x70);

+    lVar3 = *(longlong *)(pPVar9 + 0x78);

+    plVar7[0xc] = lVar1;

+    plVar7[0xd] = lVar4;

+    plVar7[0xe] = lVar2;

+    plVar7[0xf] = lVar3;

+    lVar6 = lVar6 + -1;

+    plVar5 = plVar7 + 0x10;

+    param_1 = pPVar9 + 0x80;

+  } while (lVar6 != 0);

+  lVar1 = *(longlong *)(pPVar9 + 0x88);

+  lVar6 = *(longlong *)(pPVar9 + 0x90);

+  uVar14 = 0;

+  plVar7[0x10] = *(longlong *)(pPVar9 + 0x80);

+  plVar7[0x11] = lVar1;

+  plVar7[0x12] = lVar6;

+  uVar12 = (uint)local_398;

+  if (uVar12 != 0) {

+    uVar16 = *(uint *)(this + 0x10);

+    puVar11 = auStack_384;

+    do {

+      pCVar8 = this + ((ulonglong)puVar11[-2] % (ulonglong)uVar16) * 0x148 + 0x450;

+      if (((*(uint *)pCVar8 & 1) == 0) || ((*(uint *)pCVar8 >> 0xb & 1) != 0)) {

+        *puVar11 = 0;

+        puVar11[7] = 0;

+        puVar11[8] = 0;

+      }

+      else {

+        if ((*puVar11 >> 0x10 & 1) == 0) {

+          *puVar11 = *puVar11 & 0xfffdffff | 0x10000;

+        }

+        *(undefined8 *)(puVar11 + 7) = *(undefined8 *)(pCVar8 + 0x10);

+        puVar11[0xd] = *(uint *)(pCVar8 + 0x88);

+        *(undefined8 *)(puVar11 + 0x11) = *(undefined8 *)(pCVar8 + 0x80);

+        if (pCVar8 == (CPTPEngine *)param_2) {

+          *(undefined8 *)(this + 0xc2c) = uStack_3ac;

+        }

+        if (*(longlong *)(pCVar8 + 0x80) == local_3c8[0]) {

+          iVar10 = 1;

+        }

+      }

+      uVar14 = uVar14 + 1;

+      puVar11 = puVar11 + 0x24;

+    } while (uVar14 < uVar12);

+  }

+  uVar16 = 0;

+  pPVar15 = aPStack_390;

+  uVar14 = 0;

+  uVar13 = local_398;

+  if (uVar12 != 0) {

+    do {

+      uVar12 = *(uint *)(this + ((ulonglong)*(uint *)(pPVar15 + 4) %

+                                (ulonglong)*(uint *)(this + 0x10)) * 0x148 + 0x450);

+      if (((uVar12 & 1) != 0) && ((uVar12 >> 0xb & 1) == 0)) {

+        FixupGestureContact(this,pPVar15,

+                            (uint)(this + ((ulonglong)*(uint *)(pPVar15 + 4) %

+                                          (ulonglong)*(uint *)(this + 0x10)) * 0x148 + 0x450 ==

+                                  (CPTPEngine *)param_2));

+        uVar13 = local_398;

+      }

+      uVar16 = uVar16 + 1;

+      pPVar15 = pPVar15 + 0x90;

+      uVar14 = (uint)uVar13;

+    } while (uVar16 < uVar14);

+  }

+  CBasePTPEngine::SendGestureOutput((CBasePTPEngine *)this,2,param_3,uVar14,aPStack_390);

+  return iVar10;

+}

+
```

## `QualityOfService::Initialize`  (modified)

```diff
--- QualityOfService::Initialize
+++ QualityOfService::Initialize
@@ -1,2 +1,30 @@
-Failed to decompile win32kbase.sys - .ProgramDB QualityOfService::Initialize : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* long __cdecl QualityOfService::Initialize(void) */

+

+long __cdecl QualityOfService::Initialize(void)

+

+{

+  undefined1 *puVar1;

+  undefined1 *puVar2;

+  longlong lVar3;

+  

+  puVar1 = Win32AllocPoolZInitImpl(0x100,0x28,0x72717355);

+  puVar2 = (undefined1 *)0x0;

+  if (puVar1 != (undefined1 *)0x0) {

+    *puVar1 = 0;

+    puVar2 = puVar1 + 8;

+    *(undefined1 **)(puVar1 + 0x10) = puVar2;

+    *(undefined1 **)puVar2 = puVar2;

+    puVar2 = puVar1 + 0x18;

+    *(undefined1 **)(puVar1 + 0x20) = puVar2;

+    *(undefined1 **)puVar2 = puVar2;

+    lVar3 = W32GetUserSessionState();

+    if (*(longlong *)(lVar3 + 0xa1f8) != 0) {

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

+    }

+    *(undefined1 **)(lVar3 + 0xa1f8) = puVar1;

+    puVar2 = puVar1;

+  }

+  return ~-(uint)(puVar2 != (undefined1 *)0x0) & 0xc0000017;

+}

+
```

## `NSInstrumentation::CTypeIsolation<49152,192>::Allocate`  (modified)

```diff
--- NSInstrumentation::CTypeIsolation<49152,192>::Allocate
+++ NSInstrumentation::CTypeIsolation<49152,192>::Allocate
@@ -1,2 +1,106 @@
-Failed to decompile win32kbase.sys - .ProgramDB NSInstrumentation::CTypeIsolation<49152,192>::Allocate : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* protected: void * __ptr64 __cdecl NSInstrumentation::CTypeIsolation<49152,192>::Allocate(void)

+   __ptr64 */

+

+void * __thiscall

+NSInstrumentation::CTypeIsolation<49152,192>::Allocate(CTypeIsolation<49152,192> *this)

+

+{

+  W32_PUSH_LOCK *pWVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  undefined1 *puVar5;

+  CSectionEntry<49152,192> *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<49152,192>)0x0) {

+    local_18 = *(W32_PUSH_LOCK **)(this + 0x10);

+    _Dst = (void *)0x0;

+    local_10 = 0;

+    GreAcquirePushLockShared(local_18);

+    for (pCVar6 = *(CSectionEntry<49152,192> **)this; pCVar6 != (CSectionEntry<49152,192> *)this;

+        pCVar6 = *(CSectionEntry<49152,192> **)pCVar6) {

+      unaff_R14 = CSectionBitmapAllocator<49152,192>::Allocate

+                            (*(CSectionBitmapAllocator<49152,192> **)(pCVar6 + 0x20));

+      puVar5 = auStack_38;

+      if (unaff_R14 != (void *)0x0) goto LAB_0;

+    }

+    CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+    ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                   *)&local_18);

+    pCVar6 = CSectionEntry<49152,192>::Create();

+    if (pCVar6 != (CSectionEntry<49152,192> *)0x0) {

+      _Dst = CSectionBitmapAllocator<49152,192>::Allocate

+                       (*(CSectionBitmapAllocator<49152,192> **)(pCVar6 + 0x20));

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

+        CSectionEntry<49152,192>::Destroy(pCVar6);

+      }

+      else {

+        pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+        W32AcquirePushLockExclusive(pWVar1);

+        lVar2 = *(longlong *)this;

+        if (*(CTypeIsolation<49152,192> **)(lVar2 + 8) == this) {

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<49152,192> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<49152,192> **)(lVar2 + 8) = pCVar6;

+          *(int *)(this + 0x20) = *(int *)(this + 0x20) + 0xfc;

+          *(CSectionEntry<49152,192> **)this = pCVar6;

+          GreReleasePushLockExclusive(pWVar1);

+        }

+        else {

+          do {

+            do {

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

+              (*pcVar4)(3);

+              puVar5 = puVar7 + 8;

+LAB_0:

+              _Dst = unaff_R14;

+              puVar7 = puVar5;

+              if (pCVar6 == *(CSectionEntry<49152,192> **)this) goto LAB_1;

+              *(undefined8 *)(puVar7 + -8) = 0x14006f18e;

+              CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+              ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                             *)(puVar7 + 0x20));

+              pWVar1 = *(W32_PUSH_LOCK **)(this + 0x10);

+              *(undefined8 *)(puVar7 + -8) = 0x14006f19a;

+              W32AcquirePushLockExclusive(pWVar1);

+              lVar2 = *(longlong *)pCVar6;

+              unaff_R14 = _Dst;

+            } while ((*(CSectionEntry<49152,192> **)(lVar2 + 8) != pCVar6) ||

+                    (plVar3 = *(longlong **)(pCVar6 + 8),

+                    (CSectionEntry<49152,192> *)*plVar3 != pCVar6));

+            *plVar3 = lVar2;

+            *(longlong **)(lVar2 + 8) = plVar3;

+            lVar2 = *(longlong *)this;

+          } while (*(CTypeIsolation<49152,192> **)(lVar2 + 8) != this);

+          *(longlong *)pCVar6 = lVar2;

+          *(CTypeIsolation<49152,192> **)(pCVar6 + 8) = this;

+          *(CSectionEntry<49152,192> **)(lVar2 + 8) = pCVar6;

+          *(CSectionEntry<49152,192> **)this = pCVar6;

+          *(undefined8 *)(puVar7 + -8) = 0x14006f1d2;

+          GreReleasePushLockExclusive(pWVar1);

+LAB_1:

+          *(undefined8 *)(puVar7 + -8) = 0x14006f1dc;

+          CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>::

+          ReleaseShared((CAutoReleasableSharedCReaderWriterLock<NSInstrumentation::CPlatformReaderWriterLock>

+                         *)(puVar7 + 0x20));

+        }

+      }

+    }

+  }

+  else {

+    _Dst = (void *)ExAllocateFromPagedLookasideList(*(undefined8 *)(this + 0x18));

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

+      memset(_Dst,0,0xc0);

+    }

+  }

+  return _Dst;

+}

+
```

## `ForegroundBoost::`anonymous_namespace'::HasBoostSource`  (modified)

```diff
--- ForegroundBoost::`anonymous_namespace'::HasBoostSource
+++ ForegroundBoost::`anonymous_namespace'::HasBoostSource
@@ -1,31 +1,26 @@
 

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

-/* int __cdecl CheckFeature_Servicing_PDCAgentSessions_Enabled(void) */

-

-undefined4 <lambda_ca433e1d2bf82ece4758afe8c3ed56fe>::HasBoostSource(void)

+bool ForegroundBoost::`anonymous_namespace'::HasBoostSource(longlong param_1,char param_2)

 

 {

-  int iVar1;

-  undefined4 uVar2;

-  undefined1 auStack_58 [32];

-  undefined4 uStack_38;

-  char acStack_28 [8];

-  undefined4 uStack_20;

-  undefined4 uStack_1c;

-  undefined4 local_18;

-  ulonglong uStack_10;

+  longlong lVar1;

+  bool bVar2;

+  bool bVar3;

   

-  uStack_10 = __security_cookie ^ (ulonglong)auStack_58;

-  uStack_1c = 0;

-  uVar2 = 1;

-  acStack_28[0] = '\0';

-  uStack_20 = 0x61;

-  local_18 = 0x3937a27;

-  uStack_38 = 1;

-  iVar1 = ZwPowerInformation(0x57,&uStack_20,0xc,acStack_28);

-  if ((iVar1 != 0) || (acStack_28[0] == '\0')) {

-    uVar2 = 0;

+  bVar3 = (*(ulonglong *)(param_1 + 800) & 0x3fc0000000) != 0;

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

+    bVar2 = false;

+    lVar1 = W32GetUserSessionState();

+    for (lVar1 = *(longlong *)(lVar1 + 0x8eb0); lVar1 != 0; lVar1 = *(longlong *)(lVar1 + 0x450)) {

+      if (param_1 == lVar1) {

+        bVar2 = true;

+        break;

+      }

+    }

+    if (bVar3 != bVar2) {

+                    /* WARNING: Subroutine does not return */

+      KeBugCheckEx(0x164,0x12,0,0,0);

+    }

   }

-  return uVar2;

+  return bVar3;

 }
```

## `GroupedFGBoostProp::doBoost`  (modified)

```diff
--- GroupedFGBoostProp::doBoost
+++ GroupedFGBoostProp::doBoost
@@ -1,2 +1,24 @@
-Failed to decompile win32kbase.sys - .ProgramDB GroupedFGBoostProp::doBoost : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* private: void __cdecl GroupedFGBoostProp::doBoost(struct _EPROCESS * __ptr64,enum BoostFlag)

+   __ptr64 */

+

+void __thiscall

+GroupedFGBoostProp::doBoost(GroupedFGBoostProp *this,_EPROCESS *param_1,BoostFlag param_2)

+

+{

+  char cVar1;

+  longlong *plVar2;

+  

+  plVar2 = (longlong *)PsGetProcessWin32Process(param_1);

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

+    cVar1 = PsGetProcessExitProcessCalled(param_1);

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

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

+    }

+  }

+  else {

+    ForegroundBoost::`anonymous_namespace'::_SetForegroundPriority(plVar2,param_2 == 1,2);

+  }

+  return;

+}

+
```

## `Win32JobObject::`anonymous_namespace'::ConfigureProcessRestrictions`  (modified)

```diff
--- Win32JobObject::`anonymous_namespace'::ConfigureProcessRestrictions
+++ Win32JobObject::`anonymous_namespace'::ConfigureProcessRestrictions
@@ -1,71 +1,58 @@
 

-void <lambda_ebe346d30a668a9733c532f644f5367b>::ConfigureProcessRestrictions

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

+void Win32JobObject::`anonymous_namespace'::ConfigureProcessRestrictions

+               (longlong param_1,uint param_2)

 

 {

-  char cVar1;

-  char *in_RAX;

-  _tlgWrapperByVal<4> *unaff_RBP;

-  undefined8 in_R10;

-  undefined4 *in_R11;

+  undefined4 uVar1;

+  bool bVar2;

+  int iVar3;

+  longlong lVar4;

+  char cVar5;

+  bool bVar6;

   

-  cRam0000000142f312d1 = cRam0000000142f312d1 + (char)in_RAX;

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

-  cVar1 = _tlgKeywordOn(&DAT_0,4);

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

-    *(undefined4 *)(unaff_RBP + 0x30) = *(undefined4 *)(param_4[3].Data4 + 4);

-    *(undefined4 *)(unaff_RBP + 0x38) = *(undefined4 *)param_4[3].Data4;

-    *(undefined4 *)(unaff_RBP + -0x80) = *(undefined4 *)&param_4[3].Data2;

-    *(ulong *)(unaff_RBP + -0x7c) = param_4[3].Data1;

-    *(undefined4 *)(unaff_RBP + -0x78) = *(undefined4 *)(param_4[2].Data4 + 4);

-    *(undefined4 *)(unaff_RBP + -0x74) = *(undefined4 *)param_4[2].Data4;

-    *(undefined4 *)(unaff_RBP + -0x70) = *(undefined4 *)&param_4[2].Data2;

-    *(ulong *)(unaff_RBP + -0x6c) = param_4[2].Data1;

-    *(undefined4 *)(unaff_RBP + -0x68) = *(undefined4 *)(param_4[1].Data4 + 4);

-    *(undefined4 *)(unaff_RBP + -100) = *(undefined4 *)param_4[1].Data4;

-    *(undefined4 *)(unaff_RBP + -0x60) = *(undefined4 *)&param_4[1].Data2;

-    *(ulong *)(unaff_RBP + -0x5c) = param_4[1].Data1;

-    *(undefined4 *)(unaff_RBP + -0x58) = *(undefined4 *)(param_4->Data4 + 4);

-    *(undefined4 *)(unaff_RBP + -0x54) = *(undefined4 *)param_4->Data4;

-    *(undefined4 *)(unaff_RBP + -0x50) = *(undefined4 *)&param_4->Data2;

-    *(ulong *)(unaff_RBP + -0x4c) = param_4->Data1;

-    *(undefined4 *)(unaff_RBP + -0x48) = in_R11[0xf];

-    *(undefined4 *)(unaff_RBP + -0x44) = in_R11[0xe];

-    *(undefined4 *)(unaff_RBP + -0x40) = in_R11[0xd];

-    *(undefined4 *)(unaff_RBP + -0x3c) = in_R11[0xc];

-    *(undefined4 *)(unaff_RBP + -0x38) = in_R11[0xb];

-    *(undefined4 *)(unaff_RBP + -0x34) = in_R11[10];

-    *(undefined4 *)(unaff_RBP + -0x30) = in_R11[9];

-    *(undefined4 *)(unaff_RBP + -0x2c) = in_R11[8];

-    *(undefined4 *)(unaff_RBP + -0x28) = in_R11[7];

-    *(undefined4 *)(unaff_RBP + -0x24) = in_R11[6];

-    *(undefined4 *)(unaff_RBP + -0x20) = in_R11[5];

-    *(undefined4 *)(unaff_RBP + -0x1c) = in_R11[4];

-    *(undefined4 *)(unaff_RBP + -0x18) = in_R11[3];

-    *(undefined4 *)(unaff_RBP + -0x14) = in_R11[2];

-    *(undefined4 *)(unaff_RBP + -0x10) = in_R11[1];

-    *(undefined4 *)(unaff_RBP + -0xc) = *in_R11;

-    *(int *)(unaff_RBP + -8) = (int)((ulonglong)*(undefined8 *)(unaff_RBP + 0x58) >> 0x20);

-    *(int *)(unaff_RBP + -4) = (int)*(undefined8 *)(unaff_RBP + 0x58);

-    *(int *)(unaff_RBP + 4) = (int)*(undefined8 *)(unaff_RBP + 0x50);

-    *(int *)unaff_RBP = (int)((ulonglong)*(undefined8 *)(unaff_RBP + 0x50) >> 0x20);

-    *(_GUID **)(unaff_RBP + 8) = param_3;

-    *(undefined8 *)(unaff_RBP + 0x10) = in_R10;

-    _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<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>_>

-              ((_tlgProvider_t *)&DAT_0,&DAT_140274f08,param_3,param_4,

-               (_tlgWrapperByVal<8> *)(unaff_RBP + 0x10),(_tlgWrapperByVal<8> *)(unaff_RBP + 8),

-               unaff_RBP + 4,unaff_RBP,unaff_RBP + -4,unaff_RBP + -8,unaff_RBP + -0xc,

-               unaff_RBP + -0x10,unaff_RBP + -0x14,unaff_RBP + -0x18,unaff_RBP + -0x1c,

-               unaff_RBP + -0x20,unaff_RBP + -0x24,unaff_RBP + -0x28,unaff_RBP + -0x2c,

-               unaff_RBP + -0x30,unaff_RBP + -0x34,unaff_RBP + -0x38,unaff_RBP + -0x3c,

-               unaff_RBP + -0x40,unaff_RBP + -0x44,unaff_RBP + -0x48,unaff_RBP + -0x4c,

-               unaff_RBP + -0x50,unaff_RBP + -0x54,unaff_RBP + -0x58,unaff_RBP + -0x5c,

-               unaff_RBP + -0x60,unaff_RBP + -100,unaff_RBP + -0x68,unaff_RBP + -0x6c,

-               unaff_RBP + -0x70,unaff_RBP + -0x74,unaff_RBP + -0x78,unaff_RBP + -0x7c,

-               unaff_RBP + -0x80,unaff_RBP + 0x38,unaff_RBP + 0x30);

+  bVar2 = true;

+  cVar5 = '\x01';

+  SetRestrictedFlags(param_1,param_2 & 0xffffff01);

+  if ((param_2 >> 8 & 1) != 0) {

+    iVar3 = Feature_LearningModeExpansion__private_IsEnabledDeviceUsageNoInline();

+    if (iVar3 == 0) {

+      DisableImeForProcess(param_1);

+    }

+    else if ((*(uint *)(param_1 + 0xc) & 0x800000) == 0) {

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

+          (-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c))) ||

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

+        cVar5 = '\0';

+      }

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

+      if ((cVar5 != '\0') || (bVar6)) {

+        uVar1 = *(undefined4 *)(param_1 + 0x38);

+        lVar4 = W32GetUserSessionState();

+        WPP_RECORDER_AND_TRACE_SF_D

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

+                   *(undefined8 *)(lVar4 + 0x10f78),4,8,0xd,

+                   &WPP_7e9e0062906337f0d6c257ef3fadb387_Traceguids,uVar1);

+      }

+      DisableImeForProcess(param_1);

+    }

+  }

+  if (((param_2 & 0x20) != 0) &&

+     (iVar3 = Feature_LearningModeExpansion__private_IsEnabledDeviceUsageNoInline(), iVar3 != 0)) {

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

+       ((-1 < (char)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c) ||

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

+      bVar2 = false;

+    }

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

+    if ((bVar2) || (bVar6)) {

+      uVar1 = *(undefined4 *)(param_1 + 0x38);

+      lVar4 = W32GetUserSessionState();

+      WPP_RECORDER_AND_TRACE_SF_D

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

+                 *(undefined8 *)(lVar4 + 0x10f78),4,8,0xe,

+                 &WPP_7e9e0062906337f0d6c257ef3fadb387_Traceguids,uVar1);

+    }

   }

   return;

 }
```

## `PTPEngineTraceProducer::OnInput`  (modified)

```diff
--- PTPEngineTraceProducer::OnInput
+++ PTPEngineTraceProducer::OnInput
@@ -1,2 +1,52 @@
-Failed to decompile win32kbase.sys - .ProgramDB PTPEngineTraceProducer::OnInput : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* public: long __cdecl PTPEngineTraceProducer::OnInput(struct PTPInput * __ptr64,struct

+   tagTPAAPSTATE * __ptr64) __ptr64 */

+

+long __thiscall

+PTPEngineTraceProducer::OnInput

+          (PTPEngineTraceProducer *this,PTPInput *param_1,tagTPAAPSTATE *param_2)

+

+{

+  long lVar1;

+  _GUID *p_Var2;

+  undefined4 local_res8 [2];

+  undefined8 local_res10;

+  tagTPAAPSTATE *local_28;

+  ushort local_20;

+  PTPInput *local_18;

+  undefined2 local_10;

+  

+  p_Var2 = (_GUID *)param_2;

+  if (((5 < DAT_0) && (((byte)DAT_14029aed0 & 3) != 0)) &&

+     ((_GUID *)(ulonglong)((uint)DAT_1 & 3) == DAT_1)) {

+    p_Var2 = (_GUID *)-(longlong)param_2;

+    local_res8[0] = 4;

+    local_20 = -(ushort)(param_2 != (tagTPAAPSTATE *)0x0) & 0x20;

+    local_10 = 0x38;

+    local_res10 = *(undefined8 *)(this + 0xd0);

+    local_28 = param_2;

+    local_18 = param_1;

+    _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>,_tlgWrapperBinary,_tlgWrapperBinary>

+              ((_tlgProvider_t *)this,&DAT_2,DAT_14029aed8,p_Var2,

+               (_tlgWrapperByVal<8> *)&local_res10,(_tlgWrapperByVal<4> *)local_res8,

+               (_tlgWrapperBinary *)&local_18,(_tlgWrapperBinary *)&local_28);

+  }

+  if (((*(int *)(param_1 + 0x30) != 0) && (5 < DAT_0)) &&

+     ((((byte)DAT_3 & 3) != 0 &&

+      ((_GUID *)(ulonglong)((uint)DAT_1 & 3) == DAT_1)))) {

+    local_18 = param_1 + 0x38;

+    local_res8[0] = 3;

+    local_res10 = *(undefined8 *)(this + 0xd0);

+    local_10 = (undefined2)((uint)*(ushort *)(param_1 + 0x30) * 0x90);

+    _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>,_tlgWrapperBinary>

+              ((_tlgProvider_t *)(ulonglong)((uint)*(ushort *)(param_1 + 0x30) * 0x90),

+               &DAT_4,DAT_14029aed8,p_Var2,(_tlgWrapperByVal<8> *)&local_res10,

+               (_tlgWrapperByVal<4> *)local_res8,(_tlgWrapperBinary *)&local_18);

+  }

+  lVar1 = (**(code **)(**(longlong **)(this + 0x18) + 0x10))(*(longlong **)(this + 0x18),param_1);

+  return lVar1;

+}

+
```

## `CCompositionRefreshRateBooster::HandleRefreshRateUnboostTimer`  (modified)

```diff
--- CCompositionRefreshRateBooster::HandleRefreshRateUnboostTimer
+++ <lambda_1a5ee060bdb1ce9703eb1122d26d57bd>::<lambda_invoker_cdecl>
@@ -1,2 +1,23 @@
-Failed to decompile win32kbase.sys - .ProgramDB CCompositionRefreshRateBooster::HandleRefreshRateUnboostTimer : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+void <lambda_1a5ee060bdb1ce9703eb1122d26d57bd>::<lambda_invoker_cdecl>(void)

+

+{

+  longlong lVar1;

+  int iVar2;

+  

+  InputTraceLogging::KST::HandleRefreshRateUnboostTimer();

+  lVar1 = W32GetUserSessionState();

+  lVar1 = *(longlong *)(lVar1 + 0xc20);

+  CPushLock::AcquireLockExclusive((CPushLock *)(lVar1 + 0x58));

+  if (*(char *)(lVar1 + 0x68) != '\0') {

+    *(undefined1 *)(lVar1 + 0x68) = 0;

+    iVar2 = DCompositionBoostCompositionClockForInput(0);

+    if (iVar2 < 0) {

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

+    }

+    InputTraceLogging::Win32k::CompositionRefreshRateUnboost();

+  }

+  CPushLock::ReleaseLock((CPushLock *)(lVar1 + 0x58));

+  return;

+}

+
```

## `Win32JobObject::`anonymous_namespace'::FindW32Job`  (modified)

```diff
--- Win32JobObject::`anonymous_namespace'::FindW32Job
+++ Win32JobObject::HasHandleAccess
@@ -1,36 +1,33 @@
 

-void <lambda_ebe346d30a668a9733c532f644f5367b>::FindW32Job

-               (_tlgProvider_t *param_1,void *param_2,_GUID *param_3,_GUID *param_4)

+/* bool __cdecl Win32JobObject::HasHandleAccess(unsigned long,void * __ptr64) */

+

+bool __cdecl Win32JobObject::HasHandleAccess(ulong param_1,void *param_2)

 

 {

-  undefined4 in_EAX;

-  _tlgWrapperByVal<4> *unaff_RBP;

-  undefined4 uStack000000000000010c;

-  undefined8 in_stack_00000108;

-  _tlgWrapperByVal<4> *in_stack_00000110;

-  _tlgWrapperByVal<4> *in_stack_00000118;

-  _tlgWrapperByVal<4> *in_stack_00000120;

-  _tlgWrapperByVal<4> *in_stack_00000128;

-  _tlgWrapperByVal<4> *in_stack_00000130;

-  _tlgWrapperByVal<4> *in_stack_00000138;

-  _tlgWrapperByVal<4> *in_stack_00000140;

-  _tlgWrapperByVal<4> *in_stack_00000148;

+  longlong lVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  uint uVar4;

+  bool bVar5;

   

-  uStack000000000000010c = (undefined4)((ulonglong)in_stack_00000108 >> 0x20);

-  _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<8>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>,_tlgWrapperByVal<4>_>

-            (param_1,param_2,param_3,param_4,(_tlgWrapperByVal<8> *)(unaff_RBP + 0x10),

-             (_tlgWrapperByVal<8> *)(unaff_RBP + 8),unaff_RBP + 4,unaff_RBP,unaff_RBP + -4,

-             unaff_RBP + -8,unaff_RBP + -0xc,unaff_RBP + -0x10,unaff_RBP + -0x14,unaff_RBP + -0x18,

-             unaff_RBP + -0x1c,unaff_RBP + -0x20,unaff_RBP + -0x24,unaff_RBP + -0x28,

-             unaff_RBP + -0x2c,unaff_RBP + -0x30,unaff_RBP + -0x34,unaff_RBP + -0x38,

-             unaff_RBP + -0x3c,unaff_RBP + -0x40,unaff_RBP + -0x44,unaff_RBP + -0x48,

-             unaff_RBP + -0x4c,unaff_RBP + -0x50,unaff_RBP + -0x54,unaff_RBP + -0x58,

-             unaff_RBP + -0x5c,unaff_RBP + -0x60,unaff_RBP + -100,

-             (_tlgWrapperByVal<4> *)CONCAT44(uStack000000000000010c,in_EAX),in_stack_00000110,

-             in_stack_00000118,in_stack_00000120,in_stack_00000128,in_stack_00000130,

-             in_stack_00000138,in_stack_00000140,in_stack_00000148);

-  return;

+  lVar1 = W32GetUserSessionState();

+  W32AcquirePushLockSharedEx((W32_PUSH_LOCK *)(lVar1 + 0x10f50),0);

+  lVar2 = `anonymous_namespace'::FindW32Job(param_1);

+  if ((lVar2 != 0) && (plVar3 = *(longlong **)(lVar2 + 0x20), plVar3 != (longlong *)0x0)) {

+    uVar4 = 0;

+    if (*(uint *)(lVar2 + 0x18) != 0) {

+      bVar5 = true;

+      do {

+        if ((void *)*plVar3 == param_2) goto LAB_0;

+        uVar4 = uVar4 + 1;

+        plVar3 = plVar3 + 1;

+      } while (uVar4 < *(uint *)(lVar2 + 0x18));

+    }

+  }

+  bVar5 = false;

+LAB_0:

+  ExReleasePushLockSharedEx(lVar1 + 0x10f50,0);

+  KeLeaveCriticalRegion();

+  return bVar5;

 }
```

## `NTOSKRNL.EXE::PsGetThreadId`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetThreadId calling
+++ NTOSKRNL.EXE::PsGetThreadId calling
@@ -19 +18,0 @@
-ForegroundBoost::`anonymous_namespace'::CanAdjustPriority
```

## `NTOSKRNL.EXE::PsGetCurrentProcess`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentProcess calling
+++ NTOSKRNL.EXE::PsGetCurrentProcess calling
@@ -81 +80,0 @@
-UserGlobalAtomTableCallout_Old
```

## `NTOSKRNL.EXE::ObCloseHandle`  (modified)

```diff
--- NTOSKRNL.EXE::ObCloseHandle calling
+++ NTOSKRNL.EXE::ObCloseHandle calling
@@ -4,0 +5 @@
+DCompositionCreateLayoutSynchronizationObject
```

## `WIN32K.SYS::KfGetProcessEffectiveUILimits`  (modified)

```diff
--- WIN32K.SYS::KfGetProcessEffectiveUILimits calling
+++ WIN32K.SYS::KfGetProcessEffectiveUILimits calling
@@ -2,0 +3 @@
+tagPROCESSINFO::CanPerformUIOperation
```

## `NTOSKRNL.EXE::ZwAssociateWaitCompletionPacket`  (modified)

```diff
--- NTOSKRNL.EXE::ZwAssociateWaitCompletionPacket calling
+++ NTOSKRNL.EXE::ZwAssociateWaitCompletionPacket calling
@@ -1,0 +2 @@
+IOCPDispatcher::SetupIOCPForDispatcherHandle
```

## `NTOSKRNL.EXE::PsSetProcessPriorityByClass`  (modified)

```diff
--- NTOSKRNL.EXE::PsSetProcessPriorityByClass calling
+++ NTOSKRNL.EXE::PsSetProcessPriorityByClass calling
@@ -3 +2,0 @@
-ForegroundBoost::`anonymous_namespace'::SetProcessPriorityByClass
@@ -5 +3,0 @@
-GroupedFGBoostProp::doBoost
```

## `NTOSKRNL.EXE::ExReleaseResourceAndLeaveCriticalRegion`  (modified)

```diff
--- NTOSKRNL.EXE::ExReleaseResourceAndLeaveCriticalRegion calling
+++ NTOSKRNL.EXE::ExReleaseResourceAndLeaveCriticalRegion calling
@@ -29 +28,0 @@
-xxxUserProcessCallout
```

## `NTOSKRNL.EXE::ZwClose`  (modified)

```diff
--- NTOSKRNL.EXE::ZwClose calling
+++ NTOSKRNL.EXE::ZwClose calling
@@ -68,0 +69 @@
+IOCPDispatcher::SetupIOCPForDispatcherHandle
```

## `WIN32K.SYS::W32GetUserSessionState`  (modified)

```diff
--- WIN32K.SYS::W32GetUserSessionState calling
+++ WIN32K.SYS::W32GetUserSessionState calling
@@ -0,0 +1 @@
+<lambda_1a5ee060bdb1ce9703eb1122d26d57bd>::<lambda_invoker_cdecl>
@@ -7 +7,0 @@
-<lambda_c9e4fec9532ca8e5b5101c78de254c3e>::<lambda_invoker_cdecl>
@@ -348 +347,0 @@
-CloseWin32InputRelatedObHandles
@@ -486 +484,0 @@
-ForegroundBoost::LogProcessInformation
@@ -491 +488,0 @@
-ForegroundBoost::`anonymous_namespace'::CanAdjustPriority
@@ -498 +494,0 @@
-ForegroundBoost::`anonymous_namespace'::_SetForegroundPriority_Old
@@ -579,0 +576,2 @@
+IOCPDispatcher::HandleThreadDispatcherSignal
+IOCPDispatcher::SetupIOCPForDispatcherHandle
@@ -1220 +1217,0 @@
-UserGlobalAtomTableCallout_Old
@@ -1254 +1250,0 @@
-ValidateHandleSecure_New
@@ -1268 +1263,0 @@
-W32GetUserJobsGlobals
@@ -1290,0 +1286 @@
+Win32JobObject::HasHandleAccess
@@ -1293,0 +1290 @@
+Win32JobObject::`anonymous_namespace'::ConfigureProcessRestrictions
@@ -1447,0 +1445 @@
+tagPROCESSINFO::CanPerformUIOperation
@@ -1523 +1520,0 @@
-xxxUserProcessCallout
```

## `NTOSKRNL.EXE::ObfReferenceObject`  (modified)

```diff
--- NTOSKRNL.EXE::ObfReferenceObject calling
+++ NTOSKRNL.EXE::ObfReferenceObject calling
@@ -3,0 +4 @@
+DirectComposition::CLayoutSynchronizationInfo::AddRef
```

## `WIN32K.SYS::W32GetUserGdiSessionState`  (modified)

```diff
--- WIN32K.SYS::W32GetUserGdiSessionState calling
+++ WIN32K.SYS::W32GetUserGdiSessionState calling
@@ -90 +89,0 @@
-xxxUserProcessCallout
```

## `NTOSKRNL.EXE::ExEnterCriticalRegionAndAcquireResourceExclusive`  (modified)

```diff
--- NTOSKRNL.EXE::ExEnterCriticalRegionAndAcquireResourceExclusive calling
+++ NTOSKRNL.EXE::ExEnterCriticalRegionAndAcquireResourceExclusive calling
@@ -12 +11,0 @@
-xxxUserProcessCallout
```

## `NTOSKRNL.EXE::PsGetCurrentProcessWin32Process`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentProcessWin32Process calling
+++ NTOSKRNL.EXE::PsGetCurrentProcessWin32Process calling
@@ -9,0 +10 @@
+CheckSystemParametersAccess
@@ -108 +108,0 @@
-UserGlobalAtomTableCallout_Old
```

## `NTOSKRNL.EXE::PsGetThreadWin32Thread`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetThreadWin32Thread calling
+++ NTOSKRNL.EXE::PsGetThreadWin32Thread calling
@@ -60 +59,0 @@
-UserGlobalAtomTableCallout_Old
```

## `NTOSKRNL.EXE::PsDereferencePrimaryToken`  (modified)

```diff
--- NTOSKRNL.EXE::PsDereferencePrimaryToken calling
+++ NTOSKRNL.EXE::PsDereferencePrimaryToken calling
@@ -7 +6,0 @@
-xxxUserProcessCallout
```

## `NTOSKRNL.EXE::PsGetCurrentProcessWow64Process`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetCurrentProcessWow64Process calling
+++ NTOSKRNL.EXE::PsGetCurrentProcessWow64Process calling
@@ -41 +40,0 @@
-ValidateHandleSecure_New
```

## `NTOSKRNL.EXE::ObReferenceObjectByPointer`  (modified)

```diff
--- NTOSKRNL.EXE::ObReferenceObjectByPointer calling
+++ NTOSKRNL.EXE::ObReferenceObjectByPointer calling
@@ -14,0 +15 @@
+DirectComposition::LayoutSynchronizationObject::ObjectInit
```

## `NTOSKRNL.EXE::KeBugCheck`  (modified)

```diff
--- NTOSKRNL.EXE::KeBugCheck calling
+++ NTOSKRNL.EXE::KeBugCheck calling
@@ -17 +16,0 @@
-IOCPDispatcher::Dispatch
@@ -20 +18,0 @@
-NtMITDispatchCompletion
```

## `NTOSKRNL.EXE::PsReferencePrimaryToken`  (modified)

```diff
--- NTOSKRNL.EXE::PsReferencePrimaryToken calling
+++ NTOSKRNL.EXE::PsReferencePrimaryToken calling
@@ -10 +9,0 @@
-xxxUserProcessCallout
```

## `NTOSKRNL.EXE::PsGetProcessWin32WindowStation`  (modified)

```diff
--- NTOSKRNL.EXE::PsGetProcessWin32WindowStation calling
+++ NTOSKRNL.EXE::PsGetProcessWin32WindowStation calling
@@ -2 +1,0 @@
-UserGlobalAtomTableCallout_Old
```
