# CVE-2026-112763 — cldflt.sys patch diff

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

## `HsmFltProcessStoreProperties`  (modified)

```diff
--- HsmFltProcessStoreProperties
+++ HsmFltProcessStoreProperties
@@ -1,508 +1,758 @@
-

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

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

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

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

 

 ulonglong HsmFltProcessStoreProperties

-                    (undefined8 param_1,longlong param_2,ulonglong param_3,undefined8 param_4,

+                    (undefined8 param_1,longlong param_2,ulonglong param_3,longlong param_4,

                     longlong param_5,longlong ****param_6,undefined8 param_7,longlong param_8,

                     ulonglong param_9,uint param_10,int param_11,int param_12)

 

 {

-  ushort uVar1;

-  uint uVar2;

-  ushort uVar3;

-  uint uVar4;

-  undefined1 (*pauVar5) [16];

-  ushort uVar6;

-  undefined8 uVar7;

-  undefined8 uVar8;

-  undefined8 uVar9;

-  byte bVar10;

-  uint in_EAX;

+  byte bVar1;

+  int iVar2;

+  longlong ****pppplVar3;

+  longlong ****pppplVar4;

+  longlong *****ppppplVar5;

+  longlong *****ppppplVar6;

+  code *pcVar7;

+  char cVar8;

+  undefined1 uVar9;

+  undefined4 uVar10;

   uint uVar11;

   uint uVar12;

-  ulonglong uVar13;

-  ushort uVar14;

-  ushort uVar15;

+  uint uVar13;

+  longlong *****ppppplVar14;

+  longlong ******pppppplVar15;

   undefined8 uVar16;

-  undefined1 (*pauVar17) [16];

-  byte bVar18;

-  ushort uVar19;

-  undefined1 (*unaff_RBX) [16];

-  uint unaff_ESI;

-  undefined1 (*pauVar21) [16];

-  undefined1 (*unaff_R12) [16];

-  longlong unaff_R13;

+  longlong ******pppppplVar17;

+  ulonglong uVar18;

+  uint uVar19;

+  uint uVar20;

+  longlong ******pppppplVar21;

   byte bVar22;

-  undefined1 (*unaff_R14) [16];

-  undefined *unaff_R15;

-  uint *puVar23;

-  void *pvVar24;

-  undefined8 uVar25;

-  byte in_stack_00000080;

-  undefined1 (*in_stack_00000088) [16];

-  void *in_stack_00000090;

-  undefined2 *in_stack_00000098;

-  uint uStack00000000000000a0;

-  int in_stack_000000a4;

-  void *in_stack_000000a8;

-  uint in_stack_000000b0;

-  undefined1 (*in_stack_000000b8) [16];

-  undefined1 (*in_stack_000000c0) [16];

-  uint in_stack_000000d0;

-  uint uStack00000000000000d4;

-  byte in_stack_000000d8;

-  uint *in_stack_000000e8;

-  undefined1 (*in_stack_000000f0) [16];

-  longlong in_stack_000000f8;

-  undefined1 (*in_stack_00000100) [16];

-  int in_stack_00000110;

-  int *in_stack_00000198;

-  size_t in_stack_000001a0;

-  undefined4 uStack00000000000001d0;

-  byte bStack00000000000001d4;

-  undefined2 uStack00000000000001dc;

-  undefined2 uStack00000000000001de;

-  undefined8 in_stack_000001e0;

-  undefined8 in_stack_000001e8;

-  undefined8 in_stack_000001f0;

-  undefined8 in_stack_000001f8;

-  uint uStack0000000000000200;

-  undefined1 (*in_stack_00000208) [16];

-  undefined4 uStack0000000000000210;

-  undefined4 uStack0000000000000214;

-  uint uVar20;

-  undefined4 uVar26;

+  undefined2 uVar23;

+  ulonglong uVar24;

+  longlong ******pppppplVar25;

+  longlong ***_Src;

+  undefined1 *puVar26;

+  longlong ******pppppplVar27;

+  longlong ******pppppplVar28;

+  undefined *puVar29;

+  longlong ******pppppplVar30;

+  int iVar31;

+  longlong ******pppppplVar32;

+  longlong ******pppppplVar33;

+  longlong ****pppplVar34;

+  undefined1 auStackY_d8 [8];

+  undefined1 auStackY_d0 [24];

+  longlong ****local_78;

+  longlong *****local_70;

+  undefined8 local_68;

+  longlong ***local_60;

+  longlong ***local_58;

+  undefined8 local_50;

+  longlong *****local_48;

+  longlong *****local_40;

   

-code_r0x000140087bd4:

-  bVar22 = (byte)unaff_R14;

-  uVar19 = (ushort)unaff_RBX;

-  uVar20 = (uint)unaff_RBX;

-  if (in_EAX != 0) {

-    pauVar21 = (undefined1 (*) [16])0x4;

-    pauVar17 = in_stack_00000100;

-    uVar11 = HsmpAccessCheck(unaff_R13,(ulonglong)in_stack_00000100,4);

-    uVar13 = (ulonglong)uVar11;

-    HsmDbgBreakOnStatus(uVar11);

-    if ((int)uVar11 < 0) {

-      if (((WPP_GLOBAL_Control != unaff_R15) &&

-          (uVar13 = (ulonglong)*(uint *)(WPP_GLOBAL_Control + 0x2c),

-          (bVar22 & (byte)*(uint *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        pauVar17 = (undefined1 (*) [16])0x6d;

-        uVar13 = *(ulonglong *)(WPP_GLOBAL_Control + 0x18);

-        pauVar21 = unaff_R12;

-        WPP_SF_qiD(uVar13,0x6d,unaff_R12,unaff_R13);

-      }

-      TlmWriteAccessDeniedForAddSubDirectory(uVar13,pauVar17,pauVar21);

-      goto LAB_0;

+  puVar26 = auStackY_d8;

+  pppppplVar28 = (longlong ******)0x0;

+  uVar20 = 0;

+  local_50 = *(undefined8 *)(param_2 + 0x20);

+  local_60 = (longlong ***)0x0;

+  local_58 = (longlong ***)0x0;

+  local_78 = (longlong ****)0x0;

+  local_68 = (longlong ****)0x0;

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

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+    puVar29 = WPP_GLOBAL_Control;

+    if (param_5 != 0) {

+      HsmpGetStreamSize(param_5);

     }

+    WPP_SF_qqLiqLiqq(*(undefined8 *)(puVar29 + 0x18),0x19,puVar29,param_2);

   }

-  uStack00000000000000d4 = uStack0000000000000200 | 0x401000;

-  if (in_stack_000000d0 == uVar20) {

-    uStack00000000000000a0 = uStack0000000000000200 >> 9 & (uint)unaff_R14;

+  uVar18 = param_9;

+  local_40 = (longlong *****)&local_48;

+  local_48 = (longlong *****)&local_48;

+  uVar12 = *(uint *)(param_9 + 0x10);

+  if (((uVar12 < 0x20) || (param_10 < uVar12)) ||

+     ((*(uint *)(param_9 + 0x14) == 0 || ((param_10 - uVar12) / *(uint *)(param_9 + 0x14) < 0x18))))

+  {

+LAB_0:

+    uVar20 = 0xc000cf0b;

+LAB_1:

+    pppppplVar25 = (longlong ******)(ulonglong)uVar20;

+LAB_2:

+    HsmDbgBreakOnStatus(uVar20);

+    pppppplVar33 = pppppplVar28;

   }

   else {

-    uStack00000000000000a0 = 0x10;

-    if ((bStack00000000000001d4 & 0x40) != 0) {

-      uStack00000000000000a0 = 0x16;

-      uStack00000000000000d4 = uStack0000000000000200 & 0xffbfefff;

+    uVar24 = uVar12 + param_9;

+    param_9 = uVar24;

+    pppppplVar25 = pppppplVar28;

+    pppppplVar33 = pppppplVar28;

+    while( true ) {

+      if (*(uint *)(uVar18 + 0x14) <= (uint)pppppplVar33) break;

+      pppplVar34 = (longlong ****)(uVar24 + (longlong)pppppplVar33 * 0x18);

+      if (*(uint *)pppplVar34 != 0) {

+        if (0x80000 < *(uint *)(pppplVar34 + 2)) {

+          pppppplVar25 = (longlong ******)0x8000cf04;

+          uVar20 = 0x8000cf04;

+          goto LAB_2;

+        }

+        ppppplVar14 = (longlong *****)

+                      ExAllocatePool2(0x100,*(uint *)(pppplVar34 + 2) * 2 + 0x58,0x72507348);

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

+          uVar20 = 0xc000009a;

+          goto LAB_1;

+        }

+        ppppplVar14[3] = pppplVar34;

+        uVar12 = *(uint *)pppplVar34;

+        *(uint *)(ppppplVar14 + 2) = uVar12;

+        *(uint *)((longlong)ppppplVar14 + 0x14) = *(uint *)(pppplVar34 + 2);

+        ppppplVar14[5] = (longlong ****)((longlong)ppppplVar14 + 0x54);

+        pppppplVar15 = &local_48;

+        for (pppppplVar17 = (longlong ******)local_40; pppppplVar17 != &local_48;

+            pppppplVar17 = (longlong ******)pppppplVar17[1]) {

+          if (*(uint *)(pppppplVar17 + 2) <= uVar12) {

+            if (uVar12 == *(uint *)(pppppplVar17 + 2)) {

+              ExFreePoolWithTag(ppppplVar14,0x72507348);

+              goto LAB_0;

+            }

+            break;

+          }

+          pppppplVar15 = pppppplVar17;

+        }

+        ppppplVar5 = pppppplVar15[1];

+        if ((longlong ******)*ppppplVar5 != pppppplVar15) goto LAB_3;

+        *ppppplVar14 = (longlong ****)pppppplVar15;

+        ppppplVar14[1] = (longlong ****)ppppplVar5;

+        *ppppplVar5 = (longlong ****)ppppplVar14;

+        pppppplVar15[1] = ppppplVar14;

+        if (*(int *)((longlong)ppppplVar14 + 0x14) != 0) {

+          _Src = pppplVar34[1];

+          cVar8 = FltIs32bitProcess(param_8);

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

+            _Src = (longlong ***)((ulonglong)_Src & 0xffffffff);

+          }

+          ProbeForRead(_Src,*(undefined4 *)((longlong)ppppplVar14 + 0x14),1);

+          memmove(ppppplVar14[5],_Src,(ulonglong)*(uint *)((longlong)ppppplVar14 + 0x14));

+          uVar10 = RtlCrc32(ppppplVar14[5],*(undefined4 *)((longlong)ppppplVar14 + 0x14),0);

+          *(undefined4 *)(ppppplVar14 + 10) = uVar10;

+          uVar12 = *(uint *)((longlong)ppppplVar14 + 0x14);

+          pppplVar34 = ppppplVar14[5];

+          uVar11 = HsmiCompressBuffer(ppppplVar14 + 10,uVar12 + 4,

+                                      (longlong ****)((ulonglong)uVar12 + (longlong)pppplVar34),

+                                      (uVar12 + 3 & 0xfffffffc) - 4,

+                                      (uint *)((longlong)ppppplVar14 + 0x3c),

+                                      (undefined1 *)(ppppplVar14 + 7),

+                                      (byte *)((longlong)ppppplVar14 + 0x39));

+          pppppplVar25 = (longlong ******)(ulonglong)uVar11;

+          HsmDbgBreakOnStatus(uVar11);

+          if (((int)uVar11 < 0) || (*(char *)(ppppplVar14 + 7) == '\0')) {

+            ppppplVar14[6] = ppppplVar14[5];

+            *(undefined4 *)((longlong)ppppplVar14 + 0x3c) =

+                 *(undefined4 *)((longlong)ppppplVar14 + 0x14);

+          }

+          else {

+            ppppplVar14[6] = (longlong ****)((ulonglong)uVar12 + (longlong)pppplVar34);

+          }

+        }

+        uVar12 = uVar20;

+        if (*(int *)((longlong)ppppplVar14 + 0x3c) != 0) {

+          uVar12 = *(int *)((longlong)ppppplVar14 + 0x3c) + 0xbU & 0xfffffffc;

+        }

+        *(uint *)(ppppplVar14 + 8) = uVar12;

+        uVar24 = param_9;

+      }

+      pppppplVar33 = (longlong ******)(ulonglong)((uint)pppppplVar33 + 1);

     }

-  }

-  if ((bStack00000000000001d4 & bVar22) != 0) {

-    uStack00000000000000a0 = uStack00000000000000a0 | 0x40;

-  }

-  if ((_bStack00000000000001d4 & 0x400) != 0) {

-    uStack00000000000000a0 = uStack00000000000000a0 | 0x100;

-  }

-  pauVar21 = (undefined1 (*) [16])(*in_stack_000000c0 + (ushort)uStack00000000000001dc);

-  pauVar17 = (undefined1 (*) [16])(ulonglong)uStack00000000000000a0;

-  puVar23 = in_stack_000000e8;

-  uVar11 = HsmpRpBuildBuffer(in_stack_00000208,uStack00000000000000a0,pauVar21,

-                             uStack00000000000001de,in_stack_000000e8);

-  uVar26 = (undefined4)((ulonglong)puVar23 >> 0x20);

-  HsmDbgBreakOnStatus(uVar11);

-  if ((int)uVar11 < 0) {

-    if (((WPP_GLOBAL_Control != unaff_R15) &&

-        ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-      pauVar17 = (undefined1 (*) [16])0x6e;

-      goto LAB_1;

-    }

-  }

-  else {

-    *in_stack_00000098 = 0x58;

-    in_stack_00000098[1] = 0x1e32;

-    in_stack_00000098[2] = uVar19;

-    *(uint **)(in_stack_00000098 + 4) = in_stack_000000e8;

-    in_stack_00000098[3] = (short)in_stack_000000e8[1] + 8;

-    *(undefined8 **)(in_stack_00000098 + 0x10) = &stack0x000001e0;

-    *(uint *)(in_stack_00000098 + 0x14) = uStack00000000000000d4;

-    if (in_stack_000000d0 == 0) {

-      if (0 < (longlong)in_stack_00000208) {

-        in_stack_00000098[1] = in_stack_00000098[1] | (ushort)unaff_R14;

-      }

-      *(undefined1 (**) [16])(in_stack_00000098 + 8) = in_stack_00000208;

-      *(undefined1 (**) [16])(in_stack_00000098 + 0xc) = in_stack_00000208;

-      in_stack_00000098[1] = in_stack_00000098[1] | 0xc;

-    }

-    *(undefined4 *)(in_stack_00000098 + 0x16) = 8;

-    uVar16 = CONCAT44(uVar26,0x100180);

-    pauVar21 = (undefined1 (*) [16])&stack0x000000f0;

-    pauVar17 = in_stack_000000b8;

-    uVar11 = FltCreateFileEx2(DAT_2,in_stack_000000b8,pauVar21,&stack0x00000088,uVar16);

-    uVar26 = (undefined4)((ulonglong)uVar16 >> 0x20);

-    HsmDbgBreakOnStatus(uVar11);

-    bVar18 = (byte)unaff_RBX;

-    pauVar5 = unaff_R14;

-    if ((((uVar11 == 0xc0000035) || (uVar11 == 0xc0000279)) &&

-        ((_bStack00000000000001d4 & 0x4000) != 0)) &&

-       (uVar13 = Feature_1245077819__private_IsEnabledDeviceUsageNoInline(), pauVar5 = unaff_RBX,

-       in_stack_00000080 = bVar18, (int)uVar13 != 0)) {

-      pauVar21 = (undefined1 (*) [16])0x40;

-      pauVar17 = in_stack_00000100;

-      uVar11 = HsmpAccessCheck(unaff_R13,(ulonglong)in_stack_00000100,0x40);

-      HsmDbgBreakOnStatus(uVar11);

-      if ((int)uVar11 < 0) {

-        pauVar21 = (undefined1 (*) [16])&stack0x00000108;

-        pauVar17 = in_stack_000000b8;

-        uVar11 = FltCreateFileEx(DAT_2,in_stack_000000b8,pauVar21,&stack0x000000e0,

-                                 CONCAT44(uVar26,0x100080));

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

-          pauVar21 = (undefined1 (*) [16])0x10000;

-          pauVar17 = unaff_RBX;

-          uVar11 = HsmpAccessCheck(unaff_R13,(ulonglong)unaff_RBX,0x10000);

-          ObfDereferenceObject(unaff_RBX);

-          FltClose(unaff_RBX);

-        }

-        if ((int)uVar11 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_R15) &&

-              ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-            pauVar17 = (undefined1 (*) [16])0x6f;

-            goto LAB_1;

-          }

-          goto LAB_0;

-        }

-      }

-    }

-    bVar10 = (byte)pauVar5;

-    if ((byte)pauVar5 == 0) {

-      pauVar21 = (undefined1 (*) [16])&stack0x000000f0;

-      pauVar17 = in_stack_000000b8;

-      uVar11 = FltCreateFileEx(DAT_2,in_stack_000000b8,pauVar21,&stack0x00000088,0x100180);

-      HsmDbgBreakOnStatus(uVar11);

-      bVar10 = in_stack_00000080;

-    }

-    if ((int)uVar11 < 0) {

-      if (((WPP_GLOBAL_Control != unaff_R15) &&

-          ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        pauVar17 = (undefined1 (*) [16])0x70;

-        goto LAB_1;

-      }

-    }

-    else {

-      if (bVar10 == 0) {

-        pauVar21 = (undefined1 (*) [16])0x8;

-        pauVar17 = in_stack_00000088;

-        uVar11 = HsmpMarkHandleUsnSourceInfo(unaff_R13,in_stack_00000088,8,0);

-        HsmDbgBreakOnStatus(uVar11);

-        if ((int)uVar11 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_R15) &&

-              ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-            pauVar17 = (undefined1 (*) [16])0x71;

-            goto LAB_1;

-          }

-          goto LAB_0;

-        }

-        pvVar24 = *in_stack_000000c0 + (ushort)uStack00000000000001dc;

-        pauVar17 = in_stack_00000088;

-        pauVar21 = in_stack_00000208;

-        uVar11 = HsmpRpCreate(unaff_R13,(longlong)in_stack_00000088,(longlong)in_stack_00000208,

-                              uStack00000000000000a0,pvVar24,uStack00000000000001de,bVar18);

-        uVar26 = (undefined4)((ulonglong)pvVar24 >> 0x20);

-        HsmDbgBreakOnStatus(uVar11);

-        if ((int)uVar11 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_R15) &&

-              ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-            pauVar17 = (undefined1 (*) [16])0x72;

-            goto LAB_1;

-          }

-          goto LAB_0;

-        }

-        if ((in_stack_000000d0 == uVar20) && (in_stack_00000208 != unaff_RBX)) {

-          pauVar21 = (undefined1 (*) [16])CONCAT71((int7)((ulonglong)pauVar21 >> 8),bVar22);

-          pauVar17 = in_stack_00000088;

-          uVar11 = HsmpToggleFileSparseAttribute(unaff_R13,(longlong)in_stack_00000088,bVar22);

-          HsmDbgBreakOnStatus(uVar11);

-          if ((int)uVar11 < 0) {

-            if (((WPP_GLOBAL_Control != unaff_R15) &&

-                ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-              pauVar17 = (undefined1 (*) [16])0x73;

-              goto LAB_1;

-            }

-            goto LAB_0;

-          }

-          uVar16 = CONCAT44(uVar26,0x14);

-          pauVar21 = (undefined1 (*) [16])&stack0x00000208;

-          pauVar17 = in_stack_00000088;

-          uVar11 = FltSetInformationFile(in_stack_000000b8,in_stack_00000088,pauVar21,8,uVar16);

-          uVar26 = (undefined4)((ulonglong)uVar16 >> 0x20);

-          HsmDbgBreakOnStatus(uVar11);

-          if ((int)uVar11 < 0) {

-            if (((WPP_GLOBAL_Control != unaff_R15) &&

-                ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-              pauVar17 = (undefined1 (*) [16])0x74;

-              goto LAB_1;

-            }

-            goto LAB_0;

-          }

-          pauVar17 = in_stack_00000088;

-          pauVar21 = in_stack_00000208;

-          uVar11 = HsmpSetFileVDL(in_stack_000000b8,in_stack_00000088,in_stack_00000208);

-          HsmDbgBreakOnStatus(uVar11);

-          if ((int)uVar11 < 0) {

-            if (((WPP_GLOBAL_Control != unaff_R15) &&

-                ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-              pauVar17 = (undefined1 (*) [16])0x75;

-              goto LAB_1;

-            }

-            goto LAB_0;

-          }

-        }

-        uVar9 = in_stack_000001f8;

-        uVar8 = in_stack_000001f0;

-        uVar7 = in_stack_000001e8;

-        uVar16 = in_stack_000001e0;

-        uVar13 = _uStack0000000000000200 >> 0x20;

-        uVar25 = CONCAT44(uVar26,4);

-        pauVar21 = (undefined1 (*) [16])&stack0x00000220;

-        pauVar17 = in_stack_00000088;

-        uVar11 = FltSetInformationFile(in_stack_000000b8,in_stack_00000088,pauVar21,0x28,uVar25);

-        uVar26 = (undefined4)((ulonglong)uVar25 >> 0x20);

-        HsmDbgBreakOnStatus(uVar11);

-        if ((int)uVar11 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_R15) &&

-              ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-            pauVar17 = (undefined1 (*) [16])0x76;

-            goto LAB_1;

-          }

-          goto LAB_0;

-        }

-        pauVar21 = (undefined1 (*) [16])(in_stack_000000c0[4] + 8);

-        pauVar17 = in_stack_00000088;

-        uVar11 = HsmpQueryLastEffectiveUsn

-                           (in_stack_000000b8,(ulonglong)in_stack_00000088,(longlong *)pauVar21);

-        HsmDbgBreakOnStatus(uVar11);

-        if ((int)uVar11 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_R15) &&

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

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

-            pauVar17 = (undefined1 (*) [16])0x77;

-            goto LAB_1;

-          }

-          goto LAB_0;

-        }

-        pauVar21 = (undefined1 (*) [16])&stack0x00000220;

-        pauVar17 = in_stack_00000088;

-        uVar11 = FltQueryInformationFile

-                           (in_stack_000000b8,in_stack_00000088,pauVar21,0x28,CONCAT44(uVar26,4));

-        HsmDbgBreakOnStatus(uVar11);

-        if ((int)uVar11 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_R15) &&

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

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

-            pauVar17 = (undefined1 (*) [16])0x78;

-            goto LAB_1;

-          }

-          goto LAB_0;

-        }

-        *(undefined8 *)in_stack_000000c0[1] = uVar16;

-        *(undefined8 *)(in_stack_000000c0[1] + 8) = uVar7;

-        *(undefined8 *)in_stack_000000c0[2] = uVar8;

-        *(undefined8 *)(in_stack_000000c0[2] + 8) = uVar9;

-        *(ulonglong *)in_stack_000000c0[3] = CONCAT44((int)uVar13,uStack00000000000000d4);

-      }

-      else {

-        *(undefined8 *)in_stack_000000c0[1] = in_stack_000001e0;

-        *(undefined8 *)(in_stack_000000c0[1] + 8) = in_stack_000001e8;

-        *(undefined8 *)in_stack_000000c0[2] = in_stack_000001f0;

-        *(undefined8 *)(in_stack_000000c0[2] + 8) = in_stack_000001f8;

-        *(undefined4 *)in_stack_000000c0[3] = *(undefined4 *)(in_stack_00000098 + 0x14);

-        *(undefined8 *)(in_stack_000000c0[4] + 8) = *(undefined8 *)(in_stack_00000098 + 0x18);

-        pauVar17 = in_stack_000000c0;

-      }

-      if (((WPP_GLOBAL_Control != unaff_R15) &&

-          ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        pauVar17 = (undefined1 (*) [16])0x79;

-        pauVar21 = unaff_R12;

-        WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x79,unaff_R12,unaff_R13);

+    pppppplVar33 = (longlong ******)0x0;

+    if ((longlong ******)local_48 != &local_48) {

+      uVar12 = HsmpLoadPropertyStream(param_2,param_5,param_3,(longlong)param_6,'\x01');

+      pppppplVar25 = (longlong ******)(ulonglong)uVar12;

+      HsmDbgBreakOnStatus(uVar12);

+      if (-1 < (int)uVar12) {

+        pppppplVar33 = (longlong ******)param_6[0x1c];

+        local_70 = (longlong *****)pppppplVar33;

+        param_9 = param_3;

+        for (pppppplVar25 = (longlong ******)local_48; pppppplVar25 != &local_48;

+            pppppplVar25 = (longlong ******)*pppppplVar25) {

+          uVar16 = HsmiDoesBlobOperationConflictWithExistingLocks

+                             ((longlong)pppppplVar33,&param_9,*(uint *)(pppppplVar25 + 2),'\x01');

+          if ((char)uVar16 != '\0') {

+            pppppplVar25 = (longlong ******)0xc000cf1a;

+            iVar31 = -0x3fff30e6;

+            goto LAB_4;

+          }

+        }

+        pppppplVar15 = pppppplVar33 + 9;

+        while( true ) {

+          pppppplVar25 = (longlong ******)*pppppplVar15;

+          uVar12 = 0;

+          if (pppppplVar25 == pppppplVar33 + 8) break;

+          pppppplVar17 = pppppplVar28;

+          pppppplVar21 = &local_48;

+          if ((longlong ******)local_40 != &local_48) {

+            pppppplVar30 = (longlong ******)local_40;

+            pppppplVar27 = &local_48;

+            do {

+              pppppplVar21 = pppppplVar30;

+              pppppplVar30 = pppppplVar21 + 2;

+              if (*(uint *)pppppplVar30 <= *(uint *)(pppppplVar25 + 2)) {

+                pppppplVar17 = pppppplVar21;

+                pppppplVar21 = pppppplVar27;

+                if (*(uint *)(pppppplVar25 + 2) != *(uint *)pppppplVar30) {

+                  pppppplVar17 = (longlong ******)0x0;

+                }

+                break;

+              }

+              pppppplVar30 = (longlong ******)pppppplVar21[1];

+              pppppplVar27 = pppppplVar21;

+            } while ((longlong ******)pppppplVar21[1] != &local_48);

+          }

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

+            pppppplVar17 = (longlong ******)ExAllocatePool2(0x100,0x58,0x72507348);

+            if (pppppplVar17 == (longlong ******)0x0) goto LAB_5;

+            *(undefined4 *)(pppppplVar17 + 2) = *(undefined4 *)(pppppplVar25 + 2);

+            if (*(char *)((longlong)pppppplVar25 + 0x1b) == '\0') {

+              uVar11 = *(uint *)(pppppplVar25 + 3);

+            }

+            else {

+              uVar11 = *(uint *)((longlong)pppppplVar25 + 0x1c);

+            }

+            *(uint *)((longlong)pppppplVar17 + 0x14) = uVar11 & 0xffffff;

+            cVar8 = *(char *)((longlong)pppppplVar25 + 0x1b);

+            *(char *)(pppppplVar17 + 7) = cVar8;

+            uVar9 = 0;

+            if (*(char *)((longlong)pppppplVar25 + 0x1b) != '\0') {

+              uVar9 = *(undefined1 *)((longlong)pppppplVar25 + 0x1f);

+            }

+            *(undefined1 *)((longlong)pppppplVar17 + 0x39) = uVar9;

+            *(uint *)((longlong)pppppplVar17 + 0x3c) = *(uint *)(pppppplVar25 + 3) & 0xffffff;

+            if ((*(uint *)(pppppplVar25 + 3) & 0xffffff) != 0) {

+              uVar12 = (*(uint *)(pppppplVar25 + 3) & 0xffffff) + 0xb & 0xfffffffc;

+            }

+            *(uint *)(pppppplVar17 + 8) = uVar12;

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

+              *(undefined4 *)(pppppplVar17 + 10) = *(undefined4 *)((longlong)pppppplVar25 + 0x1c);

+            }

+            ppppplVar14 = pppppplVar21[1];

+            pppplVar34 = param_6;

+            if ((longlong ******)*ppppplVar14 != pppppplVar21) goto LAB_3;

+            *pppppplVar17 = (longlong *****)pppppplVar21;

+            pppppplVar17[1] = ppppplVar14;

+            *ppppplVar14 = (longlong ****)pppppplVar17;

+            pppppplVar21[1] = (longlong *****)pppppplVar17;

+          }

+          pppppplVar17[4] = (longlong *****)pppppplVar25;

+          *(undefined4 *)((longlong)pppppplVar17 + 0x44) =

+               *(undefined4 *)((longlong)pppppplVar25 + 0x14);

+          pppppplVar15 = (longlong ******)(*pppppplVar15 + 1);

+        }

+        uVar18 = param_9 >> 0x20;

+        param_9 = param_9 & 0xffffffff00000000;

+        param_12 = 0;

+        pppppplVar15 = (longlong ******)local_48;

+        pppppplVar17 = pppppplVar28;

+        pppppplVar21 = pppppplVar28;

+        uVar11 = uVar12;

+        if ((longlong ******)local_48 != &local_48) {

+          do {

+            if ((*(int *)((longlong)pppppplVar15 + 0x3c) != 0) &&

+               (pppppplVar17 = (longlong ******)(ulonglong)((int)pppppplVar17 + 1),

+               (*(byte *)((longlong)pppppplVar15 + 0x12) & 2) != 0)) {

+              pppppplVar21 = (longlong ******)(ulonglong)((int)pppppplVar21 + 1);

+            }

+            uVar11 = (uint)pppppplVar17;

+            pppppplVar15 = (longlong ******)*pppppplVar15;

+          } while (pppppplVar15 != &local_48);

+          param_12 = (int)pppppplVar21;

+          param_9 = CONCAT44((int)uVar18,uVar11);

+        }

+        if (uVar11 < 3) {

+          iVar31 = 2;

+        }

+        else {

+          iVar31 = (uVar11 - 1 & 0xfffffffe) + 2;

+        }

+        param_11 = iVar31;

+        uVar11 = iVar31 * 8 + 0x10;

+        pppppplVar15 = &local_48;

+        pppppplVar17 = &local_48;

+        pppppplVar21 = (longlong ******)local_48;

+        if ((longlong ******)local_48 != &local_48) {

+          do {

+            ppppplVar14 = pppppplVar21[4];

+            if ((((ppppplVar14 == (longlong *****)0x0) ||

+                 (((ulonglong)ppppplVar14[3] & 0xffffff) == 0)) ||

+                (*(uint *)((longlong)ppppplVar14 + 0x14) < uVar11)) ||

+               (pppppplVar21[3] != (longlong *****)0x0)) {

+              ppppplVar14 = *pppppplVar21;

+              pppplVar34 = param_6;

+              if (((longlong ******)pppppplVar21[1] != pppppplVar17) ||

+                 ((longlong ******)ppppplVar14[1] != pppppplVar21)) goto LAB_3;

+              *pppppplVar17 = ppppplVar14;

+              ppppplVar14[1] = (longlong ****)pppppplVar17;

+              if ((longlong ******)*local_40 != &local_48) goto LAB_3;

+              *pppppplVar21 = (longlong *****)&local_48;

+              pppppplVar21[1] = local_40;

+              *local_40 = (longlong ****)pppppplVar21;

+              local_40 = (longlong *****)pppppplVar21;

+              if (pppppplVar15 == &local_48) {

+                pppppplVar15 = pppppplVar21;

+              }

+              pppppplVar17 = (longlong ******)pppppplVar17[1];

+            }

+            else {

+              *(undefined4 *)(pppppplVar21 + 9) = *(undefined4 *)((longlong)pppppplVar21 + 0x44);

+              *(undefined1 *)((longlong)pppppplVar21 + 0x4c) = 1;

+            }

+            pppppplVar17 = (longlong ******)*pppppplVar17;

+            pppppplVar21 = (longlong ******)*pppppplVar17;

+          } while (pppppplVar21 != pppppplVar15);

+        }

+        pppppplVar17 = &local_48;

+        pppppplVar21 = (longlong ******)local_48;

+        while (pppppplVar21 != pppppplVar15) {

+          pppppplVar30 = pppppplVar17;

+          if (pppppplVar17 != &local_48) {

+            do {

+              if (*(uint *)((longlong)pppppplVar30 + 0x44) <=

+                  *(uint *)((longlong)pppppplVar21 + 0x44)) break;

+              pppppplVar30 = (longlong ******)pppppplVar30[1];

+            } while (pppppplVar30 != &local_48);

+          }

+          if (pppppplVar30 != pppppplVar17) {

+            ppppplVar14 = *pppppplVar21;

+            pppplVar34 = param_6;

+            if (((longlong ******)pppppplVar21[1] != pppppplVar17) ||

+               ((longlong ******)ppppplVar14[1] != pppppplVar21)) goto LAB_3;

+            *pppppplVar17 = ppppplVar14;

+            ppppplVar14[1] = (longlong ****)pppppplVar17;

+            ppppplVar14 = *pppppplVar30;

+            if ((longlong ******)ppppplVar14[1] != pppppplVar30) goto LAB_3;

+            *pppppplVar21 = ppppplVar14;

+            pppppplVar21[1] = (longlong *****)pppppplVar30;

+            ppppplVar14[1] = (longlong ****)pppppplVar21;

+            *pppppplVar30 = (longlong *****)pppppplVar21;

+            pppppplVar17 = (longlong ******)pppppplVar17[1];

+          }

+          pppppplVar17 = (longlong ******)*pppppplVar17;

+          pppppplVar21 = (longlong ******)*pppppplVar17;

+        }

+        if (pppppplVar15 != &local_48) {

+          do {

+            pppppplVar17 = (longlong ******)pppppplVar15[1];

+            pppppplVar21 = pppppplVar28;

+            pppppplVar30 = pppppplVar28;

+            iVar31 = param_11;

+            if (pppppplVar17 == &local_48) break;

+            do {

+              pppppplVar27 = (longlong ******)pppppplVar17[1];

+              if (pppppplVar27 == &local_48) {

+                uVar13 = *(int *)(pppppplVar17 + 9) - uVar11;

+              }

+              else {

+                uVar13 = (*(int *)(pppppplVar17 + 9) - *(int *)(pppppplVar27 + 9)) -

+                         *(int *)(pppppplVar27 + 8);

+              }

+              if ((uint)pppppplVar21 < uVar13) {

+                pppppplVar21 = (longlong ******)(ulonglong)uVar13;

+                pppppplVar30 = pppppplVar17;

+              }

+              pppppplVar17 = pppppplVar27;

+            } while (pppppplVar27 != &local_48);

+            if ((uint)pppppplVar21 == 0) break;

+            pppppplVar17 = pppppplVar15;

+            pppppplVar27 = pppppplVar28;

+            pppppplVar32 = pppppplVar28;

+            uVar13 = uVar12;

+            if (pppppplVar15 != &local_48) {

+              do {

+                uVar13 = *(uint *)(pppppplVar17 + 8);

+                if ((uVar13 <= (uint)pppppplVar21) && ((uint)pppppplVar32 < uVar13)) {

+                  pppppplVar32 = (longlong ******)(ulonglong)uVar13;

+                  pppppplVar27 = pppppplVar17;

+                }

+                uVar13 = (uint)pppppplVar32;

+                pppppplVar17 = (longlong ******)*pppppplVar17;

+              } while (pppppplVar17 != &local_48);

+            }

+            if (uVar13 == 0) break;

+            if (pppppplVar27 == pppppplVar15) {

+              pppppplVar15 = (longlong ******)*pppppplVar15;

+            }

+            ppppplVar14 = pppppplVar27[1];

+            pppplVar3 = *ppppplVar14;

+            pppplVar4 = (longlong ****)*pppplVar3;

+            pppplVar34 = param_6;

+            if (((longlong *****)pppplVar3[1] != ppppplVar14) ||

+               ((longlong ****)pppplVar4[1] != pppplVar3)) goto LAB_3;

+            *ppppplVar14 = pppplVar4;

+            pppplVar4[1] = (longlong ***)ppppplVar14;

+            for (pppppplVar17 = (longlong ******)pppppplVar30[1];

+                ((pppppplVar17 != &local_48 && (*(char *)((longlong)pppppplVar17 + 0x4c) == '\0'))

+                && (*(uint *)(pppppplVar27 + 2) < *(uint *)(pppppplVar17 + 2)));

+                pppppplVar17 = (longlong ******)pppppplVar17[1]) {

+              *(int *)(pppppplVar17 + 9) = *(int *)(pppppplVar17 + 9) + *(int *)(pppppplVar27 + 8);

+            }

+            ppppplVar14 = *pppppplVar17;

+            if ((longlong ******)ppppplVar14[1] != pppppplVar17) goto LAB_3;

+            *pppppplVar27 = ppppplVar14;

+            pppppplVar27[1] = (longlong *****)pppppplVar17;

+            ppppplVar14[1] = (longlong ****)pppppplVar27;

+            *pppppplVar17 = (longlong *****)pppppplVar27;

+            pppppplVar17 = (longlong ******)pppppplVar27[1];

+            uVar13 = uVar11;

+            if (pppppplVar17 != &local_48) {

+              uVar13 = *(int *)(pppppplVar17 + 9) + *(int *)(pppppplVar17 + 8);

+            }

+            *(uint *)(pppppplVar27 + 9) = uVar13;

+            iVar31 = param_11;

+          } while (pppppplVar15 != &local_48);

+        }

+        for (; pppppplVar15 != &local_48; pppppplVar15 = (longlong ******)*pppppplVar15) {

+          if (*(int *)((longlong)pppppplVar15 + 0x3c) != 0) {

+            pppppplVar25 = (longlong ******)pppppplVar15[1];

+            if (pppppplVar25 == &local_48) {

+              *(uint *)(pppppplVar15 + 9) = uVar11;

+            }

+            else {

+              *(int *)(pppppplVar15 + 9) = *(int *)(pppppplVar25 + 9) + *(int *)(pppppplVar25 + 8);

+            }

+          }

+        }

+        iVar31 = iVar31 * 8 + 0x10;

+        local_78 = (longlong ****)ExAllocatePool2(0x100,iVar31,0x72507348);

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

+LAB_5:

+          iVar31 = -0x3fffff66;

+          pppppplVar25 = (longlong ******)0xc000009a;

+LAB_4:

+          HsmDbgBreakOnStatus(iVar31);

+        }

+        else {

+          *(undefined1 *)local_78 = 2;

+          *(undefined1 *)((longlong)local_78 + 1) = 0;

+          *(short *)((longlong)local_78 + 2) = (short)iVar31;

+          if ((longlong ******)local_48 != &local_48) {

+            pppppplVar15 = pppppplVar33 + 8;

+            pppppplVar25 = (longlong ******)local_48;

+            pppppplVar17 = pppppplVar28;

+            do {

+              if (*(int *)((longlong)pppppplVar25 + 0x3c) != 0) {

+                if (pppppplVar25[4] == (longlong *****)0x0) {

+                  ppppplVar14 = (longlong *****)ExAllocatePool2(0x100,0x28,0x72507348);

+                  if (ppppplVar14 == (longlong *****)0x0) goto LAB_5;

+                  *(undefined4 *)(ppppplVar14 + 2) = *(undefined4 *)(pppppplVar25 + 2);

+                  HsmiLookupPropertyLockForBlob((longlong)pppppplVar33,(longlong)ppppplVar14);

+                  pppppplVar21 = pppppplVar15;

+                  if ((longlong ******)pppppplVar33[9] != pppppplVar15) {

+                    pppppplVar30 = (longlong ******)pppppplVar33[9];

+                    do {

+                      pppppplVar27 = pppppplVar30;

+                      if (*(uint *)(pppppplVar27 + 2) <= *(uint *)(ppppplVar14 + 2)) break;

+                      pppppplVar30 = (longlong ******)pppppplVar27[1];

+                      pppppplVar21 = pppppplVar27;

+                    } while ((longlong ******)pppppplVar27[1] != pppppplVar15);

+                  }

+                  ppppplVar5 = pppppplVar21[1];

+                  pppplVar34 = param_6;

+                  if ((longlong ******)*ppppplVar5 != pppppplVar21) goto LAB_3;

+                  *ppppplVar14 = (longlong ****)pppppplVar21;

+                  ppppplVar14[1] = (longlong ****)ppppplVar5;

+                  *ppppplVar5 = (longlong ****)ppppplVar14;

+                  pppppplVar21[1] = ppppplVar14;

+                  pppppplVar25[4] = ppppplVar14;

+                }

+                *(undefined4 *)(local_78 + (longlong)pppppplVar17 + 2) =

+                     *(undefined4 *)(pppppplVar25 + 2);

+                *(undefined4 *)((longlong)local_78 + (longlong)pppppplVar17 * 8 + 0x14) =

+                     *(undefined4 *)(pppppplVar25 + 9);

+                pppppplVar17 = (longlong ******)(ulonglong)((int)pppppplVar17 + 1);

+              }

+              pppppplVar25 = (longlong ******)*pppppplVar25;

+            } while (pppppplVar25 != &local_48);

+          }

+          uVar16 = local_50;

+          pppppplVar25 = (longlong ******)local_40;

+          pppppplVar15 = (longlong ******)local_48;

+          if ((longlong ******)local_48 != &local_48) {

+            do {

+              if (((pppppplVar15[4] != (longlong *****)0x0) &&

+                  (*(int *)((longlong)pppppplVar15 + 0x3c) != 0)) &&

+                 ((*(int *)((longlong)pppppplVar15 + 0x44) != 0 &&

+                  ((*(int *)(pppppplVar15 + 9) != *(int *)((longlong)pppppplVar15 + 0x44) &&

+                   (pppppplVar15[3] == (longlong *****)0x0)))))) {

+                uVar13 = *(uint *)((longlong)pppppplVar33 + 0x3c);

+                uVar19 = uVar12;

+                if (uVar13 != 0) {

+                  ppppplVar14 = pppppplVar33[6];

+                  pppppplVar25 = pppppplVar28;

+                  do {

+                    iVar31 = (int)pppppplVar25;

+                    if (*(int *)(ppppplVar14 + (longlong)pppppplVar25) == *(int *)(pppppplVar15 + 2)

+                       ) {

+                      if (iVar31 == uVar13 - 1) {

+                        iVar31 = *(int *)((longlong)pppppplVar33[5] + 0xc) +

+                                 *(int *)(pppppplVar33[5] + 1);

+                      }

+                      else {

+                        iVar31 = *(int *)((longlong)ppppplVar14 + (ulonglong)(iVar31 + 1) * 8 + 4);

+                      }

+                      uVar19 = iVar31 - *(int *)((longlong)ppppplVar14 +

+                                                (longlong)pppppplVar25 * 8 + 4);

+                      break;

+                    }

+                    pppppplVar25 = (longlong ******)(ulonglong)(iVar31 + 1U);

+                  } while (iVar31 + 1U < uVar13);

+                }

+                ppppplVar14 = (longlong *****)ExAllocatePool2(0x100,uVar19,0x72507348);

+                pppppplVar15[6] = ppppplVar14;

+                if (ppppplVar14 == (longlong *****)0x0) goto LAB_5;

+                local_60 = (longlong ***)((ulonglong)*(uint *)((longlong)pppppplVar15 + 0x44) + 8);

+                uVar13 = FltReadFile(uVar16,pppppplVar33[3],&local_60,

+                                     *(undefined4 *)((longlong)pppppplVar15 + 0x3c));

+                pppppplVar25 = (longlong ******)(ulonglong)uVar13;

+                HsmDbgBreakOnStatus(uVar13);

+                if ((int)uVar13 < 0) {

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

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

+                     ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_6;

+                  uVar23 = 0x1a;

+                  goto LAB_7;

+                }

+              }

+              pppppplVar15 = (longlong ******)*pppppplVar15;

+              pppppplVar25 = (longlong ******)local_40;

+            } while (pppppplVar15 != &local_48);

+          }

+          for (; uVar16 = local_50, pppppplVar25 != &local_48;

+              pppppplVar25 = (longlong ******)pppppplVar25[1]) {

+            if ((pppppplVar25[4] != (longlong *****)0x0) &&

+               (*(int *)((longlong)pppppplVar25 + 0x3c) != 0)) {

+              uVar20 = (*(int *)(pppppplVar25 + 9) + *(int *)(pppppplVar25 + 8)) - uVar11;

+              break;

+            }

+          }

+          uVar12 = uVar20 + uVar11;

+          bVar1 = *(byte *)((longlong)pppppplVar33[5] + 1);

+          bVar22 = bVar1 & 1;

+          if ((bVar22 != 0) || (*(uint *)(param_2 + 0x5c) <= uVar12)) {

+            if (bVar22 == 0) {

+              *(byte *)((longlong)pppppplVar33[5] + 1) = bVar1 | 1;

+            }

+            uVar12 = (uVar12 - 1) + *(int *)(param_2 + 0x54) & -*(int *)(param_2 + 0x54);

+            uVar20 = uVar12 - uVar11;

+          }

+          *(uint *)(local_78 + 1) = uVar11;

+          *(uint *)((longlong)local_78 + 0xc) = uVar20;

+          if (*(uint *)(pppppplVar33 + 4) < uVar12) {

+            local_58 = (longlong ***)(ulonglong)uVar12;

+            uVar20 = FltSetInformationFile(local_50,pppppplVar33[3],&local_58,8);

+            pppppplVar25 = (longlong ******)(ulonglong)uVar20;

+            HsmDbgBreakOnStatus(uVar20);

+            if (-1 < (int)uVar20) {

+              *(int *)(pppppplVar33 + 4) = (int)local_58;

+              *(int *)((longlong)param_6 + 0xec) = (int)local_58;

+              *(undefined1 *)(param_6 + 0x1d) = 1;

+              goto LAB_8;

+            }

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

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

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_6;

+            uVar23 = 0x1b;

+LAB_7:

+            WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar23,

+                        &WPP_763fdbe3267e397a59cf662dc14be4ed_Traceguids,param_2);

+          }

+          else {

+LAB_8:

+            uVar10 = RtlCrc32(local_78,*(undefined2 *)((longlong)local_78 + 2),0);

+            *(undefined4 *)((longlong)local_78 + 4) = uVar10;

+            if ((*(short *)((longlong)local_78 + 2) != *(short *)((longlong)pppppplVar33[5] + 2)) ||

+               (uVar18 = RtlCompareMemory(&local_78,pppppplVar33 + 5,

+                                          *(short *)((longlong)local_78 + 2)),

+               ppppplVar14 = (longlong *****)local_78, uVar18 != *(ushort *)((longlong)local_78 + 2)

+               )) {

+              local_60 = (longlong ***)0x0;

+              ppppplVar14 = (longlong *****)&local_60;

+              uVar20 = FltWriteFile(uVar16,pppppplVar33[3],ppppplVar14,

+                                    *(undefined2 *)((longlong)local_78 + 2));

+              pppppplVar25 = (longlong ******)(ulonglong)uVar20;

+              if ((int)uVar20 < 0) {

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

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

+                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_6;

+                uVar23 = 0x1c;

+                goto LAB_7;

+              }

+              ExFreePoolWithTag(pppppplVar33[5],0x72507348);

+              pppppplVar33[5] = (longlong *****)local_78;

+              local_78 = (longlong ****)0x0;

+              pppppplVar33[6] = pppppplVar33[5] + 2;

+              *(int *)(pppppplVar33 + 7) = param_11;

+              *(undefined4 *)((longlong)pppppplVar33 + 0x3c) = (undefined4)param_9;

+            }

+            pppppplVar28 = (longlong ******)local_48;

+            if ((longlong ******)local_48 != &local_48) {

+              do {

+                if (((pppppplVar28[4] != (longlong *****)0x0) &&

+                    (((ulonglong)pppppplVar28[4][3] & 0xffffff) != 0)) ||

+                   (*(int *)((longlong)pppppplVar28 + 0x3c) != 0)) {

+                  if (*(byte *)(pppppplVar28 + 7) == 0) {

+                    uVar20 = *(uint *)(pppppplVar28 + 10);

+                  }

+                  else {

+                    uVar20 = (uint)*(byte *)((longlong)pppppplVar28 + 0x39) << 0x18 |

+                             *(uint *)((longlong)pppppplVar28 + 0x14) & 0xffffff;

+                  }

+                  local_68 = (longlong ****)

+                             CONCAT44(uVar20,(uint)*(byte *)(pppppplVar28 + 7) << 0x18 |

+                                             *(uint *)((longlong)pppppplVar28 + 0x3c) & 0xffffff);

+                  iVar31 = *(int *)(pppppplVar28 + 9);

+                  iVar2 = *(int *)((longlong)pppppplVar28[4] + 0x14);

+                  ppppplVar14 = (longlong *****)0x0;

+                  param_9 = RtlCompareMemory(&local_68,pppppplVar28[4] + 3,8);

+                  if (*(int *)((longlong)pppppplVar28 + 0x3c) != 0) {

+                    if ((iVar31 != iVar2) || (param_9 != 8)) {

+                      local_60 = (longlong ***)(ulonglong)*(uint *)(pppppplVar28 + 9);

+                      ppppplVar14 = (longlong *****)&local_60;

+                      uVar20 = FltWriteFile(local_50,local_70[3],ppppplVar14,8);

+                      pppppplVar25 = (longlong ******)(ulonglong)uVar20;

+                      HsmDbgBreakOnStatus(uVar20);

+                      if (-1 < (int)uVar20) goto LAB_9;

+                      pppppplVar33 = (longlong ******)local_70;

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

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

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

+                        uVar23 = 0x1d;

+LAB_10:

+                        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar23,

+                                    &WPP_763fdbe3267e397a59cf662dc14be4ed_Traceguids,param_2);

+                        pppppplVar33 = (longlong ******)local_70;

+                      }

+                      goto LAB_6;

+                    }

+LAB_9:

+                    if ((iVar31 != iVar2) || (pppppplVar28[3] != (longlong *****)0x0)) {

+                      local_60 = (longlong ***)((ulonglong)*(uint *)(pppppplVar28 + 9) + 8);

+                      ppppplVar14 = (longlong *****)&local_60;

+                      uVar20 = FltWriteFile(local_50,local_70[3],ppppplVar14,

+                                            *(undefined4 *)((longlong)pppppplVar28 + 0x3c));

+                      pppppplVar25 = (longlong ******)(ulonglong)uVar20;

+                      HsmDbgBreakOnStatus(uVar20);

+                      if ((int)uVar20 < 0) {

+                        pppppplVar33 = (longlong ******)local_70;

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

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

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

+                          uVar23 = 0x1e;

+                          goto LAB_10;

+                        }

+                        goto LAB_6;

+                      }

+                    }

+                  }

+                  if (iVar31 != iVar2) {

+                    *(undefined4 *)((longlong)pppppplVar28[4] + 0x14) =

+                         *(undefined4 *)(pppppplVar28 + 9);

+                  }

+                  if (param_9 != 8) {

+                    pppppplVar28[4][3] = local_68;

+                  }

+                }

+                pppppplVar28 = (longlong ******)*pppppplVar28;

+                pppppplVar33 = (longlong ******)local_70;

+              } while (pppppplVar28 != &local_48);

+            }

+            if (uVar12 < *(uint *)(pppppplVar33 + 4)) {

+              local_58 = (longlong ***)(ulonglong)uVar12;

+              ppppplVar14 = (longlong *****)&local_58;

+              iVar31 = FltSetInformationFile(local_50,pppppplVar33[3],ppppplVar14,8);

+              HsmDbgBreakOnStatus(iVar31);

+              if (iVar31 < 0) {

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

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

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

+                  ppppplVar14 = (longlong *****)&WPP_763fdbe3267e397a59cf662dc14be4ed_Traceguids;

+                  WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x1f,

+                              &WPP_763fdbe3267e397a59cf662dc14be4ed_Traceguids,param_2);

+                }

+              }

+              else {

+                *(int *)(pppppplVar33 + 4) = (int)local_58;

+                *(int *)((longlong)param_6 + 0xec) = (int)local_58;

+                *(undefined1 *)(param_6 + 0x1d) = 1;

+              }

+            }

+            if (param_5 != 0) {

+              HsmpPersistEssentialPropPresent

+                        (param_5,param_3,CONCAT71((int7)((ulonglong)ppppplVar14 >> 8),param_12 != 0)

+                        );

+            }

+            *(undefined8 *)(param_8 + 0x20) = 0;

+            pppppplVar25 = (longlong ******)0x0;

+          }

+        }

       }

     }

   }

-LAB_0:

-  *(uint *)in_stack_000000c0[4] = uVar11;

-  if (in_stack_00000088 != (undefined1 (*) [16])0x0) {

-    if ((int)uVar11 < 0) {

-      pauVar17 = in_stack_00000088;

-      HsmpSetFileDisposition(*(undefined8 *)(unaff_R13 + 0x20),in_stack_00000088);

+LAB_6:

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

+    pppppplVar33 = pppppplVar33 + 8;

+    pppppplVar28 = (longlong ******)*pppppplVar33;

+    pppppplVar15 = pppppplVar33;

+    while (pppppplVar17 = pppppplVar28, pppppplVar17 != pppppplVar33) {

+      if (((ulonglong)pppppplVar17[3] & 0xffffff) == 0) {

+        ppppplVar14 = *pppppplVar17;

+        pppplVar34 = param_6;

+        if (((longlong ******)pppppplVar17[1] != pppppplVar15) ||

+           ((longlong ******)ppppplVar14[1] != pppppplVar17)) goto LAB_3;

+        *pppppplVar15 = ppppplVar14;

+        ppppplVar14[1] = (longlong ****)pppppplVar15;

+        HsmiFreePropertyBlob((longlong)pppppplVar17);

+        pppppplVar17 = (longlong ******)*pppppplVar15[1];

+      }

+      pppppplVar15 = pppppplVar17;

+      pppppplVar28 = (longlong ******)*pppppplVar17;

     }

-    ObfDereferenceObject(in_stack_00000088);

-    in_stack_00000088 = unaff_RBX;

+    ExReleaseResourceLite(param_6 + 0xf);

+    KeLeaveCriticalRegion();

   }

-  if (in_stack_000000f0 != (undefined1 (*) [16])0x0) {

-    FltClose();

-    in_stack_000000f0 = unaff_RBX;

+  while (ppppplVar14 = local_48, pppplVar34 = param_6, (longlong ******)local_48 != &local_48) {

+    pppppplVar28 = (longlong ******)*local_48;

+    if (((longlong ******)local_48[1] != &local_48) || (pppppplVar28[1] != local_48))

+    goto LAB_3;

+    pppppplVar28[1] = (longlong *****)&local_48;

+    ppppplVar5 = (longlong *****)local_48[6];

+    if ((ppppplVar5 != (longlong *****)0x0) &&

+       ((ppppplVar6 = (longlong *****)local_48[5], ppppplVar6 == (longlong *****)0x0 ||

+        ((ppppplVar5 != ppppplVar6 &&

+         (ppppplVar5 !=

+          (longlong *****)((ulonglong)*(uint *)((longlong)local_48 + 0x14) + (longlong)ppppplVar6)))

+        )))) {

+      local_48 = (longlong *****)pppppplVar28;

+      ExFreePoolWithTag(ppppplVar5,0x72507348);

+      pppppplVar28 = (longlong ******)local_48;

+    }

+    local_48 = (longlong *****)pppppplVar28;

+    ppppplVar5 = (longlong *****)ppppplVar14[5];

+    if ((ppppplVar5 != (longlong *****)0x0) &&

+       (ppppplVar5 != (longlong *****)((longlong)ppppplVar14 + 0x54))) {

+      ExFreePoolWithTag(ppppplVar5,0x72507348);

+    }

+    ExFreePoolWithTag(ppppplVar14,0x72507348);

   }

-  if (((int)uVar11 < 0) && ((in_stack_000000d8 & bVar22) != 0)) goto LAB_3;

-  uVar12 = uVar20;

-  if (uStack00000000000001d0 != uVar20) {

-    uVar12 = in_stack_000000b0 + uStack00000000000001d0;

+LAB_11:

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

+    *(undefined8 *)(puVar26 + -8) = 0x14008ad69;

+    ExFreePoolWithTag(*(longlong *)(puVar26 + 0x60),0x72507348);

   }

-  if (uVar12 == 0) goto LAB_3;

-  pauVar21 = (undefined1 (*) [16])0x50;

-  memset(&stack0x000001d0,0,0x50);

-  in_stack_000000c0 = (undefined1 (*) [16])((longlong)in_stack_000000a8 + (ulonglong)uVar12);

-  uVar11 = in_stack_00000110 - uVar12;

-  pauVar17 = (undefined1 (*) [16])(ulonglong)uVar11;

-  if (uVar11 < 0x50) {

-    uVar11 = 0xc000cf0b;

-    HsmDbgBreakOnStatus(-0x3fff30f5);

-    unaff_ESI = ~-(uint)(in_stack_000000a4 != 0) & 0xc000cf0b;

-    if (((WPP_GLOBAL_Control == unaff_R15) ||

-        ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_3;

-    pauVar17 = (undefined1 (*) [16])0x67;

-    goto LAB_4;

-  }

-  _uStack00000000000001d0 = *in_stack_000000c0;

-  in_stack_000001e0 = *(undefined8 *)in_stack_000000c0[1];

-  in_stack_000001e8 = *(undefined8 *)(in_stack_000000c0[1] + 8);

-  in_stack_000001f0 = *(undefined8 *)in_stack_000000c0[2];

-  in_stack_000001f8 = *(undefined8 *)(in_stack_000000c0[2] + 8);

-  _uStack0000000000000200 = *(ulonglong *)in_stack_000000c0[3];

-  in_stack_00000208 = *(undefined1 (**) [16])(in_stack_000000c0[3] + 8);

-  _uStack0000000000000210 = *(undefined8 *)in_stack_000000c0[4];

-  pauVar21 = (undefined1 (*) [16])(uStack00000000000001d0._8_8_ >> 0x20 & 0xffff);

-  uVar2 = (uint)pauVar21;

-  uVar6 = uStack00000000000001d0._14_2_;

-  uVar14 = uStack00000000000001d0._10_2_;

-  uVar3 = uStack00000000000001d0._8_2_;

-  uVar4 = uVar2 + uVar6;

-  if (uVar2 + uVar6 < (uint)uVar3 + (uint)uVar14) {

-    uVar4 = (uint)uVar3 + (uint)uVar14;

-  }

-  if (((uVar11 < uVar3) || (uVar11 - uVar3 < (uint)uVar14)) ||

-     ((uVar11 < uVar2 || ((uVar11 - uVar2 < (uint)uVar6 || (0x1000 < uVar6)))))) {

-LAB_5:

-    uVar11 = 0xc000cf0b;

-    HsmDbgBreakOnStatus(-0x3fff30f5);

-    unaff_ESI = ~-(uint)(in_stack_000000a4 != 0) & 0xc000cf0b;

-    if ((WPP_GLOBAL_Control == unaff_R15) ||

-       (((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0 ||

-        ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_3;

-    pauVar17 = (undefined1 (*) [16])0x68;

-    uVar16 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-    goto LAB_6;

-  }

-  pauVar21 = (undefined1 (*) [16])(ulonglong)(uint)uStack00000000000001d0;

-  if ((uStack00000000000001d0 != 0) &&

-     (((uint)uStack00000000000001d0 < uVar4 || (uVar11 < (uint)uStack00000000000001d0))))

-  goto LAB_5;

-  for (uVar15 = uVar19; in_stack_000000b0 = uVar12, uVar15 < uVar14 >> 1;

-      uVar15 = uVar15 + (ushort)unaff_R14) {

-    uVar1 = *(ushort *)(*in_stack_000000c0 + (ulonglong)uVar15 * 2 + (ulonglong)uVar3);

-    pauVar17 = (undefined1 (*) [16])(ulonglong)uVar1;

-    if ((uVar1 == 0x5c) || (uVar1 == 0x3a)) {

-      uVar11 = 0xc000cf0b;

-      HsmDbgBreakOnStatus(-0x3fff30f5);

-      if ((WPP_GLOBAL_Control == unaff_R15) ||

-         (((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0 ||

-          ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_0;

-      pauVar17 = (undefined1 (*) [16])0x69;

-      goto LAB_7;

-    }

-  }

-  if ((uStack00000000000001d0 & 3) != 0) {

-    HsmDbgBreakOnStatus(-0x3fff30f5);

-    uVar11 = 0xc000cf0b;

-    if (((WPP_GLOBAL_Control != unaff_R15) &&

-        (uVar11 = 0xc000cf0b, (bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-      pauVar17 = (undefined1 (*) [16])0x6a;

-LAB_4:

-      uVar16 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-LAB_6:

-      uVar11 = 0xc000cf0b;

-      WPP_SF_qiD(uVar16,(short)pauVar17,unaff_R12,unaff_R13);

-      pauVar21 = unaff_R12;

-    }

+  *(undefined8 *)(puVar26 + -8) = 0x14008ad76;

+  HsmpUnloadPropertyStream((longlong)pppplVar34);

+  return (ulonglong)pppppplVar25 & 0xffffffff;

 LAB_3:

-    if (((in_stack_000000a4 != 0) && (uVar11 = unaff_ESI, WPP_GLOBAL_Control != unaff_R15)) &&

-       (((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

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

-      WPP_SF_qqdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),pauVar17,pauVar21,unaff_R13);

-    }

-    *in_stack_00000198 = in_stack_000000a4;

-    if (in_stack_000000e8 != (uint *)0x0) {

-      ExFreePoolWithTag(in_stack_000000e8,0x70527348);

-    }

-    if (in_stack_000000f8 != 0) {

-      FltFreeExtraCreateParameterList(DAT_2);

-    }

-    if (in_stack_000000a8 != (void *)0x0) {

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

-        memmove(in_stack_00000090,in_stack_000000a8,in_stack_000001a0);

-      }

-      ExFreePoolWithTag(in_stack_000000a8,0x70537348);

-    }

-    if (in_stack_00000100 != (undefined1 (*) [16])0x0) {

-      ObfDereferenceObject();

-    }

-    return (ulonglong)uVar11;

-  }

-  in_EAX = uStack0000000000000200 & 0x10;

-  if (((((_uStack0000000000000200 & 0x10) == 0) && ((in_stack_000000d8 & 2) == 0)) &&

-      (in_stack_00000208 != unaff_RBX)) ||

-     ((((_uStack0000000000000200 & 0x10) != 0 && ((in_stack_000000d8 & 4) == 0)) &&

-      ((bStack00000000000001d4 & 0x40) == 0)))) {

-    uVar11 = 0xc000cf0b;

-    HsmDbgBreakOnStatus(-0x3fff30f5);

-    if (((WPP_GLOBAL_Control == unaff_R15) ||

-        ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-    pauVar17 = (undefined1 (*) [16])0x6b;

-  }

-  else {

-    if (uVar6 != uVar19) goto LAB_8;

-    uVar11 = 0xc000cf0b;

-    HsmDbgBreakOnStatus(-0x3fff30f5);

-    if (((WPP_GLOBAL_Control == unaff_R15) ||

-        ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-    pauVar17 = (undefined1 (*) [16])0x6c;

-  }

-LAB_7:

-  uVar11 = 0xc000cf0b;

-LAB_1:

-  pauVar21 = unaff_R12;

-  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(short)pauVar17,unaff_R12,unaff_R13);

-  goto LAB_0;

-LAB_8:

-  in_stack_000000a4 = in_stack_000000a4 + (uint)unaff_R14;

-  uStack0000000000000210 = 0xc000cf07;

-  in_stack_00000080 = bVar22;

-  in_stack_000000d0 = in_EAX;

-  goto code_r0x000140087bd4;

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

+  (*pcVar7)(3);

+  puVar26 = auStackY_d0;

+  goto LAB_11;

 }
```

## `CldiPortProcessServiceCommands`  (modified)

```diff
--- CldiPortProcessServiceCommands
+++ CldiPortProcessServiceCommands
@@ -1,161 +1,814 @@
 

 void * CldiPortProcessServiceCommands(longlong param_1,short param_2,longlong param_3,uint param_4)

 

 {

-  longlong lVar1;

-  longlong *plVar2;

-  undefined4 uVar3;

-  int iVar4;

-  uint uVar5;

-  undefined4 *puVar6;

-  ulonglong uVar7;

-  undefined8 uVar8;

-  undefined *puVar9;

-  undefined2 uVar10;

-  undefined8 *unaff_RBX;

-  void *pvVar11;

-  undefined8 *puVar12;

-  byte bVar13;

-  longlong unaff_R12;

-  undefined8 unaff_R13;

-  int iVar14;

-  undefined4 *unaff_R14;

-  uint unaff_R15D;

-  undefined8 in_stack_00000020;

-  undefined4 *in_stack_00000040;

-  int in_stack_00000048;

-  int in_stack_00000050;

-  undefined4 in_stack_00000054;

-  undefined8 in_stack_00000058;

-  undefined4 *in_stack_00000060;

-  longlong in_stack_00000070;

-  longlong *in_stack_00000078;

-  undefined8 in_stack_00000090;

-  undefined8 in_stack_00000098;

-  undefined8 *in_stack_000000e0;

-  undefined1 in_stack_000000e8;

-  undefined8 *in_stack_000000f0;

-  uint in_stack_000000f8;

+  ushort uVar1;

+  ushort uVar2;

+  uint uVar3;

+  uint uVar4;

+  int iVar5;

+  uint uVar6;

+  uint uVar7;

+  uint uVar8;

+  undefined4 uVar9;

+  ulonglong uVar10;

+  longlong *plVar11;

+  ulonglong uVar12;

+  longlong lVar13;

+  undefined8 uVar14;

+  longlong lVar15;

+  longlong lVar16;

+  undefined *puVar17;

+  undefined2 uVar18;

+  void *pvVar19;

+  void *pvVar20;

+  void *pvVar21;

+  ushort *puVar22;

+  int iVar23;

+  int *piVar24;

+  void *pvVar25;

+  uint local_res10 [2];

+  undefined8 local_c8;

+  longlong local_c0;

+  longlong *local_b8;

+  longlong local_b0;

+  ulonglong local_a8;

+  ulonglong local_a0;

+  undefined8 *local_98;

+  undefined4 local_90;

+  uint local_8c;

+  longlong local_88;

+  longlong local_80;

+  ulonglong local_78;

+  ulonglong local_70;

+  ushort local_68 [4];

+  wchar_t *local_60;

+  ushort local_58 [4];

+  longlong lStack_50;

+  ushort local_48 [4];

+  wchar_t *local_40;

   

-  puVar6 = (undefined4 *)((ulonglong)in_stack_00000040 & 0xffffffff);

-  do {

-    *(undefined1 *)(puVar6 + 1) = 1;

-    *(undefined1 *)((longlong)in_stack_00000040 + 5) = 3;

-    *(ushort *)((longlong)in_stack_00000040 + 6) =

-         CONCAT11(*(undefined1 *)(in_stack_00000040 + 1),

-                  *(undefined1 *)((longlong)in_stack_00000040 + 5));

-    in_stack_00000040[2] = unaff_R15D;

-    *(undefined8 *)(in_stack_00000040 + 4) = unaff_R13;

-    uVar3 = RtlComputeCrc32(0,in_stack_00000040,0xffc);

-    in_stack_00000040[0x3ff] = uVar3;

-    in_stack_00000070 = (ulonglong)unaff_R15D * 8;

-    in_stack_00000078 = unaff_RBX + 0x14;

-    puVar12 = &stack0x00000058;

-    uVar7 = HsmpFileCachePreparePinWrite

-                      (*(longlong *)(*in_stack_00000078 + 8 + in_stack_00000070),

-                       (*(longlong *)(in_stack_00000040 + 4) + 1) % unaff_R12 << 0xc,

-                       (undefined *)puVar12,1,in_stack_00000020,puVar12,&stack0x00000040,

-                       &stack0x000000e8);

-    iVar4 = (int)uVar7;

-    in_stack_00000048 = iVar4;

-    HsmDbgBreakOnStatus(iVar4);

-    bVar13 = (byte)unaff_R12;

-    if (iVar4 < 0) {

-      puVar9 = WPP_GLOBAL_Control;

+  pvVar19 = (void *)0x0;

+  local_68[0] = 0xc;

+  local_68[1] = 0xe;

+  local_68[2] = 0;

+  local_68[3] = 0;

+  local_c8 = 0;

+  local_78 = 0;

+  local_a0 = 0;

+  local_70 = 0;

+  local_a8 = 0;

+  local_60 = L"CldFlt";

+  local_88 = 0;

+  local_40 = L"180451";

+  local_80 = 0;

+  local_b0 = 0;

+  local_98 = (undefined8 *)0x0;

+  uVar7 = 0xc0000225;

+  local_c0 = 0;

+  local_48[0] = 0xc;

+  local_48[1] = 0xe;

+  local_48[2] = 0;

+  local_48[3] = 0;

+  local_58[0] = 0;

+  local_58[1] = 0;

+  local_58[2] = 0;

+  local_58[3] = 0;

+  lStack_50 = 0;

+  if (param_2 == 6) {

+    local_b8 = (longlong *)0x0;

+    uVar7 = 0;

+    local_res10[0] = 0;

+    if (((((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 5)) ||

+           (uVar4 = *(uint *)(param_3 + 8), uVar4 < 0x38)) || (0x11 < *(ushort *)(param_3 + 0x30)))

+         || ((uVar8 = *(uint *)(param_3 + 0x34), uVar8 != 0 &&

+             ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))))) ||

+        ((uVar4 < *(ushort *)(param_3 + 0x32) ||

+         ((uVar3 = *(ushort *)(param_3 + 0x32) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3)))))) ||

+       ((*(ushort *)(param_3 + 0x30) != 6 || (*(short *)(param_3 + 0x32) != 8)))) {

+      pvVar19 = (void *)0xc0000225;

+    }

+    else {

+      local_c0 = *(longlong *)((ulonglong)*(uint *)(param_3 + 0x34) + param_3);

+    }

+    HsmDbgBreakOnStatus((int)pvVar19);

+    if ((int)pvVar19 < 0) {

+      pvVar20 = pvVar19;

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0xd;

+    }

+    else {

+      if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0xe)) ||

+           ((uVar4 = *(uint *)(param_3 + 8), uVar4 < 0x80 || (0x11 < *(ushort *)(param_3 + 0x78)))))

+          || ((uVar8 = *(uint *)(param_3 + 0x7c), uVar8 != 0 &&

+              ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))))) ||

+         (((uVar4 < *(ushort *)(param_3 + 0x7a) ||

+           (((uVar3 = *(ushort *)(param_3 + 0x7a) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3)) ||

+            (*(ushort *)(param_3 + 0x78) != 10)))) || (*(short *)(param_3 + 0x7a) != 4)))) {

+        pvVar19 = (void *)0xc0000225;

+      }

+      else {

+        pvVar19 = (void *)0x0;

+        uVar7 = *(uint *)((ulonglong)*(uint *)(param_3 + 0x7c) + param_3);

+        local_res10[0] = uVar7;

+      }

+      HsmDbgBreakOnStatus((int)pvVar19);

+      pvVar20 = pvVar19;

+      if (-1 < (int)pvVar19) {

+        if (local_c0 == 0) {

+          *(uint *)(param_1 + 0x88) = uVar7;

+        }

+        else {

+          uVar10 = Feature_1966059833__private_IsEnabledDeviceUsageNoInline();

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

+            FltAcquirePushLockSharedEx(param_1 + 0x90,0);

+            plVar11 = (longlong *)CldiPortLookupSyncRootNoLock(param_1,local_c0);

+            local_b8 = plVar11;

+            FltReleasePushLockEx(param_1 + 0x90,0);

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

+              pvVar20 = (void *)0xc000cf0b;

+              HsmDbgBreakOnStatus(-0x3fff30f5);

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

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

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

+                WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x10,

+                          &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,param_1);

+                pvVar20 = (void *)0xc000cf0b;

+              }

+            }

+            else {

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

+            }

+          }

+          else {

+            uVar10 = CldiPortLookupAndReferenceSyncRoot(param_1,local_c0,(longlong *)&local_b8);

+            if ((int)uVar10 < 0) {

+              pvVar20 = (void *)0xc000cf0b;

+              HsmDbgBreakOnStatus(-0x3fff30f5);

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

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

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

+                WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xf,

+                           &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,param_1);

+              }

+            }

+            else {

+              *(uint *)(local_b8 + 6) = uVar7;

+              ExReleaseRundownProtection(local_b8 + 0xb);

+              pvVar20 = (void *)(uVar10 & 0xffffffff);

+            }

+          }

+        }

+        goto LAB_0;

+      }

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0xe;

+    }

+LAB_1:

+    uVar7 = (uint)pvVar19;

+  }

+  else {

+    if ((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 3)) ||

+        (uVar4 = *(uint *)(param_3 + 8), uVar4 < 0x28)) ||

+       (((0x11 < *(ushort *)(param_3 + 0x20) ||

+         (((uVar8 = *(uint *)(param_3 + 0x24), uVar8 != 0 &&

+           ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))) ||

+          (uVar4 < *(ushort *)(param_3 + 0x22))))) ||

+        (((uVar3 = *(ushort *)(param_3 + 0x22) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3)) ||

+         ((*(ushort *)(param_3 + 0x20) != 0xb || (*(short *)(param_3 + 0x22) != 8)))))))) {

+      pvVar19 = (void *)0xc0000225;

+    }

+    else {

+      local_c8 = *(undefined8 *)((ulonglong)*(uint *)(param_3 + 0x24) + param_3);

+    }

+    HsmDbgBreakOnStatus((int)pvVar19);

+    if ((int)pvVar19 < 0) {

+      pvVar20 = pvVar19;

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0x11;

+      goto LAB_1;

+    }

+    uVar4 = ObReferenceObjectByHandle

+                      (local_c8,0,*(undefined8 *)IoFileObjectType_exref,1,&local_a8,0);

+    pvVar19 = (void *)(ulonglong)uVar4;

+    HsmDbgBreakOnStatus(uVar4);

+    if ((int)uVar4 < 0) {

+      pvVar20 = pvVar19;

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0x12;

+      goto LAB_1;

+    }

+    uVar4 = FltGetVolumeFromFileObject(Globals,local_a8,&local_88);

+    pvVar20 = (void *)(ulonglong)uVar4;

+    HsmDbgBreakOnStatus(uVar4);

+    if ((int)uVar4 < 0) {

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0x13;

+LAB_2:

+      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar18,

+                &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,local_c8);

+      goto LAB_0;

+    }

+    uVar4 = FltAttachVolumeAtAltitude(Globals,local_88,local_48,local_68,&local_80);

+    HsmDbgBreakOnStatus(uVar4);

+    if (uVar4 == 0xc01c0012) {

+      uVar4 = FltGetVolumeInstanceFromName(Globals,local_88,local_68,&local_80);

+      HsmDbgBreakOnStatus(uVar4);

+    }

+    else {

+      TlmWriteFilterAttachEvent(uVar4,local_48,local_68,local_88);

+    }

+    pvVar20 = (void *)(ulonglong)uVar4;

+    if ((int)uVar4 < 0) {

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0x14;

+      goto LAB_2;

+    }

+    uVar4 = FltGetInstanceContext(local_80,&local_b0);

+    pvVar20 = (void *)(ulonglong)uVar4;

+    HsmDbgBreakOnStatus(uVar4);

+    if ((int)uVar4 < 0) {

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0x15;

+      goto LAB_2;

+    }

+    uVar10 = local_a8;

+    uVar4 = HsmpAccessCheck(local_b0,local_a8,2);

+    pvVar20 = (void *)(ulonglong)uVar4;

+    HsmDbgBreakOnStatus(uVar4);

+    pvVar19 = (void *)0x0;

+    if ((int)uVar4 < 0) {

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0x16;

+      goto LAB_2;

+    }

+    local_b8 = *(longlong **)(local_b0 + 0x10);

+    if (param_2 == 1) goto LAB_0;

+    if (param_2 != 2) {

+      if (param_2 == 3) {

+        uVar7 = HsmCldDeleteSyncRootInfo(local_b0,local_a8);

+        pvVar20 = (void *)(ulonglong)uVar7;

+        HsmDbgBreakOnStatus(uVar7);

+        if ((((-1 < (int)uVar7) || ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control)) ||

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

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+        uVar18 = 0x1c;

+      }

+      else {

+        uVar7 = 0;

+        if (param_2 == 7) {

+          pvVar25 = (void *)0x0;

+          uVar4 = HsmiQueryFullFilePath

+                            (*(undefined8 *)(local_b0 + 0x20),uVar10,local_a8,0x101,

+                             (undefined4 *)local_58);

+          pvVar21 = (void *)(ulonglong)uVar4;

+          HsmDbgBreakOnStatus(uVar4);

+          pvVar20 = (void *)0x0;

+          if ((int)uVar4 < 0) {

+            pvVar20 = pvVar21;

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

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

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+            uVar18 = 0x1d;

+          }

+          else {

+            if (((((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0x17)) ||

+                   (uVar4 = *(uint *)(param_3 + 8), uVar4 < 200)) ||

+                  (0x11 < *(ushort *)(param_3 + 0xc0))) ||

+                 ((uVar8 = *(uint *)(param_3 + 0xc4), uVar8 != 0 &&

+                  ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))))) ||

+                (uVar4 < *(ushort *)(param_3 + 0xc2))) ||

+               (((uVar3 = *(ushort *)(param_3 + 0xc2) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3)) ||

+                ((*(ushort *)(param_3 + 0xc0) != 6 || (*(short *)(param_3 + 0xc2) != 8)))))) {

+              pvVar20 = (void *)0xc0000225;

+              uVar10 = local_a0;

+            }

+            else {

+              uVar10 = *(ulonglong *)((ulonglong)*(uint *)(param_3 + 0xc4) + param_3);

+            }

+            HsmDbgBreakOnStatus((int)pvVar20);

+            if ((int)pvVar20 < 0) {

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

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

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+              uVar18 = 0x1e;

+            }

+            else {

+              pvVar20 = pvVar19;

+              if (((((((0x17 < param_4) && (9 < *(ushort *)(param_3 + 0xe))) &&

+                     (uVar4 = *(uint *)(param_3 + 8), pvVar20 = pvVar25, 0x5f < uVar4)) &&

+                    (*(ushort *)(param_3 + 0x58) < 0x12)) &&

+                   (((uVar8 = *(uint *)(param_3 + 0x5c), uVar8 == 0 ||

+                     (((uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 <= uVar8 && (uVar8 <= uVar4))))

+                    && (*(ushort *)(param_3 + 0x5a) <= uVar4)))) &&

+                  ((uVar3 = *(ushort *)(param_3 + 0x5a) + uVar8, uVar8 <= uVar3 && (uVar3 <= uVar4))

+                  )) && (*(ushort *)(param_3 + 0x58) == 0x11)) {

+                if ((*(uint *)(param_3 + 0x5c) != 0) && (*(ushort *)(param_3 + 0x5a) != 0)) {

+                  pvVar19 = (void *)(param_3 + (ulonglong)*(uint *)(param_3 + 0x5c));

+                }

+                uVar7 = (uint)*(ushort *)(param_3 + 0x5a);

+                pvVar20 = pvVar19;

+              }

+              uVar7 = CldSyncReportSyncStatusOnRoot(local_b8,uVar10,local_58,pvVar20,uVar7);

+              pvVar20 = (void *)(ulonglong)uVar7;

+              HsmDbgBreakOnStatus(uVar7);

+              if ((((-1 < (int)uVar7) || ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control))

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

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+              uVar18 = 0x1f;

+            }

+          }

+        }

+        else {

+          if (((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 5)) ||

+             ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 0x38 || (0x11 < *(ushort *)(param_3 + 0x30)))

+             )) {

+LAB_3:

+            pvVar19 = (void *)0xc0000225;

+          }

+          else {

+            uVar4 = *(uint *)(param_3 + 0x34);

+            uVar10 = (ulonglong)uVar4;

+            if (((uVar4 != 0) &&

+                ((uVar10 < (ulonglong)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4)))) ||

+               (((uVar7 < *(ushort *)(param_3 + 0x32) ||

+                 (((uVar8 = *(ushort *)(param_3 + 0x32) + uVar4, uVar8 < uVar4 || (uVar7 < uVar8))

+                  || (*(ushort *)(param_3 + 0x30) != 6)))) || (*(short *)(param_3 + 0x32) != 8))))

+            goto LAB_3;

+            local_c0 = *(longlong *)((ulonglong)*(uint *)(param_3 + 0x34) + param_3);

+          }

+          HsmDbgBreakOnStatus((int)pvVar19);

+          if ((int)pvVar19 < 0) {

+            pvVar20 = pvVar19;

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

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

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+            uVar18 = 0x20;

+          }

+          else {

+            if (param_2 != 4) {

+              if (param_2 != 5) {

+                pvVar20 = (void *)0xc0000010;

+                HsmDbgBreakOnStatus(-0x3ffffff0);

+                goto LAB_0;

+              }

+              if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0x17)) ||

+                   ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 200 ||

+                    (0x11 < *(ushort *)(param_3 + 0xc0))))) ||

+                  ((uVar4 = *(uint *)(param_3 + 0xc4), uVar4 != 0 &&

+                   ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4)))))) ||

+                 (((uVar7 < *(ushort *)(param_3 + 0xc2) ||

+                   (((uVar8 = *(ushort *)(param_3 + 0xc2) + uVar4, uVar8 < uVar4 || (uVar7 < uVar8))

+                    || (*(ushort *)(param_3 + 0xc0) != 6)))) || (*(short *)(param_3 + 0xc2) != 8))))

+              {

+                pvVar20 = (void *)0xc0000225;

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

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

+                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                uVar18 = 0x2d;

+                goto LAB_2;

+              }

+              lVar15 = *(longlong *)((ulonglong)*(uint *)(param_3 + 0xc4) + param_3);

+              FltAcquirePushLockExclusiveEx(&DAT_4,0);

+              uVar10 = Feature_4003440952__private_IsEnabledDeviceUsageNoInline();

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

+                lVar13 = param_1 + 0x90;

+                FltAcquirePushLockSharedEx(lVar13,0);

+                lVar16 = CldiPortLookupSyncRootNoLock(param_1,local_c0);

+                if ((lVar16 == 0) || (*(longlong *)(lVar16 + 0x18) != lVar15)) {

+                  pvVar20 = (void *)0xc000cf0b;

+                  HsmDbgBreakOnStatus(-0x3fff30f5);

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

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

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

+                    WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2e,

+                                &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,param_1);

+                  }

+                  FltReleasePushLockEx(lVar13,0);

+                  goto LAB_5;

+                }

+                FltReleasePushLockEx(lVar13,0);

+              }

+              uVar10 = Feature_2414246201__private_IsEnabledDeviceUsageNoInline();

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

+                uVar7 = CldSyncDisconnectRootDeprecated

+                                  ((longlong)local_b8,lVar15,local_c0,&local_98);

+              }

+              else {

+                uVar14 = CldSyncDisconnectRoot((longlong)local_b8,param_1,lVar15,local_c0,&local_98)

+                ;

+                uVar7 = (uint)uVar14;

+              }

+              pvVar20 = (void *)(ulonglong)uVar7;

+              HsmDbgBreakOnStatus(uVar7);

+              if ((int)uVar7 < 0) {

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

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

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

+                  uVar18 = 0x2f;

+                  goto LAB_6;

+                }

+              }

+              else {

+                FltAcquirePushLockExclusiveEx(param_1 + 0x90,0);

+                RtlDeleteElementGenericTableAvl(param_1 + 0x98,&local_c0);

+                FltReleasePushLockEx(param_1 + 0x90,0);

+                piVar24 = (int *)(param_1 + 0x8c);

+                *piVar24 = *piVar24 + -1;

+                if (*piVar24 == 0) {

+                  lVar15 = IoGetCurrentProcess();

+                  HsmOsClearProcessAsSyncProvider(lVar15);

+                  CldReleaseProcessInfo((undefined8 *)(param_1 + 0x68));

+                }

+              }

+              goto LAB_5;

+            }

+            local_98 = (undefined8 *)0x0;

+            local_8c = 0;

+            local_90 = 0;

+            local_70 = local_70 & 0xffffffff00000000;

+            local_78 = 0;

+            uVar12 = HsmpCheckLegacyFilterAbsence();

+            pvVar20 = (void *)(uVar12 & 0xffffffff);

+            HsmDbgBreakOnStatus((int)uVar12);

+            if ((int)uVar12 < 0) {

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

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

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+              uVar18 = 0x21;

+            }

+            else {

+              uVar7 = HsmiQueryFullFilePath

+                                (*(undefined8 *)(local_b0 + 0x20),uVar10,local_a8,0x101,

+                                 (undefined4 *)local_58);

+              pvVar20 = (void *)(ulonglong)uVar7;

+              HsmDbgBreakOnStatus(uVar7);

+              pvVar19 = (void *)0x0;

+              if ((int)uVar7 < 0) {

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

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

+                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                uVar18 = 0x22;

+              }

+              else {

+                if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 6)) ||

+                     ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 0x40 ||

+                      (0x11 < *(ushort *)(param_3 + 0x38))))) ||

+                    ((uVar4 = *(uint *)(param_3 + 0x3c), uVar4 != 0 &&

+                     ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4))))))

+                   || ((uVar7 < *(ushort *)(param_3 + 0x3a) ||

+                       ((((uVar8 = *(ushort *)(param_3 + 0x3a) + uVar4, uVar8 < uVar4 ||

+                          (uVar7 < uVar8)) || (*(ushort *)(param_3 + 0x38) != 10)) ||

+                        (*(short *)(param_3 + 0x3a) != 4)))))) {

+                  pvVar19 = (void *)0xc0000225;

+                }

+                else {

+                  local_8c = *(uint *)((ulonglong)*(uint *)(param_3 + 0x3c) + param_3);

+                }

+                HsmDbgBreakOnStatus((int)pvVar19);

+                pvVar20 = (void *)0x0;

+                if ((int)pvVar19 < 0) {

+                  pvVar20 = pvVar19;

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

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

+                     ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                  uVar18 = 0x23;

+                }

+                else {

+                  if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0xf)) ||

+                       ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 0x88 ||

+                        (0x11 < *(ushort *)(param_3 + 0x80))))) ||

+                      ((uVar4 = *(uint *)(param_3 + 0x84), uVar4 != 0 &&

+                       ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4))))))

+                     || (((uVar7 < *(ushort *)(param_3 + 0x82) ||

+                          (((uVar8 = *(ushort *)(param_3 + 0x82) + uVar4, uVar8 < uVar4 ||

+                            (uVar7 < uVar8)) || (*(ushort *)(param_3 + 0x80) != 10)))) ||

+                         (*(short *)(param_3 + 0x82) != 4)))) {

+                    pvVar20 = (void *)0xc0000225;

+                  }

+                  else {

+                    local_70 = CONCAT44(local_70._4_4_,

+                                        *(undefined4 *)

+                                         ((ulonglong)*(uint *)(param_3 + 0x84) + param_3));

+                  }

+                  HsmDbgBreakOnStatus((int)pvVar20);

+                  if ((int)pvVar20 < 0) {

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

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

+                       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                    uVar18 = 0x24;

+                  }

+                  else {

+                    if ((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0xe)) ||

+                        ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 0x80 ||

+                         (0x11 < *(ushort *)(param_3 + 0x78))))) ||

+                       (((uVar4 = *(uint *)(param_3 + 0x7c), uVar4 != 0 &&

+                         ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4))))

+                        || (((uVar7 < *(ushort *)(param_3 + 0x7a) ||

+                             (((uVar8 = *(ushort *)(param_3 + 0x7a) + uVar4, uVar8 < uVar4 ||

+                               (uVar7 < uVar8)) || (*(ushort *)(param_3 + 0x78) != 10)))) ||

+                            (*(short *)(param_3 + 0x7a) != 4)))))) {

+                      pvVar19 = (void *)0xc0000225;

+                    }

+                    else {

+                      pvVar19 = (void *)0x0;

+                      local_90 = *(undefined4 *)((ulonglong)*(uint *)(param_3 + 0x7c) + param_3);

+                    }

+                    HsmDbgBreakOnStatus((int)pvVar19);

+                    pvVar20 = (void *)0x0;

+                    if ((int)pvVar19 < 0) {

+                      pvVar20 = pvVar19;

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

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

+                         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                      uVar18 = 0x25;

+                    }

+                    else {

+                      if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0x17)) ||

+                           ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 200 ||

+                            (0x11 < *(ushort *)(param_3 + 0xc0))))) ||

+                          ((uVar4 = *(uint *)(param_3 + 0xc4), uVar4 != 0 &&

+                           ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4))

+                           )))) || ((uVar7 < *(ushort *)(param_3 + 0xc2) ||

+                                    ((((uVar8 = *(ushort *)(param_3 + 0xc2) + uVar4, uVar8 < uVar4

+                                       || (uVar7 < uVar8)) || (*(ushort *)(param_3 + 0xc0) != 6)) ||

+                                     (*(short *)(param_3 + 0xc2) != 8)))))) {

+                        pvVar20 = (void *)0xc0000225;

+                      }

+                      else {

+                        local_a0 = *(ulonglong *)((ulonglong)*(uint *)(param_3 + 0xc4) + param_3);

+                      }

+                      HsmDbgBreakOnStatus((int)pvVar20);

+                      if (-1 < (int)pvVar20) {

+                        uVar12 = Feature_2089703736__private_IsEnabledDeviceUsageNoInline();

+                        plVar11 = local_b8;

+                        uVar10 = local_a0;

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

+                          uVar7 = FltQueryInformationFile

+                                            (*(undefined8 *)(local_b0 + 0x20),local_a8,&local_78,8,6

+                                             ,0);

+                          pvVar20 = (void *)(ulonglong)uVar7;

+                          HsmDbgBreakOnStatus(uVar7);

+                          uVar10 = local_a0;

+                          plVar11 = local_b8;

+                          if ((int)uVar7 < 0) {

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

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

+                               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                            uVar18 = 0x27;

+                            goto LAB_2;

+                          }

+                          if (local_78 != local_a0) {

+                            local_res10[0] = local_res10[0] & 0xffffff00;

+                            puVar22 = local_58;

+                            uVar12 = local_a0;

+                            iVar23 = CldSyncIsPathWithinSyncRootByFileId

+                                               ((longlong)local_b8,local_a0,puVar22,

+                                                (undefined1 *)local_res10);

+                            HsmDbgBreakOnStatus(iVar23);

+                            if ((iVar23 < 0) || ((char)local_res10[0] == '\0')) {

+                              pvVar20 = (void *)0xc000000d;

+                              HsmDbgBreakOnStatus(-0x3ffffff3);

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

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

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

+                                WPP_SF_iiidd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                                             puVar22,local_c8);

+                              }

+                              goto LAB_0;

+                            }

+                          }

+                        }

+                        FltAcquirePushLockExclusiveEx(&DAT_4,0);

+                        uVar7 = CldSyncConnectRoot(plVar11,param_1,uVar10,local_58,local_8c,local_90

+                                                   ,local_c0,(longlong *)&local_98);

+                        pvVar20 = (void *)(ulonglong)uVar7;

+                        HsmDbgBreakOnStatus(uVar7);

+                        if ((int)uVar7 < 0) {

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

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

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

+                            uVar18 = 0x2a;

+LAB_6:

+                            WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar18,

+                                      &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,local_c8);

+                          }

+                        }

+                        else {

+                          FltAcquirePushLockExclusiveEx(param_1 + 0x90,0);

+                          lVar15 = local_c0;

+                          uVar7 = CldiPortInsertSyncRootNoLock(param_1,local_98,local_c0,uVar10);

+                          uVar14 = 0;

+                          pvVar20 = (void *)(ulonglong)uVar7;

+                          FltReleasePushLockEx(param_1 + 0x90);

+                          if ((int)uVar7 < 0) {

+                            CldSyncDisconnectRootByObject(local_98,0xc0000002);

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

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

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

+                              uVar18 = 0x2b;

+                              goto LAB_6;

+                            }

+                          }

+                          else {

+                            plVar11 = (longlong *)(param_1 + 0x68);

+                            if ((*plVar11 == 0) ||

+                               (lVar13 = IoGetCurrentProcess(), *plVar11 == lVar13)) {

+                              uVar14 = IoGetCurrentProcess();

+                              CldCaptureProcessInfo(uVar14,plVar11);

+                              lVar15 = IoGetCurrentProcess();

+                              HsmOsSetProcessAsSyncProvider(lVar15);

+                              *(int *)(param_1 + 0x8c) = *(int *)(param_1 + 0x8c) + 1;

+                              *(undefined4 *)(param_1 + 0x104) = (undefined4)local_70;

+                            }

+                            else {

+                              pvVar20 = (void *)0xc000cf18;

+                              HsmDbgBreakOnStatus(-0x3fff30e8);

+                              puVar17 = WPP_GLOBAL_Control;

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

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

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

+                                puVar17 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

+                                WPP_SF_qiqDZd(puVar17,uVar14,lVar15,param_1);

+                              }

+                              uVar9 = PsGetCurrentProcessId();

+                              MicrosoftTelemetryAssertTriggeredArgsMsgKM

+                                        (puVar17,*(undefined4 *)(param_1 + 0x80),uVar9,

+                                         "ConnectingPortContext\'s SyncProvider is already set");

+                            }

+                          }

+                        }

+LAB_5:

+                        FltReleasePushLockEx(&DAT_4,0);

+                        goto LAB_0;

+                      }

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

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

+                         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                      uVar18 = 0x26;

+                    }

+                  }

+                }

+              }

+            }

+          }

+        }

+      }

+      goto LAB_2;

+    }

+    piVar24 = (int *)0x0;

+    uVar4 = 0;

+    if (param_4 < 0x18) {

+      pvVar19 = (void *)0xc0000225;

+    }

+    else {

+      if (((((*(ushort *)(param_3 + 0xe) < 4) || (uVar4 = *(uint *)(param_3 + 8), uVar4 < 0x30)) ||

+           (0x11 < *(ushort *)(param_3 + 0x28))) ||

+          (((uVar8 = *(uint *)(param_3 + 0x2c), uVar8 != 0 &&

+            ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))) ||

+           ((uVar4 < *(ushort *)(param_3 + 0x2a) ||

+            ((uVar3 = *(ushort *)(param_3 + 0x2a) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3))))))))

+         || (*(ushort *)(param_3 + 0x28) != 0x11)) {

+        pvVar19 = (void *)0xc0000225;

+        uVar4 = 0;

+      }

+      else {

+        if ((*(uint *)(param_3 + 0x2c) != 0) && (*(ushort *)(param_3 + 0x2a) != 0)) {

+          piVar24 = (int *)(param_3 + (ulonglong)*(uint *)(param_3 + 0x2c));

+        }

+        pvVar19 = (void *)0x0;

+        uVar4 = (uint)*(ushort *)(param_3 + 0x2a);

+      }

+      if ((int)pvVar19 < 0) {

+        uVar4 = 0;

+      }

+    }

+    HsmDbgBreakOnStatus((int)pvVar19);

+    if ((int)pvVar19 < 0) {

+      pvVar20 = pvVar19;

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

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

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+      uVar18 = 0x17;

+      goto LAB_1;

+    }

+    if (piVar24 != (int *)0x0) {

+      iVar23 = 0;

+      if (((0x17 < uVar4) && (iVar23 = 1, *piVar24 == 0x6e497253)) &&

+         (((*(byte *)(piVar24 + 3) & 2) == 0 ||

+          (iVar5 = RtlComputeCrc32(0,piVar24 + 2,uVar4 - 8), iVar23 = 2, piVar24[1] == iVar5)))) {

+        uVar8 = piVar24[2];

+        iVar23 = 3;

+        if (uVar8 <= uVar4) {

+          uVar1 = *(ushort *)((longlong)piVar24 + 0xe);

+          uVar10 = 0;

+          iVar23 = 4;

+          if ((uVar1 != 0) && (iVar23 = 5, (uint)uVar1 * 8 + 0x10 < uVar8)) {

+            iVar23 = 0x10000;

+            while( true ) {

+              uVar3 = (uint)uVar1;

+              if (8 < uVar1) {

+                uVar3 = 9;

+              }

+              if (uVar3 <= (uint)uVar10) {

+                if (((((7 < *(ushort *)((longlong)piVar24 + 0xe)) && (0x4f < uVar8)) &&

+                     (*(ushort *)(piVar24 + 0x12) < 0x12)) &&

+                    ((uVar3 = piVar24[0x13], uVar3 == 0 ||

+                     (((uint)*(ushort *)((longlong)piVar24 + 0xe) * 8 + 0x10 <= uVar3 &&

+                      (uVar3 <= uVar8)))))) &&

+                   ((*(ushort *)((longlong)piVar24 + 0x4a) <= uVar8 &&

+                    (((uVar6 = *(ushort *)((longlong)piVar24 + 0x4a) + uVar3, uVar3 <= uVar6 &&

+                      (uVar6 <= uVar8)) &&

+                     ((*(ushort *)(piVar24 + 0x12) == 0x10 &&

+                      (*(short *)((longlong)piVar24 + 0x4a) == 0x10)))))))) {

+                  memmove((void *)(param_1 + 0x108),

+                          (void *)((ulonglong)(uint)piVar24[0x13] + (longlong)piVar24),0x10);

+                  uVar7 = 0;

+                }

+                HsmDbgBreakOnStatus(uVar7);

+                if ((int)uVar7 < 0) {

+                  pvVar19 = (void *)(ulonglong)uVar7;

+                  pvVar20 = pvVar19;

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

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

+                     ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                  uVar18 = 0x1a;

+                  goto LAB_7;

+                }

+                uVar7 = HsmCldPersistSyncRootInfo(local_b0,local_a8,piVar24,uVar4);

+                pvVar20 = (void *)(ulonglong)uVar7;

+                HsmDbgBreakOnStatus(uVar7);

+                if (((-1 < (int)uVar7) || ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control))

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

+                       ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_0;

+                uVar18 = 0x1b;

+                goto LAB_2;

+              }

+              if ((((0x11 < *(ushort *)(piVar24 + uVar10 * 2 + 4)) ||

+                   ((uVar3 = piVar24[uVar10 * 2 + 5], uVar3 != 0 && (uVar3 < (uint)uVar1 * 8 + 0x10)

+                    ))) || (uVar8 < uVar3)) ||

+                 (((uVar2 = *(ushort *)((longlong)piVar24 + uVar10 * 8 + 0x12), uVar8 < uVar2 ||

+                   (uVar6 = uVar2 + uVar3, uVar6 < uVar3)) || (uVar8 < uVar6)))) break;

+              iVar23 = iVar23 + 1;

+              uVar10 = (ulonglong)((uint)uVar10 + 1);

+            }

+          }

+        }

+      }

+      pvVar20 = (void *)0xc000000d;

+      HsmDbgBreakOnStatus(-0x3ffffff3);

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

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-         (bVar13 <= (byte)WPP_GLOBAL_Control[0x29])) {

-        uVar10 = 0x56;

-        in_stack_000000e0 = unaff_RBX;

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

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

+        WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x19,

+                  &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,iVar23);

+      }

+      goto LAB_0;

+    }

+    uVar7 = 0xc000cf0b;

+    pvVar19 = (void *)0xc000cf0b;

+    pvVar20 = (void *)0xc000cf0b;

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

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

+       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+    uVar18 = 0x18;

+  }

+LAB_7:

+  WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar18,

+           &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,uVar7);

+  pvVar20 = pvVar19;

 LAB_0:

-        puVar9 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-        WPP_SF_qisdd(puVar9,uVar10,puVar12,in_stack_000000e0,*in_stack_000000e0,

-                     (char *)(in_stack_000000e0 + 4));

-      }

-LAB_1:

-      uVar5 = HsmiBitmapTranslateIOStatus(puVar9,iVar4);

-      pvVar11 = (void *)(ulonglong)uVar5;

-      HsmDbgBreakOnStatus(uVar5);

-LAB_2:

-      if (unaff_R14 != (undefined4 *)0x0) {

-        ExFreePoolWithTag(unaff_R14,0x6d427348);

-      }

-      if (in_stack_00000050 != 0) {

-        in_stack_00000090 = CONCAT44(in_stack_00000054,in_stack_00000050);

-        in_stack_00000098 = in_stack_00000058;

-        HsmIBitmapNORMALUnpinBlock((int *)&stack0x00000090);

-      }

-      return pvVar11;

-    }

-    in_stack_00000050 = 1;

-    puVar12 = (undefined8 *)0x1000;

-    puVar6 = unaff_R14;

-    memmove(in_stack_00000040,unaff_R14,0x1000);

-    if (iVar4 < 0) {

-      puVar9 = WPP_GLOBAL_Control;

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

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

-         ((byte)WPP_GLOBAL_Control[0x29] < bVar13)) goto LAB_1;

-      uVar10 = 0x57;

-      in_stack_000000e0 = unaff_RBX;

-      goto LAB_0;

-    }

-    uVar8 = HsmpFileCacheSetAddressRangeModified(in_stack_00000040,puVar6,puVar12);

-    iVar4 = (int)uVar8;

-    HsmDbgBreakOnStatus(iVar4);

-    if (iVar4 < 0) {

-      puVar9 = WPP_GLOBAL_Control;

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

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

-         ((byte)WPP_GLOBAL_Control[0x29] < bVar13)) goto LAB_1;

-      uVar10 = 0x58;

-      in_stack_000000e0 = unaff_RBX;

-      goto LAB_0;

-    }

-    in_stack_00000090 = CONCAT44(in_stack_00000054,in_stack_00000050);

-    in_stack_00000098 = in_stack_00000058;

-    HsmIBitmapNORMALUnpinBlock((int *)&stack0x00000090);

-    plVar2 = in_stack_00000078;

-    lVar1 = in_stack_00000070;

-    in_stack_00000050 = 0;

-    in_stack_00000040 = (undefined4 *)0x0;

-    iVar14 = 0;

-    do {

-      uVar7 = HsmpFileCacheFlush(*(longlong *)(*plVar2 + 8 + lVar1));

-      iVar4 = (int)uVar7;

-      pvVar11 = (void *)(uVar7 & 0xffffffff);

-      HsmDbgBreakOnStatus(iVar4);

-      unaff_RBX = in_stack_000000e0;

-      unaff_R14 = in_stack_00000060;

-      if (iVar4 != -0x3fffffac) break;

-      iVar14 = iVar14 + 1;

-    } while (iVar14 < 5);

-    unaff_R12 = 2;

-    if (iVar4 < 0) {

-      puVar9 = WPP_GLOBAL_Control;

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

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_1;

-      uVar10 = 0x59;

-      goto LAB_0;

-    }

-    if (unaff_R15D == 0) {

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

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        WPP_SF_qisi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),puVar6,in_stack_000000e0 + 4,

-                    in_stack_000000e0,*in_stack_000000e0,(char *)(in_stack_000000e0 + 4));

-      }

-      *in_stack_000000f0 = unaff_R13;

-      goto LAB_2;

-    }

-    in_stack_000000e8 = 0;

-    unaff_R15D = unaff_R15D - 1;

-    in_stack_00000040 = in_stack_00000060;

-    in_stack_000000f8 = unaff_R15D;

-    memset(in_stack_00000060,0,0x1000);

-    *in_stack_00000040 = 0x704d7442;

-    puVar6 = in_stack_00000040;

-  } while( true );

+  if (lStack_50 != 0) {

+    ExFreePoolWithTag(lStack_50,0x73557348);

+  }

+  if (local_b0 != 0) {

+    FltReleaseContext();

+  }

+  if (local_80 != 0) {

+    FltObjectDereference();

+  }

+  if (local_88 != 0) {

+    FltObjectDereference();

+  }

+  if (local_a8 != 0) {

+    ObfDereferenceObject();

+  }

+  return pvVar20;

 }
```

## `CldiPortNotifyMessage`  (modified)

```diff
--- CldiPortNotifyMessage
+++ CldiPortNotifyMessage
@@ -1,512 +1,363 @@
 

-/* WARNING: Instruction at (ram,0x000140072fb1) overlaps instruction at (ram,0x000140072fb0)

-    */

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

 

 uint CldiPortNotifyMessage

                (longlong param_1,void *param_2,ulonglong param_3,void *param_4,uint param_5,

                uint *param_6)

 

 {

-  undefined7 uVar1;

-  ulonglong uVar2;

-  uint uVar3;

-  uint uVar4;

-  undefined8 uVar5;

-  undefined8 *puVar6;

-  byte bVar7;

-  byte bVar8;

-  int iVar9;

-  longlong lVar10;

-  undefined *puVar11;

-  undefined2 uVar12;

-  byte bVar13;

-  ulonglong unaff_RBX;

-  byte bVar15;

-  int unaff_ESI;

-  int iVar16;

-  undefined8 *unaff_RDI;

-  longlong lVar17;

-  undefined8 *puVar18;

-  longlong lVar19;

-  byte bVar20;

-  longlong in_R11;

-  uint unaff_R12D;

-  ulonglong unaff_R13;

-  ulonglong unaff_R14;

-  int iVar21;

-  undefined8 *unaff_R15;

-  bool bVar22;

-  byte in_stack_00000050;

-  byte in_stack_00000051;

-  byte in_stack_00000052;

-  uint in_stack_00000054;

-  undefined4 in_stack_00000058;

-  uint in_stack_0000005c;

-  uint in_stack_00000060;

-  undefined4 in_stack_00000064;

-  ulonglong in_stack_00000068;

-  uint in_stack_00000070;

-  undefined4 uStack0000000000000078;

-  undefined4 uStack000000000000007c;

-  undefined8 *in_stack_00000080;

-  uint in_stack_00000088;

-  ulonglong in_stack_00000090;

-  ulonglong in_stack_000000a0;

-  int in_stack_000000a8;

-  ulonglong in_stack_000000b0;

-  undefined8 *puStack00000000000000b8;

-  ulonglong in_stack_000000c0;

-  ulonglong in_stack_000000c8;

-  int in_stack_000000e0;

-  undefined4 in_stack_000000e4;

-  longlong in_stack_000000f8;

-  sbyte sStack0000000000000100;

-  uint *in_stack_00000118;

-  ulonglong in_stack_00000130;

-  ulonglong in_stack_00000140;

-  undefined8 uStack0000000000000160;

-  longlong in_stack_00000170;

-  ulonglong in_stack_00000178;

-  longlong in_stack_00000180;

-  ulonglong *in_stack_00000188;

-  uint in_stack_000001d8;

-  undefined8 in_stack_000001f0;

-  ulonglong *in_stack_000001f8;

-  int iVar14;

+  uint *puVar1;

+  ushort uVar2;

+  bool bVar3;

+  bool bVar4;

+  bool bVar5;

+  int iVar6;

+  uint uVar7;

+  uint extraout_EAX;

+  longlong lVar8;

+  ulonglong uVar9;

+  void *pvVar10;

+  uint uVar11;

+  uint uVar12;

+  uint uVar13;

+  undefined2 uVar14;

+  ulonglong uVar15;

+  uint uVar16;

+  int *_Dst;

+  byte bVar17;

+  uint uVar18;

+  undefined8 uVar19;

+  ulonglong uVar20;

+  uint uVar21;

+  uint uVar22;

+  short local_84;

+  uint local_74;

+  ulonglong *local_70;

+  ulonglong local_58;

+  ulonglong local_50;

   

-  iVar16 = unaff_ESI + *(int *)(unaff_RBX + 0x41 + (longlong)unaff_RDI * 2);

-  puVar6 = unaff_RDI;

-code_r0x000140072fb6:

-  iVar21 = (int)param_4;

-  uVar4 = *(uint *)(&stack0x00000098 + ((ulonglong)puVar6 & 0xffffffff) * 4);

-  puVar18 = (undefined8 *)(ulonglong)uVar4;

-  iVar14 = (int)unaff_RBX;

-  bVar15 = (byte)iVar16;

-  bVar13 = (byte)unaff_RBX;

-  if ((uVar4 != 3) && (uVar4 != 0)) {

-    if (WPP_GLOBAL_Control == param_2) goto LAB_0;

-    if ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) goto LAB_0;

-    if ((byte)WPP_GLOBAL_Control[0x29] < 5) goto LAB_0;

-    WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x7a,puVar18,unaff_RDI,*unaff_RDI,

-                  (char *)(unaff_RDI + 4));

+  uVar18 = (uint)param_3;

+  uVar15 = param_3 & 0xffffffff;

+  uVar21 = 0;

+  uVar22 = 0;

+  _Dst = (int *)0x0;

+  local_84 = 0;

+  local_58 = 0;

+  local_50 = 0;

+  local_70 = (ulonglong *)0x0;

+  local_74 = 0;

+  pvVar10 = param_2;

+  lVar8 = IoGetCurrentProcess();

+  if (*(longlong *)(param_1 + 0x48) != lVar8) {

+    uVar7 = 0xc000cf18;

+    HsmDbgBreakOnStatus(-0x3fff30e8);

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

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

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

+      uVar19 = IoGetCurrentProcess();

+      PsGetProcessId(uVar19);

+      IoGetCurrentProcess();

+      WPP_SF_qqDqDqDZZqDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),pvVar10,param_3,param_1);

+    }

     goto LAB_0;

   }

-  if ((longlong)unaff_R14 < param_1) {

-    in_stack_000000a0 = param_1;

-    unaff_R14 = param_1;

+  *(undefined8 *)(param_1 + 0x20) = _DAT_1;

+  if ((param_4 != (void *)0x0) && (param_5 != 0)) {

+    local_74 = param_5;

+    uVar19 = 0x424f6c43;

+    local_70 = (ulonglong *)ExAllocatePool2(0x100,param_5);

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

+      uVar7 = 0xc000009a;

+      HsmDbgBreakOnStatus(-0x3fffff66);

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

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

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

+        WPP_SF_qqDqDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8c,uVar19,param_1);

+      }

+      _Dst = (int *)0x0;

+      goto LAB_0;

+    }

+  }

+  ProbeForRead(param_2,uVar15,4);

+  uVar19 = 0x736d6c43;

+  _Dst = (int *)ExAllocatePool2(0x102,uVar15);

+  if (_Dst == (int *)0x0) {

+    uVar7 = 0xc000009a;

+    HsmDbgBreakOnStatus(-0x3fffff66);

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

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

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

+      WPP_SF_qqDqDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8d,uVar19,param_1);

+    }

+    goto LAB_0;

+  }

+  memmove(_Dst,param_2,uVar15);

+  bVar5 = false;

+  bVar17 = 0;

+  if ((0x17 < uVar18) && (*_Dst == 0x706d6c43)) {

+    puVar1 = (uint *)(_Dst + 2);

+    if ((*(byte *)(_Dst + 3) & 2) != 0) {

+      uVar15 = (ulonglong)(uVar18 - 8);

+      iVar6 = RtlComputeCrc32(0,puVar1);

+      if (_Dst[1] != iVar6) goto LAB_2;

+    }

+    if (((*puVar1 <= uVar18) && (*(ushort *)((longlong)_Dst + 0xe) != 0)) &&

+       (uVar20 = 0, (uint)*(ushort *)((longlong)_Dst + 0xe) * 8 + 0x10 < *puVar1)) {

+      while( true ) {

+        uVar15 = uVar20;

+        uVar7 = 0x17;

+        uVar2 = *(ushort *)((longlong)_Dst + 0xe);

+        if (uVar2 < 0x17) {

+          uVar7 = (uint)uVar2;

+        }

+        bVar3 = true;

+        if (uVar7 <= (uint)uVar15) break;

+        if ((((0x11 < *(ushort *)(_Dst + uVar15 * 2 + 4)) ||

+             (((uVar7 = _Dst[uVar15 * 2 + 5], uVar7 != 0 && (uVar7 < (uint)uVar2 * 8 + 0x10)) ||

+              (uVar16 = *puVar1, uVar16 < uVar7)))) ||

+            ((uVar2 = *(ushort *)((longlong)_Dst + uVar15 * 8 + 0x12), uVar16 < uVar2 ||

+             (uVar11 = uVar2 + uVar7, uVar11 < uVar7)))) || (uVar16 < uVar11)) {

+          bVar3 = false;

+        }

+        if (!bVar3) goto LAB_2;

+        uVar20 = (ulonglong)((uint)uVar15 + 1);

+      }

+      uVar7 = *puVar1;

+      uVar15 = (ulonglong)uVar7;

+      if (0x17 < uVar7) {

+        if (uVar2 == 0) {

+LAB_3:

+          uVar7 = 0xc0000225;

+        }

+        else {

+          if ((0x11 < *(ushort *)(_Dst + 4)) ||

+             (((((uVar16 = _Dst[5], uVar16 != 0 && (uVar16 < (uint)uVar2 * 8 + 0x10)) ||

+                (uVar7 < uVar16)) ||

+               ((uVar7 < *(ushort *)((longlong)_Dst + 0x12) ||

+                (uVar11 = *(ushort *)((longlong)_Dst + 0x12) + uVar16, uVar11 < uVar16)))) ||

+              (bVar4 = bVar3, uVar7 < uVar11)))) {

+            bVar4 = false;

+          }

+          if (((!bVar4) || (*(ushort *)(_Dst + 4) != 7)) || (*(short *)((longlong)_Dst + 0x12) != 1)

+             ) goto LAB_3;

+          bVar17 = *(byte *)((ulonglong)(uint)_Dst[5] + (longlong)_Dst);

+          uVar7 = uVar22;

+        }

+        if ((-1 < (int)uVar7) && (bVar17 < 2)) {

+          bVar5 = bVar3;

+        }

+      }

+    }

+  }

+LAB_2:

+  if (!bVar5) {

+    uVar7 = 0xc000000d;

+    HsmDbgBreakOnStatus(-0x3ffffff3);

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

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

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

+      WPP_SF_qqDqDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8e,uVar15,param_1);

+    }

+    goto LAB_0;

+  }

+  uVar16 = 0xc0000225;

+  uVar7 = uVar16;

+  if ((0x17 < uVar18) && (1 < *(ushort *)((longlong)_Dst + 0xe))) {

+    uVar11 = _Dst[2];

+    uVar15 = (ulonglong)uVar11;

+    if (0x1f < uVar11) {

+      if (((0x11 < *(ushort *)(_Dst + 6)) ||

+          (((uVar13 = _Dst[7], uVar13 != 0 &&

+            (uVar13 < (uint)*(ushort *)((longlong)_Dst + 0xe) * 8 + 0x10)) || (uVar11 < uVar13))))

+         || (((uVar11 < *(ushort *)((longlong)_Dst + 0x1a) ||

+              (uVar12 = *(ushort *)((longlong)_Dst + 0x1a) + uVar13, uVar12 < uVar13)) ||

+             (bVar5 = true, uVar11 < uVar12)))) {

+        bVar5 = false;

+      }

+      if (((bVar5) && (*(ushort *)(_Dst + 6) == 8)) && (*(short *)((longlong)_Dst + 0x1a) == 2)) {

+        local_84 = *(short *)((ulonglong)(uint)_Dst[7] + (longlong)_Dst);

+        uVar7 = uVar22;

+      }

+    }

+  }

+  HsmDbgBreakOnStatus(uVar7);

+  if ((int)uVar7 < 0) {

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

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

+       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+    uVar14 = 0x90;

+    goto LAB_4;

+  }

+  if ((ushort)(local_84 + 0x3fffU) < 5) {

+    uVar7 = CldiPortProcessGlobal(local_84,(longlong)_Dst,uVar18,local_70,local_74);

+  }

+  else if ((ushort)(local_84 + 0xbfffU) < 2) {

+    uVar7 = CldiPortProcessFilterControl(param_1,local_84,(longlong)_Dst,uVar18,local_70,local_74);

   }

   else {

-    in_stack_000000a0 = unaff_R14 + in_R11;

-    unaff_R14 = unaff_R14 + in_R11;

-  }

-  in_stack_000000a0 = unaff_R14;

-  if (((WPP_GLOBAL_Control != param_2) &&

-      ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-    WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x79,puVar18,unaff_RDI,*unaff_RDI,

-                  (char *)(unaff_RDI + 4));

-    iVar21 = (int)in_stack_00000080;

-  }

-  in_stack_00000060 = iVar21 + iVar16;

-  in_stack_00000080 = (undefined8 *)(ulonglong)in_stack_00000060;

-LAB_1:

-  if (((longlong)unaff_R14 < (longlong)in_stack_00000068) &&

-     (((ulonglong)in_stack_00000080 & 0xffffffff) <

-      (-(ulonglong)(in_stack_00000054 != 0) & 0xffffffffffffc010) + 0x7fe0)) {

-    if ((int)unaff_R15 == 0) {

-      in_stack_00000090 = 3;

-      uVar4 = 7;

-      bVar20 = bVar15;

-    }

-    else {

-      in_stack_00000090 = 2;

-      uVar4 = 3;

-      bVar20 = bVar13;

-    }

-    puVar18 = (undefined8 *)0x4;

-    in_stack_00000140 = (ulonglong)(uVar4 & (uint)in_stack_00000080);

-    puVar6 = &`HsmBitmapGetNextLevelBlockState'::__l2::level0Masks;

-    if (bVar20 == 0) {

-      puVar6 = (undefined8 *)&`HsmBitmapGetNextLevelBlockState'::__l2::levelnMasks;

-    }

-    bVar8 = *(byte *)((((ulonglong)in_stack_00000080 & 0xffffffff) >> (sbyte)in_stack_00000090) +

-                     in_stack_000000b0) & *(byte *)((longlong)puVar6 + in_stack_00000140);

-    if (bVar8 == *(byte *)((longlong)puVar6 + in_stack_00000140)) {

-      puVar18 = (undefined8 *)0x3;

-    }

-    else if (bVar8 == 0) {

-      puVar18 = (undefined8 *)(unaff_RBX & 0xffffffff);

-    }

-    else if (bVar20 == 0) {

-      puVar18 = (undefined8 *)

-                (ulonglong)

-                ((uint)(*(byte *)((longlong)&`HsmBitmapGetNextLevelBlockState'::__l2::levelnStates +

-                                 in_stack_00000140) < bVar8) + iVar16);

-    }

-    *(int *)(&stack0x00000098 + ((ulonglong)unaff_R15 & 0xffffffff) * 4) = (int)puVar18;

-    if ((int)unaff_R12D < 0) {

-      puVar11 = WPP_GLOBAL_Control;

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

-          ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        uVar12 = 0x77;

-LAB_2:

-        puVar11 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-        WPP_SF_qisdqdd(puVar11,uVar12,unaff_RDI + 4,unaff_RDI,*unaff_RDI,(char *)(unaff_RDI + 4));

-      }

-LAB_3:

-      unaff_R12D = HsmiBitmapTranslateIOStatus(puVar11,unaff_R12D);

-      HsmDbgBreakOnStatus(unaff_R12D);

+    *(undefined8 *)(param_1 + 0x30) = _DAT_1;

+    if (6 < (ushort)(local_84 - 1U)) {

+      uVar7 = uVar16;

+      if (0x17 < uVar18) {

+        bVar5 = true;

+        if (*(ushort *)((longlong)_Dst + 0xe) < 9) {

+LAB_5:

+          uVar7 = 0xc0000225;

+          uVar11 = uVar21;

+        }

+        else {

+          uVar7 = _Dst[2];

+          uVar15 = (ulonglong)uVar7;

+          if (uVar7 < 0x58) goto LAB_5;

+          if (((0x11 < *(ushort *)(_Dst + 0x14)) ||

+              ((uVar11 = _Dst[0x15], uVar11 != 0 &&

+               (uVar11 < (uint)*(ushort *)((longlong)_Dst + 0xe) * 8 + 0x10)))) ||

+             (((uVar7 < uVar11 ||

+               ((uVar7 < *(ushort *)((longlong)_Dst + 0x52) ||

+                (uVar13 = *(ushort *)((longlong)_Dst + 0x52) + uVar11, uVar13 < uVar11)))) ||

+              (bVar3 = bVar5, uVar7 < uVar13)))) {

+            bVar3 = false;

+          }

+          if ((!bVar3) || (*(ushort *)(_Dst + 0x14) != 0x11)) goto LAB_5;

+          uVar11 = (uint)*(ushort *)((longlong)_Dst + 0x52);

+          uVar7 = uVar22;

+        }

+        uVar19 = 4;

+        if ((-1 < (int)uVar7) && (uVar11 != 0x82)) {

+          uVar7 = 0xc000cf0b;

+          HsmDbgBreakOnStatus(-0x3fff30f5);

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

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

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

+            WPP_SF_qqDqDDDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar19,uVar15,param_1);

+          }

+          goto LAB_0;

+        }

+        uVar7 = uVar16;

+        if ((0x17 < uVar18) && (4 < *(ushort *)((longlong)_Dst + 0xe))) {

+          uVar11 = _Dst[2];

+          uVar15 = (ulonglong)uVar11;

+          if (0x37 < uVar11) {

+            if (((0x11 < *(ushort *)(_Dst + 0xc)) ||

+                ((((uVar7 = _Dst[0xd], uVar7 != 0 &&

+                   (uVar7 < (uint)*(ushort *)((longlong)_Dst + 0xe) * 8 + 0x10)) || (uVar11 < uVar7)

+                  ) || ((uVar11 < *(ushort *)((longlong)_Dst + 0x32) ||

+                        (uVar13 = *(ushort *)((longlong)_Dst + 0x32) + uVar7, uVar13 < uVar7))))))

+               || (uVar11 < uVar13)) {

+              bVar5 = false;

+            }

+            uVar7 = uVar16;

+            if (((bVar5) && (*(ushort *)(_Dst + 0xc) == 6)) &&

+               (*(short *)((longlong)_Dst + 0x32) == 8)) {

+              local_58 = *(ulonglong *)((ulonglong)(uint)_Dst[0xd] + (longlong)_Dst);

+              uVar7 = uVar22;

+            }

+          }

+        }

+      }

+      HsmDbgBreakOnStatus(uVar7);

+      if ((int)uVar7 < 0) {

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

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

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+        uVar14 = 0x92;

+      }

+      else {

+        uVar7 = uVar16;

+        if ((0x17 < uVar18) && (7 < *(ushort *)((longlong)_Dst + 0xe))) {

+          uVar11 = _Dst[2];

+          uVar15 = (ulonglong)uVar11;

+          if (0x4f < uVar11) {

+            if (((*(ushort *)(_Dst + 0x12) < 0x12) &&

+                ((uVar7 = _Dst[0x13], uVar7 == 0 ||

+                 ((uint)*(ushort *)((longlong)_Dst + 0xe) * 8 + 0x10 <= uVar7)))) &&

+               ((uVar7 <= uVar11 &&

+                (((*(ushort *)((longlong)_Dst + 0x4a) <= uVar11 &&

+                  (uVar13 = *(ushort *)((longlong)_Dst + 0x4a) + uVar7, uVar13 <= uVar11)) &&

+                 (uVar7 <= uVar13)))))) {

+              bVar5 = true;

+            }

+            else {

+              bVar5 = false;

+            }

+            uVar7 = uVar16;

+            if (((bVar5) && (*(ushort *)(_Dst + 0x12) == 6)) &&

+               (*(short *)((longlong)_Dst + 0x4a) == 8)) {

+              local_50 = *(ulonglong *)((ulonglong)(uint)_Dst[0x13] + (longlong)_Dst);

+              uVar7 = uVar22;

+            }

+          }

+        }

+        HsmDbgBreakOnStatus(uVar7);

+        if (-1 < (int)uVar7) {

+          if (local_84 != 0x201) {

+            uVar15 = local_58;

+            uVar20 = local_50;

+            uVar9 = CldiPortAccessCheck(param_1,local_58,local_50);

+            uVar7 = (uint)uVar9;

+            HsmDbgBreakOnStatus(uVar7);

+            if ((int)uVar7 < 0) {

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

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

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

+                WPP_SF_qiild(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar15,uVar20,param_1);

+              }

+              goto LAB_0;

+            }

+          }

+          if (local_84 == -0x2fff) {

+            if ((local_70 != (ulonglong *)0x0) && (local_74 == 8)) {

+              *local_70 = 0;

+            }

+            CldiPortProcessGetRangeInfo

+                      (param_1,local_58,local_50,(longlong)_Dst,uVar18,local_70,local_74);

+            HsmDbgBreakOnStatus(extraout_EAX);

+            uVar7 = extraout_EAX;

+          }

+          else {

+            CldiPortSetSyncStatus(param_1,local_58,local_50,(longlong)_Dst,uVar18);

+            if ((ushort)(local_84 - 0x101U) < 6) {

+              uVar7 = CldiPortProcessTransfer

+                                (param_1,local_58,local_50,local_84,(longlong)_Dst,uVar18,local_70,

+                                 local_74);

+            }

+            else if (local_84 == 0x201) {

+              pvVar10 = CldiPortProcessAckNotification

+                                  (param_1,local_58,local_50,(longlong)_Dst,uVar18);

+              uVar7 = (uint)pvVar10;

+            }

+            else {

+              uVar7 = 0xc000cf0b;

+            }

+          }

+          goto LAB_6;

+        }

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

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

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+        uVar14 = 0x93;

+      }

 LAB_4:

-      if (in_stack_00000052 != bVar13) {

-        FltReleasePushLockEx(unaff_RDI + 6,0);

-      }

-      if (in_stack_000000e0 != iVar14) {

-        uStack0000000000000160 = CONCAT44(in_stack_000000e4,in_stack_000000e0);

-        HsmIBitmapNORMALUnpinBlock((int *)&stack0x00000160);

-      }

-      return unaff_R12D;

-    }

-    if ((((int)unaff_R13 != iVar16) ||

-        (*(int *)(&stack0x00000098 + ((ulonglong)unaff_R15 & 0xffffffff) * 4) != iVar14)) &&

-       ((param_1 = in_stack_000000c8, param_2 = &WPP_GLOBAL_Control, param_4 = in_stack_00000080,

-        in_R11 = in_stack_000000f8, puVar6 = unaff_R15, (int)unaff_R13 != 0 ||

-        (*(int *)(&stack0x00000098 + ((ulonglong)unaff_R15 & 0xffffffff) * 4) != 3))))

-    goto code_r0x000140072fb6;

-    in_stack_00000050 = bVar15;

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

-        ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-      WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x78,puVar18,unaff_RDI,*unaff_RDI,

-                    (char *)(unaff_RDI + 4));

-    }

-  }

+      WPP_SF_qqDqDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar14,uVar15,param_1);

+      goto LAB_0;

+    }

+    pvVar10 = CldiPortProcessServiceCommands(param_1,local_84,(longlong)_Dst,uVar18);

+    uVar7 = (uint)pvVar10;

+  }

+LAB_6:

+  HsmDbgBreakOnStatus(uVar7);

 LAB_0:

-  do {

-    do {

-      do {

-        iVar21 = (int)unaff_R15;

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

-            ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x7b,puVar18,unaff_RDI,*unaff_RDI

-                        ,(char *)(unaff_RDI + 4));

-        }

-        bVar22 = in_stack_00000054 != 0;

-        in_stack_00000054 = -in_stack_00000054;

-        if (((ulonglong)in_stack_00000080 & 0xffffffff) ==

-            (-(ulonglong)bVar22 & 0xffffffffffffc010) + 0x7fe0) {

-          iVar21 = iVar21 + 2;

-        }

-        if (((in_stack_00000050 == bVar13) && ((longlong)unaff_R14 < (longlong)in_stack_00000068))

-           && (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control &&

-               (((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

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

-          WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x7c,unaff_RDI + 4,unaff_RDI,

-                        *unaff_RDI,(char *)(unaff_RDI + 4));

-        }

-        uVar4 = iVar21 - 1;

-LAB_5:

-        unaff_R15 = (undefined8 *)(ulonglong)uVar4;

-        uVar1 = (undefined7)(unaff_RBX >> 8);

-        in_stack_00000054 = uVar4;

-        in_stack_00000070 = uVar4;

-        in_stack_00000088 = uVar4;

-        if (((in_stack_00000050 != bVar13) || ((*in_stack_00000118 >> 0xc & 7) < uVar4)) ||

-           ((longlong)in_stack_00000068 <= (longlong)unaff_R14)) {

-          uVar2 = unaff_R14;

-          if ((in_stack_00000068 != 0) && ((longlong)in_stack_00000068 < (longlong)unaff_R14)) {

-            in_stack_000000a0 = in_stack_00000068;

-            uVar2 = in_stack_00000068;

-          }

-          do {

-            unaff_R14 = uVar2;

-            iVar21 = (int)unaff_R13;

-            if (((longlong)in_stack_000000c0 <= (longlong)unaff_R14) ||

-               ((longlong)unaff_R14 <= (longlong)in_stack_00000130)) {

-LAB_6:

-              if ((longlong)unaff_R14 < (longlong)in_stack_000000c0) {

-                in_stack_000000c0 = unaff_R14;

-              }

-              *in_stack_000001f8 = in_stack_000000c0;

-              *(bool *)in_stack_000001f0 = iVar21 == iVar16;

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

-                  ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-                WPP_SF_qisiil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_RDI + 4,

-                              in_stack_000001f8,unaff_RDI,*unaff_RDI,(char *)(unaff_RDI + 4));

-              }

-              goto LAB_4;

-            }

-            lVar19 = (longlong)unaff_R14 >> ((byte)in_stack_00000058 & 0x3f);

-            in_stack_00000090 = (in_stack_00000170 >> ((byte)in_stack_00000058 & 0x3f)) - lVar19;

-            in_stack_00000051 = bVar13;

-            bVar20 = bVar15;

-            in_stack_00000130 = unaff_R14;

-            if (((((in_stack_000001d8 & 3) != 0) &&

-                 (uVar5 = HsmiBitmapNORMALLookupMcbMapping

-                                    ((longlong)unaff_RDI,(ulonglong)in_stack_000001d8,lVar19,

-                                     (longlong *)&stack0x00000090,&stack0x00000051), bVar20 = bVar13

-                 , (char)uVar5 == '\0')) || (bVar20 != 0)) && (in_stack_00000178 != unaff_RBX))

-            goto code_r0x000140072345;

-            if (iVar21 == 3) {

-              uVar2 = CONCAT71(uVar1,in_stack_00000051 != bVar13);

-              unaff_R13 = uVar2 & 0xffffffff;

-              in_stack_00000064 = (undefined4)uVar2;

-            }

-            iVar21 = (int)unaff_R13;

-            if ((uint)in_stack_00000051 != (uint)CONCAT71(uVar1,iVar21 == iVar16))

-            goto LAB_6;

-            in_stack_000000a0 = unaff_R14 + (in_stack_00000090 << ((byte)in_stack_00000058 & 0x3f));

-            uVar2 = in_stack_000000a0;

-          } while( true );

-        }

-        in_stack_000000a8 = (-(uint)(uVar4 != 0) & 0xfffffff0) + 0x20;

-        in_stack_000000f8 = *(longlong *)((longlong)&stack0x00000160 + (longlong)unaff_R15 * 8);

-        lVar19 = in_stack_000000f8 << (5U - (uVar4 != 0) & 0x3f);

-        in_stack_00000090 = lVar19 + -1 + unaff_R14;

-        if (uVar4 == 0) {

-          in_stack_000000c8 = in_stack_000000f8 + -1 + unaff_R14 & ~(in_stack_000000f8 - 1U);

-          in_stack_00000090 = -lVar19 & in_stack_00000090;

-          lVar17 = (longlong)(~(in_stack_000000f8 - 1U) & unaff_R14) >>

-                   ((byte)in_stack_00000058 & 0x3f);

-          lVar10 = lVar17 + SUB168(SEXT816(-0x7fdff7fdff7fdff7) * SEXT816(lVar17),8);

-          puStack00000000000000b8 = (undefined8 *)((lVar10 >> 0xe) - (lVar10 >> 0x3f));

-          in_stack_00000060 = (int)lVar17 + (int)puStack00000000000000b8 * -0x7fe0;

-        }

-        else {

-          lVar10 = unaff_R14 - (longlong)unaff_R14 % in_stack_000000f8;

-          in_stack_000000c8 = lVar10 + in_stack_000000f8;

-          in_stack_00000090 = in_stack_00000090 - (longlong)in_stack_00000090 % lVar19;

-          lVar10 = lVar10 / in_stack_000000f8;

-          lVar17 = SUB168(SEXT816(-0x7fdff7fdff7fdff7) * SEXT816(lVar10),8) + lVar10;

-          puStack00000000000000b8 = (undefined8 *)((lVar17 >> 0xd) - (lVar17 >> 0x3f));

-          in_stack_00000060 = (int)lVar10 + (int)puStack00000000000000b8 * -0x3ff0;

-        }

-        puVar18 = (undefined8 *)(ulonglong)in_stack_00000060;

-        in_stack_00000080 = puVar18;

-        if (in_stack_000000e0 != iVar14) {

-          in_stack_00000140 = CONCAT44(in_stack_000000e4,in_stack_000000e0);

-          HsmIBitmapNORMALUnpinBlock((int *)&stack0x00000140);

-          in_stack_000000b0 = unaff_RBX;

-          in_stack_000000e0 = iVar14;

-        }

-        if (uVar4 == (*in_stack_00000118 >> 0xc & 7)) {

-          in_stack_000000b0 = *in_stack_00000188;

-        }

-        else {

-          iVar21 = *(int *)(&stack0x00000098 + (ulonglong)(uVar4 + 1) * 4);

-          _uStack0000000000000078 = CONCAT44(uStack000000000000007c,iVar21);

-          lVar10 = 0x2000;

-          if ((iVar21 != iVar16) && (iVar21 == 2)) {

-            lVar10 = 0x3000;

-          }

-          puVar18 = (undefined8 *)((longlong)puStack00000000000000b8 * 0x2000 + lVar10);

-          puVar6 = unaff_R15;

-          unaff_R12D = func_0x0001400738bc();

-          in_stack_0000005c = unaff_R12D;

-          HsmDbgBreakOnStatus(unaff_R12D);

-          if ((int)unaff_R12D < 0) {

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

-                ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-              WPP_SF_qisdild(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),puVar6,

-                             puStack00000000000000b8,unaff_RDI,*unaff_RDI,(char *)(unaff_RDI + 4));

-            }

-            goto LAB_4;

-          }

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

-              ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-            WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x6e,puStack00000000000000b8,

-                          unaff_RDI,*unaff_RDI,(char *)(unaff_RDI + 4));

-            puVar18 = puStack00000000000000b8;

-          }

-        }

-        if ((int)unaff_R13 == 3) {

-          if (uVar4 == 0) {

-            sStack0000000000000100 = 3;

-            uVar3 = 7;

-            bVar20 = bVar15;

-          }

-          else {

-            sStack0000000000000100 = 2;

-            uVar3 = 3;

-            bVar20 = bVar13;

-          }

-          _uStack0000000000000078 = (ulonglong)(uVar3 & (uint)in_stack_00000080);

-          puVar6 = &`HsmBitmapGetNextLevelBlockState'::__l2::level0Masks;

-          if (bVar20 == 0) {

-            puVar6 = (undefined8 *)&`HsmBitmapGetNextLevelBlockState'::__l2::levelnMasks;

-          }

-          bVar8 = *(byte *)((longlong)puVar6 + _uStack0000000000000078);

-          bVar7 = *(byte *)((((ulonglong)in_stack_00000080 & 0xffffffff) >> sStack0000000000000100)

-                           + in_stack_000000b0) & bVar8;

-          if (bVar7 == bVar8) {

-            iVar21 = 3;

-          }

-          else {

-            iVar21 = iVar14;

-            if ((bVar7 != 0) && (iVar21 = 4, bVar20 == 0)) {

-              iVar21 = (uint)(*(byte *)((longlong)

-                                        &`HsmBitmapGetNextLevelBlockState'::__l2::levelnStates +

-                                       _uStack0000000000000078) < bVar7) + iVar16;

-            }

-          }

-          *(int *)(&stack0x00000098 + (longlong)unaff_R15 * 4) = iVar21;

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

-            iVar21 = *(int *)(&stack0x00000098 + (longlong)unaff_R15 * 4);

-            if ((iVar21 == 3) ||

-               (puVar18 = (undefined8 *)CONCAT71((int7)((ulonglong)puVar18 >> 8),bVar8), iVar21 == 0

-               )) {

-              uVar2 = CONCAT71(uVar1,iVar21 == 3);

-              unaff_R13 = uVar2 & 0xffffffff;

-              in_stack_00000064 = (undefined4)uVar2;

-              _uStack0000000000000078 = uVar2 & 0xffffffff;

-              puVar18 = (undefined8 *)WPP_GLOBAL_Control;

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

-                 (((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

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

-                WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x70,WPP_GLOBAL_Control,

-                              unaff_RDI,*unaff_RDI,(char *)(unaff_RDI + 4));

-                unaff_R13 = _uStack0000000000000078 & 0xffffffff;

-                in_stack_00000064 = uStack0000000000000078;

-              }

-            }

-            goto LAB_7;

-          }

-          puVar11 = WPP_GLOBAL_Control;

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

-              ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_3;

-          uVar12 = 0x6f;

-          goto LAB_2;

-        }

-LAB_7:

-        iVar21 = (int)unaff_R13;

-      } while (iVar21 == 3);

-      while( true ) {

-        if ((((longlong)in_stack_00000068 <= (longlong)unaff_R14) ||

-            ((-(ulonglong)(in_stack_00000054 != 0) & 0xffffffffffffc010) + 0x7fe0 <=

-             ((ulonglong)in_stack_00000080 & 0xffffffff))) ||

-           (((uint)in_stack_00000080 & in_stack_000000a8 - 1U) == 0)) goto LAB_8;

-        if (uVar4 == 0) {

-          _uStack0000000000000078 = 3;

-          uVar3 = 7;

-          bVar20 = bVar15;

-        }

-        else {

-          _uStack0000000000000078 = 2;

-          uVar3 = 3;

-          bVar20 = bVar13;

-        }

-        puVar18 = (undefined8 *)0x4;

-        in_stack_00000140 = (ulonglong)(uVar3 & (uint)in_stack_00000080);

-        puVar6 = &`HsmBitmapGetNextLevelBlockState'::__l2::level0Masks;

-        if (bVar20 == 0) {

-          puVar6 = (undefined8 *)&`HsmBitmapGetNextLevelBlockState'::__l2::levelnMasks;

-        }

-        bVar8 = *(byte *)((((ulonglong)in_stack_00000080 & 0xffffffff) >>

-                          (sbyte)_uStack0000000000000078) + in_stack_000000b0) &

-                *(byte *)((longlong)puVar6 + in_stack_00000140);

-        if (bVar8 == *(byte *)((longlong)puVar6 + in_stack_00000140)) {

-          puVar18 = (undefined8 *)0x3;

-        }

-        else if (bVar8 == 0) {

-          puVar18 = (undefined8 *)(unaff_RBX & 0xffffffff);

-        }

-        else if (bVar20 == 0) {

-          puVar18 = (undefined8 *)

-                    (ulonglong)

-                    ((uint)(*(byte *)((longlong)

-                                      &`HsmBitmapGetNextLevelBlockState'::__l2::levelnStates +

-                                     in_stack_00000140) < bVar8) + iVar16);

-        }

-        *(int *)(&stack0x00000098 + (longlong)unaff_R15 * 4) = (int)puVar18;

-        if ((int)unaff_R12D < 0) {

-          puVar11 = WPP_GLOBAL_Control;

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

-              ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-            uVar12 = 0x71;

-            goto LAB_2;

-          }

-          goto LAB_3;

-        }

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

-            ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          puVar18 = unaff_RDI + 4;

-          WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x72,puVar18,unaff_RDI,*unaff_RDI

-                        ,(char *)puVar18);

-        }

-        if (((iVar21 == iVar16) && (*(int *)(&stack0x00000098 + (longlong)unaff_R15 * 4) == iVar14))

-           || ((iVar21 == 0 && (*(int *)(&stack0x00000098 + (longlong)unaff_R15 * 4) == 3)))) break;

-        if ((*(int *)(&stack0x00000098 + (longlong)unaff_R15 * 4) != 3) &&

-           (*(int *)(&stack0x00000098 + (longlong)unaff_R15 * 4) != 0)) goto LAB_8;

-        if ((longlong)unaff_R14 < (longlong)in_stack_000000c8) {

-          in_stack_000000a0 = in_stack_000000c8;

-          unaff_R14 = in_stack_000000c8;

-        }

-        else {

-          in_stack_000000a0 = unaff_R14 + in_stack_000000f8;

-          unaff_R14 = unaff_R14 + in_stack_000000f8;

-        }

-        in_stack_000000a0 = unaff_R14;

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

-            ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x74,puVar18,unaff_RDI,*unaff_RDI

-                        ,(char *)(unaff_RDI + 4));

-        }

-        in_stack_00000060 = (int)in_stack_00000080 + iVar16;

-        in_stack_00000080 = (undefined8 *)(ulonglong)in_stack_00000060;

-      }

-      in_stack_00000050 = bVar15;

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

-          ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x73,puVar18,unaff_RDI,*unaff_RDI,

-                      (char *)(unaff_RDI + 4));

-      }

-LAB_8:

-    } while (((uint)in_stack_00000080 & in_stack_000000a8 - 1U) != 0);

-    while ((longlong)unaff_R14 < (longlong)in_stack_00000068) {

-      uVar3 = in_stack_000000a8 + (int)in_stack_00000080;

-      puVar18 = (undefined8 *)(ulonglong)uVar3;

-      if ((undefined8 *)((-(ulonglong)(in_stack_00000054 != 0) & 0xffffffffffffc010) + 0x7fe0) <=

-          puVar18) goto LAB_1;

-      iVar9 = -1;

-      if (iVar21 != iVar16) {

-        iVar9 = iVar14;

-      }

-      if (*(int *)((((ulonglong)in_stack_00000080 & 0xffffffff) >> (3U - (uVar4 != 0) & 0x3f)) +

-                  in_stack_000000b0) != iVar9) goto LAB_1;

-      in_stack_00000080 = (undefined8 *)(ulonglong)uVar3;

-      in_stack_000000a0 = in_stack_00000090;

-      if ((longlong)in_stack_00000090 <= (longlong)unaff_R14) {

-        in_stack_000000a0 = unaff_R14 + lVar19;

-      }

-      unaff_R14 = in_stack_000000a0;

-      in_stack_00000060 = uVar3;

-      if ((int)unaff_R12D < 0) {

-        puVar11 = WPP_GLOBAL_Control;

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

-            ((bVar15 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          uVar12 = 0x75;

-          goto LAB_2;

-        }

-        goto LAB_3;

-      }

-    }

-  } while( true );

-code_r0x000140072345:

-  in_stack_00000068 = in_stack_00000180 * in_stack_00000090 + unaff_R14;

-  uVar4 = *in_stack_00000118;

-  *(undefined4 *)(&stack0x00000098 + (ulonglong)(uVar4 >> 0xc & 7) * 4) = 4;

-  uVar4 = uVar4 >> 0xc & 7;

-  in_stack_00000050 = bVar13;

-  goto LAB_5;

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

+    memmove(param_4,local_70,(ulonglong)local_74);

+    uVar21 = local_74;

+  }

+  *param_6 = uVar21;

+  if (local_70 != (ulonglong *)0x0) {

+    ExFreePoolWithTag(local_70,0x424f6c43);

+  }

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

+    ExFreePoolWithTag(_Dst,0x736d6c43);

+  }

+  return uVar7;

 }
```

## `HsmFltPreCLEANUP`  (modified)

```diff
--- HsmFltPreCLEANUP
+++ HsmFltPreCLEANUP
@@ -1,32 +1,568 @@
+

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

 

 uint HsmFltPreCLEANUP(longlong param_1,longlong param_2,longlong *param_3,longlong *param_4)

 

 {

-  byte *pbVar1;

-  undefined4 in_EAX;

-  uint uVar2;

-  undefined4 in_register_00000004;

-  longlong *unaff_RBP;

+  ulonglong *_Src;

+  int *piVar1;

+  undefined4 uVar2;

   longlong lVar3;

-  longlong unaff_RSI;

+  ulonglong *puVar4;

+  undefined8 uVar5;

+  code *pcVar6;

+  longlong lVar7;

+  undefined1 *puVar8;

+  char cVar9;

+  uint uVar10;

+  uint uVar11;

+  int iVar12;

+  longlong lVar13;

+  longlong lVar14;

+  undefined8 uVar15;

+  int *piVar16;

+  ulonglong uVar17;

+  ulonglong uVar18;

+  undefined8 uVar19;

+  longlong *plVar20;

+  undefined2 uVar21;

+  longlong *plVar22;

+  undefined1 *puVar23;

+  longlong lVar24;

+  longlong *plVar25;

+  uint uVar26;

+  longlong *in_R10;

+  undefined *puVar27;

+  longlong *in_R11;

+  ulonglong uVar28;

+  uint uVar29;

+  longlong *local_res10;

+  longlong *local_res18;

+  uint local_res20 [2];

+  undefined8 uStack_120;

+  undefined1 auStack_118 [32];

+  char local_f8 [64];

+  longlong local_b8;

+  longlong local_b0;

+  longlong local_a8;

+  ulonglong local_a0;

+  ulonglong *local_98;

+  longlong *local_90;

+  longlong *local_88;

+  int *local_80;

+  ulonglong local_78;

+  longlong *local_70;

+  ulonglong local_68;

+  undefined8 local_60;

+  undefined8 uStack_58;

+  undefined8 local_50;

+  uint uVar30;

   

-  pbVar1 = (byte *)(CONCAT44(in_register_00000004,in_EAX) + -0x7b);

-  *pbVar1 = *pbVar1 | (byte)param_1;

-  lVar3 = *unaff_RBP;

-  if (*pbVar1 != 0) {

-    *unaff_RBP = 0x140061532;

-    ExFreePoolWithTag(param_1,0x73557348);

-  }

-  *unaff_RBP = 0x140061546;

-  uVar2 = ExFreePoolWithTag();

-  if (unaff_RSI != 0) {

-    *unaff_RBP = 0x1400612ad;

-    uVar2 = FltReleaseContext();

-  }

-  if (lVar3 != 0) {

-    *unaff_RBP = 0x14006155a;

-    uVar2 = FltReleaseContext(lVar3);

-  }

-  return uVar2;

+  lVar13 = 0;

+  *param_3 = 0;

+  lVar14 = *(longlong *)(param_2 + 0x18);

+  local_b8 = 0;

+  uVar29 = 1;

+  uVar30 = 1;

+  local_80 = (int *)0x0;

+  local_b0 = 0;

+  FltGetStreamHandleContext(lVar14,*(undefined8 *)(param_2 + 0x20),&local_b0);

+  if (local_b0 != 0) {

+    if ((*(uint *)(*(longlong *)(local_b0 + 0x10) + 0x1c) & 1) == 0) {

+      if (local_b0 != 0) {

+        FltDeleteContext(local_b0);

+        goto LAB_0;

+      }

+      goto LAB_1;

+    }

+    if (local_b0 == 0) goto LAB_1;

+    if (*(longlong *)

+         (*(longlong *)(*(longlong *)(*(longlong *)(local_b0 + 0x10) + 0x10) + 0x10) + 0x20) ==

+        lVar14) {

+      if (param_1 != 0) {

+        lVar14 = FltGetRequestorProcess(param_1);

+        cVar9 = HsmOsIsPassThroughModeEnabled(lVar14);

+        if (cVar9 != '\0') goto LAB_0;

+      }

+    }

+    else {

+LAB_0:

+      FltReleaseContext(local_b0);

+      local_b0 = 0;

+    }

+    lVar14 = local_b0;

+    if (local_b0 == 0) goto LAB_1;

+    lVar13 = *(longlong *)(local_b0 + 0x10);

+    lVar24 = *(longlong *)(lVar13 + 0x10);

+    local_b8 = *(longlong *)(lVar24 + 0x10);

+    FltReferenceContext(lVar24);

+    goto LAB_2;

+  }

+LAB_1:

+  lVar14 = local_b0;

+  lVar3 = *(longlong *)(param_2 + 0x18);

+  local_a8 = 0;

+  FltGetFileContext(lVar3,*(undefined8 *)(param_2 + 0x20),&local_a8);

+  puVar23 = auStack_118;

+  lVar24 = local_a8;

+  if (local_a8 != 0) {

+    if (*(longlong *)(*(longlong *)(local_a8 + 0x10) + 0x20) == lVar3) {

+      if (param_1 != 0) {

+        lVar13 = FltGetRequestorProcess(param_1);

+        cVar9 = HsmOsIsPassThroughModeEnabled(lVar13);

+        lVar24 = local_a8;

+        lVar13 = 0;

+        if (cVar9 != '\0') goto LAB_3;

+      }

+    }

+    else {

+LAB_3:

+      FltReleaseContext(local_a8);

+      local_a8 = 0;

+      lVar24 = 0;

+      lVar13 = 0;

+    }

+LAB_2:

+    puVar23 = auStack_118;

+    if (lVar24 != 0) {

+      uVar17 = *(ulonglong *)(param_2 + 0x20);

+      local_78 = uVar17;

+      local_68 = uVar17;

+      KeEnterCriticalRegion();

+      ExAcquireResourceExclusiveLite(lVar24 + 0x78);

+      local_a0 = *(ulonglong *)(lVar24 + 0xe0);

+      puVar23 = auStack_118;

+      if (local_a0 != 0) {

+        plVar22 = *(longlong **)(local_a0 + 0x60);

+        plVar20 = (longlong *)(local_a0 + 0x60);

+        local_res10 = plVar20;

+        local_res18 = plVar20;

+        if (plVar22 != plVar20) {

+          do {

+            plVar25 = plVar22;

+            if ((uVar17 <= (ulonglong)plVar22[-8]) && ((ulonglong)plVar22[-8] <= uVar17)) {

+              puVar23 = auStack_118;

+              if ((longlong *)plVar22[1] != local_res10) goto LAB_4;

+              lVar3 = *plVar22;

+              puVar23 = auStack_118;

+              if (*(longlong **)(lVar3 + 8) != plVar22) goto LAB_4;

+              *local_res10 = lVar3;

+              *(longlong **)(lVar3 + 8) = local_res10;

+              plVar22[1] = (longlong)plVar22;

+              *plVar22 = (longlong)plVar22;

+              *(undefined4 *)(plVar22 + -2) = 0xc0000008;

+              KeSetEvent(plVar22 + -5,0,0);

+              plVar20 = local_res18;

+              plVar25 = *(longlong **)local_res10[1];

+            }

+            plVar22 = (longlong *)*plVar25;

+            local_res10 = plVar25;

+          } while (plVar22 != plVar20);

+        }

+        in_R11 = *(longlong **)(local_a0 + 0x50);

+        param_4 = (longlong *)(local_a0 + 0x50);

+        local_res10 = (longlong *)((ulonglong)local_res10 & 0xffffffffffffff00);

+        puVar23 = auStack_118;

+        puVar8 = auStack_118;

+        in_R10 = param_4;

+        local_90 = param_4;

+        local_88 = param_4;

+        local_70 = in_R11;

+        if (in_R11 != param_4) {

+          do {

+            puVar23 = puVar8;

+            local_98 = (ulonglong *)(in_R11 + 3);

+            local_90 = in_R10;

+            local_70 = in_R11;

+            if ((int)in_R11[4] == 0) {

+              uVar10 = uVar29;

+              if (*local_98 <= uVar17) {

+                if (*local_98 < uVar17) {

+                  uVar10 = 0xffffffff;

+                }

+                else {

+                  local_res10 = (longlong *)CONCAT71(local_res10._1_7_,1);

+                  uVar10 = 0;

+                }

+              }

+              while (uVar10 == 0) {

+LAB_5:

+                plVar20 = (longlong *)*in_R10;

+                if (((longlong *)plVar20[1] == in_R10) &&

+                   (lVar3 = *plVar20, *(longlong **)(lVar3 + 8) == plVar20)) {

+                  *in_R10 = lVar3;

+                  *(longlong **)(lVar3 + 8) = in_R10;

+                  *(undefined8 *)(puVar23 + -8) = 0x1400526df;

+                  HsmiFreePropertyLock((longlong)in_R11);

+                  param_4 = local_88;

+                  in_R10 = (longlong *)local_90[1];

+                  break;

+                }

+LAB_4:

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

+                (*pcVar6)();

+                puVar23 = puVar23 + 8;

+                uVar10 = uVar29;

+              }

+LAB_6:

+              cVar9 = (char)local_res10;

+            }

+            else {

+              uVar18 = 0;

+              local_res18 = (longlong *)((ulonglong)local_res18 & 0xffffffff00000000);

+              if (*(uint *)((longlong)in_R11 + 0x14) != 0) {

+                uVar17 = *local_98;

+                uVar28 = (ulonglong)*(uint *)((longlong)in_R11 + 0x14);

+                do {

+                  uVar10 = (uint)uVar18;

+                  uVar26 = (int)uVar28 + uVar10 >> 1;

+                  *(undefined8 *)(puVar23 + -8) = 0x140052c4a;

+                  uVar18 = HsmiCompareLockOwners

+                                     ((ulonglong *)(uVar17 + (ulonglong)uVar26 * 8),&local_78);

+                  uVar28 = uVar28 & 0xffffffff;

+                  uVar11 = uVar26 + 1;

+                  if (-1 < (int)uVar18) {

+                    uVar28 = (ulonglong)uVar26;

+                    uVar11 = uVar10;

+                  }

+                  uVar18 = (ulonglong)uVar11;

+                } while (uVar11 < (uint)uVar28);

+                uVar18 = (ulonglong)uVar11;

+                local_res18 = (longlong *)CONCAT44(local_res18._4_4_,uVar11);

+                uVar17 = local_68;

+                param_4 = local_88;

+              }

+              in_R11 = local_70;

+              in_R10 = local_90;

+              local_res20[0] = *(uint *)((longlong)local_70 + 0x14);

+              if (local_res20[0] <= (uint)uVar18) goto LAB_6;

+              puVar4 = (ulonglong *)(*local_98 + uVar18 * 8);

+              local_98 = puVar4;

+              *(undefined8 *)(puVar23 + -8) = 0x140052ca3;

+              uVar18 = HsmiCompareLockOwners(puVar4,&local_78);

+              puVar4 = local_98;

+              if ((int)uVar18 != 0) goto LAB_6;

+              local_res10 = (longlong *)CONCAT71(local_res10._1_7_,1);

+              if (local_res20[0] < 2) goto LAB_5;

+              uVar10 = local_res20[0] - 1;

+              *(uint *)((longlong)in_R11 + 0x14) = uVar10;

+              cVar9 = '\x01';

+              if ((uint)local_res18 < uVar10) {

+                _Src = local_98 + 1;

+                *(undefined8 *)(puVar23 + -8) = 0x140052ce6;

+                memmove(puVar4,_Src,(ulonglong)(uVar10 - (uint)local_res18) << 3);

+                param_4 = local_88;

+                in_R10 = local_90;

+              }

+            }

+            uVar18 = local_a0;

+            in_R10 = (longlong *)*in_R10;

+            in_R11 = (longlong *)*in_R10;

+            puVar8 = puVar23;

+          } while (in_R11 != param_4);

+          local_90 = in_R10;

+          local_70 = in_R11;

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

+            *(undefined8 *)(puVar23 + -8) = 0x140052713;

+            HsmiProcessPropertyLockRequestList(uVar18);

+          }

+        }

+      }

+      *(undefined8 *)(puVar23 + -8) = 0x1400525bf;

+      ExReleaseResourceLite(lVar24 + 0x78);

+      *(undefined8 *)(puVar23 + -8) = 0x1400525cb;

+      KeLeaveCriticalRegion();

+    }

+  }

+  if (lVar14 == 0) goto LAB_7;

+  *(longlong *)(puVar23 + 0x20) = lVar13;

+  *(undefined8 *)(puVar23 + -8) = 0x1400525eb;

+  HsmpTracePreCallbackEnter(param_1,'\0',1,lVar14,*(longlong *)(puVar23 + 0x20));

+  piVar16 = local_80;

+  if (((*(uint *)(lVar14 + 0x28) >> 0xc & 1) == 0) || ((*(uint *)(lVar14 + 0x28) >> 0xb & 1) != 0))

+  goto LAB_8;

+  local_50 = 0;

+  local_a0 = 0;

+  local_res20[0] = 0;

+  local_60 = 0;

+  uStack_58 = 0;

+  local_res18 = (longlong *)((ulonglong)local_res18 & 0xffffffff00000000);

+  *(undefined8 *)(puVar23 + -8) = 0x14005284f;

+  KeInitializeEvent(&local_60,1,0);

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

+  *(undefined8 **)(param_1 + 0x40) = &local_60;

+  uVar10 = *(uint *)(lVar13 + 0x1c);

+  *(code **)(puVar23 + 0x20) = HsmiInfoRenameNotificationCallback;

+  *(undefined8 *)(puVar23 + -8) = 0x140052888;

+  HsmpCldNotifyPreOperation

+            (4,param_1,(uVar10 & 2) << 3,0,*(undefined **)(puVar23 + 0x20),

+             *(undefined8 *)(puVar23 + 0x28));

+  *(undefined8 *)(puVar23 + -8) = 0x140052898;

+  iVar12 = FltCancellableWaitForSingleObject(&local_60,0,param_1);

+  local_res10 = (longlong *)CONCAT44(local_res10._4_4_,iVar12);

+  *(undefined8 *)(puVar23 + -8) = 0x1400528a7;

+  HsmDbgBreakOnStatus(iVar12);

+  if (((int)local_res10 == -0x3fffffb5) ||

+     (iVar12 = (int)local_res10, (int)local_res10 == -0x3ffffee0)) {

+    *(undefined8 *)(puVar23 + -8) = 0x140052d01;

+    FltCancelIo(param_1);

+    *(undefined8 *)(puVar23 + 0x20) = 0;

+    *(undefined8 *)(puVar23 + -8) = 0x140052d22;

+    KeWaitForSingleObject(&local_60,0,0,0);

+    iVar12 = (int)local_res10;

+  }

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

+  if (iVar12 < 0) {

+LAB_9:

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

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

+    {

+      *(undefined8 *)(puVar23 + -8) = 0x140052901;

+      puVar27 = WPP_GLOBAL_Control;

+      uVar15 = HsmpGetStreamSize(lVar13);

+      lVar3 = *(longlong *)(lVar13 + 0x10);

+      uVar5 = *(undefined8 *)(puVar27 + 0x18);

+      *(int *)(puVar23 + 0x50) = iVar12;

+      lVar7 = local_b8;

+      *(longlong *)(puVar23 + 0x48) = lVar14;

+      *(undefined8 *)(puVar23 + 0x40) = uVar15;

+      *(undefined4 *)(puVar23 + 0x38) = *(undefined4 *)(lVar13 + 0x1c);

+      uVar15 = *(undefined8 *)(lVar3 + 0x20);

+      *(longlong *)(puVar23 + 0x30) = lVar13;

+      *(undefined8 *)(puVar23 + 0x28) = uVar15;

+      *(undefined8 *)(puVar23 + 0x20) = *(undefined8 *)(param_2 + 0x20);

+      *(undefined8 *)(puVar23 + -8) = 0x14005294c;

+      WPP_SF_qqiqLiqd(uVar5,0xb,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,lVar7);

+    }

+    uVar5 = *(undefined8 *)(param_2 + 0x20);

+    uVar15 = *(undefined8 *)(param_2 + 0x18);

+    local_res10 = (longlong *)CONCAT44(local_res10._4_4_,8);

+    *(undefined4 *)(puVar23 + 0x20) = 0x40;

+    *(undefined8 *)(puVar23 + -8) = 0x140052974;

+    iVar12 = FltSetInformationFile(uVar15,uVar5,&local_res10);

+    local_res18 = (longlong *)CONCAT44(local_res18._4_4_,iVar12);

+    *(undefined8 *)(puVar23 + -8) = 0x140052983;

+    HsmDbgBreakOnStatus(iVar12);

+    piVar16 = local_80;

+    if ((int)(uint)local_res18 < 0) {

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

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

+         ) {

+        lVar3 = *(longlong *)(lVar13 + 0x10);

+        uVar5 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+        *(uint *)(puVar23 + 0x40) = (uint)local_res18;

+        *(longlong *)(puVar23 + 0x38) = param_1;

+        uVar15 = *(undefined8 *)(lVar3 + 0x10);

+        *(undefined8 *)(puVar23 + 0x30) = *(undefined8 *)(lVar3 + 0x20);

+        *(undefined8 *)(puVar23 + 0x28) = *(undefined8 *)(param_2 + 0x20);

+        *(longlong *)(puVar23 + 0x20) = lVar13;

+        *(undefined8 *)(puVar23 + -8) = 0x1400529fb;

+        WPP_SF_qqqiqd(uVar5,0xc,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,uVar15);

+      }

+      goto LAB_7;

+    }

+LAB_10:

+    *param_3 = lVar14;

+    uVar29 = 0;

+    lVar14 = 0;

+    uVar30 = uVar29;

+    if (piVar16 == (int *)0x0) goto LAB_7;

+  }

+  else {

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

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

+    {

+      *(undefined8 *)(puVar23 + -8) = 0x140052d5f;

+      puVar27 = WPP_GLOBAL_Control;

+      uVar19 = HsmpGetStreamSize(lVar13);

+      lVar3 = *(longlong *)(lVar13 + 0x10);

+      uVar5 = *(undefined8 *)(puVar27 + 0x18);

+      *(undefined4 *)(puVar23 + 0x58) = *(undefined4 *)(param_1 + 0x18);

+      uVar2 = *(undefined4 *)(lVar13 + 0x1c);

+      *(int *)(puVar23 + 0x50) = iVar12;

+      lVar7 = local_b8;

+      *(longlong *)(puVar23 + 0x48) = lVar14;

+      *(undefined8 *)(puVar23 + 0x40) = uVar19;

+      *(undefined4 *)(puVar23 + 0x38) = uVar2;

+      uVar15 = *(undefined8 *)(lVar3 + 0x20);

+      *(longlong *)(puVar23 + 0x30) = lVar13;

+      *(undefined8 *)(puVar23 + 0x28) = uVar15;

+      *(undefined8 *)(puVar23 + 0x20) = *(undefined8 *)(param_2 + 0x20);

+      *(undefined8 *)(puVar23 + -8) = 0x140052da8;

+      WPP_SF_qqiqLiqdd(uVar5,lVar3,uVar19,lVar7);

+    }

+    lVar3 = local_b8;

+    iVar12 = *(int *)(param_1 + 0x18);

+    if (iVar12 < 0) goto LAB_9;

+    *(undefined8 *)(puVar23 + -8) = 0x140052a62;

+    piVar16 = (int *)HsmpAcquireFileNameLock(lVar3,lVar13,param_1);

+    if (piVar16 == (int *)0x0) goto LAB_7;

+    puVar4 = *(ulonglong **)(param_2 + 0x20);

+    *(longlong ***)(puVar23 + 0x20) = &local_res18;

+    lVar3 = local_b8;

+    local_98 = puVar4;

+    *(undefined8 *)(puVar23 + -8) = 0x140052a93;

+    uVar10 = HsmiCldGetSyncRootFileIdByFileObject

+                       (lVar3,(ulonglong)puVar4,&local_a0,(int *)local_res20,

+                        *(undefined4 **)(puVar23 + 0x20));

+    local_res10 = (longlong *)CONCAT44(local_res10._4_4_,uVar10);

+    *(undefined8 *)(puVar23 + -8) = 0x140052a9d;

+    HsmDbgBreakOnStatus(uVar10);

+    puVar4 = local_98;

+    lVar3 = local_b8;

+    if ((((int)local_res10 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

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

+    {

+      *(int *)(puVar23 + 0x30) = (int)local_res10;

+      uVar5 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+      *(ulonglong **)(puVar23 + 0x28) = puVar4;

+      *(longlong *)(puVar23 + 0x20) = lVar13;

+      *(undefined8 *)(puVar23 + -8) = 0x140052b9f;

+      WPP_SF_qqqd(uVar5,0x34,&WPP_3908498190613570cb26e49c321d2b2f_Traceguids,lVar3);

+    }

+    *(undefined8 *)(puVar23 + -8) = 0x140052aad;

+    HsmDbgBreakOnStatus((int)local_res10);

+    iVar12 = 0;

+    if ((int)local_res10 != -0x3fff30ed) {

+      iVar12 = (int)local_res10;

+    }

+    if (-1 < iVar12) {

+      if (((uint)local_res18 != 0) && (local_res20[0] == 1)) {

+        uVar5 = *(undefined8 *)(lVar13 + 8);

+        *(undefined8 *)(puVar23 + -8) = 0x140052ae6;

+        uVar17 = (*DAT_11)(uVar5);

+        if (uVar17 == local_a0) {

+          if ((*(uint *)(lVar13 + 0x1c) & 2) == 0) {

+            *(undefined8 *)(puVar23 + -8) = 0x140052e38;

+            HsmpCloseExternalBitmaps(lVar13);

+          }

+          lVar3 = *(longlong *)(param_2 + 0x20);

+          *(undefined8 *)(puVar23 + -8) = 0x140052b0c;

+          iVar12 = HsmpRpRemove(lVar13,lVar3,'\x01');

+          local_res10 = (longlong *)CONCAT44(local_res10._4_4_,iVar12);

+          *(undefined8 *)(puVar23 + -8) = 0x140052b16;

+          HsmDbgBreakOnStatus(iVar12);

+          if ((int)local_res10 < 0) {

+            uVar30 = uVar29;

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

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

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

+              uVar21 = 0xe;

+              iVar12 = (int)local_res10;

+              goto LAB_12;

+            }

+            goto LAB_13;

+          }

+        }

+      }

+LAB_8:

+      *(undefined8 *)(puVar23 + -8) = 0x140052604;

+      HsmpRecallTerminateProgressiveHydration(lVar14);

+      if ((*(longlong *)(lVar13 + 0xa0) != 0) &&

+         (*(longlong *)(*(longlong *)(lVar13 + 0xa0) + 0x20) != 0)) {

+        if (param_1 != 0) {

+          *(undefined8 *)(puVar23 + -8) = 0x14005273a;

+          FltGetRequestorProcess(param_1);

+        }

+        *(undefined8 *)(puVar23 + -8) = 0x14005274a;

+        uVar15 = HsmpGetFileLock(lVar13);

+        uVar5 = *(undefined8 *)(param_2 + 0x20);

+        *(undefined8 *)(puVar23 + -8) = 0x14005275b;

+        iVar12 = FsRtlFastUnlockAll(uVar15,uVar5);

+        lVar3 = local_b8;

+        if ((((iVar12 + 0x80000000U & 0x80000000) == 0) && (iVar12 != -0x3fffff82)) &&

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

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

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

+          uVar5 = *(undefined8 *)(lVar24 + 0x20);

+          *(int *)(puVar23 + 0x40) = iVar12;

+          *(longlong *)(puVar23 + 0x38) = param_1;

+          uVar15 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+          *(undefined8 *)(puVar23 + 0x30) = uVar5;

+          *(undefined8 *)(puVar23 + 0x28) = *(undefined8 *)(param_2 + 0x20);

+          *(longlong *)(puVar23 + 0x20) = lVar13;

+          *(undefined8 *)(puVar23 + -8) = 0x1400527ec;

+          WPP_SF_qqqiqd(uVar15,0xf,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,lVar3);

+        }

+      }

+      if (*(char *)(lVar14 + 0x2d) != '\0') {

+        uVar5 = *(undefined8 *)(param_2 + 0x20);

+        uVar15 = *(undefined8 *)(param_2 + 0x18);

+        *(undefined8 *)(puVar23 + -8) = 0x140052e6c;

+        iVar12 = FltFlushBuffers2(uVar15,uVar5,1);

+        lVar3 = local_b8;

+        if ((((iVar12 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

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

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

+          uVar5 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+          *(int *)(puVar23 + 0x40) = iVar12;

+          *(longlong *)(puVar23 + 0x38) = param_1;

+          *(undefined8 *)(puVar23 + 0x30) = *(undefined8 *)(lVar24 + 0x20);

+          *(undefined8 *)(puVar23 + 0x28) = *(undefined8 *)(param_2 + 0x20);

+          *(longlong *)(puVar23 + 0x20) = lVar13;

+          *(undefined8 *)(puVar23 + -8) = 0x140052ee7;

+          WPP_SF_qqqiqd(uVar5,0x10,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,lVar3);

+        }

+      }

+      lVar13 = *(longlong *)(lVar14 + 0x10);

+      if ((*(uint *)(lVar14 + 0x28) & 0x10) != 0) {

+        *(undefined8 *)(puVar23 + -8) = 0x140052ef8;

+        HsmpAcquireReparseUpdateLock(lVar13,'\x01');

+        if ((*(uint *)(lVar14 + 0x28) & 0x10) != 0) {

+          piVar1 = (int *)(lVar13 + 0x70);

+          *piVar1 = *piVar1 + -1;

+          if (*piVar1 == 0) {

+            *(undefined8 *)(puVar23 + -8) = 0x140052f11;

+            ExReInitializeRundownProtection(lVar13 + 0x78);

+            *(undefined8 *)(puVar23 + -8) = 0x140052f29;

+            KeSetEvent(lVar13 + 0x80,0,0);

+          }

+          *(uint *)(lVar14 + 0x28) = *(uint *)(lVar14 + 0x28) & 0xffffffef;

+        }

+        lVar13 = *(longlong *)(lVar13 + 0x10);

+        *(undefined8 *)(puVar23 + -8) = 0x140052f43;

+        FltReleasePushLockEx(lVar13 + 0x18,0);

+      }

+      goto LAB_10;

+    }

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

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

+    {

+      uVar21 = 0xd;

+LAB_12:

+      lVar7 = local_b8;

+      lVar3 = *(longlong *)(lVar13 + 0x10);

+      *(int *)(puVar23 + 0x40) = iVar12;

+      uVar5 = *(undefined8 *)(lVar3 + 0x20);

+      *(longlong *)(puVar23 + 0x38) = param_1;

+      uVar15 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+      *(undefined8 *)(puVar23 + 0x30) = uVar5;

+      *(undefined8 *)(puVar23 + 0x28) = *(undefined8 *)(param_2 + 0x20);

+      *(longlong *)(puVar23 + 0x20) = lVar13;

+      *(undefined8 *)(puVar23 + -8) = 0x140052e2b;

+      WPP_SF_qqqiqd(uVar15,uVar21,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,lVar7);

+      uVar30 = uVar29;

+    }

+  }

+LAB_13:

+  uVar29 = uVar30;

+  *(undefined8 *)(puVar23 + -8) = 0x140052b40;

+  HsmpReleaseFileNameLock(piVar16);

+LAB_7:

+  if (lVar24 != 0) {

+    *(undefined8 *)(puVar23 + -8) = 0x1400524b0;

+    FltReleaseContext(lVar24);

+  }

+  if (lVar14 != 0) {

+    *(undefined8 *)(puVar23 + -8) = 0x140052f60;

+    FltDeleteContext(lVar14);

+    *(undefined8 *)(puVar23 + -8) = 0x140052f6f;

+    FltReleaseContext(lVar14);

+    lVar14 = *param_3;

+    puVar23[0x20] = 1;

+    *(undefined8 *)(puVar23 + -8) = 0x140052f8b;

+    HsmpTracePreCallbackExit((ulonglong)uVar29,param_1,lVar14,'\0',puVar23[0x20]);

+  }

+  return uVar29;

 }
```

## `CldHsmPopulatePlaceholders`  (modified)

```diff
--- CldHsmPopulatePlaceholders
+++ CldHsmPopulatePlaceholders
@@ -1,31 +1,213 @@
 

-int CldHsmPopulatePlaceholders

-              (longlong param_1,uint *param_2,longlong *param_3,undefined8 param_4,wchar_t *param_5,

-              undefined *param_6,undefined8 param_7,void *param_8,undefined8 *param_9)

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

+

+void CldHsmPopulatePlaceholders

+               (longlong param_1,uint *param_2,longlong *param_3,undefined8 param_4,wchar_t *param_5

+               ,undefined *param_6,undefined8 param_7,void *param_8,undefined8 *param_9)

 

 {

-  int iVar1;

-  longlong in_RAX;

+  bool bVar1;

+  char cVar2;

+  int iVar3;

+  ulonglong uVar4;

+  undefined8 *puVar5;

+  undefined8 uVar6;

+  ulonglong uVar7;

+  undefined2 uVar8;

+  uint uVar9;

+  void *pvVar10;

+  uint *puVar11;

+  uint *puVar12;

+  undefined *puVar13;

+  longlong *plVar14;

+  uint local_res18 [2];

+  undefined8 local_res20;

+  undefined8 uVar16;

+  void *local_48;

+  undefined8 *local_40;

+  longlong *plVar15;

   

-  *(byte *)(in_RAX + -0x77) = *(byte *)(in_RAX + -0x77) ^ (byte)param_1;

-  DAT_0 = &DAT_14002a8c0;

-  DAT_1 = &DAT_1;

-  iVar1 = HsmOsGetPhysicalMemorySize((longlong *)param_1);

-  HsmDbgBreakOnStatus(iVar1);

-  if (iVar1 < 0) {

+  puVar11 = (uint *)0x0;

+  puVar12 = (uint *)0x0;

+  local_48 = (void *)0x0;

+  plVar15 = (longlong *)0x0;

+  plVar14 = (longlong *)0x0;

+  local_res18[0] = 0;

+  bVar1 = false;

+  local_res20 = param_4;

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

+    iVar3 = -0x3fff30ee;

+    HsmDbgBreakOnStatus(-0x3fff30ee);

+    puVar12 = puVar11;

+    plVar14 = plVar15;

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

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

        (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-      WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x80,

-               &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,iVar1);

+      uVar8 = 0x67;

+LAB_1:

+      WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar8,

+                  &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_2);

     }

   }

   else {

-    DAT_2 = 0x4000000;

-    if ((ulonglong)param_6 >> 6 < 0x4000000) {

-      DAT_2 = (ulonglong)param_6 >> 6;

-    }

-  }

-  return iVar1;

+    local_40 = (undefined8 *)CldLookupSyncRoot(param_3[2]);

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

+      iVar3 = -0x3fff30ff;

+      HsmDbgBreakOnStatus(-0x3fff30ff);

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

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

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

+        uVar8 = 0x68;

+        puVar12 = puVar11;

+        plVar14 = plVar15;

+        goto LAB_1;

+      }

+    }

+    else {

+      if (param_3[4] == 0) {

+        iVar3 = CldStreamOpen(param_3);

+        HsmDbgBreakOnStatus(iVar3);

+        if (iVar3 < 0) {

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

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

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

+            uVar8 = 0x6a;

+            puVar12 = puVar11;

+            plVar14 = plVar15;

+            goto LAB_1;

+          }

+          goto LAB_2;

+        }

+      }

+      plVar14 = (longlong *)param_3[4];

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

+        FltGetIoPriorityHint(param_2);

+      }

+      cVar2 = HsmOsIsSyncProviderProcessFromAttributionInfo(param_1);

+      uVar7 = HsmOsGetProcessId(param_1);

+      uVar4 = HsmOsGetProcessSessionId(param_1);

+      uVar9 = (uint)uVar4;

+      puVar5 = (undefined8 *)HsmOsGetVmGuid(param_1);

+      uVar16 = param_7;

+      puVar12 = CldiStreamAllocateRequest

+                          (puVar5,uVar9,(uint)uVar7,plVar14,

+                           (-(uint)(cVar2 != '\0') & 0x40000000) + 2,local_res20,param_6,param_7,0,

+                           param_9);

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

+        iVar3 = -0x3fffff66;

+        HsmDbgBreakOnStatus(-0x3fffff66);

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

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

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

+          uVar8 = 0x6b;

+          goto LAB_1;

+        }

+      }

+      else {

+        CldiStreamCdqACQUIRE(*(longlong *)(*plVar14 + 8) + 0x90);

+        bVar1 = true;

+        uVar7 = Feature_3667029304__private_IsEnabledDeviceUsageNoInline();

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

+          pvVar10 = *(void **)(*(longlong *)*plVar14 + 0x30);

+          uVar9 = *(uint *)(*(longlong *)*plVar14 + 0x38);

+        }

+        else {

+          uVar6 = HsmCaptureFileIdentity(*param_3,&local_48,local_res18);

+          iVar3 = (int)uVar6;

+          HsmDbgBreakOnStatus(iVar3);

+          pvVar10 = local_48;

+          uVar9 = local_res18[0];

+          if (iVar3 < 0) {

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

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

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

+              uVar8 = 0x6c;

+              goto LAB_1;

+            }

+            goto LAB_2;

+          }

+        }

+        puVar13 = *(undefined **)(*(longlong *)(*(longlong *)*plVar14 + 0x10) + 0x20);

+        uVar7 = CldSyncSendPopulationRequest

+                          (local_40,5,puVar13,*(longlong *)(puVar12 + 0x1c),

+                           *(undefined8 *)(*(longlong *)*plVar14 + 0x28),pvVar10,uVar9,uVar16,

+                           param_5,param_8,(undefined8 *)(puVar12 + 0x2a));

+        iVar3 = (int)uVar7;

+        HsmDbgBreakOnStatus(iVar3);

+        if (iVar3 < 0) {

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

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

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

+            WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x6d,

+                         &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_2);

+          }

+        }

+        else {

+          puVar11 = param_2;

+          iVar3 = CldiStreamInsertIntoCancelSafeQueue(plVar14,param_2,puVar13,puVar12);

+          HsmDbgBreakOnStatus(iVar3);

+          if (iVar3 < 0) {

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

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

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

+              WPP_SF_qqqi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x6e,puVar13,param_2);

+            }

+          }

+          else {

+            CldiStreamCdqRELEASE(*(longlong *)(*plVar14 + 8) + 0x90);

+            bVar1 = false;

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

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

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

+              puVar11 = (uint *)0x6f;

+              WPP_SF_qqqi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x6f,puVar13,param_2);

+            }

+            puVar12 = (uint *)0x0;

+            CldiStreamStartCountdownTimer('\0',puVar11,puVar13);

+          }

+        }

+      }

+    }

+  }

+LAB_2:

+  uVar7 = Feature_3667029304__private_IsEnabledDeviceUsageNoInline();

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

+    HsmFreeFileIdentity((longlong)local_48);

+  }

+  uVar7 = Feature_2089223483__private_IsEnabledDeviceUsageNoInline();

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

+    if (bVar1) {

+      CldiStreamCdqRELEASE(*(longlong *)(*plVar14 + 8) + 0x90);

+    }

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

+      TlmWriteCvForPopulatePlaceholders((longlong)(puVar12 + 0x2a),iVar3);

+    }

+    if ((iVar3 < 0) && (param_6 != (undefined *)0x0)) {

+      (*(code *)param_6)(param_7,iVar3,0);

+    }

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

+      return;

+    }

+    CldiStreamDeleteRequest(puVar12);

+    return;

+  }

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

+    TlmWriteCvForPopulatePlaceholders((longlong)(puVar12 + 0x2a),iVar3);

+    if (!bVar1) {

+      CldiStreamCdqACQUIRE(*(longlong *)(*plVar14 + 8) + 0x90);

+      bVar1 = true;

+    }

+    CldiStreamDeleteRequest(puVar12);

+    uVar7 = Feature_4003697978__private_IsEnabledDeviceUsageNoInline();

+    if ((int)uVar7 != 0) goto LAB_3;

+  }

+  if (bVar1) {

+    CldiStreamCdqRELEASE(*(longlong *)(*plVar14 + 8) + 0x90);

+  }

+LAB_3:

+  if ((iVar3 < 0) && (param_6 != (undefined *)0x0)) {

+    (*(code *)param_6)(param_7,iVar3,0);

+  }

+  return;

 }
```

## `CldiStreamSignalEvents`  (modified)

```diff
--- CldiStreamSignalEvents
+++ CldiStreamSignalEvents
@@ -1,10 +1,46 @@
-

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

 

 void CldiStreamSignalEvents(char param_1,undefined8 param_2,undefined8 param_3)

 

 {

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

-  halt_baddata();

+  char cVar1;

+  undefined8 *puVar2;

+  

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

+    KeClearEvent();

+  }

+  else {

+    param_3 = 0;

+    KeSetEvent(DAT_0,0);

+  }

+  puVar2 = DAT_1;

+  if (DAT_2 == 0) {

+    cVar1 = DAT_3;

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

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

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

+      WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),10,

+              &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids);

+      cVar1 = DAT_3;

+    }

+  }

+  else {

+    for (; (undefined8 **)puVar2 != &DAT_1; puVar2 = (undefined8 *)*puVar2) {

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

+        ZwResetEvent(puVar2[4],0);

+      }

+      else {

+        ZwSetEvent();

+      }

+    }

+    cVar1 = param_1;

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

+        (cVar1 = param_1, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+       (cVar1 = param_1, 4 < (byte)WPP_GLOBAL_Control[0x29])) {

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xb,param_3,DAT_2);

+      cVar1 = param_1;

+    }

+  }

+  DAT_3 = cVar1;

+  return;

 }
```

## `CldSyncSendHydrationRequest`  (modified)

```diff
--- CldSyncSendHydrationRequest
+++ CldSyncSendHydrationRequest
@@ -1,74 +1,249 @@
 

 ulonglong CldSyncSendHydrationRequest

-                    (undefined8 *param_1,undefined1 param_2,undefined *param_3,longlong param_4,

-                    undefined8 param_5,void *param_6,int param_7,uint param_8,longlong param_9,

-                    uint param_10,uint param_11,ulonglong param_12,longlong param_13,

+                    (undefined8 *param_1,undefined1 param_2,undefined8 param_3,longlong param_4,

+                    undefined8 param_5,void *param_6,int param_7,undefined4 param_8,longlong param_9

+                    ,uint param_10,uint param_11,ulonglong param_12,longlong param_13,

                     undefined8 param_14,undefined8 param_15,undefined8 param_16,byte param_17,

                     void *param_18,undefined8 *param_19)

 

 {

-  char cVar1;

-  uint uVar2;

-  undefined *puVar3;

-  undefined7 in_register_00000011;

-  undefined4 *puVar4;

-  longlong unaff_RBX;

-  int *unaff_RSI;

-  longlong unaff_RDI;

-  undefined7 uVar5;

-  byte bVar6;

-  ulonglong unaff_R14;

-  char unaff_R15B;

+  int *piVar1;

+  longlong lVar2;

+  char cVar3;

+  uint uVar4;

+  ulonglong uVar5;

+  ulonglong uVar6;

+  ulonglong uVar7;

+  undefined2 uVar8;

+  longlong lVar9;

+  ulonglong uVar10;

+  int iVar11;

+  int *piVar12;

+  undefined8 uVar13;

+  int iVar14;

+  ulonglong uVar15;

+  ulonglong uVar16;

+  longlong local_88;

+  longlong local_80;

+  ulonglong local_78;

+  longlong local_70;

+  longlong local_68;

+  ulonglong local_60;

+  longlong local_58;

   

-  puVar4 = (undefined4 *)CONCAT71(in_register_00000011,param_2);

-  do {

-    cVar1 = RtlPrefixString(param_1);

-    bVar6 = (byte)unaff_R14;

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

-      HsmDbgBreakOnStatus(-0x3fffffb1);

-      puVar3 = WPP_GLOBAL_Control;

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

-          ((bVar6 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        param_3 = &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids;

-        puVar3 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-        puVar4 = (undefined4 *)0x40;

-        WPP_SF_qqqd(puVar3,0x40,&WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,unaff_RBX);

-      }

-      TlmWriteDisallowPurgeableKernelEA(puVar3,puVar4,param_3);

+  uVar10 = 0;

+  local_68 = 0;

+  local_88 = 0;

+  uVar13 = param_3;

+  uVar5 = CldiSyncReferenceRoot((longlong)param_1);

+  uVar16 = uVar5 & 0xffffffff;

+  HsmDbgBreakOnStatus((int)uVar5);

+  if ((int)uVar5 < 0) {

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

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

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

+      WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4c,

+                   &WPP_028866cd16db3b910821a8d7e4c3d7b2_Traceguids,param_1);

+    }

+  }

+  else {

+    local_70 = CldSyncReferenceStream

+                         ((longlong)param_1,param_5,CONCAT71((int7)((ulonglong)uVar13 >> 8),1));

+    if (local_70 == 0) {

+      uVar16 = 0xc00000e5;

+      HsmDbgBreakOnStatus(-0x3fffff1b);

+    }

+    else {

+      uVar5 = (ulonglong)param_10;

+      uVar15 = ~((ulonglong)param_10 - 1) & param_12;

+      local_78 = param_13 + -1 + uVar5 + param_12 & ~((ulonglong)param_10 - 1);

+      local_58 = local_70 + 0x18;

+      piVar12 = (int *)((ulonglong)(-(uint)((param_11 & 0x40) != 0) & 0x10) + 0x38 + local_70);

+      local_60 = uVar15;

+      FltAcquirePushLockExclusiveEx(local_58,0);

+      local_80 = 0;

+      for (; (longlong)uVar15 < (longlong)local_78; uVar15 = uVar15 + uVar5 * local_88) {

+        local_80 = (longlong)uVar15 / (longlong)uVar5;

+        cVar3 = FsRtlLookupBaseMcbEntry(local_70 + 0x20,local_80,&local_68,&local_88,0,0,0);

+        if ((cVar3 == '\0') || (local_68 == -1)) {

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

+            lVar9 = (longlong)(local_78 + -uVar15) / (longlong)uVar5;

 LAB_0:

-      *(undefined8 *)(unaff_RBX + 0x20) = 0;

-      unaff_R14 = 4;

-      *(undefined4 *)(unaff_RBX + 0x18) = 0xc000004f;

+            local_88 = lVar9;

+          }

+          else {

+            lVar9 = (longlong)(local_78 + -uVar15) / (longlong)uVar5;

+            if (lVar9 <= local_88) goto LAB_0;

+          }

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

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

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

+            WPP_SF_qDqD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4d,WPP_GLOBAL_Control,piVar12);

+          }

+          lVar9 = param_9 - uVar5 * local_80;

+          if ((longlong)(uVar5 * local_88) <= lVar9) {

+            lVar9 = uVar5 * local_88;

+          }

+          uVar4 = CldPortSendHydrationMessage

+                            (param_1[0xc],*param_1,param_2,param_8,param_3,param_4,param_5,param_6,

+                             param_7,param_9,param_11,uVar5 * local_80,lVar9,param_14,param_15,

+                             param_16,(uint)param_17,param_18,param_19);

+          uVar16 = (ulonglong)uVar4;

+          HsmDbgBreakOnStatus(uVar4);

+          if ((int)uVar4 < 0) goto LAB_1;

+          FsRtlAddBaseMcbEntry(local_70 + 0x20,local_80,local_80 + 1,local_88);

+        }

+      }

+      uVar4 = 0;

+      uVar15 = (longlong)local_60 / (longlong)uVar5;

+      uVar6 = (longlong)local_78 / (longlong)uVar5;

+      iVar14 = piVar12[1] + -1;

+      if (-1 < iVar14) {

+        uVar16 = uVar10;

+        do {

+          iVar11 = (int)(iVar14 + (uint)uVar16) >> 1;

+          uVar4 = iVar11 + 1;

+          if ((longlong)uVar15 <=

+              *(longlong *)(*(longlong *)(piVar12 + 2) + (longlong)iVar11 * 0x18)) {

+            uVar4 = (uint)uVar16;

+            iVar14 = iVar11 + -1;

+          }

+          uVar16 = (ulonglong)uVar4;

+        } while ((int)uVar4 <= iVar14);

+      }

+      uVar7 = CldiSyncEnsurePendingRanges(piVar12);

+      uVar16 = uVar7 & 0xffffffff;

+      HsmDbgBreakOnStatus((int)uVar7);

+      if ((int)uVar7 < 0) {

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

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

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

+          uVar10 = param_9 - uVar5 * local_80;

+          if ((longlong)(uVar5 * local_88) <= (longlong)uVar10) {

+            uVar10 = uVar5 * local_88;

+          }

+          WPP_SF_qDqD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4e,uVar10 & 0xffffffff,piVar12);

+        }

+      }

+      else {

+        uVar5 = uVar10;

+        if (-1 < (int)(uVar4 - 1)) {

+          uVar5 = (ulonglong)(uVar4 - 1);

+        }

+        lVar9 = (longlong)(int)uVar5 * 0x18;

+        while( true ) {

+          iVar14 = (int)uVar5;

+          local_60 = uVar15;

+          if (piVar12[1] <= iVar14) break;

+          if ((longlong)uVar6 <= (longlong)uVar15) goto LAB_2;

+          lVar2 = *(longlong *)(piVar12 + 2);

+          uVar7 = *(ulonglong *)(lVar2 + lVar9);

+          if ((longlong)uVar15 < (longlong)uVar7) {

+            uVar16 = uVar6;

+            if ((longlong)uVar7 <= (longlong)uVar6) {

+              uVar16 = uVar7;

+            }

+            uVar5 = CldiSyncInsertPendingRange(piVar12,uVar5,uVar15,uVar16 - uVar15);

+            uVar16 = uVar5 & 0xffffffff;

+            HsmDbgBreakOnStatus((int)uVar5);

+            if ((int)uVar5 < 0) goto LAB_1;

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

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

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

+              uVar8 = 0x4f;

+LAB_3:

+              WPP_SF_qDDiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar8,

+                            *(undefined8 *)(piVar12 + 2),piVar12);

+            }

+          }

+          else if (uVar15 == uVar7) {

+            if ((longlong)(uVar6 - uVar15) < *(longlong *)(lVar2 + 8 + lVar9)) {

+              uVar5 = CldiSyncSplitPendingRange(piVar12,iVar14,uVar6);

+              uVar16 = uVar5 & 0xffffffff;

+              HsmDbgBreakOnStatus((int)uVar5);

+              if ((int)uVar5 < 0) goto LAB_1;

+              piVar1 = (int *)(*(longlong *)(piVar12 + 2) + 0x10 + (longlong)iVar14 * 0x18);

+              *piVar1 = *piVar1 + 1;

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

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

+                 ((byte)WPP_GLOBAL_Control[0x29] < 4)) goto LAB_2;

+              uVar13 = *(undefined8 *)(piVar12 + 2);

+              uVar8 = 0x51;

+              goto LAB_4;

+            }

+            piVar1 = (int *)(lVar2 + 0x10 + lVar9);

+            *piVar1 = *piVar1 + 1;

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

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

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

+              uVar8 = 0x50;

+              goto LAB_3;

+            }

+          }

+          else if (((longlong)uVar7 < (longlong)uVar15) &&

+                  ((longlong)uVar15 < (longlong)(uVar7 + *(longlong *)(lVar2 + 8 + lVar9)))) {

+            uVar5 = CldiSyncSplitPendingRange(piVar12,iVar14,uVar15);

+            uVar16 = uVar5 & 0xffffffff;

+            HsmDbgBreakOnStatus((int)uVar5);

+            if ((int)uVar5 < 0) goto LAB_1;

+            piVar1 = (int *)(*(longlong *)(piVar12 + 2) + 0x10 + lVar9);

+            *piVar1 = *piVar1 + 1;

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

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

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

+              uVar8 = 0x52;

+              goto LAB_3;

+            }

+          }

+          uVar5 = (ulonglong)(iVar14 + 1);

+          uVar15 = *(longlong *)(*(longlong *)(piVar12 + 2) + 8 + lVar9) +

+                   *(longlong *)(*(longlong *)(piVar12 + 2) + lVar9);

+          lVar9 = lVar9 + 0x18;

+          if ((longlong)uVar15 < (longlong)local_60) {

+            uVar15 = local_60;

+          }

+        }

+        if ((longlong)uVar15 < (longlong)uVar6) {

+          uVar5 = CldiSyncInsertPendingRange

+                            (piVar12,(ulonglong)(uint)piVar12[1],uVar15,uVar6 - uVar15);

+          uVar16 = uVar5 & 0xffffffff;

+          HsmDbgBreakOnStatus((int)uVar5);

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

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

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

+            uVar8 = 0x53;

+            uVar13 = *(undefined8 *)(piVar12 + 2);

+LAB_4:

+            WPP_SF_qDDiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar8,uVar13,piVar12);

+          }

+        }

+LAB_2:

+        iVar14 = piVar12[1];

+        uVar5 = uVar10;

+        if (0 < iVar14) {

+          do {

+            iVar11 = (int)uVar5;

+            if (((iVar11 < iVar14 + -1) &&

+                (lVar9 = *(longlong *)(piVar12 + 2),

+                *(int *)(lVar9 + 0x10 + uVar10) == *(int *)(lVar9 + 0x28 + uVar10))) &&

+               (*(longlong *)(lVar9 + 8 + uVar10) + *(longlong *)(lVar9 + uVar10) ==

+                *(longlong *)(lVar9 + 0x18 + uVar10))) {

+              CldiSyncSplicePendingRanges((longlong)piVar12,iVar11);

+              iVar11 = iVar11 + -1;

+              uVar10 = uVar10 - 0x18;

+            }

+            iVar14 = piVar12[1];

+            uVar10 = uVar10 + 0x18;

+            uVar5 = (ulonglong)(iVar11 + 1U);

+          } while ((int)(iVar11 + 1U) < iVar14);

+        }

+      }

 LAB_1:

-      FltReleaseContext();

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

-        HsmpTracePreCallbackExit(unaff_R14 & 0xffffffff,unaff_RBX,0,'\0','\x01');

-      }

-      return unaff_R14 & 0xffffffff;

+      FltReleasePushLockEx(local_58,0);

+      CldiSyncReleaseRundown(local_70);

     }

-    uVar5 = (undefined7)((ulonglong)param_3 >> 8);

-    cVar1 = RtlEqualString(&DoNotConvertToCloudFilesEA,&param_8);

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

-      HsmDbgBreakOnStatus(-0x3fffffb1);

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

-          ((bVar6 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x41,

-                    &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,unaff_RBX);

-      }

-      goto LAB_0;

-    }

-    uVar2 = (int)param_14 + *unaff_RSI;

-    param_14 = CONCAT44(param_14._4_4_,uVar2);

-    if (*unaff_RSI == 0) goto LAB_1;

-    puVar4 = &param_8;

-    unaff_RSI = (int *)((ulonglong)uVar2 + unaff_RDI);

-    param_1 = (undefined8 *)&KernelPurgeableEaNamePrefix;

-    param_3 = (undefined *)CONCAT71(uVar5,bVar6);

-    param_8 = (uint)CONCAT12(*(byte *)((longlong)unaff_RSI + 5),

-                             (ushort)*(byte *)((longlong)unaff_RSI + 5));

-    param_9 = (longlong)(unaff_RSI + 2);

-  } while( true );

+    ExReleaseRundownProtection(param_1 + 0xb);

+  }

+  return uVar16;

 }
```

## `HsmiInfoPrepareForPostRename`  (modified)

```diff
--- HsmiInfoPrepareForPostRename
+++ HsmiInfoPrepareForPostRename
@@ -1,265 +1,271 @@
 

 int HsmiInfoPrepareForPostRename(longlong *param_1,uint param_2,undefined8 *param_3)

 

 {

-  undefined8 *puVar1;

-  int iVar2;

-  undefined8 uVar3;

-  ulonglong uVar4;

-  ulonglong uVar5;

-  uint *_Dst;

-  uint *unaff_RBX;

-  uint *unaff_RSI;

-  uint uVar6;

-  ulonglong unaff_RDI;

-  size_t _Size;

-  uint in_R9D;

-  uint uVar7;

-  uint uVar8;

-  undefined8 in_R10;

-  longlong lVar9;

-  char in_R11B;

-  longlong unaff_R12;

-  int unaff_R13D;

-  uint uVar10;

-  ulonglong unaff_R14;

-  int unaff_R15D;

-  char in_stack_00000070;

-  int in_stack_00000078;

-  uint *in_stack_00000080;

-  longlong in_stack_00000090;

-  uint *in_stack_000000a0;

+  char cVar1;

+  uint *puVar2;

+  uint *puVar3;

+  char cVar4;

+  char cVar5;

+  char cVar6;

+  uint *puVar7;

+  ulonglong uVar8;

+  uint *puVar9;

+  longlong lVar10;

+  longlong lVar11;

+  undefined2 uVar12;

+  uint *puVar13;

+  uint uVar14;

+  uint *puVar15;

+  undefined *puVar16;

+  undefined1 uVar17;

+  uint *puVar18;

+  undefined1 uVar19;

+  uint *in_stack_ffffffffffffff18;

+  longlong in_stack_ffffffffffffff28;

+  int local_98;

+  uint local_88 [2];

+  uint *local_80;

+  longlong local_78;

+  uint local_70;

+  longlong local_68;

+  longlong local_60;

+  uint *local_58;

+  longlong local_50;

   

-code_r0x00014004fbbf:

-  unaff_RSI[0xe] = in_R9D;

+  local_68 = param_1[5];

+  local_60 = param_1[4];

+  uVar19 = 1;

+  puVar2 = (uint *)param_1[3];

+  puVar13 = (uint *)param_1[1];

+  lVar11 = *param_1;

+  local_70 = *(uint *)(param_1 + 6);

+  cVar1 = *(char *)((longlong)param_1 + 0x34);

+  cVar6 = *(char *)((longlong)param_1 + 0x35);

+  local_98 = 1;

+  puVar3 = *(uint **)(*(longlong *)(puVar2 + 4) + 8);

+  local_50 = *(longlong *)(*(longlong *)(puVar2 + 4) + 0x28);

+  puVar7 = (uint *)0x0;

+  local_78 = 0;

+  puVar15 = (uint *)0x0;

+  local_80 = (uint *)0x0;

+  local_88[0] = 0;

+  *param_3 = 0;

+  local_58 = puVar13;

+  HsmDbgBreakOnStatus(param_2);

+  puVar9 = puVar7;

+  puVar18 = puVar7;

+  if ((int)param_2 < 0) {

 LAB_0:

-  iVar2 = (int)unaff_RDI;

-  if (unaff_R14 < (ulonglong)(iVar2 + 0x40) + 4) goto LAB_1;

-  uVar10 = unaff_RBX[0x11];

-  if ((uVar10 & 0xffff0fff) == DAT_2) {

-    uVar4 = HsmOsDisguisePlaceholder(in_R11B,((uint)in_R10 & unaff_RBX[0xe]) == 0);

-    if ((char)uVar4 == '\0') {

+    puVar2[8] = 0;

+    puVar2[9] = 0;

+    puVar2[6] = param_2;

+    local_98 = 4;

+LAB_1:

+    if (puVar9 == (uint *)0x0) goto LAB_2;

+  }

+  else {

+    if (((puVar13 == (uint *)0x0) || (puVar18 = *(uint **)(puVar13 + 4), puVar18 == (uint *)0x0)) ||

+       (*(longlong *)(puVar18 + 4) == 0)) {

+      lVar10 = 0;

+    }

+    else {

+      lVar10 = *(longlong *)(*(longlong *)(puVar18 + 4) + 0x20);

+    }

+    uVar8 = HsmpIsPlaceholder((longlong)puVar18);

+    cVar4 = (char)uVar8;

+    if ((cVar1 == '\0') && (cVar4 == '\0')) goto LAB_2;

+    uVar14 = 0;

+    puVar9 = puVar15;

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

+      in_stack_ffffffffffffff18 = local_88;

+      param_2 = HsmpCldGetSyncPolicy

+                          (lVar11,(longlong)puVar18,(longlong)puVar3,0,in_stack_ffffffffffffff18);

+      HsmDbgBreakOnStatus(param_2);

+      uVar14 = local_88[0];

+      if ((int)param_2 < 0) {

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

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

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

+          WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x18,

+                      &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,lVar11);

+        }

+        goto LAB_0;

+      }

+    }

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

+      if (lVar10 == 0) {

+        param_2 = HsmpRelativeStreamOpen

+                            (lVar11,puVar3,0,0x81,1,0x200000,in_stack_ffffffffffffff28,&local_78,

+                             (longlong *)&local_80);

+      }

+      else {

+        param_2 = HsmpOpenFileByIdEx(lVar11,*(undefined8 *)(lVar11 + 0x20),lVar10,0x81,

+                                     in_stack_ffffffffffffff18,0x200000,'\0',&local_78,

+                                     (longlong *)&local_80);

+      }

+      HsmDbgBreakOnStatus(param_2);

+      if (-1 < (int)param_2) goto LAB_3;

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

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

+         ) goto LAB_0;

+      uVar12 = 0x19;

+LAB_4:

+      WPP_SF_qqqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                    &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,puVar2);

+      puVar9 = puVar7;

+      goto LAB_0;

+    }

 LAB_3:

-      unaff_RSI[0x10] = uVar10;

+    puVar9 = (uint *)ExAllocatePool2(0x100,0x30,0x636f7348);

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

+      param_2 = 0xc000009a;

+      HsmDbgBreakOnStatus(-0x3fffff66);

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

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

+         ) {

+        uVar12 = 0x1a;

+LAB_5:

+        WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                     &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,puVar2);

+      }

+      goto LAB_0;

+    }

+    *puVar9 = 0x636f7348;

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

+      *(uint **)(puVar9 + 2) = puVar18;

+      FltReferenceContext(puVar18);

+    }

+    puVar13 = puVar18;

+    puVar7 = puVar2;

+    cVar5 = HsmpCldIsCallbackRequested(5,(longlong)puVar18,(longlong)puVar2,'\0');

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

+      puVar7 = puVar3;

+      param_2 = HsmiQueryFullFilePath

+                          (*(undefined8 *)(lVar11 + 0x20),puVar13,(longlong)puVar3,0x101,puVar9 + 6)

+      ;

+      HsmDbgBreakOnStatus(param_2);

+      if ((int)param_2 < 0) {

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

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

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

+          uVar12 = 0x1b;

+          goto LAB_5;

+        }

+        goto LAB_0;

+      }

+    }

+    lVar10 = FltGetRequestorProcess(puVar2);

+    cVar5 = HsmOsIsSyncProviderProcess(lVar10);

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

+LAB_6:

+      uVar17 = 0;

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

+LAB_7:

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

+           (cVar6 = HsmpCldIsCallbackRequested(5,(longlong)puVar18,(longlong)puVar2,'\0'),

+           cVar6 != '\0')) goto LAB_8;

+      }

+      else {

+        if ((uVar14 >> 10 & 1) != 0) {

+          lVar11 = FltGetRequestorProcess(puVar2);

+          cVar6 = HsmOsIsSyncProviderProcess(lVar11);

+          if (cVar6 != '\0') goto LAB_7;

+        }

+        HsmpPersistInSync((longlong)puVar18,(longlong)puVar3,(longlong)puVar7);

+        uVar17 = 1;

+LAB_8:

+        *(undefined1 *)(puVar9 + 0xb) = 0;

+        *(longlong *)(puVar9 + 4) = param_1[2];

+        param_1[2] = 0;

+        if ((cVar1 == '\0') || (local_50 == 0)) {

+          uVar19 = 0;

+        }

+        puVar9[10] = local_70;

+        *(undefined1 *)((longlong)puVar9 + 0x2d) = uVar19;

+        *(undefined1 *)((longlong)puVar9 + 0x2e) = uVar17;

+        local_98 = 0;

+        *param_3 = puVar9;

+        puVar9 = (uint *)0x0;

+      }

+      if ((int)param_2 < 0) goto LAB_0;

       goto LAB_1;

     }

-  }

-  else if ((unaff_RBX[0xe] >> 10 & 1) != 0) goto LAB_3;

-  unaff_RSI[0x10] = unaff_RBX[0x10];

-LAB_1:

-  if ((ulonglong)(iVar2 + 0x3c) + 4 <= unaff_R14) {

-    unaff_RSI[0xf] = unaff_RBX[0xf];

-  }

-  uVar10 = (uint)unaff_R14;

-  if (uVar10 < unaff_RBX[0xf] + 0x44 + iVar2) goto LAB_4;

-  _Size = (size_t)unaff_RBX[0xf];

-  _Dst = unaff_RSI + 0x11;

-LAB_5:

-  do {

-    memmove(_Dst,unaff_RBX + 0x14,_Size);

-    in_R11B = in_stack_00000070;

-LAB_4:

-    do {

-      if ((unaff_RDI & 0xffffffff) + 4 <= unaff_R14) {

-        *unaff_RSI = unaff_R13D + 7U & 0xfffffff8;

-      }

-LAB_6:

-      if (*unaff_RBX == 0) {

-        if ((unaff_RDI & 0xffffffff) + 4 <= unaff_R14) {

-          *(int *)((unaff_RDI & 0xffffffff) + unaff_R12) = unaff_R15D;

-        }

-        uVar6 = (int)unaff_RDI + unaff_R13D;

-LAB_7:

-        *in_stack_000000a0 = uVar6;

-        return unaff_R15D;

-      }

-      uVar6 = (int)unaff_RDI + (unaff_R13D + 7U & 0xfffffff8);

-      unaff_RDI = (ulonglong)uVar6;

-      unaff_RBX = (uint *)((longlong)unaff_RBX + (ulonglong)*unaff_RBX);

-      if (in_stack_00000080 <= unaff_RBX) goto LAB_7;

-      in_R10 = 0x401000;

-      uVar7 = 0x401000;

-      if (uVar10 <= uVar6) goto LAB_7;

-      if (in_stack_00000078 == 1) {

-        unaff_RSI = (uint *)((ulonglong)uVar6 + unaff_R12);

-        unaff_R13D = unaff_RBX[0xf] + 0x40;

-        if (uVar6 + 0x38 <= uVar10) {

-          uVar3 = *(undefined8 *)(unaff_RBX + 2);

-          *(undefined8 *)unaff_RSI = *(undefined8 *)unaff_RBX;

-          *(undefined8 *)(unaff_RSI + 2) = uVar3;

-          uVar3 = *(undefined8 *)(unaff_RBX + 6);

-          *(undefined8 *)(unaff_RSI + 4) = *(undefined8 *)(unaff_RBX + 4);

-          *(undefined8 *)(unaff_RSI + 6) = uVar3;

-          uVar3 = *(undefined8 *)(unaff_RBX + 10);

-          *(undefined8 *)(unaff_RSI + 8) = *(undefined8 *)(unaff_RBX + 8);

-          *(undefined8 *)(unaff_RSI + 10) = uVar3;

-          *(undefined8 *)(unaff_RSI + 0xc) = *(undefined8 *)(unaff_RBX + 0xc);

-        }

-        if ((ulonglong)(uVar6 + 0x38) + 4 <= unaff_R14) {

-          if ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2) {

-            uVar7 = unaff_RBX[0xe];

-            uVar4 = HsmOsDisguisePlaceholder(in_R11B,(uVar7 & 0x401000) == 0);

-            if ((char)uVar4 != '\0') {

-              uVar7 = uVar7 & 0xffffe9ff;

-              if (uVar7 == 0) {

-                uVar7 = 0x80;

-              }

-              unaff_RSI[0xe] = uVar7;

-              goto LAB_8;

-            }

-          }

-          unaff_RSI[0xe] = unaff_RBX[0xe];

-        }

-LAB_8:

-        if ((ulonglong)(uVar6 + 0x3c) + 4 <= unaff_R14) {

-          unaff_RSI[0xf] = unaff_RBX[0xf];

-        }

-        if (uVar10 < unaff_RBX[0xf] + 0x40 + uVar6) goto LAB_4;

-        _Size = (size_t)unaff_RBX[0xf];

-        _Dst = unaff_RSI + 0x10;

-        goto LAB_5;

-      }

-      if (in_stack_00000078 == 2) {

-        unaff_RSI = (uint *)(unaff_RDI + unaff_R12);

-        unaff_R13D = unaff_RBX[0xf] + 0x44;

-        if (uVar6 + 0x38 <= uVar10) {

-          uVar3 = *(undefined8 *)(unaff_RBX + 2);

-          *(undefined8 *)unaff_RSI = *(undefined8 *)unaff_RBX;

-          *(undefined8 *)(unaff_RSI + 2) = uVar3;

-          uVar3 = *(undefined8 *)(unaff_RBX + 6);

-          *(undefined8 *)(unaff_RSI + 4) = *(undefined8 *)(unaff_RBX + 4);

-          *(undefined8 *)(unaff_RSI + 6) = uVar3;

-          uVar3 = *(undefined8 *)(unaff_RBX + 10);

-          *(undefined8 *)(unaff_RSI + 8) = *(undefined8 *)(unaff_RBX + 8);

-          *(undefined8 *)(unaff_RSI + 10) = uVar3;

-          *(undefined8 *)(unaff_RSI + 0xc) = *(undefined8 *)(unaff_RBX + 0xc);

-        }

-        if (unaff_R14 < (ulonglong)(uVar6 + 0x38) + 4) goto LAB_0;

-        if ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2) {

-          uVar10 = unaff_RBX[0xe];

-          uVar4 = HsmOsDisguisePlaceholder(in_R11B,(uVar10 & 0x401000) == 0);

-          if ((char)uVar4 != '\0') {

-            in_R9D = uVar10 & 0xffffe9ff;

-            if (in_R9D == 0) {

-              in_R9D = 0x80;

-            }

-            goto code_r0x00014004fbbf;

-          }

-        }

-        unaff_RSI[0xe] = unaff_RBX[0xe];

-        goto LAB_0;

-      }

-      if (in_stack_00000078 != 0x26) {

-        if (in_stack_00000078 == 0x4e) {

-          uVar4 = (ulonglong)uVar6;

-          uVar7 = unaff_RBX[0xf];

-          unaff_R13D = uVar7 + 0x50;

-          if (uVar6 + 0x50 <= uVar10) {

-            uVar3 = *(undefined8 *)(unaff_RBX + 2);

-            *(undefined8 *)(uVar4 + in_stack_00000090) = *(undefined8 *)unaff_RBX;

-            ((undefined8 *)(uVar4 + in_stack_00000090))[1] = uVar3;

-            uVar3 = *(undefined8 *)(unaff_RBX + 6);

-            puVar1 = (undefined8 *)(uVar4 + 0x10 + in_stack_00000090);

-            *puVar1 = *(undefined8 *)(unaff_RBX + 4);

-            puVar1[1] = uVar3;

-            uVar3 = *(undefined8 *)(unaff_RBX + 10);

-            puVar1 = (undefined8 *)(uVar4 + 0x20 + in_stack_00000090);

-            *puVar1 = *(undefined8 *)(unaff_RBX + 8);

-            puVar1[1] = uVar3;

-            uVar3 = *(undefined8 *)(unaff_RBX + 0xe);

-            puVar1 = (undefined8 *)(uVar4 + 0x30 + in_stack_00000090);

-            *puVar1 = *(undefined8 *)(unaff_RBX + 0xc);

-            puVar1[1] = uVar3;

-            uVar3 = *(undefined8 *)(unaff_RBX + 0x12);

-            puVar1 = (undefined8 *)(uVar4 + 0x40 + in_stack_00000090);

-            *puVar1 = *(undefined8 *)(unaff_RBX + 0x10);

-            puVar1[1] = uVar3;

-          }

-          lVar9 = in_stack_00000090;

-          if (((ulonglong)(uVar6 + 0x38) + 4 <= unaff_R14) &&

-             ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2)) {

-            uVar8 = unaff_RBX[0xe];

-            uVar5 = HsmOsDisguisePlaceholder(in_R11B,(uVar8 & 0x401000) == 0);

-            if ((char)uVar5 != '\0') {

-              uVar8 = uVar8 & 0xffffe9ff;

-              if (uVar8 == 0) {

-                uVar8 = 0x80;

-              }

-              *(uint *)(uVar4 + 0x38 + lVar9) = uVar8;

-            }

-          }

-          if ((((ulonglong)(uVar6 + 0x44) + 4 <= unaff_R14) &&

-              ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2)) &&

-             (uVar5 = HsmOsDisguisePlaceholder(in_R11B,(unaff_RBX[0xe] & 0x401000) == 0),

-             (char)uVar5 != '\0')) {

-            *(int *)(uVar4 + 0x44 + lVar9) = unaff_R15D;

-          }

-          if (unaff_RBX[0xf] + 0x50 + uVar6 <= uVar10) {

-            memmove((void *)(lVar9 + 0x50 + uVar4),unaff_RBX + 0x14,(ulonglong)unaff_RBX[0xf]);

-            in_R11B = in_stack_00000070;

-          }

-          unaff_R12 = in_stack_00000090;

-          if (uVar4 + 4 <= unaff_R14) {

-            *(uint *)(uVar4 + in_stack_00000090) = uVar7 + 0x57 & 0xfffffff8;

-          }

-        }

-        goto LAB_6;

-      }

-      unaff_RSI = (uint *)((ulonglong)uVar6 + unaff_R12);

-      unaff_R13D = unaff_RBX[0xf] + 0x50;

-      if (uVar6 + 0x38 <= uVar10) {

-        uVar3 = *(undefined8 *)(unaff_RBX + 2);

-        *(undefined8 *)unaff_RSI = *(undefined8 *)unaff_RBX;

-        *(undefined8 *)(unaff_RSI + 2) = uVar3;

-        uVar3 = *(undefined8 *)(unaff_RBX + 6);

-        *(undefined8 *)(unaff_RSI + 4) = *(undefined8 *)(unaff_RBX + 4);

-        *(undefined8 *)(unaff_RSI + 6) = uVar3;

-        uVar3 = *(undefined8 *)(unaff_RBX + 10);

-        *(undefined8 *)(unaff_RSI + 8) = *(undefined8 *)(unaff_RBX + 8);

-        *(undefined8 *)(unaff_RSI + 10) = uVar3;

-        *(undefined8 *)(unaff_RSI + 0xc) = *(undefined8 *)(unaff_RBX + 0xc);

-      }

-      if ((ulonglong)(uVar6 + 0x38) + 4 <= unaff_R14) {

-        uVar7 = 0x401000;

-        if ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2) {

-          uVar8 = unaff_RBX[0xe];

-          uVar7 = 0x401000;

-          uVar4 = HsmOsDisguisePlaceholder(in_R11B,(uVar8 & 0x401000) == 0);

-          if ((char)uVar4 != '\0') {

-            uVar8 = uVar8 & 0xffffe9ff;

-            if (uVar8 == 0) {

-              uVar8 = 0x80;

-            }

-            unaff_RSI[0xe] = uVar8;

-            goto LAB_9;

-          }

-        }

-        unaff_RSI[0xe] = unaff_RBX[0xe];

-      }

-LAB_9:

-      if ((ulonglong)(uVar6 + 0x40) + 4 <= unaff_R14) {

-        uVar8 = unaff_RBX[0x11];

-        if ((uVar8 & 0xffff0fff) == DAT_2) {

-          uVar4 = HsmOsDisguisePlaceholder(in_R11B,(uVar7 & unaff_RBX[0xe]) == 0);

-          if ((char)uVar4 != '\0') {

-LAB_10:

-            unaff_RSI[0x10] = unaff_RBX[0x10];

-            goto LAB_11;

-          }

-        }

-        else if ((unaff_RBX[0xe] >> 10 & 1) == 0) goto LAB_10;

-        unaff_RSI[0x10] = uVar8;

-      }

-LAB_11:

-      if ((ulonglong)(uVar6 + 0x48) + 8 <= unaff_R14) {

-        *(undefined8 *)(unaff_RSI + 0x12) = *(undefined8 *)(unaff_RBX + 0x12);

-      }

-      if ((ulonglong)(uVar6 + 0x3c) + 4 <= unaff_R14) {

-        unaff_RSI[0xf] = unaff_RBX[0xf];

-      }

-    } while (uVar10 < unaff_RBX[0xf] + 0x50 + uVar6);

-    _Size = (size_t)unaff_RBX[0xf];

-    _Dst = unaff_RSI + 0x14;

-  } while( true );

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

+      puVar7 = local_80;

+      param_2 = HsmpRecurseDirectory

+                          (lVar11,local_78,local_80,(-(uint)(cVar4 != '\0') & 0x400) + 0x10,'\x01',

+                           '\0',HsmiInfoPopulatePlaceholderOnRename,

+                           HsmiInfoHydratePlaceholderOnRename,puVar2);

+      HsmDbgBreakOnStatus(param_2);

+      if (-1 < (int)param_2) goto LAB_6;

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

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

+         ) {

+        uVar12 = 0x1e;

+        puVar7 = puVar9;

+        goto LAB_4;

+      }

+      goto LAB_0;

+    }

+    param_2 = HsmpAcquireUserRequestRundownProtection((longlong)puVar18,puVar2);

+    HsmDbgBreakOnStatus(param_2);

+    if ((int)param_2 < 0) {

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

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

+         ) {

+        puVar16 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)puVar18);

+        WPP_SF_qqLiiqd(*(undefined8 *)(puVar16 + 0x18),0x1c,puVar16,lVar11);

+      }

+      goto LAB_0;

+    }

+    *(undefined1 *)(puVar9 + 0xb) = 1;

+    *(longlong *)(puVar9 + 4) = param_1[2];

+    lVar10 = *(longlong *)(puVar2 + 4);

+    param_1[2] = 0;

+    local_98 = HsmpRecallInitiateHydrationEx

+                         (local_58,puVar18,*(ulonglong *)(lVar10 + 8),(byte *)0x10007,puVar2,

+                          (uint *)0x0,-1,0,(undefined *)(-(ulonglong)(cVar6 != '\0') & 0x140037220))

+    ;

+    param_2 = puVar2[6];

+    HsmDbgBreakOnStatus(param_2);

+    if ((int)param_2 < 0) {

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

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

+         ) {

+        puVar16 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)puVar18);

+        WPP_SF_qqLiiqiid(*(undefined8 *)(puVar16 + 0x18),local_60,puVar16,lVar11);

+      }

+      goto LAB_0;

+    }

+    if (local_98 == 0) {

+      *param_3 = puVar9;

+      puVar9 = (uint *)0x0;

+      goto LAB_1;

+    }

+  }

+  if (*(int **)(puVar9 + 4) != (int *)0x0) {

+    HsmpReleaseFileNameLock(*(int **)(puVar9 + 4));

+  }

+  if ((char)puVar9[0xb] != '\0') {

+    HsmpReleaseUserRequestRundownProtection(*(longlong *)(puVar9 + 2));

+  }

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

+    ExFreePoolWithTag(*(longlong *)(puVar9 + 8),0x73557348);

+  }

+  if (*(longlong *)(puVar9 + 2) != 0) {

+    FltReleaseContext(puVar18);

+  }

+  ExFreePoolWithTag(puVar9,0x636f7348);

+LAB_2:

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

+    ObfDereferenceObject(local_80);

+  }

+  if (local_78 != 0) {

+    FltClose(local_78);

+  }

+  return local_98;

 }
```

## `HsmiIsUnsupportedLogfilePlaceholder`  (modified)

```diff
--- HsmiIsUnsupportedLogfilePlaceholder
+++ HsmiIsUnsupportedLogfilePlaceholder
@@ -1,11 +1,89 @@
+

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

 

 uint HsmiIsUnsupportedLogfilePlaceholder

                (longlong param_1,longlong param_2,uint param_3,undefined1 *param_4)

 

 {

-  uint in_EAX;

+  ulonglong uVar1;

+  uint uVar2;

+  int iVar3;

+  ulonglong *puVar4;

+  undefined1 auStackY_98 [32];

+  uint local_68 [2];

+  longlong local_60;

+  undefined4 local_58 [8];

+  ulonglong local_38;

   

-  *(char *)(param_1 + 0x5f) = *(char *)(param_1 + 0x5f) + (char)in_EAX;

-  return in_EAX;

+  local_38 = __security_cookie ^ (ulonglong)auStackY_98;

+  puVar4 = (ulonglong *)0x0;

+  local_60 = 0;

+  *param_4 = 0;

+  local_58[0] = 0x2232bba3;

+  local_58[1] = 0x49cc01bb;

+  local_58[2] = 0xeeff0a6;

+  local_58[3] = 0x256c8f53;

+  local_58[4] = 0x8650c9fe;

+  local_58[5] = 0x8bf60cec;

+  local_58[6] = 0x59831ebd;

+  local_58[7] = 0x90105456;

+  if ((param_3 & 0xffff0fff) != DAT_0) {

+    return 0;

+  }

+  uVar2 = FltGetEcpListFromCallbackData(DAT_1,0x8650c9fe,&local_60);

+  if ((int)uVar2 < 0) {

+    return uVar2;

+  }

+  if (local_60 == 0) {

+    return uVar2;

+  }

+  uVar2 = 0;

+  while( true ) {

+    if (1 < uVar2) {

+      return 0;

+    }

+    iVar3 = FltFindExtraCreateParameter(DAT_1,local_60,local_58 + (ulonglong)uVar2 * 4,0);

+    if (-1 < iVar3) break;

+    uVar2 = uVar2 + 1;

+  }

+  local_68[0] = 0x528;

+  uVar1 = *(ulonglong *)(*(longlong *)(param_2 + 0x10) + 8);

+  while( true ) {

+    uVar2 = local_68[0];

+    if (puVar4 != (ulonglong *)0x0) {

+      ExFreePoolWithTag(puVar4,0x69527348);

+    }

+    puVar4 = (ulonglong *)ExAllocatePool2(0x100,uVar2,0x69527348);

+    if (puVar4 == (ulonglong *)0x0) break;

+    uVar2 = HsmpCldGetSyncRootStandardInfo(param_1,0,uVar1,puVar4,uVar2,local_68);

+    if (uVar2 != 0x80000005) {

+      if ((int)uVar2 < 0) {

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

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

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

+          WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xb,

+                     &WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids,param_1);

+        }

+      }

+      else {

+        *param_4 = (puVar4[1] & 0x20000) != 0;

+      }

+      ExFreePoolWithTag(puVar4,0x69527348);

+      return uVar2;

+    }

+  }

+  HsmDbgBreakOnStatus(-0x3fffff66);

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

+    return 0xc000009a;

+  }

+  if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+    return 0xc000009a;

+  }

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

+    return 0xc000009a;

+  }

+  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),10,

+             &WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids,param_1);

+  return 0xc000009a;

 }
```

## `CldHsmHydratePlaceholder`  (modified)

```diff
--- CldHsmHydratePlaceholder
+++ CldHsmHydratePlaceholder
@@ -1,44 +1,624 @@
 

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

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

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

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

 

-int CldHsmHydratePlaceholder

-              (longlong param_1,uint *param_2,longlong *param_3,undefined8 param_4,

-              undefined4 param_5,ulonglong param_6,longlong param_7,undefined8 param_8,

-              undefined8 param_9,uint param_10,longlong param_11,undefined8 param_12,uint param_13,

-              undefined *param_14,undefined8 param_15,undefined4 param_16,undefined8 param_17,

-              longlong *param_18,undefined8 param_19,undefined8 *param_20)

+void CldHsmHydratePlaceholder

+               (longlong param_1,uint *param_2,longlong *param_3,undefined8 param_4,

+               undefined4 param_5,ulonglong param_6,longlong param_7,undefined8 param_8,

+               undefined8 param_9,uint param_10,longlong param_11,undefined8 param_12,uint param_13,

+               undefined *param_14,undefined8 param_15,undefined4 param_16,undefined8 param_17,

+               longlong *param_18,undefined8 param_19,undefined8 *param_20)

 

 {

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  undefined *unaff_RSI;

-  int unaff_EDI;

-  undefined *puVar1;

-  longlong unaff_R13;

-  bool in_SF;

+  longlong *plVar1;

+  undefined4 uVar2;

+  undefined8 uVar3;

+  longlong *plVar4;

+  undefined8 uVar5;

+  undefined8 uVar6;

+  code *pcVar7;

+  bool bVar8;

+  char cVar9;

+  char cVar10;

+  uint uVar11;

+  ulonglong uVar12;

+  undefined8 *puVar13;

+  uint *puVar14;

+  longlong *plVar15;

+  char *pcVar16;

+  ulonglong uVar17;

+  uint uVar18;

+  undefined2 uVar19;

+  uint *puVar20;

+  undefined1 *puVar21;

+  uint uVar22;

+  longlong lVar23;

+  longlong *plVar24;

+  char *pcVar25;

+  longlong lVar26;

+  longlong *plVar27;

+  undefined1 auStackY_158 [8];

+  undefined1 auStackY_150 [24];

+  char local_b8;

+  char local_b7 [7];

+  undefined8 local_b0;

+  uint local_a8;

+  longlong local_a0;

+  longlong *local_98;

+  int local_90;

+  uint local_8c;

+  longlong local_88;

+  longlong *local_80;

+  longlong local_78;

+  longlong local_70;

+  longlong local_68;

+  longlong local_60;

+  undefined8 *local_58;

   

-  if (!in_SF) {

-    unaff_EDI = HsmpRpCommitNoLock(*(longlong *)(unaff_RBP + 0x48),unaff_RBX,unaff_R13,'\0','\x01');

-    HsmDbgBreakOnStatus(unaff_EDI);

-    if ((((unaff_EDI < 0) && (WPP_GLOBAL_Control != unaff_RSI)) &&

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

-    {

-      puVar1 = WPP_GLOBAL_Control;

-      HsmpGetStreamSize(unaff_RBX);

-      WPP_SF_qLiiiid(*(undefined8 *)(puVar1 + 0x18),0x68,

-                     &WPP_7b493afee855349cd64b6fd5ca5bddac_Traceguids,unaff_RBX);

-    }

+  puVar21 = auStackY_158;

+  puVar14 = (uint *)0x0;

+  uVar11 = 0;

+  plVar27 = (longlong *)0x0;

+  local_b8 = '\0';

+  local_b0 = *(undefined8 *)(*(longlong *)(*param_3 + 0x10) + 0x20);

+  local_8c = param_10 & 0x40;

+  bVar8 = false;

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

+    uVar11 = 0xc000cf12;

+    HsmDbgBreakOnStatus(-0x3fff30ee);

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

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+      uVar19 = 0x56;

+LAB_1:

+      WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar19,

+                  &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_2);

+    }

+LAB_2:

+    bVar8 = false;

+    puVar21 = auStackY_158;

   }

-  HsmpReleaseBitmapLock(unaff_RBX);

-  FltReleasePushLockEx(*(longlong *)(unaff_RBX + 0x10) + 0x18,0);

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

-    FltClose();

+  else {

+    plVar24 = param_3;

+    local_58 = (undefined8 *)CldLookupSyncRoot(param_3[2]);

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

+      uVar11 = 0xc000cf01;

+      HsmDbgBreakOnStatus(-0x3fff30ff);

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

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+        uVar19 = 0x57;

+        goto LAB_1;

+      }

+      goto LAB_2;

+    }

+    if (param_3[4] == 0) {

+      uVar11 = CldStreamOpen(param_3);

+      HsmDbgBreakOnStatus(uVar11);

+      if ((int)uVar11 < 0) {

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

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+          WPP_SF_qqqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x59,

+                        &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_2);

+        }

+        goto LAB_2;

+      }

+    }

+    plVar27 = (longlong *)param_3[4];

+    local_a8 = ~(*(int *)(*(longlong *)*plVar27 + 0x1c) << 0xb) & 0x1000;

+    local_60 = HsmpGetStreamSize(*param_3);

+    if (local_60 < (longlong)(param_6 + param_7)) {

+      param_7 = local_60 - param_6;

+    }

+    local_a0 = param_7;

+    if (param_7 == 0) {

+LAB_3:

+      uVar3 = local_b0;

+      bVar8 = false;

+      uVar17 = param_6;

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

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+        lVar23 = *plVar27;

+        uVar5 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+        *(uint *)(puVar21 + 0x48) = uVar11;

+        *(longlong *)(puVar21 + 0x40) = param_7;

+        *(ulonglong *)(puVar21 + 0x38) = param_6;

+        *(uint **)(puVar21 + 0x30) = param_2;

+        *(uint **)(puVar21 + 0x28) = puVar14;

+        *(longlong *)(puVar21 + 0x20) = lVar23;

+        *(undefined8 *)(puVar21 + -8) = 0x1400690ba;

+        WPP_SF_iqqqiid(uVar5,param_6,plVar24,local_b0);

+      }

+      if (param_14 != (undefined *)0x0) {

+        plVar24 = (longlong *)0x0;

+        uVar17 = (ulonglong)uVar11;

+        *(undefined8 *)(puVar21 + -8) = 0x1400690e2;

+        (*(code *)param_14)(param_17);

+      }

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

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+        uVar5 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+        *(uint *)(puVar21 + 0x40) = uVar11;

+        *(longlong *)(puVar21 + 0x38) = local_a0;

+        *(ulonglong *)(puVar21 + 0x30) = param_6;

+        *(uint **)(puVar21 + 0x28) = param_2;

+        *(uint **)(puVar21 + 0x20) = puVar14;

+        *(undefined8 *)(puVar21 + -8) = 0x140069128;

+        WPP_SF_iqqiid(uVar5,uVar17,plVar24,uVar3);

+      }

+    }

+    else {

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

+        FltGetIoPriorityHint(param_2);

+      }

+      uVar22 = (-(uint)((param_10 & 0x80) != 0) & 0x80000000) + 1;

+      cVar9 = HsmOsIsSyncProviderProcessFromAttributionInfo(param_1);

+      uVar18 = uVar22 | 0x40000000;

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

+        uVar18 = uVar22;

+      }

+      uVar17 = HsmOsGetProcessId(param_1);

+      uVar12 = HsmOsGetProcessSessionId(param_1);

+      uVar22 = (uint)uVar12;

+      puVar13 = (undefined8 *)HsmOsGetVmGuid(param_1);

+      puVar14 = CldiStreamAllocateRequest

+                          (puVar13,uVar22,(uint)uVar17,plVar27,uVar18,param_4,param_14,param_17,0,

+                           param_20);

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

+        HsmDbgBreakOnStatus(-0x3fffff66);

+        puVar21 = auStackY_158;

+        uVar11 = 0xc000009a;

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

+            (puVar21 = auStackY_158, uVar11 = 0xc000009a,

+            (*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

+           (puVar21 = auStackY_158, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          uVar19 = 0x5a;

+LAB_4:

+          uVar11 = 0xc000009a;

+          puVar21 = auStackY_158;

+          bVar8 = false;

+LAB_5:

+          uVar3 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+          *(undefined8 *)(puVar21 + -8) = 0x140068675;

+          WPP_SF_qqqiqd(uVar3,uVar19,&WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_2);

+        }

+      }

+      else {

+        cVar9 = FsRtlInitializeBaseMcbEx(puVar14 + 0x4c,1);

+        param_7 = local_a0;

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

+          uVar11 = 0xc000009a;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          puVar21 = auStackY_158;

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

+              (puVar21 = auStackY_158, (*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

+             (puVar21 = auStackY_158, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            uVar19 = 0x5b;

+            goto LAB_4;

+          }

+        }

+        else {

+          plVar24 = (longlong *)(ulonglong)local_8c;

+          *(longlong *)(puVar14 + 0x5a) = local_a0;

+          uVar18 = -(uint)(local_8c != 0) & 4 | puVar14[0x5c] & 0xfffffffb;

+          uVar18 = (param_10 >> 3 ^ uVar18) & 1 ^ uVar18;

+          *(ulonglong *)(puVar14 + 0x58) = param_6;

+          *(longlong *)(puVar14 + 0x52) = param_11;

+          *(undefined8 *)(puVar14 + 0x54) = param_12;

+          puVar14[0x56] = param_13;

+          puVar14[0x5c] = (param_10 >> 3 ^ uVar18) & 2 ^ uVar18;

+          if (local_8c == 0) {

+            FltAcquirePushLockSharedEx(plVar27 + 4,0);

+            for (local_80 = (longlong *)plVar27[10]; local_80 != plVar27 + 10;

+                local_80 = (longlong *)*local_80) {

+              plVar24 = (longlong *)(ulonglong)*(uint *)(local_80 + 4);

+              uVar17 = CldiStreamServiceHydrationRequest

+                                 (plVar27,local_80[3],(size_t)plVar24,(void *)local_80[2],

+                                  (longlong)puVar14,&local_b8,(undefined1 *)0x0);

+              uVar11 = (uint)uVar17;

+              HsmDbgBreakOnStatus(uVar11);

+              if ((-1 < (int)uVar11) && (local_b8 != '\0')) {

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

+                   (((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0 &&

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

+                  WPP_SF_qqqiii(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x5c,plVar24,param_2);

+                }

+                break;

+              }

+            }

+            FltReleasePushLockEx(plVar27 + 4,0);

+          }

+          puVar21 = auStackY_158;

+          if (param_11 != 0) {

+            do {

+              FltAcquirePushLockSharedEx(plVar27 + 0xc,0);

+              plVar15 = (longlong *)plVar27[0xd];

+              while( true ) {

+                puVar21 = auStackY_158;

+                param_7 = local_a0;

+                local_98 = plVar15;

+                if ((local_b8 != '\0') || (puVar21 = auStackY_158, plVar15 == plVar27 + 0xd))

+                goto LAB_6;

+                plVar1 = plVar15 + -2;

+                local_b7[0] = '\0';

+                cVar9 = ExAcquireRundownProtection(plVar15 + 3);

+                if (cVar9 == '\0') break;

+                plVar24 = (longlong *)(ulonglong)*(uint *)(plVar15 + 6);

+                uVar17 = CldiStreamServiceHydrationRequest

+                                   (plVar27,plVar15[5],(size_t)plVar24,

+                                    (void *)((longlong)plVar15 + 0x34),(longlong)puVar14,&local_b8,

+                                    local_b7);

+                uVar11 = (uint)uVar17;

+                HsmDbgBreakOnStatus(uVar11);

+                if (local_b7[0] != '\0') {

+                  FltAcquirePushLockExclusiveEx(&DAT_7);

+                  plVar4 = (longlong *)*plVar1;

+                  if (plVar4 == plVar1) goto LAB_8;

+                  if (((longlong *)plVar4[1] == plVar1) &&

+                     (puVar13 = (undefined8 *)plVar15[-1], (longlong *)*puVar13 == plVar1)) {

+                    *puVar13 = plVar4;

+                    plVar4[1] = (longlong)puVar13;

+                    plVar15[-1] = (longlong)plVar1;

+                    *plVar1 = (longlong)plVar1;

+                    if ((param_10 & 0x10) == 0) {

+                      if ((undefined8 *)*DAT_9 == &DAT_14002a8b0) {

+                        *plVar1 = (longlong)&DAT_10;

+                        plVar15[-1] = (longlong)DAT_9;

+                        *DAT_9 = (longlong)plVar1;

+                        DAT_9 = plVar1;

+                        goto LAB_8;

+                      }

+                    }

+                    else if ((undefined8 *)*DAT_11 == &DAT_14002a8c0) {

+                      *plVar1 = (longlong)&DAT_12;

+                      plVar15[-1] = (longlong)DAT_11;

+                      *DAT_11 = (longlong)plVar1;

+                      DAT_11 = plVar1;

+LAB_8:

+                      FltReleasePushLockEx(&DAT_7);

+                      goto LAB_13;

+                    }

+                  }

+LAB_14:

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

+                  (*pcVar7)(3);

+                  puVar21 = auStackY_150;

+                  param_7 = local_a0;

+LAB_6:

+                  *(undefined8 *)(puVar21 + -8) = 0x140068a58;

+                  FltReleasePushLockEx(plVar27 + 0xc,0);

+                  goto LAB_15;

+                }

+LAB_13:

+                ExReleaseRundownProtection(plVar15 + 3);

+                param_7 = local_a0;

+                if ((-1 < (int)uVar11) && (local_b8 != '\0')) {

+                  puVar21 = auStackY_158;

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

+                     ((puVar21 = auStackY_158, (*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0

+                      && (puVar21 = auStackY_158, 3 < (byte)WPP_GLOBAL_Control[0x29])))) {

+                    WPP_SF_qqqiii(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x5d,plVar24,param_2);

+                    puVar21 = auStackY_158;

+                  }

+                  goto LAB_6;

+                }

+                if ((int)plVar27[0xf] != 0) goto LAB_16;

+                plVar15 = (longlong *)*local_98;

+              }

+              lVar23 = *local_98;

+              if ((*(longlong **)(lVar23 + 8) != local_98) ||

+                 (plVar15 = (longlong *)local_98[1], (longlong *)*plVar15 != local_98))

+              goto LAB_14;

+              *plVar15 = lVar23;

+              *(longlong **)(lVar23 + 8) = plVar15;

+              local_98[1] = (longlong)local_98;

+              *local_98 = (longlong)local_98;

+LAB_16:

+              FltReleasePushLockEx(plVar27 + 0xc);

+            } while( true );

+          }

+LAB_15:

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

+            lVar23 = plVar27[8];

+            *(undefined8 *)(puVar21 + -8) = 0x140068a72;

+            KeClearEvent(lVar23);

+            *param_18 = plVar27[8];

+          }

+          if (local_b8 != '\0') goto LAB_3;

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

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+            *(longlong *)(puVar21 + 0x50) = param_7;

+            pcVar16 = "HYDRATE";

+            pcVar25 = "background";

+            if (local_8c != 0) {

+              pcVar16 = "VALIDATE";

+            }

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

+              pcVar25 = "foreground";

+            }

+            *(ulonglong *)(puVar21 + 0x48) = param_6;

+            *(undefined8 *)(puVar21 + 0x40) = local_b0;

+            *(longlong **)(puVar21 + 0x38) = param_3;

+            *(uint **)(puVar21 + 0x30) = puVar14;

+            *(uint **)(puVar21 + 0x28) = param_2;

+            uVar3 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+            *(char **)(puVar21 + 0x20) = pcVar16;

+            *(undefined8 *)(puVar21 + -8) = 0x140068b0f;

+            WPP_SF_ssqqqiii(uVar3,WPP_GLOBAL_Control,local_b0,pcVar25,*(char **)(puVar21 + 0x20));

+          }

+          uVar12 = (ulonglong)local_a8;

+          local_90 = 0;

+          local_80 = (longlong *)0x0;

+          uVar17 = ~(uVar12 - 1) & param_6;

+          local_98 = (longlong *)((longlong)uVar17 / (longlong)uVar12);

+          lVar23 = *(longlong *)(*plVar27 + 8);

+          local_88 = (longlong)((local_a0 + -1 + param_6 + uVar12 & ~(uVar12 - 1)) - uVar17) /

+                     (longlong)uVar12;

+          *(undefined8 *)(puVar21 + -8) = 0x140068b70;

+          CldiStreamCdqACQUIRE(lVar23 + 0x90);

+          bVar8 = true;

+          local_70 = 0;

+          local_68 = 0;

+          local_78 = 0;

+          local_b7[0] = '\x01';

+          while( true ) {

+            *(longlong **)(puVar21 + 0x20) = &local_78;

+            plVar24 = &local_70;

+            *(undefined8 *)(puVar21 + -8) = 0x140068bae;

+            cVar10 = FsRtlGetNextBaseMcbEntry(puVar14 + 0x4c,local_90,plVar24,&local_68);

+            cVar9 = local_b7[0];

+            if (cVar10 == '\0') break;

+            if (local_68 == -1) {

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

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+                uVar3 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+                *(ulonglong *)(puVar21 + 0x40) = (ulonglong)local_a8 * local_78;

+                lVar23 = ((longlong)local_98 + local_70) * (ulonglong)local_a8;

+                *(longlong *)(puVar21 + 0x38) = lVar23;

+                *(undefined8 *)(puVar21 + 0x30) = local_b0;

+                *(longlong **)(puVar21 + 0x28) = param_3;

+                *(uint **)(puVar21 + 0x20) = puVar14;

+                *(undefined8 *)(puVar21 + -8) = 0x140068c25;

+                WPP_SF_qqqiii(uVar3,0x5f,lVar23,param_2);

+              }

+              lVar23 = *(longlong *)*plVar27;

+              uVar2 = *(undefined4 *)(lVar23 + 0x38);

+              uVar3 = *(undefined8 *)(lVar23 + 0x30);

+              uVar5 = *(undefined8 *)(lVar23 + 0x28);

+              lVar23 = *(longlong *)(lVar23 + 0x10);

+              *(uint **)(puVar21 + 0x90) = puVar14 + 0x2a;

+              local_b7[0] = '\0';

+              uVar6 = *(undefined8 *)(lVar23 + 0x20);

+              *(undefined8 *)(puVar21 + 0x88) = param_19;

+              *(undefined4 *)(puVar21 + 0x80) = param_16;

+              *(undefined8 *)(puVar21 + 0x78) = param_15;

+              *(undefined8 *)(puVar21 + 0x70) = param_9;

+              *(undefined8 *)(puVar21 + 0x68) = param_8;

+              *(ulonglong *)(puVar21 + 0x60) = (ulonglong)local_a8 * local_78;

+              lVar23 = *(longlong *)(puVar14 + 0x1c);

+              *(ulonglong *)(puVar21 + 0x58) = ((longlong)local_98 + local_70) * (ulonglong)local_a8

+              ;

+              *(uint *)(puVar21 + 0x50) = param_10;

+              *(uint *)(puVar21 + 0x48) = local_a8;

+              *(longlong *)(puVar21 + 0x40) = local_60;

+              *(undefined4 *)(puVar21 + 0x38) = param_5;

+              *(undefined4 *)(puVar21 + 0x30) = uVar2;

+              *(undefined8 *)(puVar21 + 0x28) = uVar3;

+              *(undefined8 *)(puVar21 + 0x20) = uVar5;

+              *(undefined8 *)(puVar21 + -8) = 0x140068ceb;

+              uVar17 = CldSyncSendHydrationRequest

+                                 (local_58,5,uVar6,lVar23,*(undefined8 *)(puVar21 + 0x20),

+                                  *(void **)(puVar21 + 0x28),*(int *)(puVar21 + 0x30),

+                                  *(undefined4 *)(puVar21 + 0x38),*(longlong *)(puVar21 + 0x40),

+                                  *(uint *)(puVar21 + 0x48),*(uint *)(puVar21 + 0x50),

+                                  *(ulonglong *)(puVar21 + 0x58),*(longlong *)(puVar21 + 0x60),

+                                  *(undefined8 *)(puVar21 + 0x68),*(undefined8 *)(puVar21 + 0x70),

+                                  *(undefined8 *)(puVar21 + 0x78),puVar21[0x80],

+                                  *(void **)(puVar21 + 0x88),*(undefined8 **)(puVar21 + 0x90));

+              uVar11 = (uint)uVar17;

+              *(undefined8 *)(puVar21 + -8) = 0x140068cf5;

+              HsmDbgBreakOnStatus(uVar11);

+              if ((int)uVar11 < 0) {

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

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

+                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_17;

+                *(uint *)(puVar21 + 0x48) = uVar11;

+                *(ulonglong *)(puVar21 + 0x40) = (ulonglong)local_a8 * local_78;

+                plVar24 = (longlong *)(((longlong)local_98 + local_70) * (ulonglong)local_a8);

+                uVar19 = 0x60;

+                *(longlong **)(puVar21 + 0x38) = plVar24;

+                *(undefined8 *)(puVar21 + 0x30) = local_b0;

+                *(longlong **)(puVar21 + 0x28) = param_3;

+                goto LAB_18;

+              }

+            }

+            local_90 = local_90 + 1;

+            local_80 = (longlong *)(local_78 + local_70);

+          }

+          if ((longlong)local_80 < local_88) {

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

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+              uVar3 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+              lVar23 = ((longlong)local_98 + (longlong)local_80) * (ulonglong)local_a8;

+              *(ulonglong *)(puVar21 + 0x40) = (local_88 - (longlong)local_80) * (ulonglong)local_a8

+              ;

+              *(longlong *)(puVar21 + 0x38) = lVar23;

+              *(undefined8 *)(puVar21 + 0x30) = local_b0;

+              *(longlong **)(puVar21 + 0x28) = param_3;

+              *(uint **)(puVar21 + 0x20) = puVar14;

+              *(undefined8 *)(puVar21 + -8) = 0x140068dfc;

+              WPP_SF_qqqiii(uVar3,0x61,lVar23,param_2);

+            }

+            lVar23 = *(longlong *)*plVar27;

+            local_88 = (local_88 - (longlong)local_80) * (ulonglong)local_a8;

+            lVar26 = ((longlong)local_80 + (longlong)local_98) * (ulonglong)local_a8;

+            uVar2 = *(undefined4 *)(lVar23 + 0x38);

+            uVar3 = *(undefined8 *)(lVar23 + 0x30);

+            uVar5 = *(undefined8 *)(lVar23 + 0x28);

+            plVar24 = *(longlong **)(*(longlong *)(lVar23 + 0x10) + 0x20);

+            *(uint **)(puVar21 + 0x90) = puVar14 + 0x2a;

+            *(undefined8 *)(puVar21 + 0x88) = param_19;

+            *(undefined4 *)(puVar21 + 0x80) = param_16;

+            *(undefined8 *)(puVar21 + 0x78) = param_15;

+            *(undefined8 *)(puVar21 + 0x70) = param_9;

+            *(undefined8 *)(puVar21 + 0x68) = param_8;

+            *(longlong *)(puVar21 + 0x60) = local_88;

+            *(longlong *)(puVar21 + 0x58) = lVar26;

+            *(uint *)(puVar21 + 0x50) = param_10;

+            *(uint *)(puVar21 + 0x48) = local_a8;

+            *(longlong *)(puVar21 + 0x40) = local_60;

+            *(undefined4 *)(puVar21 + 0x38) = param_5;

+            *(undefined4 *)(puVar21 + 0x30) = uVar2;

+            *(undefined8 *)(puVar21 + 0x28) = uVar3;

+            lVar23 = *(longlong *)(puVar14 + 0x1c);

+            *(undefined8 *)(puVar21 + 0x20) = uVar5;

+            *(undefined8 *)(puVar21 + -8) = 0x140068ecb;

+            uVar17 = CldSyncSendHydrationRequest

+                               (local_58,5,plVar24,lVar23,*(undefined8 *)(puVar21 + 0x20),

+                                *(void **)(puVar21 + 0x28),*(int *)(puVar21 + 0x30),

+                                *(undefined4 *)(puVar21 + 0x38),*(longlong *)(puVar21 + 0x40),

+                                *(uint *)(puVar21 + 0x48),*(uint *)(puVar21 + 0x50),

+                                *(ulonglong *)(puVar21 + 0x58),*(longlong *)(puVar21 + 0x60),

+                                *(undefined8 *)(puVar21 + 0x68),*(undefined8 *)(puVar21 + 0x70),

+                                *(undefined8 *)(puVar21 + 0x78),puVar21[0x80],

+                                *(void **)(puVar21 + 0x88),*(undefined8 **)(puVar21 + 0x90));

+            uVar11 = (uint)uVar17;

+            *(undefined8 *)(puVar21 + -8) = 0x140068ed5;

+            HsmDbgBreakOnStatus(uVar11);

+            if ((int)uVar11 < 0) {

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

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+                uVar19 = 0x62;

+                *(uint *)(puVar21 + 0x48) = uVar11;

+                *(longlong *)(puVar21 + 0x40) = local_88;

+                *(longlong *)(puVar21 + 0x38) = lVar26;

+                *(undefined8 *)(puVar21 + 0x30) = local_b0;

+                *(longlong **)(puVar21 + 0x28) = param_3;

+LAB_18:

+                uVar3 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+                *(uint **)(puVar21 + 0x20) = puVar14;

+                *(undefined8 *)(puVar21 + -8) = 0x140068d86;

+                WPP_SF_qqqiiid(uVar3,uVar19,plVar24,param_2);

+              }

+            }

+            else {

+LAB_19:

+              *(undefined8 *)(puVar21 + -8) = 0x140068f4b;

+              puVar20 = param_2;

+              uVar11 = CldiStreamInsertIntoCancelSafeQueue(plVar27,param_2,plVar24,puVar14);

+              *(undefined8 *)(puVar21 + -8) = 0x140068f55;

+              HsmDbgBreakOnStatus(uVar11);

+              if ((int)uVar11 < 0) {

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

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+                  uVar19 = 99;

+                  *(uint *)(puVar21 + 0x40) = uVar11;

+                  *(longlong *)(puVar21 + 0x38) = local_a0;

+                  *(ulonglong *)(puVar21 + 0x30) = param_6;

+                  *(undefined8 *)(puVar21 + 0x28) = local_b0;

+                  *(longlong **)(puVar21 + 0x20) = param_3;

+                  bVar8 = true;

+                  goto LAB_5;

+                }

+              }

+              else {

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

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+                  uVar3 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+                  pcVar16 = "HYDRATE";

+                  if (local_8c != 0) {

+                    pcVar16 = "VALIDATE";

+                  }

+                  *(longlong *)(puVar21 + 0x50) = local_a0;

+                  *(ulonglong *)(puVar21 + 0x48) = param_6;

+                  *(undefined8 *)(puVar21 + 0x40) = local_b0;

+                  *(longlong **)(puVar21 + 0x38) = plVar27;

+                  *(longlong **)(puVar21 + 0x30) = param_3;

+                  *(uint **)(puVar21 + 0x28) = puVar14;

+                  *(uint **)(puVar21 + 0x20) = param_2;

+                  *(undefined8 *)(puVar21 + -8) = 0x140069018;

+                  WPP_SF_sqqqqiii(uVar3,puVar20,plVar24,pcVar16);

+                }

+                lVar23 = *(longlong *)(*plVar27 + 8);

+                *(undefined8 *)(puVar21 + -8) = 0x14006902c;

+                CldiStreamCdqRELEASE(lVar23 + 0x90);

+                bVar8 = false;

+                puVar14 = (uint *)0x0;

+                *(undefined8 *)(puVar21 + -8) = 0x140069038;

+                CldiStreamStartCountdownTimer('\0',puVar20,(undefined *)plVar24);

+              }

+            }

+          }

+          else {

+            if (local_b7[0] == '\0') goto LAB_19;

+            lVar23 = *(longlong *)(*plVar27 + 8);

+            *(undefined8 *)(puVar21 + -8) = 0x140069051;

+            CldiStreamCdqRELEASE(lVar23 + 0x90);

+            bVar8 = false;

+            param_7 = local_a0;

+            if (cVar9 != '\0') goto LAB_3;

+          }

+        }

+      }

+    }

   }

-  if (unaff_R13 != 0) {

-    ObfDereferenceObject();

+LAB_17:

+  *(undefined8 *)(puVar21 + -8) = 0x140069134;

+  uVar17 = Feature_2089223483__private_IsEnabledDeviceUsageNoInline();

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

+    if (bVar8) {

+      lVar23 = *(longlong *)(*plVar27 + 8);

+      *(undefined8 *)(puVar21 + -8) = 0x140069151;

+      CldiStreamCdqRELEASE(lVar23 + 0x90);

+    }

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

+      *(undefined8 *)(puVar21 + -8) = 0x140069165;

+      TlmWriteCvForHydrateData((longlong)(puVar14 + 0x2a),uVar11);

+    }

+    if (((int)uVar11 < 0) && (param_14 != (undefined *)0x0)) {

+      *(undefined8 *)(puVar21 + -8) = 0x140069188;

+      (*(code *)param_14)(param_17,uVar11,0);

+    }

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

+      return;

+    }

+    *(undefined8 *)(puVar21 + -8) = 0x140069199;

+    CldiStreamDeleteRequest(puVar14);

+    return;

   }

-  return unaff_EDI;

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

+    *(undefined8 *)(puVar21 + -8) = 0x1400691af;

+    TlmWriteCvForHydrateData((longlong)(puVar14 + 0x2a),uVar11);

+    if (!bVar8) {

+      lVar23 = *(longlong *)(*plVar27 + 8);

+      *(undefined8 *)(puVar21 + -8) = 0x1400691c8;

+      CldiStreamCdqACQUIRE(lVar23 + 0x90);

+      bVar8 = true;

+    }

+    *(undefined8 *)(puVar21 + -8) = 0x1400691d3;

+    CldiStreamDeleteRequest(puVar14);

+    *(undefined8 *)(puVar21 + -8) = 0x1400691d8;

+    uVar17 = Feature_4003697978__private_IsEnabledDeviceUsageNoInline();

+    if ((int)uVar17 != 0) goto LAB_20;

+  }

+  if (bVar8) {

+    lVar23 = *(longlong *)(*plVar27 + 8);

+    *(undefined8 *)(puVar21 + -8) = 0x1400691f5;

+    CldiStreamCdqRELEASE(lVar23 + 0x90);

+  }

+LAB_20:

+  if (((int)uVar11 < 0) && (param_14 != (undefined *)0x0)) {

+    *(undefined8 *)(puVar21 + -8) = 0x140069218;

+    (*(code *)param_14)(param_17,uVar11,0);

+  }

+  return;

 }
```

## `HsmiCldGetSyncRootInfoByPath`  (modified)

```diff
--- HsmiCldGetSyncRootInfoByPath
+++ HsmiCldGetSyncRootInfoByPath
@@ -1,218 +1,61 @@
 

 uint HsmiCldGetSyncRootInfoByPath(longlong param_1,ushort *param_2,longlong *param_3)

 

 {

   uint uVar1;

   longlong lVar2;

-  undefined8 uVar3;

-  char cVar4;

-  undefined4 in_EAX;

-  uint uVar5;

-  int iVar6;

-  longlong *plVar7;

-  longlong lVar8;

-  ulonglong uVar9;

-  undefined2 uVar10;

-  uint uVar11;

-  longlong unaff_RBX;

-  ulonglong uVar12;

-  ulonglong uVar13;

-  short *psVar14;

-  longlong lVar15;

-  uint uVar16;

-  uint uVar17;

-  longlong *plVar18;

-  longlong in_R11;

-  ulonglong uVar19;

-  ulonglong uVar20;

-  undefined4 local_res8 [2];

-  longlong local_res10;

-  longlong *local_res18;

-  undefined8 local_res20;

+  longlong local_res20;

+  longlong local_18;

+  longlong local_10;

+  longlong lVar3;

   

-  *(undefined4 *)(unaff_RBX + 0x18) = in_EAX;

-  lVar2 = *(longlong *)(param_2 + 8);

-  uVar9 = 0;

-  uVar12 = 0;

-  uVar19 = 0;

-  uVar3 = *(undefined8 *)(param_1 + 0x30);

-  *(undefined4 *)(in_R11 + 8) = 0;

-  *(undefined8 *)(in_R11 + 0x10) = 0;

-  plVar7 = (longlong *)ExAllocateFromPagedLookasideList(&DAT_0);

-  if (plVar7 == (longlong *)0x0) {

-    uVar5 = 0xc000009a;

-    HsmDbgBreakOnStatus(-0x3fffff66);

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

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

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-    uVar10 = 0xd;

-    plVar18 = (longlong *)0x0;

-LAB_2:

-    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar10,

-               &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,plVar18);

-    goto LAB_1;

-  }

-  *plVar7 = param_1;

-  plVar7[1] = (longlong)param_2;

-  if ((*(longlong *)(lVar2 + 0x20) == 0) && (*(longlong *)(lVar2 + 0x10) != 0)) {

-    FltAcquirePushLockExclusiveEx(lVar2 + 0x18,0);

-    if (*(longlong *)(lVar2 + 0x20) == 0) {

-      lVar15 = *(longlong *)(lVar2 + 8);

-      local_res20 = *(undefined8 *)(lVar2 + 0x10);

-      FltAcquirePushLockSharedEx(lVar15 + 8,0);

-      lVar8 = RtlLookupElementGenericTableAvl(lVar15 + 0x10,&local_res20);

-      if (lVar8 == 0) {

-        HsmDbgBreakOnStatus(-0x3fff30ff);

-      }

-      else {

-        *(undefined8 *)(lVar2 + 0x20) = *(undefined8 *)(lVar8 + 8);

-      }

-      FltReleasePushLockEx(lVar15 + 8,0);

-    }

-    FltReleasePushLockEx(lVar2 + 0x18,0);

-  }

-  lVar15 = *(longlong *)(lVar2 + 0x20);

-  uVar20 = uVar9;

-  if (lVar15 != 0) {

-    uVar5 = CldStreamOpen((longlong *)param_2);

-    uVar20 = (ulonglong)uVar5;

-    HsmDbgBreakOnStatus(uVar5);

-    if ((int)uVar5 < 0) {

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

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

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-      uVar10 = 0xe;

-      plVar18 = plVar7;

-      goto LAB_2;

+  local_10 = 0;

+  local_res20 = 0;

+  lVar3 = 0;

+  lVar2 = 0;

+  local_18 = 0;

+  uVar1 = HsmiCldOpenSyncRoot(param_1,param_2,&local_10,&local_res20);

+  HsmDbgBreakOnStatus(uVar1);

+  if ((int)uVar1 < 0) {

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

+        (lVar3 = lVar2, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

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

+      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x18,

+                &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

     }

   }

-  uVar5 = (uint)uVar20;

-  lVar8 = IoGetCurrentProcess();

-  uVar13 = uVar9;

-  if (lVar8 != *(longlong *)PsInitialSystemProcess_exref) {

-    if ((lVar15 == 0) || (*(longlong *)(lVar15 + 0x60) == 0)) {

-      lVar15 = 0;

+  else {

+    if (local_res20 == 0) {

+      uVar1 = 0xc000cf13;

+      HsmDbgBreakOnStatus(-0x3fff30ed);

+      goto LAB_0;

+    }

+    uVar1 = HsmiCldLoadSyncRootInfoByFileObject(param_1,local_res20,&local_18);

+    HsmDbgBreakOnStatus(uVar1);

+    if ((int)uVar1 < 0) {

+      lVar3 = local_18;

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

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

+         ) {

+        WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x1a,

+                  &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+        lVar3 = local_18;

+      }

     }

     else {

-      lVar15 = *(longlong *)(*(longlong *)(lVar15 + 0x60) + 0x68);

-    }

-    lVar8 = IoGetCurrentProcess();

-    uVar13 = uVar12;

-    psVar14 = DAT_3;

-    uVar12 = uVar9;

-    uVar9 = uVar19;

-    if (lVar8 != lVar15) {

-      while( true ) {

-        uVar19 = uVar12;

-        uVar5 = (uint)uVar20;

-        if ((*(short **)(psVar14 + 4) == (short *)0x0) ||

-           ((**(short **)(psVar14 + 4) == 0x2a && (*psVar14 == 2)))) break;

-        if (uVar19 == 0) {

-          uVar5 = ZwQueryInformationProcess(0xffffffffffffffff,0x1b,0,0,local_res8);

-          HsmDbgBreakOnStatus(uVar5);

-          if (((uVar5 + 0x80000000 & 0x80000000) == 0) && (uVar5 != 0xc0000004)) {

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

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

-               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-            uVar10 = 0xf;

-          }

-          else {

-            uVar19 = ExAllocatePool2(0x100,local_res8[0],0x6e706c43);

-            if (uVar19 == 0) {

-              uVar5 = 0xc000009a;

-              HsmDbgBreakOnStatus(-0x3fffff66);

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

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

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-              uVar10 = 0x10;

-            }

-            else {

-              uVar5 = ZwQueryInformationProcess

-                                (0xffffffffffffffff,0x1b,uVar19,local_res8[0],local_res8);

-              uVar20 = (ulonglong)uVar5;

-              HsmDbgBreakOnStatus(uVar5);

-              if (-1 < (int)uVar5) goto LAB_4;

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

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

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-              uVar10 = 0x11;

-            }

-          }

-          WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar10,

-                    &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,param_1);

-          goto LAB_1;

-        }

-LAB_4:

-        uVar5 = (uint)uVar20;

-        cVar4 = FsRtlDoesNameContainWildCards(psVar14);

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

-          iVar6 = RtlCompareUnicodeString(psVar14,uVar19);

-          if (iVar6 == 0) break;

-        }

-        else {

-          cVar4 = FsRtlIsNameInExpression();

-          if (cVar4 != '\0') break;

-        }

-        psVar14 = psVar14 + 0x14;

-        uVar12 = uVar19;

-      }

-      uVar9 = uVar19;

-      if ((*(short **)(psVar14 + 0xc) == (short *)0x0) ||

-         ((**(short **)(psVar14 + 0xc) == 0x2a && (psVar14[8] == 2)))) {

-LAB_5:

-        uVar13 = (ulonglong)*(uint *)(psVar14 + 0x10);

-      }

-      else {

-        uVar5 = FltGetFileNameInformationUnsafe(uVar3,0,0x102,&local_res10);

-        HsmDbgBreakOnStatus(uVar5);

-        if ((int)uVar5 < 0) {

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

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

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

-            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x12,

-                       &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,param_1);

-          }

-          goto LAB_1;

-        }

-        if ((*(longlong *)(local_res10 + 0x50) == 0) && (*(longlong *)(local_res10 + 0x40) != 0)) {

-          cVar4 = FsRtlDoesNameContainWildCards(psVar14 + 8);

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

-            cVar4 = FsRtlIsNameInExpression(psVar14 + 8,local_res10 + 0x38,1,0);

-            if (cVar4 != '\0') goto LAB_5;

-          }

-          iVar6 = RtlCompareUnicodeString(psVar14 + 8,local_res10 + 0x38,1);

-          if (iVar6 == 0) goto LAB_5;

-        }

-      }

+      *param_3 = local_18;

     }

   }

-  uVar19 = uVar9;

-  FltAcquirePushLockExclusiveEx(lVar2 + 0x18,0);

-  uVar1 = *(uint *)(lVar2 + 0x28);

-  uVar16 = uVar1;

-  if (((byte)uVar1 & 0xf) <= ((byte)uVar13 & 0xf)) {

-    uVar16 = (uint)uVar13;

+  if (local_res20 != 0) {

+    ObfDereferenceObject(local_res20);

   }

-  uVar11 = (uint)uVar13 >> 4;

-  uVar17 = (uVar16 ^ uVar1) & 0xf ^ uVar1;

-  uVar16 = uVar1 >> 4;

-  if (((byte)(uVar1 >> 4) & 0xf) <= ((byte)uVar11 & 0xf)) {

-    uVar16 = uVar11;

+LAB_0:

+  if (local_10 != 0) {

+    FltClose();

   }

-  *(uint *)(lVar2 + 0x28) = (uVar16 << 4 ^ uVar17) & 0xf0 ^ uVar17;

-  FltReleasePushLockEx(lVar2 + 0x18,0);

-  *local_res18 = (longlong)plVar7;

-  plVar7 = (longlong *)0x0;

-LAB_1:

-  if (local_res10 != 0) {

-    FltReleaseFileNameInformation();

+  if (lVar3 != 0) {

+    ExFreePoolWithTag(lVar3,0x69537348);

   }

-  if (uVar19 != 0) {

-    ExFreePoolWithTag(uVar19,0x6e706c43);

-  }

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

-    ExFreeToPagedLookasideList(&DAT_0,plVar7);

-  }

-  return uVar5;

+  return uVar1;

 }
```

## `HsmFltPreSetBasicInformation`  (modified)

```diff
--- HsmFltPreSetBasicInformation
+++ HsmFltPreSetBasicInformation
@@ -1,570 +1,249 @@
 

-ulonglong HsmFltPreSetBasicInformation

-                    (longlong param_1,longlong param_2,longlong param_3,longlong param_4,

-                    longlong param_5,longlong *param_6)

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

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

+

+undefined8

+HsmFltPreSetBasicInformation

+          (longlong param_1,longlong param_2,longlong param_3,longlong param_4,longlong param_5,

+          longlong *param_6)

 

 {

-  ulonglong *puVar1;

-  int *_Src;

-  int *piVar2;

-  int *piVar3;

-  char cVar4;

-  ushort uVar5;

-  undefined4 uVar6;

-  uint uVar7;

-  int iVar8;

-  ulonglong uVar9;

-  undefined8 *puVar10;

+  longlong *plVar1;

+  bool bVar2;

+  bool bVar3;

+  bool bVar4;

+  bool bVar5;

+  bool bVar6;

+  char cVar7;

+  uint uVar8;

+  uint uVar9;

+  longlong lVar10;

   longlong lVar11;

-  undefined2 uVar12;

-  longlong *unaff_RBX;

-  char cVar13;

-  ushort uVar14;

-  longlong *unaff_RSI;

-  uint unaff_EDI;

-  ulonglong uVar16;

-  longlong *plVar17;

-  uint uVar18;

-  uint *_Size;

-  uint *puVar19;

-  undefined8 uVar20;

-  undefined *unaff_R12;

-  undefined4 *unaff_R13;

-  byte bVar21;

-  ushort uVar22;

-  longlong unaff_R14;

-  uint unaff_R15D;

-  int unaff_XMM6_Da;

-  undefined4 unaff_XMM6_Db;

-  longlong *in_stack_00000060;

-  longlong *plStack0000000000000070;

-  uint in_stack_00000084;

-  undefined1 in_stack_00000088;

-  longlong *in_stack_00000090;

-  uint in_stack_000000a4;

-  longlong *in_stack_000000a8;

-  ulonglong *in_stack_000000b0;

-  longlong *in_stack_000000b8;

-  int iStack00000000000000c0;

-  undefined4 uStack00000000000000c4;

-  longlong in_stack_000000e8;

-  uint *in_stack_000000f8;

-  longlong *in_stack_00000100;

-  longlong *in_stack_00000118;

-  undefined8 in_stack_00000120;

-  longlong *in_stack_00000130;

-  char cStack00000000000001b0;

-  undefined7 uStack00000000000001b1;

-  longlong in_stack_000001b8;

-  char in_stack_000001c0;

-  uint *in_stack_000001d0;

-  int iVar15;

+  ulonglong uVar12;

+  undefined2 uVar13;

+  uint uVar14;

+  undefined8 uVar15;

+  undefined *puVar16;

+  undefined1 auStackY_108 [32];

+  char local_a8 [8];

+  longlong local_a0;

+  longlong local_98;

+  undefined8 local_90;

+  uint local_88 [2];

+  longlong *local_80;

+  undefined8 local_78;

+  undefined8 uStack_70;

+  undefined8 local_68;

+  undefined8 uStack_60;

+  ulonglong local_58;

+  ulonglong local_50;

   

-  WPP_SF_qis(*(undefined8 *)(param_1 + 0x18),0x8a,param_3,unaff_RBX,*unaff_RBX,

-             (char *)(unaff_RBX + 4));

-  memset(in_stack_00000090,0,0x1000);

-  cVar13 = (char)unaff_RSI;

-  iVar15 = (int)unaff_RSI;

-  bVar21 = (byte)unaff_R14;

-  uVar7 = (uint)unaff_R14;

-  if (((longlong *)unaff_RBX[7] != unaff_RSI) &&

-     (uVar18 = *(uint *)(unaff_RBX + 2) >> 0xc & unaff_EDI, uVar16 = (ulonglong)uVar18,

-     uVar18 < unaff_R15D)) {

-    if ((WPP_GLOBAL_Control != unaff_R12) &&

-       (((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

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

-      WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8b,uVar16,unaff_RBX,*unaff_RBX,

-                   (char *)(unaff_RBX + 4));

-    }

-    if (((WPP_GLOBAL_Control != unaff_R12) &&

-        ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-      WPP_SF_qis(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8c,uVar16,unaff_RBX,*unaff_RBX,

-                 (char *)(unaff_RBX + 4));

-    }

-    HsmiBitmapNORMALSetNextLevelBlockState('\0',(longlong)in_stack_00000090,0,uVar7);

-    uVar6 = RtlComputeCrc32(0,in_stack_00000090);

-    *(undefined4 *)((longlong)in_stack_00000090 + 0xffc) = uVar6;

-    for (uVar18 = *(uint *)(unaff_RBX + 2) >> 0xc & unaff_EDI; uVar18 < unaff_R15D;

-        uVar18 = uVar18 + uVar7) {

-      if (uVar18 == (*(uint *)(unaff_RBX + 2) >> 0xc & unaff_EDI)) {

-        plStack0000000000000070 = (longlong *)unaff_RBX[7];

-      }

-      else {

-        plStack0000000000000070 = in_stack_00000090;

-      }

-      uVar16 = HsmiBitmapNORMALPrepareBlockForWrite

-                         (unaff_RBX,uVar18,(undefined *)0x0,0,4,&stack0x000000a8,

-                          (undefined8 *)&stack0x000000c0);

-      iVar8 = (int)uVar16;

-      uVar16 = uVar16 & 0xffffffff;

-      HsmDbgBreakOnStatus(iVar8);

-      if (iVar8 < 0) {

-        if (((WPP_GLOBAL_Control != unaff_R12) &&

-            ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          uVar12 = 0x8d;

+  local_50 = __security_cookie ^ (ulonglong)auStackY_108;

+  lVar10 = 0;

+  local_80 = param_6;

+  local_a0 = *(longlong *)(param_5 + 0x20);

+  if (param_2 != 0) {

+    lVar10 = *(longlong *)(param_2 + 0x10);

+  }

+  uVar15 = 1;

+  local_88[0] = 0;

+  plVar1 = *(longlong **)(*(longlong *)(param_4 + 0x10) + 0x38);

+  local_58 = 0;

+  local_78 = 0;

+  uStack_70 = 0;

+  local_68 = 0;

+  uStack_60 = 0;

+  if (lVar10 == 0) {

+    local_90 = 0;

+  }

+  else {

+    local_90 = *(undefined8 *)(lVar10 + 0x20);

+  }

+  bVar4 = false;

+  bVar6 = false;

+  local_98 = param_1;

+  uVar8 = FltQueryInformationFile(*(undefined8 *)(param_5 + 0x18),local_a0,&local_78);

+  HsmDbgBreakOnStatus(uVar8);

+  bVar5 = true;

+  bVar2 = bVar4;

+  if ((int)uVar8 < 0) {

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

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

+    {

+      uVar13 = 0x1f;

 LAB_0:

-          WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,(ulonglong)uVar18,unaff_RBX

-                       ,*unaff_RBX,(char *)(unaff_RBX + 4));

-        }

+      WPP_SF_qqqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar13,

+                    &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

+      bVar2 = bVar4;

+    }

 LAB_1:

-        unaff_XMM6_Db = uStack00000000000000c4;

-        unaff_XMM6_Da = iStack00000000000000c0;

-        goto LAB_2;

-      }

-      uVar20 = 0x1000;

-      memmove(in_stack_000000a8,plStack0000000000000070,0x1000);

-      uVar16 = (ulonglong)uVar18;

-      if (iVar8 < 0) {

-        if (((WPP_GLOBAL_Control != unaff_R12) &&

-            ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          uVar16 = *(ulonglong *)(WPP_GLOBAL_Control + 0x18);

-          WPP_SF_qisdil(uVar16,0x8e,WPP_GLOBAL_Control,unaff_RBX,*unaff_RBX,(char *)(unaff_RBX + 4))

-          ;

-        }

-        uVar7 = HsmiBitmapTranslateIOStatus(uVar16,iVar8);

-        uVar16 = (ulonglong)uVar7;

-        HsmDbgBreakOnStatus(uVar7);

-        goto LAB_1;

-      }

-      uVar9 = HsmpFileCacheSetAddressRangeModified(in_stack_000000a8,plStack0000000000000070,uVar20)

-      ;

-      uVar16 = uVar9 & 0xffffffff;

-      HsmDbgBreakOnStatus((int)uVar9);

-      if ((int)uVar9 < 0) {

-        if (((WPP_GLOBAL_Control != unaff_R12) &&

-            ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          uVar12 = 0x8f;

-          goto LAB_0;

-        }

-        goto LAB_1;

-      }

-      in_stack_00000130 = _iStack00000000000000c0;

-      HsmIBitmapNORMALUnpinBlock((int *)&stack0x00000130);

-      _iStack00000000000000c0 = (longlong *)CONCAT44(uStack00000000000000c4,iVar15);

-      unaff_EDI = 7;

-      unaff_XMM6_Da = iVar15;

-      unaff_XMM6_Db = uStack00000000000000c4;

-      in_stack_000000a8 = unaff_RSI;

-    }

-  }

-  FltReleasePushLockEx(unaff_RBX + 6,0);

-  in_stack_00000120 = 0xffffffffffffffff;

-  in_stack_00000088 = 0xff;

-  in_stack_000001c0 = cVar13;

-  for (in_stack_000000b8 = (longlong *)unaff_RBX[0x11]; in_stack_000000b8 != unaff_RBX + 0x10;

-      in_stack_000000b8 = (longlong *)in_stack_000000b8[1]) {

-    in_stack_000000b0 = (ulonglong *)(in_stack_000000b8 + 2);

-    for (plVar17 = unaff_RSI; (longlong)plVar17 < 3;

-        plVar17 = (longlong *)((longlong)plVar17 + unaff_R14)) {

-      _iStack00000000000000c0 = (longlong *)*in_stack_000000b0;

-      uVar9 = (ulonglong)unaff_RSI & 0xffffffff;

-      in_stack_000000a8 = unaff_RSI;

-      while ((_iStack00000000000000c0 != (longlong *)0x0 &&

-             (cVar4 = FsRtlGetNextBaseMcbEntry

-                                (_iStack00000000000000c0,uVar9,&stack0x000000a8,&stack0x000000f0,

-                                 &stack0x00000110), cVar4 != '\0'))) {

-        in_stack_00000130 = unaff_RSI;

-        if (unaff_RSI != (longlong *)0xffffffffffffffff) {

-          uVar16 = (ulonglong)in_stack_000000a4;

-          in_stack_00000100 = (longlong *)(uVar16 * (longlong)in_stack_000000a8);

-          in_stack_00000118 =

-               (longlong *)

-               ((ulonglong)in_stack_000000a4 * (longlong)unaff_RSI + (longlong)in_stack_00000100);

-          lVar11 = in_stack_000001b8;

-          if (in_stack_000001b8 < unaff_RBX[1]) {

-            lVar11 = unaff_RBX[1];

+    *(uint *)(param_4 + 0x18) = uVar8;

+    uVar15 = 4;

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

+    bVar5 = bVar6;

+LAB_2:

+    if (!bVar2) goto LAB_3;

+  }

+  else {

+    uVar9 = *(uint *)(plVar1 + 4);

+    if (uVar9 != 0) {

+      if ((uVar9 >> 0x13 & 1) == 0) {

+        uVar14 = -(uint)((uVar9 & 0x100000) != 0) & 2;

+      }

+      else {

+        uVar14 = 3;

+        if ((uVar9 & 0x100000) == 0) {

+          uVar14 = 1;

+        }

+      }

+      if (((uint)local_58 >> 0x13 & 1) == 0) {

+        uVar9 = (uint)(local_58 >> 0x13) & 2;

+      }

+      else {

+        uVar9 = ((uint)local_58 & 0x100000 | 0x80000) >> 0x13;

+      }

+      if ((uVar14 != uVar9) && ((uVar14 == 3 || (uVar9 == 3)))) {

+        local_a8[0] = '\0';

+        lVar10 = FltGetRequestorProcess(param_4);

+        uVar8 = HsmpCldCheckSyncProviderAccess(local_98,param_2,local_a0,lVar10,local_a8);

+        HsmDbgBreakOnStatus(uVar8);

+        if ((int)uVar8 < 0) {

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

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

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

+            uVar13 = 0x20;

+            goto LAB_0;

           }

-          if ((longlong)((uVar16 - 1) + lVar11 & -uVar16) < (longlong)in_stack_00000118)

-          goto LAB_3;

-          _cStack00000000000001b0 =

-               (ushort *)CONCAT71(uStack00000000000001b1,plVar17 != (longlong *)0x2);

-          uVar18 = HsmiBitmapNORMALMarkBitmapOnDisk

-                             (unaff_RBX,(longlong)&stack0x00000150,(undefined *)&stack0x00000120,

-                              (longlong)&stack0x00000088,in_stack_00000084,

-                              (longlong *)&stack0x00000130,(longlong)in_stack_00000090,

-                              (ulonglong *)&stack0x00000100,(ulonglong *)&stack0x00000118,

-                              plVar17 != (longlong *)0x2);

-          uVar16 = (ulonglong)uVar18;

-          HsmDbgBreakOnStatus(uVar18);

-          if ((int)uVar18 < 0) {

-            if (((WPP_GLOBAL_Control == unaff_R12) ||

-                ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-            uVar12 = 0x90;

-            goto LAB_4;

+          goto LAB_1;

+        }

+        if (local_a8[0] == '\0') {

+          *(uint *)(plVar1 + 4) = *(uint *)(plVar1 + 4) & 0xffe7ffff;

+          *(uint *)(plVar1 + 4) = *(uint *)(plVar1 + 4) | (uint)local_58 & 0x180000;

+        }

+      }

+    }

+    if (param_3 == 0) {

+      if (-1 < (int)uVar8) {

+        return 1;

+      }

+      goto LAB_1;

+    }

+    uVar8 = HsmpAcquireUserRequestRundownProtection(param_2,param_4);

+    HsmDbgBreakOnStatus(uVar8);

+    if ((int)uVar8 < 0) {

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

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

+         ) {

+        puVar16 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize(param_2);

+        WPP_SF_qqLiqiqd(*(undefined8 *)(puVar16 + 0x18),0x21,

+                        &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,local_98);

+      }

+      goto LAB_1;

+    }

+    FltAcquirePushLockSharedEx(*(longlong *)(param_2 + 0x10) + 0x18,0);

+    uVar8 = *(uint *)(plVar1 + 4);

+    bVar4 = true;

+    bVar3 = true;

+    if (uVar8 != 0) {

+      if ((*(uint *)(param_2 + 0x1c) & 0x100) == 0) {

+        uVar8 = uVar8 | 0x401000;

+      }

+      else {

+        uVar8 = uVar8 & 0xffbfefff;

+      }

+      *(uint *)(plVar1 + 4) = uVar8;

+    }

+    if (plVar1[1] == -1) {

+      *(uint *)(param_3 + 0x28) = *(uint *)(param_3 + 0x28) | 8;

+    }

+    else if (plVar1[1] == -2) {

+      *(uint *)(param_3 + 0x28) = *(uint *)(param_3 + 0x28) & 0xfffffff7;

+    }

+    uVar8 = *(uint *)(plVar1 + 4);

+    if (((uVar8 != 0) && (uVar12 = HsmpIsPlaceholderHandle(param_3), (char)uVar12 != '\0')) &&

+       (((uVar8 >> 0x13 & 1) != 0 && ((uVar8 & 0x100000) != 0)))) {

+      HsmpAcquireBitmapLock(param_2,'\0');

+      if ((*(uint *)(param_2 + 0x1c) & 0x100) == 0) {

+        *(uint *)(plVar1 + 4) = *(uint *)(plVar1 + 4) & 0xffe7ffff;

+        *(uint *)(plVar1 + 4) = *(uint *)(plVar1 + 4) | (uint)local_58 & 0x180000;

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

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

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

+          WPP_SF_qqqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x22,

+                        &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

+        }

+      }

+      HsmpReleaseBitmapLock(param_2);

+    }

+    lVar10 = local_a0;

+    uVar8 = HsmpCldGetSyncPolicy(local_98,param_2,local_a0,0,local_88);

+    HsmDbgBreakOnStatus(uVar8);

+    uVar9 = local_88[0];

+    bVar2 = bVar4;

+    if ((int)uVar8 < 0) {

+      bVar6 = bVar5;

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

+          (bVar2 = bVar3, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

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

+        uVar13 = 0x23;

+        bVar6 = bVar5;

+        goto LAB_0;

+      }

+      goto LAB_1;

+    }

+    if ((local_88[0] >> 10 & 1) == 0) {

+LAB_4:

+      if ((*(uint *)(param_2 + 0x1c) >> 0xd & 1) == 0) goto LAB_5;

+      uVar8 = (uint)local_58;

+      if ((*(uint *)(param_2 + 0x1c) & 2) == 0) {

+        if ((((uVar9 >> 0xb & 1) == 0) || (*plVar1 < 1)) &&

+           (((uVar9 >> 0xf & 1) == 0 || (plVar1[2] < 1)))) {

+          uVar14 = *(uint *)(plVar1 + 4);

+          bVar2 = bVar3;

+          if (uVar14 == 0) goto LAB_5;

+          if ((((uVar9 >> 0xc & 1) == 0) || ((((byte)uVar14 ^ (byte)local_58) & 1) == 0)) &&

+             (((uVar9 >> 0xd & 1) == 0 || (((uVar14 ^ uVar8) & 2) == 0)))) {

+            uVar9 = uVar9 >> 0xe;

+            goto joined_r0x00014006219a;

           }

-          if (((WPP_GLOBAL_Control != unaff_R12) &&

-              ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-            WPP_SF_qisdiic(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x91,unaff_RBX + 4,unaff_RBX,

-                           *unaff_RBX,(char *)(unaff_RBX + 4));

+        }

+LAB_6:

+        FltReleasePushLockEx(*(longlong *)(param_2 + 0x10) + 0x18,0);

+        HsmpPersistInSync(param_2,local_a0,lVar10);

+        bVar2 = false;

+      }

+      else {

+        if ((((uVar9 >> 0x10 & 1) != 0) && (0 < *plVar1)) ||

+           (((uVar9 >> 0x14 & 1) != 0 && (0 < plVar1[2])))) goto LAB_6;

+        uVar14 = *(uint *)(plVar1 + 4);

+        bVar2 = bVar3;

+        if (uVar14 != 0) {

+          if ((((uVar9 >> 0x11 & 1) == 0) || ((((byte)uVar14 ^ (byte)local_58) & 1) == 0)) &&

+             (((uVar9 >> 0x12 & 1) == 0 || (((uVar14 ^ uVar8) & 2) == 0)))) {

+            uVar9 = uVar9 >> 0x13;

+joined_r0x00014006219a:

+            bVar2 = bVar3;

+            if (((uVar9 & 1) == 0) || (((uVar14 ^ uVar8) & 4) == 0)) goto LAB_5;

           }

-        }

-        uVar9 = (ulonglong)((int)uVar9 + uVar7);

-      }

-      in_stack_000000b0 = in_stack_000000b0 + 1;

-    }

-  }

-  puVar1 = (ulonglong *)unaff_RBX[1];

-  if ((longlong)puVar1 < in_stack_000001b8) {

-    _iStack00000000000000c0 = (longlong *)~((ulonglong)in_stack_000000a4 - 1);

-    in_stack_000000b0 = (ulonglong *)((ulonglong)puVar1 & (ulonglong)_iStack00000000000000c0);

-    in_stack_00000100 = unaff_RSI;

-    if (in_stack_000000b0 == puVar1) {

+          goto LAB_6;

+        }

+      }

 LAB_5:

-      in_stack_00000130 =

-           (longlong *)

-           ((ulonglong)in_stack_000000a4 + in_stack_000001b8 + -1 &

-           (ulonglong)_iStack00000000000000c0);

-      puVar10 = &stack0x00000120;

-      uVar18 = HsmiBitmapNORMALMarkBitmapOnDisk

-                         (unaff_RBX,(longlong)&stack0x00000150,(undefined *)puVar10,

-                          (longlong)&stack0x00000088,in_stack_00000084,(longlong *)&stack0x00000100,

-                          (longlong)in_stack_00000090,(ulonglong *)&stack0x000000b0,

-                          (ulonglong *)&stack0x00000130,bVar21);

-      uVar16 = (ulonglong)uVar18;

-      HsmDbgBreakOnStatus(uVar18);

-      if ((int)uVar18 < 0) {

-        if (((WPP_GLOBAL_Control != unaff_R12) &&

-            ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          uVar12 = 0x93;

-LAB_4:

-          WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,WPP_GLOBAL_Control,

-                       unaff_RBX,*unaff_RBX,(char *)(unaff_RBX + 4));

-        }

-        goto LAB_2;

-      }

-      if (((WPP_GLOBAL_Control != unaff_R12) &&

-          ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        WPP_SF_qisdiic(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x94,puVar10,unaff_RBX,*unaff_RBX,

-                       (char *)(unaff_RBX + 4));

-      }

-      goto LAB_6;

-    }

-    _cStack00000000000001b0 = (ushort *)CONCAT71(uStack00000000000001b1,cVar13);

-    puVar19 = (uint *)&stack0x000000b0;

-    in_stack_000000b8 = unaff_RSI;

-    puVar10 = HsmIBitmapNORMALQueryRangeEx

-                        (unaff_RBX,7,(longlong *)puVar19,unaff_RBX + 1,&stack0x000001b0,

-                         (longlong *)&stack0x000000b8);

-    uVar16 = (ulonglong)puVar10 & 0xffffffff;

-    HsmDbgBreakOnStatus((int)puVar10);

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

-      if ((cStack00000000000001b0 == cVar13) || ((longlong)in_stack_000000b8 < unaff_RBX[1])) {

+      bVar5 = false;

+      uVar15 = 0;

+      *local_80 = param_2;

+      goto LAB_2;

+    }

+    lVar11 = FltGetRequestorProcess(param_4);

+    cVar7 = HsmOsIsSyncProviderProcess(lVar11);

+    if (cVar7 == '\0') goto LAB_4;

+  }

+  FltReleasePushLockEx(*(longlong *)(param_2 + 0x10) + 0x18,0);

 LAB_3:

-        uVar16 = 0xc00000e5;

-        HsmDbgBreakOnStatus(-0x3fffff1b);

-        goto LAB_2;

-      }

-      goto LAB_5;

-    }

-    if (((WPP_GLOBAL_Control == unaff_R12) ||

-        ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-    uVar12 = 0x92;

-  }

-  else {

-LAB_6:

-    uVar6 = RtlComputeCrc32(0,in_stack_00000090,0xffc);

-    *(undefined4 *)((longlong)in_stack_00000090 + 0xffc) = uVar6;

-    if (in_stack_00000084 == 0) {

-      *(longlong **)((longlong)in_stack_000000f8 + 8) = unaff_RSI;

-    }

-    else {

-      _iStack00000000000000c0 = unaff_RBX;

-      uVar18 = HsmExpandKernelStackAndCallout

-                         (HsmiBitmapNORMALFlushBitmapOnDiskCallout,(int *)&stack0x000000d8);

-      uVar16 = (ulonglong)uVar18;

-      HsmDbgBreakOnStatus(uVar18);

-      if ((int)uVar18 < 0) {

-        if (((WPP_GLOBAL_Control != unaff_R12) &&

-            ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-          WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x95,

-                   &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,uVar18);

-        }

-        goto LAB_2;

-      }

-      if (((WPP_GLOBAL_Control != unaff_R12) &&

-          ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-        WPP_SF_qisdi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x96,unaff_RBX + 4,unaff_RBX,

-                     *unaff_RBX,(char *)(unaff_RBX + 4));

-      }

-    }

-    in_stack_00000060[2] = (longlong)in_stack_00000090;

-    *(uint *)(in_stack_00000060 + 3) =

-         (in_stack_00000084 ^ *(uint *)(in_stack_00000060 + 3)) & 0xfffffff8 ^ in_stack_00000084;

-    *in_stack_00000060 = in_stack_000001b8;

-    if (((WPP_GLOBAL_Control != unaff_R12) &&

-        ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

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

-                    (ulonglong)(*(uint *)(unaff_RBX + 2) >> 6 & 0x3f),

-                    (ulonglong)(uint)((int)(in_stack_00000084 << 0x1d) >> 0x1d),unaff_RBX,*unaff_RBX

-                    ,(char *)(unaff_RBX + 4));

-    }

-    *(int *)(in_stack_000000e8 + 4) = iVar15;

-    *unaff_R13 = 0x70527442;

-    in_stack_000000f8 = unaff_R13 + 2;

-    *in_stack_000000f8 = 0x38;

-    uVar14 = (ushort)unaff_RSI;

-    *(ushort *)(unaff_R13 + 3) = uVar14;

-    _cStack00000000000001b0 = (ushort *)((longlong)unaff_R13 + 0xe);

-    *_cStack00000000000001b0 = 5;

-    *(undefined8 *)(unaff_R13 + 4) = 0;

-    *(undefined8 *)(unaff_R13 + 6) = 0;

-    *(undefined8 *)(unaff_R13 + 8) = 0;

-    *(undefined8 *)(unaff_R13 + 10) = 0;

-    *(undefined8 *)(unaff_R13 + 0xc) = 0;

-    uVar22 = (ushort)unaff_R14;

-    puVar19 = in_stack_000001d0;

-    if (*in_stack_000001d0 < 0x18) {

-      uVar16 = 0xc0000023;

-    }

-    else {

-      if (uVar14 < *_cStack00000000000001b0) {

-        puVar19 = (uint *)(ulonglong)*in_stack_000000f8;

-        if ((ulonglong)*in_stack_000001d0 <

-            ((longlong)puVar19 + 3U & 0xfffffffffffffffc) + unaff_R14) {

-          uVar16 = 0xc0000023;

-        }

-        else {

-          uVar18 = *in_stack_000000f8 + 3 & 0xfffffffc;

-          *in_stack_000000f8 = uVar18;

-          if (*(ushort *)(unaff_R13 + 4) != uVar14) {

-            *(ushort *)(unaff_R13 + 3) = *(ushort *)(unaff_R13 + 3) | uVar22;

-          }

-          unaff_R13[4] = 0x10007;

-          unaff_R13[5] = uVar18;

-          *(byte *)((ulonglong)uVar18 + (longlong)unaff_R13) = bVar21;

-          *in_stack_000000f8 = *in_stack_000000f8 + uVar7;

-          uVar16 = (ulonglong)unaff_RSI & 0xffffffff;

-        }

-      }

-      else {

-        uVar16 = 0xc000000d;

-      }

-      _cStack00000000000001b0 = (ushort *)(in_stack_000000e8 + 0xe);

-      in_stack_000000f8 = (uint *)(in_stack_000000e8 + 8);

-    }

-    HsmDbgBreakOnStatus((int)uVar16);

-    in_stack_00000090 = unaff_RSI;

-    if ((int)uVar16 < 0) {

-      if (((WPP_GLOBAL_Control == unaff_R12) ||

-          ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-      uVar12 = 0x98;

-    }

-    else {

-      uVar18 = *in_stack_000001d0;

-      if (uVar18 < 0x18) {

-        uVar16 = 0xc0000023;

-      }

-      else {

-        puVar19 = (uint *)((ulonglong)(*(uint *)(unaff_RBX + 2) >> 6) & 0xffffffffffffff3f);

-        if (uVar22 < *_cStack00000000000001b0) {

-          if ((uVar18 < 0x20) ||

-             ((ulonglong)uVar18 <

-              ((ulonglong)*in_stack_000000f8 + 3 & 0xfffffffffffffffc) + unaff_R14)) {

-            uVar16 = 0xc0000023;

-          }

-          else {

-            *in_stack_000000f8 = *in_stack_000000f8 + 3 & 0xfffffffc;

-            if (*(ushort *)(unaff_R13 + 6) != uVar14) {

-              *(ushort *)(unaff_R13 + 3) = *(ushort *)(unaff_R13 + 3) | uVar22;

-              in_stack_000000f8 = (uint *)(in_stack_000000e8 + 8);

-            }

-            unaff_R13[6] = 0x10007;

-            uVar18 = *in_stack_000000f8;

-            unaff_R13[7] = uVar18;

-            *(char *)((ulonglong)uVar18 + (longlong)unaff_R13) = (char)puVar19;

-            *in_stack_000000f8 = *in_stack_000000f8 + uVar7;

-            uVar16 = (ulonglong)unaff_RSI & 0xffffffff;

-          }

-        }

-        else {

-          uVar16 = 0xc000000d;

-        }

-        _cStack00000000000001b0 = (ushort *)(in_stack_000000e8 + 0xe);

-      }

-      HsmDbgBreakOnStatus((int)uVar16);

-      if ((int)uVar16 < 0) {

-        if (((WPP_GLOBAL_Control == unaff_R12) ||

-            ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-        uVar12 = 0x99;

-      }

-      else {

-        uVar18 = *in_stack_000001d0;

-        puVar19 = (uint *)(ulonglong)uVar18;

-        if (uVar18 < 0x18) {

-          uVar16 = 0xc0000023;

-        }

-        else {

-          lVar11 = in_stack_00000060[3];

-          if (*_cStack00000000000001b0 < 3) {

-            uVar16 = 0xc000000d;

-          }

-          else if ((uVar18 < 0x28) ||

-                  (puVar19 < (uint *)(((ulonglong)(uint)unaff_R13[2] + 3 & 0xfffffffffffffffc) +

-                                     unaff_R14))) {

-            uVar16 = 0xc0000023;

-          }

-          else {

-            uVar18 = unaff_R13[2] + 3 & 0xfffffffc;

-            unaff_R13[2] = uVar18;

-            if (*(ushort *)(unaff_R13 + 8) != uVar14) {

-              *(ushort *)(unaff_R13 + 3) = *(ushort *)(unaff_R13 + 3) | uVar22;

-            }

-            unaff_R13[8] = 0x10007;

-            unaff_R13[9] = uVar18;

-            *(char *)((ulonglong)uVar18 + (longlong)unaff_R13) =

-                 (char)(((int)lVar11 << 0x1d) >> 0x1d);

-            unaff_R13[2] = unaff_R13[2] + uVar7;

-            uVar16 = (ulonglong)unaff_RSI & 0xffffffff;

-          }

-          _cStack00000000000001b0 = (ushort *)(in_stack_000000e8 + 0xe);

-        }

-        HsmDbgBreakOnStatus((int)uVar16);

-        if ((int)uVar16 < 0) {

-          if (((WPP_GLOBAL_Control == unaff_R12) ||

-              ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-          uVar12 = 0x9a;

-        }

-        else {

-          uVar7 = *in_stack_000001d0;

-          if (uVar7 < 0x18) {

-LAB_7:

-            uVar16 = 0xc0000023;

-          }

-          else {

-            lVar11 = in_stack_00000060[1];

-            if (3 < *_cStack00000000000001b0) {

-              if (0x2f < uVar7) {

-                puVar19 = (uint *)(ulonglong)(uint)unaff_R13[2];

-                if (((longlong)puVar19 + 3U & 0xfffffffffffffffc) + 8 <= (ulonglong)uVar7) {

-                  uVar7 = unaff_R13[2] + 3 & 0xfffffffc;

-                  unaff_R13[2] = uVar7;

-                  if (*(ushort *)(unaff_R13 + 10) != uVar14) {

-                    *(ushort *)(unaff_R13 + 3) = *(ushort *)(unaff_R13 + 3) | uVar22;

-                  }

-                  unaff_R13[10] = 0x80006;

-                  unaff_R13[0xb] = uVar7;

-                  *(longlong *)((ulonglong)uVar7 + (longlong)unaff_R13) = lVar11;

-                  unaff_R13[2] = unaff_R13[2] + 8;

-                  uVar16 = (ulonglong)unaff_RSI & 0xffffffff;

-                  goto LAB_8;

-                }

-              }

-              goto LAB_7;

-            }

-            uVar16 = 0xc000000d;

-          }

-LAB_8:

-          HsmDbgBreakOnStatus((int)uVar16);

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

-            _Src = (int *)in_stack_00000060[2];

-            if (_Src != (int *)0x0) {

-              piVar3 = _Src + 0x3ff;

-              do {

-                piVar2 = piVar3;

-                if (piVar2 <= _Src) break;

-                piVar3 = piVar2 + -1;

-              } while (piVar2[-1] == _Src[0x3fe]);

-              uVar7 = *in_stack_000001d0;

-              puVar19 = (uint *)(ulonglong)uVar7;

-              if (uVar7 < 0x18) {

-LAB_9:

-                uVar16 = 0xc0000023;

-              }

-              else {

-                if (4 < *(ushort *)((longlong)unaff_R13 + 0xe)) {

-                  if (0x37 < uVar7) {

-                    uVar5 = ((short)piVar2 - (short)in_stack_00000060[2]) + 4;

-                    _Size = (uint *)(ulonglong)uVar5;

-                    if ((uint *)(((ulonglong)(uint)unaff_R13[2] + 3 & 0xfffffffffffffffc) +

-                                (longlong)_Size) <= puVar19) {

-                      if (*(ushort *)(unaff_R13 + 0xc) != uVar14) {

-                        *(ushort *)(unaff_R13 + 3) = *(ushort *)(unaff_R13 + 3) | uVar22;

-                      }

-                      uVar7 = unaff_R13[2] + 3 & 0xfffffffc;

-                      unaff_R13[2] = uVar7;

-                      *(undefined2 *)(unaff_R13 + 0xc) = 0x11;

-                      *(ushort *)((longlong)unaff_R13 + 0x32) = uVar5;

-                      unaff_R13[0xd] = uVar7;

-                      if ((int *)((ulonglong)uVar7 + (longlong)unaff_R13) != _Src) {

-                        memmove((int *)((ulonglong)uVar7 + (longlong)unaff_R13),_Src,(size_t)_Size);

-                        puVar19 = _Size;

-                      }

-                      unaff_R13[2] = unaff_R13[2] + (uint)*(ushort *)((longlong)unaff_R13 + 0x32);

-                      uVar16 = (ulonglong)unaff_RSI & 0xffffffff;

-                      goto LAB_10;

-                    }

-                  }

-                  goto LAB_9;

-                }

-                uVar16 = 0xc000000d;

-              }

-LAB_10:

-              HsmDbgBreakOnStatus((int)uVar16);

-              if ((int)uVar16 < 0) {

-                if (((WPP_GLOBAL_Control == unaff_R12) ||

-                    ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-                uVar12 = 0x9c;

-                goto LAB_11;

-              }

-            }

-            *(ushort *)(unaff_R13 + 3) = *(ushort *)(unaff_R13 + 3) & 0xfffd;

-            unaff_R13[1] = iVar15;

-            *in_stack_000001d0 = unaff_R13[2];

-            if (((WPP_GLOBAL_Control != unaff_R12) &&

-                ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

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

-              WPP_SF_qisdiidd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_RBX + 4,

-                              (ulonglong)(uint)(((int)in_stack_00000060[3] << 0x1d) >> 0x1d),

-                              unaff_RBX,*unaff_RBX,(char *)(unaff_RBX + 4));

-            }

-            unaff_RBX[0x13] = (longlong)in_stack_00000060;

-            in_stack_00000060 = unaff_RSI;

-            goto LAB_2;

-          }

-          if (((WPP_GLOBAL_Control == unaff_R12) ||

-              ((bVar21 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-          uVar12 = 0x9b;

-        }

-      }

-    }

-  }

-LAB_11:

-  WPP_SF_iisd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,puVar19,unaff_RBX,*unaff_RBX,

-              (char *)(unaff_RBX + 4));

-LAB_2:

-  if (in_stack_000001c0 != cVar13) {

-    FltReleasePushLockEx(unaff_RBX + 6,0);

-  }

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

-    ExFreePoolWithTag(in_stack_00000090,0x6d427348);

-  }

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

-    if (in_stack_00000060[2] != 0) {

-      ExFreePoolWithTag(in_stack_00000060[2],0x6d427348);

-    }

-    ExFreePoolWithTag(in_stack_00000060,0x63427348);

-  }

-  if (unaff_XMM6_Da != 0) {

-    _iStack00000000000000c0 = (longlong *)CONCAT44(unaff_XMM6_Db,unaff_XMM6_Da);

-    HsmIBitmapNORMALUnpinBlock(&stack0x000000c0);

-  }

-  return uVar16;

+  if (bVar5) {

+    HsmpReleaseUserRequestRundownProtection(param_2);

+  }

+  return uVar15;

 }
```

## `HsmpRpReadBuffer`  (modified)

```diff
--- HsmpRpReadBuffer
+++ HsmpRpReadBuffer
@@ -1,190 +1,146 @@
 

 int HsmpRpReadBuffer(undefined8 param_1,undefined8 param_2,undefined8 *param_3)

 

 {

-  int *piVar1;

-  char cVar2;

-  undefined4 uVar3;

-  longlong lVar4;

-  longlong lVar5;

-  int iVar6;

-  longlong lVar7;

-  undefined2 uVar8;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  undefined4 unaff_EDI;

-  uint uVar9;

-  undefined4 uVar10;

-  undefined *puVar11;

-  uint uVar12;

-  uint uVar13;

-  ulonglong unaff_R12;

-  int unaff_R13D;

-  uint uVar14;

-  longlong unaff_R14;

-  ulonglong uVar15;

-  ulonglong uStack0000000000000030;

-  undefined8 uStack0000000000000048;

-  undefined8 uStack0000000000000050;

-  longlong lStack0000000000000060;

-  uint uStack0000000000000068;

+  ushort uVar1;

+  int iVar2;

+  uint *puVar3;

+  undefined8 *puVar4;

+  undefined2 uVar5;

+  undefined8 uVar6;

+  uint uVar7;

+  undefined8 uVar8;

+  uint local_res18 [4];

+  undefined8 in_stack_ffffffffffffffa8;

+  uint uVar10;

+  ulonglong uVar9;

+  undefined4 uVar11;

   

-  uVar13 = (uint)unaff_R12;

-  uStack0000000000000030 = unaff_R12;

-  if ((int)unaff_RBX != 0) {

-    uStack0000000000000030 = HsmpGetStreamSize(unaff_RBX);

+  uVar10 = (uint)((ulonglong)in_stack_ffffffffffffffa8 >> 0x20);

+  *param_3 = 0;

+  uVar7 = 0x400;

+  puVar3 = (uint *)ExAllocatePool2(0x100,0x400,0x70527348);

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

+    HsmDbgBreakOnStatus(-0x3fffff66);

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

+      return -0x3fffff66;

+    }

+    if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+      return -0x3fffff66;

+    }

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

+      return -0x3fffff66;

+    }

+    uVar5 = 0x10;

+LAB_0:

+    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar5,

+               &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_1);

+    return -0x3fffff66;

   }

-  uStack0000000000000050 = *(undefined8 *)(unaff_RBP + -0x39);

-  uStack0000000000000048 = *(undefined8 *)(unaff_RBP + -0x31);

-  WPP_SF_qqLiqLiqq(param_3[3],0x18,param_3,unaff_R14);

-  lVar7 = *(longlong *)(unaff_RBP + -0x29);

-  uVar14 = *(uint *)(*(longlong *)(unaff_RBP + -0x41) + 0x10);

-  if ((uVar14 < 0x20) || (*(uint *)(unaff_RBP + -0x49) < uVar14)) {

-LAB_0:

-    iVar6 = -0x3fff30f5;

-    uVar13 = 0xc000cf0b;

-LAB_1:

-    HsmDbgBreakOnStatus(iVar6);

+  uVar8 = 0x900a8;

+  uVar9 = (ulonglong)uVar10 << 0x20;

+  uVar6 = param_2;

+  iVar2 = FltFsControlFile(param_1,param_2,0x900a8,0,uVar9,puVar3,0x400,0);

+  HsmDbgBreakOnStatus(iVar2);

+  uVar11 = (undefined4)(uVar9 >> 0x20);

+  if ((iVar2 == -0x3fffffdd) || (iVar2 == -0x7ffffffb)) {

+    ExFreePoolWithTag(puVar3,0x70527348);

+    uVar7 = 0x4000;

+    puVar3 = (uint *)ExAllocatePool2(0x100,0x4000,0x70527348);

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

+      HsmDbgBreakOnStatus(-0x3fffff66);

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

+        return -0x3fffff66;

+      }

+      if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+        return -0x3fffff66;

+      }

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

+        return -0x3fffff66;

+      }

+      uVar5 = 0x11;

+      goto LAB_0;

+    }

+    uVar8 = 0x900a8;

+    uVar9 = uVar9 & 0xffffffff00000000;

+    iVar2 = FltFsControlFile(param_1,param_2,0x900a8,0,uVar9,puVar3,0x4000,0);

+    uVar11 = (undefined4)(uVar9 >> 0x20);

+    HsmDbgBreakOnStatus(iVar2);

+    uVar6 = param_2;

+  }

+  if (iVar2 < 0) {

+    if ((((iVar2 == -0x3ffffd8b) || ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control)) ||

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

+    goto LAB_1;

+    uVar5 = 0x12;

+LAB_2:

+    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar5,

+               &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_1);

   }

   else {

-    uVar12 = *(uint *)(*(longlong *)(unaff_RBP + -0x41) + 0x14);

-    if ((uVar12 == 0) || (uVar9 = *(uint *)(unaff_RBP + -0x49) - uVar14, uVar9 / uVar12 < 0x18))

-    goto LAB_0;

-    *(undefined8 *)(unaff_RBP + -1) = *(undefined8 *)(unaff_RBP + -0x39);

-    KeEnterCriticalRegion(uVar14,(ulonglong)uVar9 % (ulonglong)uVar12);

-    *(longlong *)(unaff_RBP + -9) = lVar7 + 0x78;

-    ExAcquireResourceExclusiveLite(lVar7 + 0x78,1);

-    if (*(ulonglong *)(lVar7 + 0xe0) == unaff_R12) {

-      lVar4 = ExAllocatePool2(0x40,0x70,0x72507348);

-      if (lVar4 != 0) {

-        *(longlong *)(lVar4 + 8) = lVar7;

-        lVar5 = lVar4 + 0x40;

-        *(longlong *)(lVar4 + 0x48) = lVar5;

-        *(longlong *)lVar5 = lVar5;

-        lVar5 = lVar4 + 0x50;

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

-        *(longlong *)lVar5 = lVar5;

-        lVar5 = lVar4 + 0x60;

-        *(longlong *)(lVar4 + 0x68) = lVar5;

-        *(longlong *)lVar5 = lVar5;

-        *(longlong *)(lVar7 + 0xe0) = lVar4;

+    if (uVar7 < (ushort)puVar3[1]) {

+      iVar2 = -0x3ffffd8b;

+      HsmDbgBreakOnStatus(-0x3ffffd8b);

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

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

+         ) {

+        WPP_SF_qqDDDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar6,uVar8,param_1);

+        iVar2 = -0x3ffffd8b;

+      }

+      goto LAB_1;

+    }

+    if ((*puVar3 & 0xffff0fff) == DAT_3) {

+      iVar2 = 0;

+      puVar4 = (undefined8 *)0x0;

+      local_res18[0] = 0;

+      if (((ushort)puVar3[1] < 4) ||

+         (uVar1 = *(ushort *)((longlong)puVar3 + 10), 0x3ffc < (ushort)(uVar1 - 4))) {

+LAB_4:

+        iVar2 = -0x3fff30fe;

+        HsmDbgBreakOnCorruption();

+        HsmDbgBreakOnStatus(-0x3fff30fe);

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

+          ExFreePoolWithTag(puVar4,0x70527348);

+        }

+      }

+      else if ((puVar3[2] & 0x8000) == 0) {

+        *param_3 = puVar3;

+      }

+      else {

+        puVar4 = (undefined8 *)ExAllocatePool2(0x100,uVar1 + 8,0x70527348);

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

+          iVar2 = -0x3fffff66;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+        }

+        else {

+          *puVar4 = *(undefined8 *)puVar3;

+          *(uint *)(puVar4 + 1) = puVar3[2];

+          iVar2 = RtlDecompressBuffer(2,(longlong)puVar4 + 0xc,uVar1 - 4,puVar3 + 3,

+                                      CONCAT44(uVar11,uVar7 - 0xc),local_res18);

+          HsmDbgBreakOnStatus(iVar2);

+          if ((iVar2 < 0) || (0xffff < local_res18[0])) goto LAB_4;

+          *(undefined2 *)((longlong)puVar4 + 4) = *(undefined2 *)((longlong)puVar3 + 10);

+          *param_3 = puVar4;

+        }

+      }

+      HsmDbgBreakOnStatus(iVar2);

+      if (iVar2 < 0) {

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

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

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+        uVar5 = 0x14;

         goto LAB_2;

       }

-      uVar13 = 0xc000009a;

-      HsmDbgBreakOnStatus(-0x3fffff66);

-      ExReleaseResourceLite(*(undefined8 *)(unaff_RBP + -9));

-      KeLeaveCriticalRegion();

-      iVar6 = -0x3fffff66;

-      goto LAB_1;

     }

-LAB_2:

-    HsmDbgBreakOnStatus(0);

-    uVar15 = unaff_R12 & 0xffffffff;

-    *(undefined8 *)(unaff_RBP + -0x29) = *(undefined8 *)(*(longlong *)(unaff_RBP + -0x29) + 0xe0);

-    lVar7 = *(longlong *)(unaff_RBP + -0x41);

-    lVar4 = (ulonglong)*(uint *)(lVar7 + 0x10) + lVar7;

-    *(longlong *)(unaff_RBP + 7) = lVar4;

-    if (uVar13 < *(uint *)(lVar7 + 0x14)) {

-      lVar5 = *(longlong *)(unaff_RBP + -0x29);

-      uVar14 = *(uint *)(unaff_RBP + -0x55);

-      do {

-        iVar6 = *(int *)(lVar4 + (unaff_R12 & 0xffffffff) * 0x18);

-        if (iVar6 != 0) {

-          cVar2 = HsmiUnlockPropertiesForOwner(lVar5,(ulonglong *)(unaff_RBP + -1),iVar6);

-          lVar4 = *(longlong *)(unaff_RBP + 7);

-          uVar14 = uVar14 & 0xff;

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

-            uVar14 = 1;

-          }

-        }

-        uVar12 = (int)unaff_R12 + 1;

-        unaff_R12 = (ulonglong)uVar12;

-      } while (uVar12 < *(uint *)(lVar7 + 0x14));

-      unaff_EDI = *(undefined4 *)(unaff_RBP + -0x21);

-      unaff_R14 = *(longlong *)(unaff_RBP + -0x11);

-      unaff_RSI = *(longlong *)(unaff_RBP + 0x67);

-      unaff_R13D = 4;

-      unaff_R12 = uVar15;

-      if ((char)uVar14 != '\0') {

-        HsmiProcessPropertyLockRequestList(*(longlong *)(unaff_RBP + -0x29));

-      }

+    else {

+      *param_3 = puVar3;

     }

-    if (*(ulonglong *)(unaff_RBP + -0x29) != uVar15) {

-      ExReleaseResourceLite(*(undefined8 *)(unaff_RBP + -9));

-      KeLeaveCriticalRegion();

+    if ((uint *)*param_3 == puVar3) {

+      return iVar2;

     }

   }

-  HsmDbgBreakOnStatus(uVar13);

-  lVar7 = *(longlong *)(unaff_RBP + -0x51);

-  uVar14 = *(uint *)(unaff_RBP + -0x59);

-  *(longlong *)(unaff_RBP + 0x67) = lVar7;

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

-    FltAcquirePushLockExclusiveEx(unaff_R14 + 0x70,0);

-    piVar1 = (int *)(unaff_R14 + 0xac);

-    *piVar1 = *piVar1 + -1;

-    if (*piVar1 == 0) {

-      KeSetEvent(unaff_R14 + 0x90,0,0);

-    }

-    FltReleasePushLockEx(unaff_R14 + 0x70,0);

-    uVar14 = *(uint *)(unaff_RBP + -0x59);

-    lVar7 = *(longlong *)(unaff_RBP + 0x67);

-  }

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

-    KeSetEvent(lVar7 + 0x60,0,0);

-    uVar14 = *(uint *)(unaff_RBP + -0x59);

-  }

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

-    FltReleaseContext(*(undefined8 *)(unaff_RBP + 0x67));

-  }

-  FltReleaseContext(unaff_R14);

-  if ((int)uVar13 < 0) {

-    uVar3 = (undefined4)unaff_R12;

-    puVar11 = WPP_GLOBAL_Control;

-    uVar10 = uVar3;

-    if (((uVar13 == 0x80000005) || (uVar13 == 0xc0000023)) ||

-       ((uVar13 == 0xc000cf13 && (*(char *)(unaff_RBP + 0x7f) == '\0')))) {

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

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3)

-         ) goto LAB_3;

-      lVar7 = *(longlong *)(unaff_RBP + 0x6f);

-      if (lVar7 != 0) {

-        uVar10 = *(undefined4 *)(lVar7 + 0x28);

-      }

-      if (unaff_RBX != 0) {

-        HsmpGetStreamSize(unaff_RBX);

-        uVar3 = *(undefined4 *)(unaff_RBX + 0x1c);

-      }

-      uVar8 = 0xf2;

-    }

-    else {

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

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_3;

-      lVar7 = *(longlong *)(unaff_RBP + 0x6f);

-      if (lVar7 != 0) {

-        uVar10 = *(undefined4 *)(lVar7 + 0x28);

-      }

-      if (unaff_RBX != 0) {

-        HsmpGetStreamSize(unaff_RBX);

-        uVar3 = *(undefined4 *)(unaff_RBX + 0x1c);

-      }

-      uVar8 = 0xf1;

-    }

-    uStack0000000000000050 = *(undefined8 *)(unaff_RBP + -0x31);

-    uStack0000000000000048 = CONCAT44(uStack0000000000000048._4_4_,uVar10);

-    uStack0000000000000030 = CONCAT44(uStack0000000000000030._4_4_,uVar3);

-    lStack0000000000000060 = unaff_RSI;

-    uStack0000000000000068 = uVar13;

-    WPP_SF_lqqLiqLiqqd(*(undefined8 *)(puVar11 + 0x18),uVar8,lVar7,unaff_EDI);

-  }

-  else if (uVar13 == 0x103) {

-    return 2;

-  }

-LAB_3:

-  if (unaff_R13D == 4) {

-    *(uint *)(unaff_RSI + 0x18) = uVar13;

-  }

-  return unaff_R13D;

+LAB_1:

+  ExFreePoolWithTag(puVar3,0x70527348);

+  return iVar2;

 }
```

## `InsertEventEntryInLookUpTable`  (modified)

```diff
--- InsertEventEntryInLookUpTable
+++ InsertEventEntryInLookUpTable
@@ -1,13 +1,165 @@
-

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

 

 ulonglong InsertEventEntryInLookUpTable

                     (longlong param_1,undefined8 *param_2,byte param_3,longlong param_4,byte param_5

                     )

 

 {

-  ulonglong in_RAX;

+  int *piVar1;

+  longlong lVar2;

+  char cVar3;

+  longlong lVar4;

+  bool bVar5;

+  byte bVar6;

+  undefined1 uVar7;

+  uint uVar8;

+  int iVar9;

+  ulonglong uVar10;

+  longlong lVar11;

+  longlong *plVar12;

+  longlong lVar13;

+  byte bVar14;

+  ulonglong uVar15;

+  longlong local_50;

+  longlong local_48;

   

-  return in_RAX;

+  lVar11 = *(longlong *)(param_1 + 0x30);

+  lVar13 = 0;

+  local_50 = 0;

+  uVar15 = 0;

+  local_48 = lVar11;

+  uVar8 = ComputeEventEntryHash(param_5,param_3,param_4);

+  bVar6 = KeGetCurrentIrql();

+  if (bVar6 < 2) {

+    iVar9 = KeIsExecutingDpc();

+    if (iVar9 == 0) {

+      ExAcquirePushLockSharedEx(lVar11 + 0x110,0);

+      bVar5 = false;

+      goto LAB_0;

+    }

+    if (*(char *)(lVar11 + 0x175) != '\0') {

+      uVar7 = KeGetCurrentIrql();

+                    /* WARNING: Subroutine does not return */

+      KeBugCheckEx(0xd1,lVar11 + 0x118,uVar7,1,0);

+    }

+    ExAcquireSpinLockShared(lVar11 + 0x118);

+  }

+  else {

+    if (*(char *)(lVar11 + 0x175) != '\0') {

+      uVar7 = KeGetCurrentIrql();

+                    /* WARNING: Subroutine does not return */

+      KeBugCheckEx(0xd1,lVar11 + 0x118,uVar7,1,0);

+    }

+    ExAcquireSpinLockSharedAtDpcLevel(lVar11 + 0x118);

+  }

+  bVar5 = true;

+LAB_0:

+  plVar12 = (longlong *)(lVar11 + (ulonglong)(uVar8 & 0x1f) * 8);

+  do {

+    if (*plVar12 == 0) {

+      if (0x3ff < *(uint *)(lVar11 + 0x100)) {

+        *(int *)(lVar11 + 0x13c) = *(int *)(lVar11 + 0x13c) + 1;

+        uVar15 = 0xc0000023;

+        goto LAB_1;

+      }

+      if (lVar13 == 0) {

+        uVar10 = CreateNewEventEntry(*(char *)(lVar11 + 0x175),param_2,param_3,param_4,param_5,uVar8

+                                     ,&local_50);

+        uVar15 = uVar10 & 0xffffffff;

+        lVar13 = local_50;

+        if (local_50 == 0) {

+          if ((int)uVar10 == -0x3fffffe9) {

+            *(int *)(lVar11 + 0x140) = *(int *)(lVar11 + 0x140) + 1;

+          }

+          else {

+            *(int *)(lVar11 + 0x144) = *(int *)(lVar11 + 0x144) + 1;

+          }

+          goto LAB_1;

+        }

+      }

+      LOCK();

+      lVar4 = *plVar12;

+      if (lVar4 == 0) {

+        *plVar12 = lVar13;

+      }

+      UNLOCK();

+      lVar13 = local_50;

+      if (lVar4 == 0) {

+        local_50 = 0;

+        LOCK();

+        piVar1 = (int *)(lVar11 + 0x100);

+        iVar9 = *piVar1;

+        *piVar1 = *piVar1 + 1;

+        UNLOCK();

+        if (iVar9 == 0) {

+          EnableFlushTimer(*(longlong *)(lVar11 + 0x168),(ulonglong)*(uint *)(lVar11 + 0x170));

+        }

+        lVar13 = local_50;

+        if (*(uint *)(lVar11 + 0x130) < *(uint *)(lVar11 + 0x100)) {

+          *(uint *)(lVar11 + 0x130) = *(uint *)(lVar11 + 0x100);

+        }

+        goto LAB_1;

+      }

+    }

+    lVar4 = *plVar12;

+    if (uVar8 == *(uint *)(lVar4 + 0x28)) {

+      iVar9 = CompareEventEntry(param_3,param_4,lVar4);

+    }

+    else {

+      iVar9 = uVar8 - *(uint *)(lVar4 + 0x28);

+    }

+    if (iVar9 == 0) {

+      if (lVar4 != 0) {

+        uVar10 = 2;

+        if (2 < param_5 + 2) {

+          do {

+            lVar11 = **(longlong **)(param_4 + uVar10 * 0x10);

+            cVar3 = *(char *)(*(longlong *)(lVar4 + 0x10) + 0xd + uVar10 * 0x10);

+            plVar12 = *(longlong **)(*(longlong *)(lVar4 + 0x10) + uVar10 * 0x10);

+            if (cVar3 == 'q') {

+              LOCK();

+              *plVar12 = *plVar12 + lVar11;

+              UNLOCK();

+            }

+            else if ((cVar3 == 'r') || (cVar3 == 's')) {

+              do {

+                lVar13 = *plVar12;

+                if (cVar3 == 'r') {

+                  if (lVar13 <= lVar11) break;

+                }

+                else if (lVar11 <= lVar13) break;

+                LOCK();

+                lVar2 = *plVar12;

+                if (lVar13 == lVar2) {

+                  *plVar12 = lVar11;

+                }

+                UNLOCK();

+              } while (lVar13 != lVar2);

+            }

+            bVar14 = (char)uVar10 + 1;

+            uVar10 = (ulonglong)bVar14;

+            lVar11 = local_48;

+            lVar13 = local_50;

+          } while ((uint)bVar14 < param_5 + 2);

+        }

+      }

+LAB_1:

+      if (bVar5) {

+        if (bVar6 < 2) {

+          ExReleaseSpinLockShared();

+        }

+        else {

+          ExReleaseSpinLockSharedFromDpcLevel(lVar11 + 0x118);

+        }

+      }

+      else {

+        ExReleasePushLockSharedEx(lVar11 + 0x110,0);

+      }

+      if (lVar13 != 0) {

+        DestroyEventEntry(lVar13);

+      }

+      return uVar15;

+    }

+    plVar12 = (longlong *)(lVar4 + 0x20 + ((longlong)iVar9 >> 0x3f & 0xfffffffffffffff8U));

+  } while( true );

 }
```

## `HsmpBuildFullLinkPath`  (modified)

```diff
--- HsmpBuildFullLinkPath
+++ HsmpBuildFullLinkPath
@@ -1,102 +1,124 @@
 

 uint HsmpBuildFullLinkPath(longlong param_1,undefined8 param_2,short *param_3,undefined4 *param_4)

 

 {

-  int *piVar1;

-  int iVar2;

+  ushort uVar1;

+  uint uVar2;

   longlong lVar3;

-  uint *puVar4;

-  undefined8 uVar5;

-  void *_Dst;

-  undefined8 unaff_RBX;

-  int unaff_EBP;

-  ulonglong uVar6;

-  int unaff_ESI;

-  int unaff_EDI;

-  undefined *puVar7;

-  longlong unaff_R13;

-  uint *unaff_R14;

-  longlong unaff_R15;

-  byte in_CF;

-  uint *in_stack_00000030;

-  longlong in_stack_00000038;

-  char in_stack_00000070;

-  uint in_stack_00000088;

+  ushort uVar4;

+  undefined2 uVar5;

+  undefined8 uVar6;

+  undefined4 uVar7;

+  undefined4 uVar8;

+  undefined4 uVar9;

+  undefined4 uVar10;

+  longlong local_res8;

+  undefined8 in_stack_ffffffffffffff78;

+  longlong local_58;

+  undefined8 local_50;

+  undefined8 uStack_48;

+  undefined8 local_40;

+  undefined8 uStack_38;

   

-  uVar6 = (ulonglong)(unaff_EBP + unaff_EDI + (uint)in_CF);

-  piVar1 = (int *)(uVar6 + 0x44 + param_1 * 4);

-  *piVar1 = *piVar1 + -1;

-  iVar2 = FltGetEcpListFromCallbackData();

-  if ((iVar2 < 0) || (in_stack_00000038 == 0)) {

-LAB_0:

-    if (uVar6 == 0) goto LAB_1;

-LAB_2:

-    if (((*(uint *)(uVar6 + 0x28) & 0x20) == 0) ||

-       (unaff_ESI = *(int *)(uVar6 + 0x40), unaff_ESI == 0)) goto LAB_1;

-LAB_3:

-    lVar3 = HsmOsReferenceProcessByProcessId(unaff_ESI);

-    if (lVar3 != 0) {

-      *(longlong *)(unaff_R14 + 4) = lVar3;

-      goto LAB_4;

+  local_58 = 0;

+  local_res8 = 0;

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

+  local_40 = 0;

+  uStack_38 = 0;

+  local_50 = 0;

+  uStack_48 = 0;

+  uVar2 = HsmpOpenFileByIdEx(param_1,uVar6,param_2,0x100080,in_stack_ffffffffffffff78,0x200001,'\0',

+                             &local_58,&local_res8);

+  HsmDbgBreakOnStatus(uVar2);

+  if ((int)uVar2 < 0) {

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

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

+    goto LAB_0;

+    uVar5 = 0x13;

+  }

+  else {

+    uVar2 = HsmiQueryFullFilePath

+                      (*(undefined8 *)(param_1 + 0x20),uVar6,local_res8,0x101,

+                       (undefined4 *)&local_40);

+    HsmDbgBreakOnStatus(uVar2);

+    if ((int)uVar2 < 0) {

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

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

+         ) goto LAB_0;

+      uVar5 = 0x14;

+    }

+    else {

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

+        uVar9 = (undefined4)uStack_38;

+        uVar10 = uStack_38._4_4_;

+        uStack_38 = 0;

+        uVar7 = (undefined4)local_40;

+        uVar8 = local_40._4_4_;

+LAB_1:

+        *param_4 = uVar7;

+        param_4[1] = uVar8;

+        param_4[2] = uVar9;

+        param_4[3] = uVar10;

+        goto LAB_0;

+      }

+      uVar4 = (ushort)local_40 + 2;

+      if ((ushort)local_40 <= uVar4) {

+        local_50._0_4_ = (uint)(ushort)local_50;

+        uVar1 = uVar4 + *param_3;

+        if (uVar4 <= uVar1) {

+          uVar4 = uVar1 + 2;

+          if (uVar1 <= uVar4) {

+            local_50 = (ulonglong)CONCAT42(local_50._4_4_,uVar4) << 0x10;

+            lVar3 = ExAllocatePool2(0x100,uVar4,0x73557348);

+            uVar2 = ~-(uint)(lVar3 != 0) & 0xc000009a;

+            uStack_48 = lVar3;

+            HsmDbgBreakOnStatus(uVar2);

+            if (lVar3 == 0) {

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

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

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

+                WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x16,

+                           &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,param_1);

+              }

+              goto LAB_0;

+            }

+            RtlAppendUnicodeStringToString(&local_50,&local_40);

+            if (*(short *)(uStack_48 + -2 + (local_50 >> 1 & 0x7fff) * 2) != 0x5c) {

+              RtlAppendUnicodeToString(&local_50,L"\\");

+            }

+            RtlAppendUnicodeStringToString(&local_50,param_3);

+            *(undefined2 *)(uStack_48 + (local_50 >> 1 & 0x7fff) * 2) = 0;

+            uVar9 = (undefined4)uStack_48;

+            uVar10 = uStack_48._4_4_;

+            uStack_48 = 0;

+            uVar7 = (uint)local_50;

+            uVar8 = local_50._4_4_;

+            goto LAB_1;

+          }

+        }

+      }

+      local_50._0_4_ = CONCAT22(0xffff,(ushort)local_50);

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

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

+         ) goto LAB_0;

+      uVar5 = 0x15;

     }

   }

-  else {

-    puVar7 = &GUID_ECP_CLOUDFILES_ATTRIBUTION;

-    iVar2 = FltFindExtraCreateParameter

-                      (DAT_5,in_stack_00000038,&GUID_ECP_CLOUDFILES_ATTRIBUTION,

-                       &stack0x00000030,&stack0x00000088);

-    HsmDbgBreakOnStatus(iVar2);

-    if ((in_stack_00000030 == (uint *)0x0) || (in_stack_00000088 < 0x51)) goto LAB_0;

-    iVar2 = HsmpValidateAttributionEcp(in_stack_00000030,in_stack_00000088,(ulonglong)puVar7);

-    HsmDbgBreakOnStatus(iVar2);

-    if (iVar2 < 0) goto LAB_0;

-    _Dst = (void *)ExAllocatePool2(0x102,in_stack_00000088,0x69417348);

-    if (uVar6 != 0) {

-      *(void **)(uVar6 + 0x50) = _Dst;

-      if (_Dst != (void *)0x0) {

-        memmove(_Dst,in_stack_00000030,(ulonglong)in_stack_00000088);

-        *(uint *)(uVar6 + 0x58) = in_stack_00000088;

-        *(undefined8 *)(unaff_R14 + 2) = *(undefined8 *)(uVar6 + 0x50);

-        unaff_R14[1] = *(uint *)(uVar6 + 0x58);

-      }

-      goto LAB_2;

-    }

-    *(void **)(unaff_R14 + 2) = _Dst;

-    if (_Dst != (void *)0x0) {

-      memmove(_Dst,in_stack_00000030,(ulonglong)in_stack_00000088);

-      *unaff_R14 = *unaff_R14 | 1;

-      unaff_R14[1] = in_stack_00000088;

-    }

-LAB_1:

-    if (unaff_R15 != 0) {

-      unaff_ESI = HsmOsGetProxiedProcessId(unaff_R15);

-      if (unaff_ESI != 0) goto LAB_3;

-    }

-    if (unaff_R13 != 0) {

-      if (unaff_R15 != 0) {

-        unaff_RBX = FltGetRequestorProcess();

-      }

-      *(undefined8 *)(unaff_R14 + 4) = unaff_RBX;

-      puVar4 = HsmOsCheckAppCompatPolicy((undefined8 *)unaff_R14,3,&stack0x00000070);

-      if ((-1 < (int)puVar4) && (in_stack_00000070 == '\0')) {

-        FltAcquirePushLockSharedEx(unaff_R13 + 0x40,0);

-        if (*(longlong *)(unaff_R13 + 0x58) != unaff_R13 + 0x58) {

-          unaff_ESI = *(int *)(*(longlong *)(unaff_R13 + 0x58) + 0x28);

-        }

-        FltReleasePushLockEx(unaff_R13 + 0x40,0);

-        if (unaff_ESI != 0) goto LAB_3;

-      }

-    }

+  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar5,

+             &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,param_1);

+LAB_0:

+  if (local_res8 != 0) {

+    ObfDereferenceObject(local_res8);

   }

-  if (unaff_R15 == 0) {

-    uVar5 = IoGetCurrentProcess();

+  if (local_58 != 0) {

+    FltClose();

   }

-  else {

-    uVar5 = FltGetRequestorProcess();

+  if (uStack_38 != 0) {

+    ExFreePoolWithTag(uStack_38,0x73557348);

   }

-  lVar3 = ObfReferenceObject(uVar5);

-  *(undefined8 *)(unaff_R14 + 4) = uVar5;

-LAB_4:

-  return (uint)lVar3;

+  if (uStack_48 != 0) {

+    ExFreePoolWithTag(uStack_48,0x73557348);

+  }

+  return uVar2;

 }
```

## `HsmFltPostQUERY_INFORMATION`  (modified)

```diff
--- HsmFltPostQUERY_INFORMATION
+++ HsmFltPostQUERY_INFORMATION
@@ -1,46 +1,167 @@
 

-ulonglong HsmFltPostQUERY_INFORMATION(longlong param_1,longlong param_2,ulonglong *param_3)

+undefined8 HsmFltPostQUERY_INFORMATION(longlong param_1,longlong param_2,ulonglong *param_3)

 

 {

-  code *pcVar1;

-  undefined8 uVar2;

-  undefined *unaff_RBX;

-  longlong unaff_RSI;

-  uint unaff_EDI;

-  longlong *unaff_R12;

-  ulonglong unaff_R14;

-  undefined8 unaff_R15;

-  longlong in_stack_00000050;

-  longlong in_stack_00000060;

-  undefined8 *in_stack_00000070;

-  longlong *in_stack_00000078;

-  char in_stack_00000138;

+  int iVar1;

+  undefined4 uVar2;

+  uint uVar3;

+  uint *puVar4;

+  bool bVar5;

+  char cVar6;

+  uint uVar7;

+  longlong lVar8;

+  ulonglong uVar9;

+  ulonglong uVar10;

+  uint *_Dst;

+  int iVar11;

+  ulonglong *_Size;

+  uint *puVar12;

+  uint uVar13;

+  uint *_Src;

+  int local_res8;

+  ulonglong local_58;

+  undefined8 local_50;

+  uint *puStack_48;

+  undefined8 local_40;

+  wchar_t *local_38;

   

-  WPP_SF_iqii(*(undefined8 *)(param_1 + 0x18),param_2,param_3,unaff_R15);

-  CldiStreamProcessPendingHydrationRequests

-            (unaff_R12,unaff_R15,(undefined *)0x2,unaff_EDI,unaff_RSI,unaff_RBX,(void *)0x0);

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

-    FltAcquirePushLockExclusiveEx(unaff_R12 + 4,0);

-    if (((undefined8 **)in_stack_00000070[1] != &stack0x00000070) ||

-       ((undefined8 **)*in_stack_00000078 != &stack0x00000070)) {

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

-      (*pcVar1)(3);

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

-      uVar2 = (*pcVar1)();

-      return uVar2;

+  uVar10 = 0;

+  if (((*(int *)(param_1 + 0x18) + 0x80000000U & 0x80000000) == 0) &&

+     (_Size = param_3, *(int *)(param_1 + 0x18) != -0x7ffffffb)) goto LAB_0;

+  lVar8 = *(longlong *)(param_2 + 0x18);

+  local_58 = 0;

+  _Size = &local_58;

+  FltGetStreamContext(lVar8,*(undefined8 *)(param_2 + 0x20));

+  if ((local_58 == 0) || ((*(uint *)(local_58 + 0x1c) & 1) == 0)) {

+    bVar5 = false;

+  }

+  else {

+    bVar5 = true;

+  }

+  if (bVar5) {

+    if (local_58 != 0) {

+      if (*(longlong *)(*(longlong *)(*(longlong *)(local_58 + 0x10) + 0x10) + 0x20) == lVar8) {

+        if (local_58 != 0) {

+          lVar8 = FltGetRequestorProcess(param_1);

+          cVar6 = HsmOsIsPassThroughModeEnabled(lVar8);

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

+        }

+      }

+      else {

+LAB_1:

+        FltReleaseContext(local_58);

+        local_58 = 0;

+      }

     }

-    *in_stack_00000078 = (longlong)in_stack_00000070;

-    in_stack_00000070[1] = in_stack_00000078;

-    in_stack_00000078 = (longlong *)&stack0x00000070;

-    in_stack_00000070 = &stack0x00000070;

-    FltReleasePushLockEx(unaff_R12 + 4,0);

   }

-  if (in_stack_00000050 != 0) {

-    MmUnlockPages(in_stack_00000060);

+  else if (local_58 != 0) {

+    FltDeleteContext(local_58);

+    goto LAB_1;

   }

-  if (in_stack_00000060 != 0) {

-    IoFreeMdl(in_stack_00000060);

+  uVar10 = local_58;

+  if (local_58 == 0) {

+    return 0;

   }

-  return unaff_R14 & 0xffffffff;

+  local_50 = local_58;

+  lVar8 = FltGetRequestorProcess(param_1);

+  cVar6 = HsmOsIsPassThroughModeEnabled(lVar8);

+  if (cVar6 != '\0') goto LAB_0;

+  _Size = (ulonglong *)0x0;

+  HsmpTracePostCallbackEnter(param_1,param_3,'\0','\x01');

+  iVar1 = *(int *)(*(longlong *)(param_1 + 0x10) + 0x20);

+  uVar2 = *(undefined4 *)(uVar10 + 0x1c);

+  cVar6 = HsmOsGetPlaceholderCompatMode(param_1);

+  uVar9 = HsmOsDisguisePlaceholder(cVar6,(byte)((uint)uVar2 >> 8) & 1);

+  if ((char)uVar9 != '\0') {

+    lVar8 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28);

+    iVar11 = -1;

+    _Size = (ulonglong *)0xffffffff;

+    if (iVar1 == 0x12) {

+LAB_2:

+      iVar11 = 0x20;

+      _Size = (ulonglong *)0xffffffff;

+    }

+    else if (iVar1 == 0x22) {

+      iVar11 = 0x30;

+      _Size = (ulonglong *)0xffffffff;

+    }

+    else if (iVar1 == 0x23) {

+      iVar11 = 0;

+      _Size = (ulonglong *)0x4;

+    }

+    else {

+      if (iVar1 == 4) goto LAB_2;

+      if (((iVar1 == 0x44) || (iVar1 == 0x46)) || (iVar1 == 0x4d)) {

+        iVar11 = 0x38;

+        _Size = (ulonglong *)0x3c;

+      }

+    }

+    if ((-1 < iVar11) &&

+       ((*(int *)(param_1 + 0x18) != -0x7ffffffb ||

+        ((longlong)iVar11 + 4U <= (ulonglong)*(uint *)(*(longlong *)(param_1 + 0x10) + 0x18))))) {

+      uVar7 = *(uint *)(iVar11 + lVar8) & 0xffffe9ff;

+      if (uVar7 == 0) {

+        uVar7 = 0x80;

+      }

+      *(uint *)(iVar11 + lVar8) = uVar7;

+    }

+    iVar11 = (int)_Size;

+    if ((-1 < iVar11) &&

+       ((*(int *)(param_1 + 0x18) != -0x7ffffffb ||

+        ((longlong)iVar11 + 4U <= (ulonglong)*(uint *)(*(longlong *)(param_1 + 0x10) + 0x18))))) {

+      *(undefined4 *)(iVar11 + lVar8) = 0;

+    }

+  }

+  if (iVar1 == 0x16) {

+    local_40 = 0x540052;

+    local_38 = L":${3D0CE612-FDEE-43f7-8ACA-957BEC0CCBA0}.";

+    puVar4 = *(uint **)(*(longlong *)(param_1 + 0x10) + 0x28);

+    uVar7 = *(uint *)(param_1 + 0x20);

+    _Src = puVar4;

+    _Dst = (uint *)0x0;

+    uVar13 = uVar7;

+    while (puVar12 = _Dst, _Dst = _Src, _Dst != (uint *)0x0) {

+      uVar3 = *_Dst;

+      if ((uVar3 == 0) || ((ulonglong)uVar13 < (ulonglong)uVar3 + 0x20)) {

+        _Src = (uint *)0x0;

+      }

+      else {

+        _Src = (uint *)((ulonglong)uVar3 + (longlong)_Dst);

+      }

+      puStack_48 = _Dst + 6;

+      local_50 = (ulonglong)CONCAT22((short)_Dst[1],(short)_Dst[1]);

+      _Size = (ulonglong *)CONCAT71((int7)((ulonglong)_Size >> 8),1);

+      cVar6 = RtlPrefixUnicodeString(&local_40);

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

+        local_res8 = (int)puVar4;

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

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

+            uVar13 = (int)_Dst - local_res8;

+          }

+          else {

+            *puVar12 = 0;

+            uVar13 = (puVar12[1] - local_res8) + 0x18 + (int)puVar12;

+          }

+          break;

+        }

+        _Size = (ulonglong *)(ulonglong)((local_res8 - (int)_Src) + uVar13);

+        uVar13 = uVar13 - *_Dst;

+        memmove(_Dst,_Src,(size_t)_Size);

+        _Src = _Dst;

+        _Dst = puVar12;

+      }

+    }

+    if (uVar13 < uVar7) {

+      _Size = (ulonglong *)(ulonglong)(uVar7 - uVar13);

+      memset((void *)((ulonglong)uVar13 + (longlong)puVar4),0,(size_t)_Size);

+      *(ulonglong *)(param_1 + 0x20) = (ulonglong)uVar13;

+    }

+  }

+LAB_0:

+  if (uVar10 != 0) {

+    FltReleaseContext();

+    HsmpTracePostCallbackExit(0,param_1,_Size,'\x01');

+  }

+  return 0;

 }
```

## `HsmiGrantLockRequest`  (modified)

```diff
--- HsmiGrantLockRequest
+++ HsmiGrantLockRequest
@@ -1,135 +1,213 @@
 

 undefined4 HsmiGrantLockRequest(longlong param_1,ulonglong *param_2,undefined1 *param_3)

 

 {

-  undefined4 uVar1;

-  undefined4 uVar2;

-  undefined4 uVar3;

-  undefined4 uVar4;

-  ushort uVar5;

-  undefined4 in_EAX;

-  byte bVar8;

-  longlong lVar6;

-  undefined *puVar7;

-  uint unaff_EBX;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  uint *unaff_RDI;

-  longlong *unaff_R12;

-  uint unaff_R14D;

-  char unaff_R15B;

-  bool in_CF;

+  undefined8 ****ppppuVar1;

+  undefined8 ***pppuVar2;

+  code *pcVar3;

+  undefined8 ****ppppuVar4;

+  undefined8 *****pppppuVar5;

+  bool bVar6;

+  undefined8 *****pppppuVar7;

+  undefined8 *_Dst;

+  ulonglong uVar8;

+  ulonglong uVar9;

+  undefined4 uVar10;

+  uint uVar11;

+  undefined8 *puVar12;

+  undefined8 *puVar13;

+  undefined8 ****ppppuVar14;

+  uint uVar15;

+  ulonglong uVar16;

+  uint uVar17;

+  ulonglong uVar18;

+  undefined8 ****ppppuVar19;

+  undefined8 ****local_58;

+  undefined8 ****local_50;

   

-  if (in_CF) {

-    if (in_CF) {

-      bVar8 = (byte)((uint)in_EAX >> 8);

-      *(byte *)(unaff_RSI + 0x2b) = *(byte *)(unaff_RSI + 0x2b) | bVar8;

-      *(char *)(unaff_RSI + -0x7d) = *(char *)(unaff_RSI + -0x7d) - bVar8;

-      return in_EAX;

+  puVar12 = (undefined8 *)(param_1 + 0x50);

+  local_50 = &local_58;

+  local_58 = &local_58;

+  puVar13 = (undefined8 *)*puVar12;

+  uVar18 = 0;

+  *param_3 = 0;

+  while( true ) {

+    uVar10 = 0;

+    if ((uint)param_2[10] <= (uint)uVar18) break;

+    if (puVar13 != puVar12) {

+      uVar17 = *(uint *)((longlong)param_2 + uVar18 * 4 + 0x54);

+      do {

+        if (uVar17 <= *(uint *)(puVar13 + 2)) {

+          if (*(uint *)(puVar13 + 2) == uVar17) {

+            if (((((char)param_2[1] != '\0') ||

+                 (uVar17 = *(uint *)((longlong)puVar13 + 0x14), uVar17 == 0)) ||

+                (uVar17 < *(uint *)(puVar13 + 4))) ||

+               (bVar6 = HsmiIsLockOwned((longlong)puVar13,param_2), bVar6)) goto LAB_0;

+            uVar11 = uVar17 + 4;

+            if ((uVar11 < uVar17) || (0xffffffff < (ulonglong)uVar11 << 3)) {

+              uVar10 = 0xc0000095;

+              goto LAB_1;

+            }

+            _Dst = (undefined8 *)

+                   ExAllocatePool2(0x100,(ulonglong)uVar11 << 3 & 0xffffffff,0x72507348);

+            if (_Dst == (undefined8 *)0x0) goto LAB_2;

+            if (*(int *)(puVar13 + 4) == 0) {

+              *_Dst = puVar13[3];

+            }

+            else {

+              memmove(_Dst,(void *)puVar13[3],(ulonglong)*(uint *)((longlong)puVar13 + 0x14) << 3);

+              ExFreePoolWithTag(puVar13[3],0x72507348);

+            }

+            puVar13[3] = _Dst;

+            *(uint *)(puVar13 + 4) = uVar11;

+            goto LAB_0;

+          }

+          break;

+        }

+        puVar13 = (undefined8 *)*puVar13;

+      } while (puVar13 != puVar12);

     }

-    *(int *)(unaff_RBP + -0x17) = (int)param_2;

-    lVar6 = ExAllocatePool2();

-    *(longlong *)(unaff_RBP + 0x7f) = lVar6;

-    *(longlong *)(unaff_RBP + -0x11) = lVar6;

-    if (lVar6 != 0) {

-      HsmDbgBreakOnStatus(0);

-      lVar6 = *(longlong *)(unaff_RBP + -0x39);

-      uVar5 = *(short *)(lVar6 + 8) - *(ushort *)(lVar6 + 0x18);

-      param_2 = (ulonglong *)((ulonglong)*(ushort *)(lVar6 + 0x18) + *(longlong *)(lVar6 + 0x10));

-      param_1 = *(undefined8 *)(unaff_RBP + 0x7f);

-      unaff_RDI = (uint *)(ulonglong)uVar5;

-      param_3 = (undefined1 *)(ulonglong)uVar5;

-      goto code_r0x000140050ab4;

-    }

-    unaff_R14D = 0xc000009a;

-    HsmDbgBreakOnStatus(-0x3fffff66);

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

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

-    {

-      WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xe,

-                 &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,*(undefined8 *)(unaff_RBP + -0x29)

-                );

-    }

-  }

-  else {

-code_r0x000140050ab4:

-    *(short *)(unaff_RBP + -0x19) = (short)unaff_RDI;

-    memmove((void *)param_1,param_2,(size_t)param_3);

-    lVar6 = *(longlong *)(unaff_RBP + 0x7f);

-    uVar1 = *(undefined4 *)(unaff_RBP + -0x19);

-    uVar2 = *(undefined4 *)(unaff_RBP + -0x15);

-    uVar3 = *(undefined4 *)(unaff_RBP + -0x11);

-    uVar4 = *(undefined4 *)(unaff_RBP + -0xd);

-    *(undefined8 *)(unaff_RBP + 0x7f) = 0;

-    *(undefined2 *)(lVar6 + ((ulonglong)unaff_RDI & 0xfffffffffffffffe)) = 0;

-    unaff_RDI = *(uint **)(unaff_RBP + 0x67);

-    *(undefined4 *)(unaff_RBP + 7) = uVar1;

-    *(undefined4 *)(unaff_RBP + 0xb) = uVar2;

-    *(undefined4 *)(unaff_RBP + 0xf) = uVar3;

-    *(undefined4 *)(unaff_RBP + 0x13) = uVar4;

-  }

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

-    FltReleaseFileNameInformation();

-  }

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

-    ExFreePoolWithTag(*(longlong *)(unaff_RBP + 0x7f),0x73557348);

-  }

-  HsmDbgBreakOnStatus(unaff_R14D);

-  if ((int)unaff_R14D < 0) {

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

-       ((byte)((byte)unaff_EBX & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0))

-    goto LAB_0;

-    lVar6 = *(longlong *)(unaff_RBP + -0x49);

-    if (1 < (byte)WPP_GLOBAL_Control[0x29]) {

-      WPP_SF_qqLqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x14,

-                     &WPP_23c031617105374e664d37900f58dae3_Traceguids,

-                     *(undefined8 *)(unaff_RBP + -9));

-    }

-  }

-  else {

-    puVar7 = HsmpRecallInitiatePopulationEx

-                       (unaff_RSI,*(longlong *)(unaff_RBP + -0x49),

-                        *(longlong *)(*(longlong *)(unaff_RDI + 4) + 8),unaff_RDI,

-                        (ushort *)(unaff_RBP + 7),0,(undefined *)0x0,*(byte *)(unaff_RBP + 0x6f));

-    unaff_EBX = (uint)puVar7;

-    if (*(char *)(unaff_RBP + 0x6f) == '\0') {

-LAB_0:

-      lVar6 = *(longlong *)(unaff_RBP + -0x49);

-    }

-    else {

-      unaff_EBX = 4;

-      unaff_R14D = func_0x000140050e34(unaff_RDI);

-      HsmDbgBreakOnStatus(unaff_R14D);

-      lVar6 = *(longlong *)(unaff_RBP + -0x49);

-    }

-  }

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

-    ExFreePoolWithTag(*(longlong *)(unaff_RBP + 0xf),0x73557348);

-  }

-  if ((int)unaff_R14D < 0) {

-    unaff_RDI[6] = unaff_R14D;

-    unaff_RDI[8] = 0;

-    unaff_RDI[9] = 0;

-    unaff_EBX = 4;

-  }

-  else {

-    if (unaff_EBX == 0) {

-      *unaff_R12 = lVar6;

+    pppppuVar7 = (undefined8 *****)ExAllocatePool2(0x100,0x30,0x72507348);

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

+LAB_2:

+      uVar10 = 0xc000009a;

+      HsmDbgBreakOnStatus(-0x3fffff66);

       goto LAB_1;

     }

-    if (unaff_EBX == 2) goto LAB_1;

+    pppppuVar7[1] = pppppuVar7;

+    *pppppuVar7 = pppppuVar7;

+    pppppuVar5 = (undefined8 *****)local_58;

+    if ((undefined8 *****)*local_50 != &local_58) goto LAB_3;

+    pppppuVar7[1] = local_50;

+    *pppppuVar7 = &local_58;

+    *local_50 = pppppuVar7;

+    *(undefined4 *)(pppppuVar7 + 2) = *(undefined4 *)((longlong)param_2 + uVar18 * 4 + 0x54);

+    *(uint *)((longlong)pppppuVar7 + 0x14) = (uint)((char)param_2[1] == '\0');

+    pppppuVar7[3] = (undefined8 ****)*param_2;

+    local_50 = pppppuVar7;

+LAB_0:

+    uVar18 = (ulonglong)((uint)uVar18 + 1);

   }

-  if (*(char *)(unaff_RBP + 0x77) != '\0') {

-    HsmpReleaseUserRequestRundownProtection(lVar6);

+  uVar18 = 0;

+  ppppuVar14 = (undefined8 ****)*puVar12;

+  ppppuVar19 = *(undefined8 *****)(param_1 + 0x40);

+  if ((uint)param_2[10] != 0) {

+    do {

+      ppppuVar4 = local_58;

+      uVar10 = 0;

+      if (ppppuVar14 != (undefined8 ****)(param_1 + 0x50)) {

+LAB_4:

+        if (*(uint *)(ppppuVar14 + 2) < *(uint *)((longlong)param_2 + uVar18 * 4 + 0x54))

+        goto code_r0x00014007735e;

+        if (*(int *)(ppppuVar14 + 2) == *(int *)((longlong)param_2 + uVar18 * 4 + 0x54)) {

+          if ((char)param_2[1] == '\0') {

+            uVar17 = *(uint *)((longlong)ppppuVar14 + 0x14);

+            uVar16 = (ulonglong)uVar17;

+            if (uVar17 == 0) {

+              *(undefined4 *)((longlong)ppppuVar14 + 0x14) = 1;

+              *param_3 = 1;

+            }

+            else if (*(int *)(ppppuVar14 + 4) != 0) {

+              uVar8 = 0;

+              if (uVar17 != 0) {

+                pppuVar2 = ppppuVar14[3];

+                do {

+                  uVar17 = (uint)uVar8;

+                  uVar15 = (int)uVar16 + uVar17 >> 1;

+                  uVar8 = HsmiCompareLockOwners((ulonglong *)(pppuVar2 + uVar15),param_2);

+                  bVar6 = -1 < (int)uVar8;

+                  uVar11 = uVar15 + 1;

+                  if (bVar6) {

+                    uVar11 = uVar17;

+                  }

+                  uVar16 = uVar16 & 0xffffffff;

+                  if (bVar6) {

+                    uVar16 = (ulonglong)uVar15;

+                  }

+                  uVar8 = (ulonglong)uVar11;

+                } while (uVar11 < (uint)uVar16);

+              }

+              uVar17 = *(uint *)((longlong)ppppuVar14 + 0x14);

+              if ((uint)uVar8 == uVar17) {

+LAB_5:

+                ppppuVar14[3][uVar8] = (undefined8 **)*param_2;

+                *(int *)((longlong)ppppuVar14 + 0x14) = *(int *)((longlong)ppppuVar14 + 0x14) + 1;

+              }

+              else {

+                uVar16 = uVar8;

+                uVar9 = HsmiCompareLockOwners((ulonglong *)(ppppuVar14[3] + uVar8),param_2);

+                if (0 < (int)uVar9) {

+                  if ((uint)uVar16 < uVar17) {

+                    memmove(ppppuVar14[3] + uVar8 + 1,ppppuVar14[3] + uVar8,

+                            (ulonglong)(uVar17 - (uint)uVar16) << 3);

+                  }

+                  goto LAB_5;

+                }

+              }

+            }

+          }

+          else {

+            if (*(int *)(ppppuVar14 + 4) != 0) {

+              ExFreePoolWithTag(ppppuVar14[3],0x72507348);

+              *(undefined4 *)(ppppuVar14 + 4) = 0;

+              ppppuVar14[3] = (undefined8 ***)*param_2;

+            }

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

+          }

+          goto LAB_6;

+        }

+      }

+LAB_7:

+      pppppuVar5 = (undefined8 *****)local_58;

+      if (((undefined8 *****)local_58[1] != &local_58) ||

+         (pppppuVar7 = (undefined8 *****)*local_58, pppppuVar7[1] != local_58)) goto LAB_3;

+      pppppuVar7[1] = &local_58;

+      ppppuVar1 = (undefined8 ****)ppppuVar14[1];

+      pppppuVar5 = pppppuVar7;

+      if ((undefined8 ****)*ppppuVar1 != ppppuVar14) goto LAB_3;

+      *local_58 = ppppuVar14;

+      local_58 = pppppuVar7;

+      ppppuVar4[1] = ppppuVar1;

+      *ppppuVar1 = ppppuVar4;

+      ppppuVar14[1] = ppppuVar4;

+      for (; ppppuVar19 != (undefined8 ****)(param_1 + 0x40);

+          ppppuVar19 = (undefined8 ****)*ppppuVar19) {

+        uVar17 = *(uint *)((longlong)param_2 + uVar18 * 4 + 0x54);

+        if (uVar17 <= *(uint *)(ppppuVar19 + 2)) {

+          if (*(uint *)(ppppuVar19 + 2) == uVar17) {

+            ppppuVar19[4] = ppppuVar4;

+            ppppuVar4[5] = ppppuVar19;

+          }

+          break;

+        }

+      }

+LAB_6:

+      uVar10 = 0;

+      uVar17 = (int)uVar18 + 1;

+      uVar18 = (ulonglong)uVar17;

+    } while (uVar17 < (uint)param_2[10]);

   }

 LAB_1:

-  if (unaff_RSI != 0) {

-    FltReleaseContext();

+  while( true ) {

+    ppppuVar14 = local_58;

+    if ((undefined8 *****)local_58 == &local_58) {

+      return uVar10;

+    }

+    pppppuVar5 = (undefined8 *****)local_58;

+    if (((undefined8 *****)local_58[1] != &local_58) ||

+       (pppppuVar7 = (undefined8 *****)*local_58, pppppuVar7[1] != local_58)) break;

+    pppppuVar7[1] = &local_58;

+    local_58 = pppppuVar7;

+    HsmiFreePropertyLock((longlong)ppppuVar14);

   }

-  if ((unaff_R15B != '\0') && (unaff_EBX != 2)) {

-    HsmpTracePreCallbackExit

-              ((ulonglong)unaff_EBX,unaff_RDI,*unaff_R12,unaff_RSI == 0,unaff_RSI != 0);

-  }

-  return unaff_EBX;

+LAB_3:

+  local_58 = pppppuVar5;

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

+  (*pcVar3)(3);

+  return uVar10;

+code_r0x00014007735e:

+  ppppuVar14 = (undefined8 ****)*ppppuVar14;

+  if (ppppuVar14 == (undefined8 ****)(param_1 + 0x50)) goto LAB_7;

+  goto LAB_4;

 }
```

## `HsmiPrepareBitmapCommit`  (modified)

```diff
--- HsmiPrepareBitmapCommit
+++ HsmiPrepareBitmapCommit
@@ -1,13 +1,56 @@
-

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

 

 int HsmiPrepareBitmapCommit(longlong param_1,int param_2,undefined8 *param_3,undefined4 *param_4)

 

 {

-  int *unaff_RDI;

+  int iVar1;

+  ushort *puVar2;

+  ushort **ppuVar3;

+  undefined4 *puVar4;

+  undefined4 local_res8 [2];

   

-  *unaff_RDI = *unaff_RDI + -1;

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

-  halt_baddata();

+  iVar1 = 0;

+  puVar2 = (ushort *)HsmiGetBitmap(param_1,param_2,(byte *)0x0);

+  ppuVar3 = (ushort **)HsmpGetStreamSize(param_1);

+  local_res8[0] = 0x1400;

+  if (puVar2 == (ushort *)0x0) {

+    *param_3 = 0;

+    *param_4 = 0;

+  }

+  else {

+    puVar4 = (undefined4 *)ExAllocatePool2(0x100);

+    if (puVar4 == (undefined4 *)0x0) {

+      iVar1 = -0x3fffff66;

+      HsmDbgBreakOnStatus(-0x3fffff66);

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

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

+         ) {

+        WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x17,

+                   &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+      }

+    }

+    else {

+      if ((*(uint *)(puVar2 + 8) & 7) == 0) {

+        iVar1 = HsmIBitmapNORMALPrepareCommit(puVar2,ppuVar3,0,puVar4,(ushort **)local_res8);

+      }

+      else {

+        iVar1 = -0x3fffff1b;

+      }

+      HsmDbgBreakOnStatus(iVar1);

+      if (iVar1 < 0) {

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

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

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

+          WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x18,

+                     &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+        }

+        ExFreePoolWithTag(puVar4,0x70527348);

+      }

+      else {

+        *param_4 = local_res8[0];

+        *param_3 = puVar4;

+      }

+    }

+  }

+  return iVar1;

 }
```

## `HsmFltDeleteSTREAMHANDLE_CONTEXT`  (modified)

```diff
--- HsmFltDeleteSTREAMHANDLE_CONTEXT
+++ HsmFltDeleteSTREAMHANDLE_CONTEXT
@@ -1,167 +1,84 @@
 

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

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

 

-uint HsmFltDeleteSTREAMHANDLE_CONTEXT(longlong param_1,ulonglong param_2,ulonglong param_3)

+void HsmFltDeleteSTREAMHANDLE_CONTEXT(longlong param_1,undefined8 param_2,undefined8 param_3)

 

 {

-  uint uVar1;

-  uint uVar2;

-  uint uVar3;

-  ulonglong in_RAX;

-  ulonglong uVar4;

-  undefined2 uVar5;

-  longlong unaff_RBP;

-  uint unaff_ESI;

-  undefined *puVar6;

-  longlong unaff_RDI;

-  short in_R10W;

-  uint unaff_R12D;

-  longlong unaff_R13;

-  short unaff_R15W;

-  bool in_SF;

-  uint uStack0000000000000048;

+  int *piVar1;

+  longlong lVar2;

+  longlong lVar3;

+  longlong lVar4;

+  longlong *plVar5;

+  code *pcVar6;

+  undefined1 *puVar7;

+  undefined1 auStack_48 [8];

+  undefined1 auStack_40 [24];

+  longlong local_28;

+  undefined4 local_20;

+  undefined4 local_18;

+  undefined4 local_10;

   

-  if (in_SF) {

-code_r0x00014006e8fa:

-    uVar3 = (uint)param_3;

-    if ((uVar3 < 0x88) || (0x11 < *(ushort *)(unaff_RDI + 0x80))) {

-LAB_0:

-      uVar4 = *(ulonglong *)(unaff_RBP + 0x48);

-      uVar3 = unaff_ESI;

+  puVar7 = auStack_48;

+  lVar2 = *(longlong *)(param_1 + 0x10);

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

+    if (DAT_0 == CldHsmDeleteStreamHandleContext) {

+      CldHsmDeleteStreamHandleContext(*(longlong *)(param_1 + 8));

     }

     else {

-      uVar1 = *(uint *)(unaff_RDI + 0x84);

-      param_2 = (ulonglong)uVar1;

-      if ((((uVar1 != 0) && ((param_2 < in_RAX * 8 + 0x10 || (uVar3 < uVar1)))) ||

-          (uVar3 < *(ushort *)(unaff_RDI + 0x82))) ||

-         ((((uVar2 = *(ushort *)(unaff_RDI + 0x82) + uVar1, uVar3 < uVar2 || (uVar2 < uVar1)) ||

-           (*(ushort *)(unaff_RDI + 0x80) != 6)) || (*(short *)(unaff_RDI + 0x82) != in_R10W))))

-      goto LAB_0;

-      uVar4 = *(ulonglong *)((ulonglong)*(uint *)(unaff_RDI + 0x84) + unaff_RDI);

-      uVar3 = 0;

-    }

-    HsmDbgBreakOnStatus(uVar3);

-    if ((int)uVar3 < 0) {

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

-        return uVar3;

-      }

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

-        return uVar3;

-      }

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

-        return uVar3;

-      }

-      uVar5 = 0x70;

-    }

-    else {

-      if ((unaff_R12D < 0x18) || (*(ushort *)(unaff_RDI + 0xe) < 0x10)) {

-LAB_1:

-        puVar6 = *(undefined **)(unaff_RBP + -0x18);

-        uVar3 = unaff_ESI;

-      }

-      else {

-        uVar3 = *(uint *)(unaff_RDI + 8);

-        param_3 = (ulonglong)uVar3;

-        if ((uVar3 < 0x90) || (0x11 < *(ushort *)(unaff_RDI + 0x88))) goto LAB_1;

-        uVar1 = *(uint *)(unaff_RDI + 0x8c);

-        param_2 = (ulonglong)uVar1;

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

-            ((param_2 < (ulonglong)*(ushort *)(unaff_RDI + 0xe) * 8 + 0x10 || (uVar3 < uVar1)))) ||

-           (((uVar3 < *(ushort *)(unaff_RDI + 0x8a) ||

-             (((uVar2 = *(ushort *)(unaff_RDI + 0x8a) + uVar1, uVar3 < uVar2 || (uVar2 < uVar1)) ||

-              (*(ushort *)(unaff_RDI + 0x88) != 6)))) || (*(short *)(unaff_RDI + 0x8a) != 8))))

-        goto LAB_1;

-        puVar6 = *(undefined **)((ulonglong)*(uint *)(unaff_RDI + 0x8c) + unaff_RDI);

-        uVar3 = 0;

-      }

-      HsmDbgBreakOnStatus(uVar3);

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

-        if (((longlong)uVar4 < 0) ||

-           ((puVar6 != (undefined *)0xffffffffffffffff &&

-            (((longlong)puVar6 < 0 || ((longlong)(0x7fffffffffffffff - uVar4) < (longlong)puVar6))))

-           )) {

-          HsmDbgBreakOnStatus(-0x3fff30f5);

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

-            return 0xc000cf0b;

-          }

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

-            return 0xc000cf0b;

-          }

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

-            return 0xc000cf0b;

-          }

-          WPP_SF_qiiDiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),param_2,param_3,unaff_R13);

-          return 0xc000cf0b;

-        }

-        param_3 = *(ulonglong *)(unaff_RBP + 0x58);

-        param_2 = *(ulonglong *)(unaff_RBP + 0x50);

-        if (unaff_R15W == 0x101) {

-          uVar3 = CldiPortProcessTransferData

-                            (unaff_R13,param_2,param_3,uVar4,puVar6,unaff_RDI,unaff_R12D);

-        }

-        else {

-          if (unaff_R15W != 0x102) goto LAB_2;

-          uVar3 = CldiPortProcessAckData

-                            (unaff_R13,param_2,param_3,uVar4,puVar6,unaff_RDI,unaff_R12D);

-        }

-        goto LAB_3;

-      }

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

-        return uVar3;

-      }

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

-        return uVar3;

-      }

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

-        return uVar3;

-      }

-      uVar5 = 0x71;

-    }

-    uStack0000000000000048 = uVar3;

-    WPP_SF_qiiDqDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar5,param_3,unaff_R13);

-  }

-  else {

-    unaff_R12D = *(uint *)(unaff_RBP + 0x70);

-    unaff_RDI = *(longlong *)(unaff_RBP + 0x68);

-    *(ulonglong *)(unaff_R13 + 0x38) = (ulonglong)_DAT_4;

-    if ((ushort)(unaff_R15W - 0x101U) < 3) {

-      unaff_ESI = 0xc0000225;

-      if ((0x17 < unaff_R12D) &&

-         (in_RAX = (ulonglong)*(ushort *)(unaff_RDI + 0xe), 0xe < *(ushort *)(unaff_RDI + 0xe))) {

-        param_3 = (ulonglong)*(uint *)(unaff_RDI + 8);

-        goto code_r0x00014006e8fa;

-      }

-      goto LAB_0;

-    }

-    uVar4 = *(ulonglong *)(unaff_RBP + 0x48);

-    puVar6 = *(undefined **)(unaff_RBP + -0x18);

-LAB_2:

-    if (unaff_R15W == 0x103) {

-      uVar3 = CldiPortProcessRetrieveData

-                        (unaff_R13,param_2,param_3,uVar4,(longlong)puVar6,unaff_RDI,unaff_R12D,

-                         *(ulonglong **)(unaff_RBP + 0x78));

-    }

-    else if (unaff_R15W == 0x104) {

-      uVar4 = CldiPortProcessRestartHydration(unaff_R13,param_2,param_3,unaff_RDI,unaff_R12D);

-      uVar3 = (uint)uVar4;

-    }

-    else if (unaff_R15W == 0x105) {

-      uVar4 = CldiPortProcessTransferPlaceholders(unaff_R13,param_2,param_3,unaff_RDI,unaff_R12D);

-      uVar3 = (uint)uVar4;

-    }

-    else if (unaff_R15W == 0x106) {

-      uVar3 = CldiPortProcessReportProgress

-                        (unaff_R13,param_2,param_3,unaff_RDI,unaff_R12D,(char *)(unaff_RBP + 0x60));

-    }

-    else {

-      uVar3 = 0xc00000e5;

-    }

-LAB_3:

-    HsmDbgBreakOnStatus(uVar3);

-    if ((-1 < (int)uVar3) && (*(char *)(unaff_RBP + 0x60) != '\0')) {

-      *(ulonglong *)(unaff_R13 + 0x40) = CONCAT44(uRamfffff78000000018,_DAT_4);

+      (*DAT_0)();

     }

   }

-  return uVar3;

+  lVar3 = *(longlong *)(param_1 + 0x60);

+  if ((lVar3 != 0) && (*(longlong *)(lVar2 + 0x68) != lVar3)) {

+    ExFreePoolWithTag(lVar3,0x76437348);

+  }

+  FltAcquirePushLockExclusiveEx(lVar2 + 0x40,0);

+  if (((char)*(undefined4 *)(param_1 + 0x28) < '\0') && ((*(uint *)(lVar2 + 0x1c) & 2) == 0)) {

+    lVar4 = *(longlong *)(param_1 + 0x18);

+    lVar3 = param_1 + 0x18;

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

+       (plVar5 = *(longlong **)(param_1 + 0x20), *plVar5 != lVar3)) {

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

+      (*pcVar6)(3);

+      puVar7 = auStack_40;

+      goto LAB_1;

+    }

+    *plVar5 = lVar4;

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

+    *(longlong *)(param_1 + 0x20) = lVar3;

+    *(longlong *)lVar3 = lVar3;

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

+       (*(int *)(lVar2 + 0x4c) = *(int *)(lVar2 + 0x4c) + -1,

+       (*(uint *)(param_1 + 0x28) & 0x40) != 0)) {

+      *(int *)(lVar2 + 0x50) = *(int *)(lVar2 + 0x50) + -1;

+    }

+  }

+  *(int *)(lVar2 + 0x48) = *(int *)(lVar2 + 0x48) + -1;

+  FltReleasePushLockEx(lVar2 + 0x40,0);

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

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+    local_10 = *(undefined4 *)(lVar2 + 0x50);

+    local_18 = *(undefined4 *)(lVar2 + 0x4c);

+    local_20 = *(undefined4 *)(lVar2 + 0x48);

+    local_28 = lVar2;

+    WPP_SF_qqDDD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x61,param_3,param_1);

+  }

+  if ((*(longlong *)(lVar2 + 0xa0) != 0) && ((*(uint *)(param_1 + 0x28) & 4) != 0)) {

+    LOCK();

+    piVar1 = (int *)(*(longlong *)(lVar2 + 0xa0) + 0x30);

+    *piVar1 = *piVar1 + -1;

+    UNLOCK();

+  }

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

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

+    ExFreePoolWithTag(*(longlong *)(param_1 + 0x48),0x69507348);

+  }

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

+    return;

+  }

+LAB_1:

+  *(undefined8 *)(puVar7 + -8) = 0x140066760;

+  ExFreePoolWithTag();

+  return;

 }
```

## `HsmpCtxCreateStreamContext`  (modified)

```diff
--- HsmpCtxCreateStreamContext
+++ HsmpCtxCreateStreamContext
@@ -1,53 +1,651 @@
+

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

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

 

 int HsmpCtxCreateStreamContext

               (ulonglong param_1,undefined4 **param_2,undefined8 param_3,uint *param_4,uint param_5,

               undefined8 *param_6)

 

 {

-  uint in_EAX;

-  int iVar1;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  undefined8 *unaff_R12;

+  ushort uVar1;

+  int iVar2;

+  uint uVar3;

+  undefined4 *puVar4;

+  int *piVar5;

+  undefined8 uVar6;

+  ulonglong uVar7;

+  uint uVar8;

+  uint uVar9;

+  longlong lVar10;

+  undefined8 uVar11;

+  undefined2 uVar12;

+  uint *puVar13;

+  longlong lVar14;

+  uint uVar15;

+  void *_Src;

+  uint uVar16;

+  undefined4 **ppuVar17;

+  undefined4 *local_b8;

+  uint local_b0;

+  uint local_ac;

+  int local_a8;

+  uint local_a4;

+  uint local_a0;

+  uint local_9c;

+  longlong local_98;

+  uint local_90;

+  undefined8 local_88;

+  longlong local_80;

+  longlong local_78;

+  longlong local_70;

+  longlong local_68;

+  longlong local_60;

+  longlong local_58;

+  undefined8 local_50;

+  size_t local_48;

   

-  if (((in_EAX & 0xffff0fff) == DAT_0) && ((*(uint *)(unaff_RBP + 0x4c) & 0x1000) != 0)) {

-    iVar1 = HsmiCldLoadSyncRootInfoByFileObject

-                      (unaff_RSI,*(undefined8 *)(unaff_RBP + 0x30),(undefined8 *)(unaff_RBP + -0x10)

-                      );

-    HsmDbgBreakOnStatus(iVar1);

-    if (iVar1 < 0) {

+  local_b8 = (undefined4 *)0x0;

+  local_70 = 0;

+  local_50 = 0;

+  *param_6 = 0;

+  local_b0 = 0;

+  puVar13 = (uint *)0x0;

+  local_68 = 0;

+  local_a4 = 0;

+  local_60 = 0;

+  local_a0 = 0;

+  local_9c = 0;

+  local_58 = 0;

+  local_90 = 0;

+  local_98 = 0;

+  local_80 = 0;

+  local_78 = 0;

+  local_a8 = 0;

+  iVar2 = HsmiCtxGetOrCreateFileContext(param_1,(longlong)param_2,param_3,&local_70);

+  HsmDbgBreakOnStatus(iVar2);

+  if (iVar2 < 0) {

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

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

+    {

+      WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x43,

+                 &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+    }

+    goto LAB_0;

+  }

+  ppuVar17 = &local_b8;

+  uVar11 = *(undefined8 *)(local_70 + 0x20);

+  local_88 = uVar11;

+  iVar2 = FltAllocateContext(DAT_1,8,0xa8,0x200,ppuVar17);

+  HsmDbgBreakOnStatus(iVar2);

+  if (iVar2 < 0) {

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

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

+    goto LAB_0;

+    uVar12 = 0x44;

+    uVar11 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+LAB_2:

+    WPP_SF_qqqd(uVar11,uVar12,&WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+  }

+  else {

+    memset(local_b8,0,0xa8);

+    *local_b8 = 0x63537348;

+    ExInitializeRundownProtection(local_b8 + 0x1e);

+    KeInitializeEvent(local_b8 + 0x20,0);

+    lVar10 = local_70;

+    local_70 = 0;

+    *(longlong *)(local_b8 + 4) = lVar10;

+    LOCK();

+    UNLOCK();

+    lVar10 = DAT_3 + 1;

+    DAT_3 = DAT_3 + 1;

+    *(longlong *)(local_b8 + 10) = lVar10;

+    local_b8[7] = local_b8[7] | 1;

+    FltInitializePushLock(local_b8 + 0x10);

+    puVar4 = local_b8 + 0x16;

+    *(undefined4 **)(local_b8 + 0x18) = puVar4;

+    *(undefined4 **)puVar4 = puVar4;

+    piVar5 = HsmpRpValidateBuffer(param_4,param_5);

+    iVar2 = (int)piVar5;

+    HsmDbgBreakOnStatus(iVar2);

+    if (iVar2 < 0) {

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

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

          ) {

-        WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x17,

-                   &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_RSI);

-      }

-      unaff_RDI = *(longlong *)(unaff_RBP + -0x10);

+        ppuVar17 = *(undefined4 ***)(local_b8 + 4);

+        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x45,

+                    &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+      }

+      local_b8[7] = local_b8[7] | 4;

+      if (iVar2 == -0x3fffffa8) {

+        local_b8[7] = local_b8[7] | 8;

+      }

+      else if (iVar2 == -0x3fffffa7) {

+        local_b8[7] = local_b8[7] | 0x10;

+      }

+    }

+    if ((local_b8[7] & 4) == 0) {

+      local_90 = param_5 - 4;

+      if (param_5 < 5) {

+        local_90 = 0;

+      }

+      puVar13 = param_4 + 1;

+      local_ac = local_b0;

+      if (0x17 < local_90) {

+        if ((((3 < *(ushort *)((longlong)param_4 + 0x12)) && (uVar15 = param_4[3], 0x2f < uVar15))

+            && ((ushort)param_4[0xb] < 0x12)) &&

+           ((uVar16 = param_4[0xc], uVar16 == 0 ||

+            (((uint)*(ushort *)((longlong)param_4 + 0x12) * 8 + 0x10 <= uVar16 && (uVar16 <= uVar15)

+             ))))) {

+          if (((*(ushort *)((longlong)param_4 + 0x2e) <= uVar15) &&

+              ((uVar3 = *(ushort *)((longlong)param_4 + 0x2e) + uVar16, uVar3 <= uVar15 &&

+               ((ushort)param_4[0xb] == 0x11)))) && (uVar16 <= uVar3)) {

+            if ((param_4[0xc] == 0) ||

+               (_Src = (void *)((longlong)puVar13 + (ulonglong)param_4[0xc]),

+               *(short *)((longlong)param_4 + 0x2e) == 0)) {

+              _Src = (void *)0x0;

+            }

+            uVar1 = *(ushort *)((longlong)param_4 + 0x2e);

+            local_ac = (uint)uVar1;

+            if ((_Src != (void *)0x0) && (local_ac != 0)) {

+              local_48 = (ulonglong)uVar1;

+              uVar6 = ExAllocatePool2(0x102,uVar1,0x69467348,0x11,ppuVar17);

+              *(undefined8 *)(local_b8 + 0xc) = uVar6;

+              if (*(void **)(local_b8 + 0xc) == (void *)0x0) {

+                iVar2 = -0x3fffff66;

+                HsmDbgBreakOnStatus(-0x3fffff66);

+                goto LAB_0;

+              }

+              memmove(*(void **)(local_b8 + 0xc),_Src,local_48);

+              local_b8[0xe] = local_ac;

+            }

+          }

+        }

+        local_ac = local_b0;

+        if ((((1 < *(ushort *)((longlong)param_4 + 0x12)) && (uVar15 = param_4[3], 0x1f < uVar15))

+            && ((ushort)param_4[7] < 0x12)) &&

+           (((uVar16 = param_4[8], uVar16 == 0 ||

+             (((uint)*(ushort *)((longlong)param_4 + 0x12) * 8 + 0x10 <= uVar16 &&

+              (uVar16 <= uVar15)))) &&

+            ((*(ushort *)((longlong)param_4 + 0x1e) <= uVar15 &&

+             (((uVar3 = *(ushort *)((longlong)param_4 + 0x1e) + uVar16, uVar3 <= uVar15 &&

+               (uVar16 <= uVar3)) &&

+              (((ushort)param_4[7] == 10 && (*(short *)((longlong)param_4 + 0x1e) == 4)))))))))) {

+          local_ac = *(uint *)((ulonglong)param_4[8] + (longlong)puVar13);

+        }

+      }

+      local_b8[7] = (local_ac & 1) << 5 | local_b8[7] & 0xffffffdf;

+      local_b8[7] = (local_ac & 2) << 5 | local_b8[7] & 0xffffffbf;

+      local_b8[7] = (local_ac & 4) << 6 | local_b8[7] & 0xfffffeff;

+      local_b8[7] = (local_ac & 8) << 7 | local_b8[7] & 0xfffffbff;

+      local_b8[7] = -(uint)((local_ac & 0x20) != 0) & 0x1000 | local_b8[7] & 0xffffefff;

+      local_b8[7] = (local_ac & 0x40) << 7 | local_b8[7] & 0xffffdfff;

+      local_b8[7] = -(uint)((local_ac & 0x10) != 0) & 2 | local_b8[7] & 0xfffffffd;

+      local_b8[7] = (local_ac & 0x80) << 7 | local_b8[7] & 0xffffbfff;

+      local_b8[7] = (local_ac & 0x100) << 7 | local_b8[7] & 0xffff7fff;

+      local_b8[7] = (local_ac & 0x200) << 7 | local_b8[7] & 0xfffeffff;

+      if (((param_4[-2] & 0x1000) != 0) && (((local_ac & 0x10) == 0 || ((local_ac & 0x20) == 0)))) {

+        HsmDbgBreakOnCorruption();

+        iVar2 = -0x3fff30fe;

+        HsmDbgBreakOnStatus(-0x3fff30fe);

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

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

+            ))) {

+          WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x46,

+                    &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,local_ac);

+        }

+        goto LAB_0;

+      }

+      lVar14 = local_78;

+      lVar10 = local_80;

+      if ((local_b8[7] & 2) == 0) {

+        uVar15 = local_90;

+        if (((((((0x17 < local_90) && (2 < *(ushort *)((longlong)param_4 + 0x12))) &&

+               (uVar16 = param_4[3], 0x27 < uVar16)) && ((ushort)param_4[9] < 0x12)) &&

+             ((uVar3 = param_4[10], uVar3 == 0 ||

+              (((uint)*(ushort *)((longlong)param_4 + 0x12) * 8 + 0x10 <= uVar3 && (uVar3 <= uVar16)

+               ))))) && (*(ushort *)((longlong)param_4 + 0x26) <= uVar16)) &&

+           (((uVar8 = *(ushort *)((longlong)param_4 + 0x26) + uVar3, uVar8 <= uVar16 &&

+             (uVar3 <= uVar8)) &&

+            (((ushort)param_4[9] == 6 && (*(short *)((longlong)param_4 + 0x26) == 8)))))) {

+          local_50 = *(undefined8 *)((ulonglong)param_4[10] + (longlong)puVar13);

+        }

+        goto LAB_4;

+      }

     }

     else {

-      *unaff_R12 = *(undefined8 *)(unaff_RBP + -0x10);

+      uVar15 = 0;

+LAB_4:

+      uVar6 = ExAllocateFromPagedLookasideList(&DAT_5);

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

+      if (*(void **)(local_b8 + 0x28) == (void *)0x0) {

+        iVar2 = -0x3fffff66;

+        HsmDbgBreakOnStatus(-0x3fffff66);

+        uVar7 = Feature_CloudFilesCrashInLogFailStreamContextAllocation__private_IsEnabledDeviceUsageNoInline

+                          ();

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

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

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

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+          uVar12 = 0x48;

+        }

+        else {

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

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

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+          uVar12 = 0x47;

+        }

+        uVar11 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+        iVar2 = -0x3fffff66;

+        goto LAB_2;

+      }

+      memset(*(void **)(local_b8 + 0x28),0,0x60);

+      FltInitializePushLock(*(longlong *)(local_b8 + 0x28) + 0x28);

+      lVar10 = *(longlong *)(local_b8 + 0x28) + 0x50;

+      *(longlong *)(*(longlong *)(local_b8 + 0x28) + 0x58) = lVar10;

+      *(longlong *)lVar10 = lVar10;

+      if (((((0x17 < uVar15) && (7 < *(ushort *)((longlong)puVar13 + 0xe))) &&

+           ((uVar16 = puVar13[2], 0x4f < uVar16 && ((ushort)puVar13[0x12] < 0x12)))) &&

+          ((uVar3 = puVar13[0x13], uVar3 == 0 ||

+           (((uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 <= uVar3 && (uVar3 <= uVar16)))))

+          ) && (((*(ushort *)((longlong)puVar13 + 0x4a) <= uVar16 &&

+                 (((uVar8 = *(ushort *)((longlong)puVar13 + 0x4a) + uVar3, uVar3 <= uVar8 &&

+                   (uVar8 <= uVar16)) && ((ushort)puVar13[0x12] == 6)))) &&

+                (*(short *)((longlong)puVar13 + 0x4a) == 8)))) {

+        *(undefined8 *)(*(longlong *)(local_b8 + 0x28) + 0x10) =

+             *(undefined8 *)((ulonglong)puVar13[0x13] + (longlong)puVar13);

+      }

+      if ((((0x17 < uVar15) && (8 < *(ushort *)((longlong)puVar13 + 0xe))) &&

+          ((uVar16 = puVar13[2], 0x57 < uVar16 && ((ushort)puVar13[0x14] < 0x12)))) &&

+         (((uVar3 = puVar13[0x15], uVar3 == 0 ||

+           (((uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 <= uVar3 && (uVar3 <= uVar16))))

+          && ((*(ushort *)((longlong)puVar13 + 0x52) <= uVar16 &&

+              ((((uVar8 = *(ushort *)((longlong)puVar13 + 0x52) + uVar3, uVar8 <= uVar16 &&

+                 (uVar3 <= uVar8)) && ((ushort)puVar13[0x14] == 6)) &&

+               (*(short *)((longlong)puVar13 + 0x52) == 8)))))))) {

+        *(undefined8 *)(*(longlong *)(local_b8 + 0x28) + 8) =

+             *(undefined8 *)((ulonglong)puVar13[0x15] + (longlong)puVar13);

+      }

+      *(undefined4 *)(*(longlong *)(local_b8 + 0x28) + 0x18) = 1;

+      if (((((0x17 < uVar15) && (9 < *(ushort *)((longlong)puVar13 + 0xe))) &&

+           ((uVar15 = puVar13[2], 0x5f < uVar15 && ((ushort)puVar13[0x16] < 0x12)))) &&

+          ((uVar16 = puVar13[0x17], uVar16 == 0 ||

+           (((uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 <= uVar16 && (uVar16 <= uVar15)))

+           ))) && (((*(ushort *)((longlong)puVar13 + 0x5a) <= uVar15 &&

+                    (((uVar3 = *(ushort *)((longlong)puVar13 + 0x5a) + uVar16, uVar16 <= uVar3 &&

+                      (uVar3 <= uVar15)) && ((ushort)puVar13[0x16] == 10)))) &&

+                   (*(short *)((longlong)puVar13 + 0x5a) == 4)))) {

+        *(undefined4 *)(*(longlong *)(local_b8 + 0x28) + 0x18) =

+             *(undefined4 *)((ulonglong)puVar13[0x17] + (longlong)puVar13);

+      }

+      uVar15 = 0xc0000225;

+      **(undefined8 **)(local_b8 + 0x28) = local_50;

+      if ((local_b8[7] & 0x40) == 0) {

+        local_ac = uVar15;

+        if (0x17 < local_90) {

+          local_a4 = 0;

+          local_ac = 0;

+          if (((((*(ushort *)((longlong)puVar13 + 0xe) < 5) || (uVar16 = puVar13[2], uVar16 < 0x38))

+               || (0x11 < (ushort)puVar13[0xc])) ||

+              (((uVar3 = puVar13[0xd], uVar3 != 0 &&

+                ((uVar3 < (uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 || (uVar16 < uVar3))

+                )) || (uVar16 < *(ushort *)((longlong)puVar13 + 0x32))))) ||

+             (((uVar8 = uVar3 + *(ushort *)((longlong)puVar13 + 0x32), uVar16 < uVar8 ||

+               ((ushort)puVar13[0xc] != 0x11)) || (uVar8 < uVar3)))) {

+            local_ac = 0xc0000225;

+          }

+          else {

+            if ((puVar13[0xd] == 0) || (*(short *)((longlong)puVar13 + 0x32) == 0)) {

+              local_68 = 0;

+            }

+            else {

+              local_68 = (longlong)puVar13 + (ulonglong)puVar13[0xd];

+            }

+            local_a4 = (uint)*(ushort *)((longlong)puVar13 + 0x32);

+          }

+          if ((int)local_ac < 0) {

+            local_a4 = 0;

+          }

+        }

+        HsmDbgBreakOnStatus(local_ac);

+        uVar7 = Feature_Cldflt_BitmapNullValueCheck__private_IsEnabledDeviceUsageNoInline();

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

+          if (-1 < (int)local_ac) {

+            ppuVar17 = (undefined4 **)0x4244;

+            uVar7 = param_1;

+            local_b0 = HsmpBitmapOpen(local_68,param_1,uVar11,**(longlong **)(local_b8 + 0x28),

+                                      0x4244,local_68,local_a4,&local_98);

+            HsmDbgBreakOnStatus(local_b0);

+            lVar10 = local_98;

+            if ((int)local_b0 < 0) {

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

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

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

+                uVar12 = 0x4b;

+                goto LAB_6;

+              }

+            }

+            else {

+              local_b0 = HsmpBitmapGetRangeState

+                                   (local_98,uVar7,*(longlong **)(local_b8 + 0x28),&local_a8);

+              HsmDbgBreakOnStatus(local_b0);

+              if (-1 < (int)local_b0) goto LAB_7;

+              uVar11 = local_88;

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

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

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

+                uVar12 = 0x4c;

+                goto LAB_8;

+              }

+            }

+          }

+        }

+        else if ((-1 < (int)local_ac) && (local_68 != 0)) {

+          ppuVar17 = (undefined4 **)0x4244;

+          uVar7 = param_1;

+          local_b0 = HsmpBitmapOpen(local_68,param_1,uVar11,**(longlong **)(local_b8 + 0x28),0x4244,

+                                    local_68,local_a4,&local_98);

+          HsmDbgBreakOnStatus(local_b0);

+          lVar10 = local_98;

+          if ((int)local_b0 < 0) {

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

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

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

+              uVar12 = 0x49;

+LAB_6:

+              ppuVar17 = param_2;

+              WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                          &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+            }

+          }

+          else {

+            local_b0 = HsmpBitmapGetRangeState

+                                 (local_98,uVar7,*(longlong **)(local_b8 + 0x28),&local_a8);

+            HsmDbgBreakOnStatus(local_b0);

+            if ((int)local_b0 < 0) {

+              uVar11 = local_88;

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

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

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

+                uVar12 = 0x4a;

+LAB_8:

+                uVar11 = local_88;

+                ppuVar17 = param_2;

+                WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                            &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+              }

+            }

+            else {

+LAB_7:

+              uVar11 = local_88;

+              if (local_a8 == 1) {

+                local_b8[7] = local_b8[7] | 0x40;

+                local_b8[7] = local_b8[7] | 0x80;

+              }

+              else {

+                local_98 = 0;

+                *(longlong *)(*(longlong *)(local_b8 + 0x28) + 0x38) = lVar10;

+              }

+            }

+          }

+        }

+      }

+      uVar16 = 0;

+      lVar10 = local_80;

+      if ((local_b8[7] & 0x100) == 0) {

+        local_ac = uVar15;

+        if (0x17 < local_90) {

+          local_ac = 0;

+          if (((((*(ushort *)((longlong)puVar13 + 0xe) < 6) || (uVar3 = puVar13[2], uVar3 < 0x40))

+               || ((0x11 < (ushort)puVar13[0xe] ||

+                   ((uVar8 = puVar13[0xf], uVar8 != 0 &&

+                    ((uVar8 < (uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 ||

+                     (uVar3 < uVar8)))))))) || (uVar3 < *(ushort *)((longlong)puVar13 + 0x3a))) ||

+             (((uVar9 = *(ushort *)((longlong)puVar13 + 0x3a) + uVar8, uVar3 < uVar9 ||

+               ((ushort)puVar13[0xe] != 0x11)) || (uVar9 < uVar8)))) {

+            local_ac = 0xc0000225;

+          }

+          else {

+            if ((puVar13[0xf] == 0) || (*(short *)((longlong)puVar13 + 0x3a) == 0)) {

+              local_60 = 0;

+            }

+            else {

+              local_60 = (longlong)puVar13 + (ulonglong)puVar13[0xf];

+            }

+            uVar16 = (uint)*(ushort *)((longlong)puVar13 + 0x3a);

+          }

+          local_a0 = uVar16;

+          if ((int)local_ac < 0) {

+            local_a0 = 0;

+          }

+        }

+        HsmDbgBreakOnStatus(local_ac);

+        uVar7 = Feature_Cldflt_BitmapNullValueCheck__private_IsEnabledDeviceUsageNoInline();

+        lVar10 = local_80;

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

+          if (-1 < (int)local_ac) {

+            ppuVar17 = (undefined4 **)0x4256;

+            uVar7 = param_1;

+            local_b0 = HsmpBitmapOpen(local_60,param_1,uVar11,**(longlong **)(local_b8 + 0x28),

+                                      0x4256,local_60,local_a0,&local_80);

+            HsmDbgBreakOnStatus(local_b0);

+            lVar10 = local_80;

+            if ((int)local_b0 < 0) {

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

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

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

+                uVar12 = 0x4f;

+                goto LAB_9;

+              }

+            }

+            else {

+              local_b0 = HsmpBitmapGetRangeState

+                                   (local_80,uVar7,*(longlong **)(local_b8 + 0x28),&local_a8);

+              HsmDbgBreakOnStatus(local_b0);

+              if (-1 < (int)local_b0) goto LAB_10;

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

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

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

+                uVar12 = 0x50;

+                goto LAB_11;

+              }

+            }

+          }

+        }

+        else if ((-1 < (int)local_ac) && (local_60 != 0)) {

+          ppuVar17 = (undefined4 **)0x4256;

+          uVar7 = param_1;

+          local_b0 = HsmpBitmapOpen(local_60,param_1,uVar11,**(longlong **)(local_b8 + 0x28),0x4256,

+                                    local_60,local_a0,&local_80);

+          HsmDbgBreakOnStatus(local_b0);

+          lVar10 = local_80;

+          if ((int)local_b0 < 0) {

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

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

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

+              uVar12 = 0x4d;

+LAB_9:

+              ppuVar17 = param_2;

+              WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                          &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+              lVar10 = local_80;

+            }

+          }

+          else {

+            local_b0 = HsmpBitmapGetRangeState

+                                 (local_80,uVar7,*(longlong **)(local_b8 + 0x28),&local_a8);

+            HsmDbgBreakOnStatus(local_b0);

+            if ((int)local_b0 < 0) {

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

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

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

+                uVar12 = 0x4e;

+LAB_11:

+                ppuVar17 = param_2;

+                WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                            &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+              }

+            }

+            else {

+LAB_10:

+              if (local_a8 == 1) {

+                local_b8[7] = local_b8[7] | 0x100;

+                local_b8[7] = local_b8[7] | 0x200;

+              }

+              else {

+                *(longlong *)(*(longlong *)(local_b8 + 0x28) + 0x40) = lVar10;

+                lVar10 = 0;

+              }

+            }

+          }

+        }

+      }

+      uVar16 = 0;

+      lVar14 = local_78;

+      if ((local_b8[7] & 0x400) == 0) {

+        if (0x17 < local_90) {

+          if (((6 < *(ushort *)((longlong)puVar13 + 0xe)) && (uVar3 = puVar13[2], 0x47 < uVar3)) &&

+             ((ushort)puVar13[0x10] < 0x12)) {

+            uVar16 = puVar13[0x11];

+            if (((uVar16 == 0) ||

+                (((uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 <= uVar16 &&

+                 (uVar16 <= uVar3)))) &&

+               ((*(ushort *)((longlong)puVar13 + 0x42) <= uVar3 &&

+                (((uVar8 = *(ushort *)((longlong)puVar13 + 0x42) + uVar16, uVar8 <= uVar3 &&

+                  ((ushort)puVar13[0x10] == 0x11)) && (uVar16 <= uVar8)))))) {

+              if ((puVar13[0x11] == 0) || (*(short *)((longlong)puVar13 + 0x42) == 0)) {

+                local_58 = 0;

+              }

+              else {

+                local_58 = (ulonglong)puVar13[0x11] + (longlong)puVar13;

+              }

+              uVar16 = (uint)*(ushort *)((longlong)puVar13 + 0x42);

+              uVar15 = 0;

+            }

+            else {

+              uVar16 = 0;

+            }

+          }

+          local_9c = uVar16;

+          if ((int)uVar15 < 0) {

+            local_9c = 0;

+          }

+        }

+        HsmDbgBreakOnStatus(uVar15);

+        uVar7 = Feature_Cldflt_BitmapNullValueCheck__private_IsEnabledDeviceUsageNoInline();

+        lVar14 = local_78;

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

+          if (-1 < (int)uVar15) {

+            ppuVar17 = (undefined4 **)0x424d;

+            uVar7 = param_1;

+            iVar2 = HsmpBitmapOpen(local_58,param_1,local_88,**(longlong **)(local_b8 + 0x28),0x424d

+                                   ,local_58,local_9c,&local_78);

+            HsmDbgBreakOnStatus(iVar2);

+            lVar14 = local_78;

+            if (iVar2 < 0) {

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

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

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

+                uVar12 = 0x53;

+                goto LAB_12;

+              }

+            }

+            else {

+              local_b0 = HsmpBitmapGetRangeState

+                                   (local_78,uVar7,*(longlong **)(local_b8 + 0x28),&local_a8);

+              HsmDbgBreakOnStatus(local_b0);

+              if (-1 < (int)local_b0) goto LAB_13;

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

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

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

+                uVar12 = 0x54;

+                goto LAB_14;

+              }

+            }

+          }

+        }

+        else if ((-1 < (int)uVar15) && (local_58 != 0)) {

+          ppuVar17 = (undefined4 **)0x424d;

+          uVar7 = param_1;

+          iVar2 = HsmpBitmapOpen(local_58,param_1,local_88,**(longlong **)(local_b8 + 0x28),0x424d,

+                                 local_58,local_9c,&local_78);

+          HsmDbgBreakOnStatus(iVar2);

+          lVar14 = local_78;

+          if (iVar2 < 0) {

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

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

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

+              uVar12 = 0x51;

+LAB_12:

+              WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                          &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+              lVar14 = local_78;

+              ppuVar17 = param_2;

+            }

+          }

+          else {

+            local_b0 = HsmpBitmapGetRangeState

+                                 (local_78,uVar7,*(longlong **)(local_b8 + 0x28),&local_a8);

+            HsmDbgBreakOnStatus(local_b0);

+            if ((int)local_b0 < 0) {

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

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

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

+                uVar12 = 0x52;

+LAB_14:

+                WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                            &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+                ppuVar17 = param_2;

+              }

+            }

+            else {

+LAB_13:

+              if (local_a8 == 1) {

+                local_b8[7] = local_b8[7] | 0x400;

+                local_b8[7] = local_b8[7] | 0x800;

+              }

+              else {

+                *(longlong *)(*(longlong *)(local_b8 + 0x28) + 0x48) = lVar14;

+                lVar14 = 0;

+              }

+            }

+          }

+        }

+      }

+    }

+    iVar2 = (*DAT_15)(local_b8,*(undefined8 *)(param_1 + 0x10),

+                             *(undefined8 *)(*(longlong *)(local_b8 + 4) + 8),local_b8 + 2,ppuVar17)

+    ;

+    HsmDbgBreakOnStatus(iVar2);

+    puVar4 = local_b8;

+    if (iVar2 < 0) {

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

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

+         ) {

+        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x55,

+                    &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+      }

+    }

+    else {

+      local_b8 = (undefined4 *)0x0;

+      *param_6 = puVar4;

+    }

+    if (local_98 != 0) {

+      HsmpBitmapRelease(local_98);

+    }

+    if (lVar10 != 0) {

+      HsmpBitmapRelease(lVar10);

+    }

+    if (lVar14 != 0) {

+      HsmpBitmapRelease(lVar14);

     }

   }

-  else {

-    iVar1 = -0x3fff30e2;

-    HsmDbgBreakOnStatus(-0x3fff30e2);

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

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

-    {

-      WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x16,

-                 &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_RSI);

-    }

+LAB_0:

+  if (local_b8 != (undefined4 *)0x0) {

+    FltReleaseContext();

   }

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

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

+  if (local_70 != 0) {

+    FltReleaseContext(local_70);

   }

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

-    FltClose();

-  }

-  if (unaff_RDI != 0) {

-    ExFreePoolWithTag(unaff_RDI,0x69537348);

-  }

-  return iVar1;

+  return iVar2;

 }
```

## `HsmiRecallHydrationCompletionCallback`  (modified)

```diff
--- HsmiRecallHydrationCompletionCallback
+++ HsmiRecallHydrationCompletionCallback
@@ -1,11 +1,28 @@
 

 void HsmiRecallHydrationCompletionCallback(longlong param_1,int param_2)

 

 {

-  code *pcVar1;

+  int *piVar1;

+  int iVar2;

+  longlong lVar3;

+  int iVar4;

   

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

-  (*pcVar1)();

+  iVar4 = param_2;

+  if (((((*(uint *)(param_1 + 0x30) & 0x200) == 0) &&

+       (lVar3 = *(longlong *)(param_1 + 0x18), lVar3 != 0)) && (param_2 != -0x3ffffdd3)) &&

+     ((iVar4 = *(int *)(lVar3 + 0x18), iVar4 == -1 || ((-1 < iVar4 && (param_2 < 0)))))) {

+    *(undefined8 *)(lVar3 + 0x20) = 0;

+    *(int *)(lVar3 + 0x18) = param_2;

+    iVar4 = param_2;

+  }

+  LOCK();

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

+  iVar2 = *piVar1;

+  *piVar1 = *piVar1 + -1;

+  UNLOCK();

+  if (iVar2 == 1) {

+    HsmiRecallPostProcessHydration(param_1,iVar4);

+  }

   return;

 }
```

## `HsmiOsOpenAppPolicyKey`  (modified)

```diff
--- HsmiOsOpenAppPolicyKey
+++ HsmiOsOpenAppPolicyKey
@@ -1,17 +1,211 @@
 

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

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

 

 int HsmiOsOpenAppPolicyKey

               (longlong *param_1,undefined8 param_2,char param_3,char param_4,longlong *param_5)

 

 {

-  int in_EAX;

-  undefined4 in_register_00000004;

+  longlong lVar1;

+  int iVar2;

+  int iVar3;

+  undefined8 *puVar4;

+  undefined8 *puVar5;

+  int iVar6;

+  int iVar7;

+  undefined4 local_res18 [4];

+  undefined4 local_128 [2];

+  longlong local_120;

+  longlong local_118;

+  undefined8 local_110;

+  longlong lStack_108;

+  longlong *local_100;

+  undefined8 uStack_f8;

+  undefined8 local_f0;

+  undefined8 uStack_e8;

+  longlong local_e0;

+  longlong local_d8;

+  longlong local_d0 [2];

+  wchar_t *pwStack_c0;

+  undefined8 *local_b8;

+  longlong local_b0;

+  wchar_t *local_a8;

+  longlong local_a0 [2];

+  undefined8 local_90;

+  longlong lStack_88;

+  longlong *local_80;

+  undefined8 uStack_78;

+  undefined8 *local_70;

+  ulonglong local_68;

+  undefined8 local_60;

+  undefined8 uStack_58;

+  undefined8 local_50;

+  undefined8 uStack_48;

+  undefined8 local_40;

   

-  *(int *)CONCAT44(in_register_00000004,in_EAX) =

-       *(int *)CONCAT44(in_register_00000004,in_EAX) + in_EAX;

-  *(char *)(param_1 + -9) = (char)param_1[-9] + (char)in_EAX;

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

-  halt_baddata();

+  puVar4 = (undefined8 *)0x0;

+  local_b0 = 0x4e004c;

+  local_128[0] = 0;

+  local_d0[0] = 0;

+  local_a8 = L"SOFTWARE\\Policies\\Microsoft\\CloudFiles";

+  local_d8 = 0;

+  local_118 = 0;

+  local_120 = 0;

+  iVar7 = 0x240;

+  local_e0 = 0;

+  local_b8 = (undefined8 *)0x0;

+  local_110 = 0;

+  lStack_108 = 0;

+  local_100 = (longlong *)0x0;

+  uStack_f8 = 0;

+  local_f0 = 0;

+  uStack_e8 = 0;

+  local_a0[0] = 0;

+  local_a0[1] = 0;

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

+    lStack_108 = 0;

+    pwStack_c0 = L"\\Registry\\Machine";

+    local_100 = local_d0 + 1;

+    local_d0[1] = 0x240022;

+    local_110 = 0x30;

+    uStack_f8 = 0x240;

+    local_f0 = 0;

+    uStack_e8 = 0;

+    iVar2 = ZwOpenKey(local_d0,0x20019,&local_110);

+    iVar6 = 0xf003f;

+  }

+  else {

+    local_d0[1] = 0;

+    pwStack_c0 = (wchar_t *)0x0;

+    iVar2 = RtlFormatCurrentUserKeyPath(local_d0 + 1);

+    if (iVar2 < 0) goto LAB_0;

+    lStack_108 = 0;

+    local_100 = local_d0 + 1;

+    local_110 = CONCAT44(local_110._4_4_,0x30);

+    uStack_f8 = CONCAT44(uStack_f8._4_4_,0x640);

+    local_f0 = 0;

+    uStack_e8 = 0;

+    iVar2 = ZwOpenKey(local_d0,0x20019,&local_110);

+    RtlFreeUnicodeString(local_d0 + 1);

+    iVar7 = (-(uint)(param_4 != '\0') & 0xfffffc00) + 0x640;

+    iVar6 = (-(uint)(param_4 != '\0') & 0xd0026) + 0x20019;

+  }

+  if (iVar2 < 0) goto LAB_0;

+  lStack_108 = local_d0[0];

+  local_100 = &local_b0;

+  local_110 = CONCAT44(local_110._4_4_,0x30);

+  uStack_f8 = CONCAT44(uStack_f8._4_4_,iVar7) | 0x1000;

+  local_f0 = 0;

+  uStack_e8 = 0;

+  iVar2 = ZwOpenKey(&local_d8,iVar6,&local_110);

+  if (iVar2 == -0x3fffffcc) {

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

+      iVar2 = ZwCreateKey(&local_d8,iVar6,&local_110,0,0,0,local_128);

+      goto LAB_1;

+    }

+LAB_2:

+    iVar2 = 0;

+  }

+  else {

+LAB_1:

+    if (iVar2 < 0) goto LAB_0;

+    lStack_108 = local_d8;

+    local_110 = CONCAT44(local_110._4_4_,0x30);

+    uStack_f8 = CONCAT44(uStack_f8._4_4_,iVar7) | 0x1000;

+    local_f0 = 0;

+    uStack_e8 = 0;

+    local_100 = param_1;

+    iVar2 = ZwOpenKey(&local_118,iVar6,&local_110);

+    if (iVar2 == -0x3fffffcc) {

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

+      iVar2 = ZwCreateKey(&local_118,iVar6,&local_110,0,0,0,local_128);

+    }

+    if (iVar2 < 0) goto LAB_0;

+    RtlInitUnicodeString(local_a0,param_2);

+    lStack_108 = local_118;

+    local_100 = local_a0;

+    local_110 = CONCAT44(local_110._4_4_,0x30);

+    uStack_f8 = CONCAT44(uStack_f8._4_4_,iVar7) | 0x1000;

+    local_f0 = 0;

+    uStack_e8 = 0;

+    iVar2 = ZwOpenKey(&local_120,iVar6,&local_110);

+    puVar5 = puVar4;

+    if (iVar2 == -0x3fffffcc) {

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

+      local_res18[0] = 0;

+      local_70 = (undefined8 *)0x0;

+      local_68 = local_68 & 0xffffffff00000000;

+      local_40 = 0;

+      local_90 = 0;

+      lStack_88 = 0;

+      local_80 = (longlong *)0x0;

+      uStack_78 = 0;

+      local_60 = 0;

+      uStack_58 = 0;

+      local_50 = 0;

+      uStack_48 = 0;

+      iVar2 = ZwOpenThreadTokenEx(0xfffffffffffffffe,0x20008,1,0x200,&local_e0);

+      if (iVar2 == -0x3fffff84) {

+        iVar2 = ZwOpenProcessTokenEx(0xffffffffffffffff,0x20008,0x200,&local_e0);

+      }

+      if (iVar2 < 0) goto LAB_0;

+      for (iVar2 = 0; iVar2 < 2; iVar2 = iVar2 + 1) {

+        iVar3 = ZwQueryInformationToken(local_e0,1,puVar4,local_res18[0],local_res18);

+        if ((iVar3 == -0x3fffffdd) &&

+           (puVar4 = (undefined8 *)ExAllocatePool2(0x100,local_res18[0],0x6b6f7448),

+           puVar4 == (undefined8 *)0x0)) {

+          iVar2 = -0x3fffff66;

+          goto LAB_0;

+        }

+      }

+      iVar2 = HsmiOsBuildAppPolicyKeyAcl(*puVar4,(longlong *)&local_b8);

+      puVar5 = local_b8;

+      if (-1 < iVar2) {

+        iVar2 = RtlCreateSecurityDescriptor(&local_60,1);

+        puVar5 = local_b8;

+        if ((-1 < iVar2) &&

+           (iVar2 = RtlSetDaclSecurityDescriptor(&local_60,1,local_b8,0), -1 < iVar2)) {

+          local_68 = 0;

+          lStack_88 = local_118;

+          local_80 = local_a0;

+          local_90 = CONCAT44(local_90._4_4_,0x30);

+          local_70 = &local_60;

+          uStack_78 = CONCAT44(uStack_78._4_4_,iVar7) | 0x1000;

+          iVar2 = ZwCreateKey(&local_120,iVar6,&local_90,0,0,0,local_128);

+          goto LAB_3;

+        }

+      }

+    }

+    else {

+LAB_3:

+      lVar1 = local_120;

+      if (-1 < iVar2) {

+        local_120 = 0;

+        *param_5 = lVar1;

+      }

+    }

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

+      ExFreePoolWithTag(puVar5,0x636c6148);

+    }

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

+      ExFreePoolWithTag(puVar4,0x6b6f7448);

+    }

+  }

+LAB_0:

+  if (local_e0 != 0) {

+    ZwClose();

+  }

+  if (local_120 != 0) {

+    ZwClose();

+  }

+  if (local_118 != 0) {

+    ZwClose();

+  }

+  if (local_d8 != 0) {

+    ZwClose();

+  }

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

+    ZwClose();

+  }

+  return iVar2;

 }
```

## `HsmIBitmapNORMALQueryRangeEx`  (modified)

```diff
--- HsmIBitmapNORMALQueryRangeEx
+++ HsmIBitmapNORMALQueryRangeEx
@@ -1,13 +1,612 @@
-

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

 

 undefined8 *

 HsmIBitmapNORMALQueryRangeEx

           (undefined8 *param_1,uint param_2,longlong *param_3,undefined8 *param_4,

           undefined1 *param_5,longlong *param_6)

 

 {

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

-  halt_baddata();

+  bool bVar1;

+  uint uVar2;

+  int iVar3;

+  undefined8 *puVar4;

+  undefined8 uVar5;

+  undefined8 *puVar6;

+  undefined8 *puVar7;

+  ulonglong uVar8;

+  byte bVar9;

+  byte bVar10;

+  undefined8 *puVar11;

+  undefined2 uVar12;

+  uint *puVar13;

+  ulonglong uVar14;

+  longlong lVar15;

+  longlong lVar16;

+  undefined *puVar17;

+  uint uVar18;

+  undefined8 *puVar19;

+  undefined8 **ppuVar20;

+  ulonglong uVar21;

+  uint uVar22;

+  uint uVar23;

+  bool bVar24;

+  char local_177;

+  char local_176;

+  uint local_174;

+  uint local_170;

+  int local_16c;

+  uint local_168;

+  uint local_164;

+  undefined8 *local_160;

+  uint local_158;

+  ulonglong local_150;

+  undefined8 *local_148;

+  uint local_140;

+  undefined8 *local_138;

+  uint auStack_130 [2];

+  undefined8 *local_128;

+  int local_120;

+  ulonglong local_118;

+  undefined8 *local_110;

+  undefined8 *local_108;

+  undefined8 *local_100;

+  undefined8 *local_f8;

+  undefined8 *local_e8;

+  ulonglong uStack_e0;

+  ulonglong local_d8;

+  undefined8 *local_d0;

+  undefined8 local_c8;

+  undefined8 *local_c0;

+  undefined8 *local_b8;

+  uint *local_b0;

+  longlong local_a8;

+  undefined8 *local_a0;

+  undefined8 *local_98;

+  uint local_90;

+  undefined8 *local_88;

+  ulonglong uStack_80;

+  undefined8 *local_78;

+  int local_70 [2];

+  undefined8 *local_68;

+  ulonglong uStack_60;

+  ulonglong local_58;

+  ulonglong local_50;

+  ulonglong local_48;

+  ulonglong *local_40;

+  

+  puVar11 = (undefined8 *)0x0;

+  puVar19 = (undefined8 *)0x0;

+  local_140 = 0;

+  local_16c = 0;

+  local_176 = '\0';

+  local_e8 = (undefined8 *)0x0;

+  uStack_e0 = 0;

+  local_118 = 0;

+  local_158 = 3;

+  local_164 = 3;

+  local_68 = (undefined8 *)0x0;

+  uStack_60 = 0;

+  local_b0 = (uint *)(param_1 + 2);

+  local_170 = *local_b0 >> 6 & 0x3f;

+  uVar21 = (ulonglong)(uint)(1 << ((byte)local_170 & 0x1f));

+  uVar2 = *(uint *)(param_1 + 3);

+  if ((int)uVar2 < 0) {

+    puVar19 = (undefined8 *)(ulonglong)uVar2;

+    HsmDbgBreakOnStatus(uVar2);

+    local_e8 = (undefined8 *)((ulonglong)local_e8 & 0xffffffff00000000);

+  }

+  else {

+    *param_5 = 0;

+    local_f8 = puVar11;

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

+      local_f8 = (undefined8 *)*param_3;

+    }

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

+      puVar4 = (undefined8 *)param_1[1];

+    }

+    else {

+      puVar4 = (undefined8 *)*param_4;

+    }

+    local_c0 = local_f8;

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

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

+    {

+      WPP_SF_qisii(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),local_f8,param_3,param_1,*param_1,

+                   (char *)(param_1 + 4));

+    }

+    if ((longlong)local_f8 < 0) {

+      *param_5 = 1;

+      if ((longlong)puVar4 < 0) {

+        puVar11 = puVar4;

+      }

+      *param_6 = (longlong)puVar11;

+    }

+    else {

+      local_138 = (undefined8 *)param_1[1];

+      if ((longlong)local_f8 < (longlong)local_138) {

+        local_108 = puVar4;

+        if ((longlong)local_138 < (longlong)puVar4) {

+          local_108 = local_138;

+        }

+        local_98 = (undefined8 *)(~(uVar21 - 1) & (ulonglong)local_f8);

+        local_58 = (ulonglong)((uVar21 - 1) + (longlong)local_108) & ~(uVar21 - 1);

+        uVar2 = *local_b0;

+        uVar22 = uVar2 >> 0xc;

+        uVar23 = uVar22 & 7;

+        puVar19 = puVar11;

+        uVar18 = 3;

+        local_48 = uVar21;

+        if (uVar23 != 0xffffffff) {

+          ppuVar20 = &local_68;

+          do {

+            puVar4 = (undefined8 *)

+                     HsmiBitmapNORMALComputeGranularity

+                               ((int)puVar19,(ulonglong)(uint)(1 << ((byte)(uVar2 >> 6) & 0x1f)));

+            *ppuVar20 = puVar4;

+            uVar18 = (int)puVar19 + 1;

+            puVar19 = (undefined8 *)(ulonglong)uVar18;

+            ppuVar20 = ppuVar20 + 1;

+          } while (uVar18 < uVar23 + 1);

+          puVar19 = (undefined8 *)(ulonglong)local_140;

+          uVar18 = local_158;

+        }

+        puVar4 = local_98;

+        local_128 = local_98;

+        uVar2 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)param_1);

+        local_70[0] = 0;

+        local_70[1] = 0;

+        uStack_80 = CONCAT44(uVar2,uVar22) & 0xffffffff00000007;

+        local_78 = local_138;

+        local_88 = param_1;

+        HsmExpandKernelStackAndCallout(HsmiBitmapNORMALOpenOnDiskCallout,local_70);

+        FltAcquirePushLockSharedEx(param_1 + 6,0);

+        local_176 = '\x01';

+        if ((*local_b0 & 0x10) == 0) {

+          local_40 = param_1 + 7;

+          local_50 = param_1[7];

+          local_98 = (undefined8 *)((longlong)puVar4 + -1);

+          puVar7 = local_108;

+          while (((longlong)puVar4 < (longlong)puVar7 && ((longlong)local_98 < (longlong)puVar4))) {

+            bVar1 = false;

+            local_98 = puVar4;

+            bVar24 = true;

+            local_177 = '\0';

+            lVar15 = (longlong)puVar4 >> ((byte)local_170 & 0x3f);

+            local_138 = (undefined8 *)(((longlong)local_58 >> ((byte)local_170 & 0x3f)) - lVar15);

+            if ((param_2 & 3) == 0) {

+LAB_0:

+              if (bVar24) goto LAB_1;

+LAB_2:

+              if (uVar18 == 3) {

+                uVar18 = (uint)(local_177 != '\0');

+                local_164 = (uint)(local_177 != '\0');

+              }

+              if ((bool)local_177 != (uVar18 == 1)) break;

+              local_128 = (undefined8 *)

+                          ((longlong)puVar4 + ((longlong)local_138 << ((byte)local_170 & 0x3f)));

+              puVar4 = local_128;

+            }

+            else {

+              uVar5 = HsmiBitmapNORMALLookupMcbMapping

+                                ((longlong)param_1,(ulonglong)param_2,lVar15,(longlong *)&local_138,

+                                 &local_177);

+              if ((char)uVar5 != '\0') {

+                bVar24 = false;

+                goto LAB_0;

+              }

+LAB_1:

+              puVar13 = local_b0;

+              if (local_50 == 0) goto LAB_2;

+              local_160 = (undefined8 *)(local_48 * (longlong)local_138 + (longlong)puVar4);

+              uVar2 = *local_b0;

+              auStack_130[uVar2 >> 0xc & 7] = 4;

+              uVar2 = uVar2 >> 0xc & 7;

+              while( true ) {

+                uVar21 = (ulonglong)uVar2;

+                local_90 = uVar2;

+                local_174 = uVar2;

+                local_158 = uVar2;

+                local_140 = uVar2;

+                if (((bVar1) || ((*puVar13 >> 0xc & 7) < uVar2)) ||

+                   ((longlong)local_160 <= (longlong)puVar4)) break;

+                local_120 = (-(uint)(uVar2 != 0) & 0xfffffff0) + 0x20;

+                local_d8 = uVar21;

+                local_d0 = (&local_68)[uVar21];

+                local_a0 = local_d0;

+                local_a8 = (longlong)local_d0 << (5U - (uVar2 != 0) & 0x3f);

+                puVar17 = (undefined *)(local_a8 + -1 + (longlong)puVar4);

+                if (uVar2 == 0) {

+                  local_100 = (undefined8 *)

+                              ((ulonglong)((longlong)local_d0 + -1 + (longlong)puVar4) &

+                              ~((longlong)local_d0 - 1U));

+                  local_138 = (undefined8 *)(-local_a8 & (ulonglong)puVar17);

+                  lVar16 = (longlong)(~((longlong)local_d0 - 1U) & (ulonglong)puVar4) >>

+                           ((byte)local_170 & 0x3f);

+                  lVar15 = lVar16 + SUB168(SEXT816(-0x7fdff7fdff7fdff7) * SEXT816(lVar16),8);

+                  local_110 = (undefined8 *)((lVar15 >> 0xe) - (lVar15 >> 0x3f));

+                  local_b8 = local_110;

+                  local_168 = (int)lVar16 + (int)local_110 * -0x7fe0;

+                }

+                else {

+                  lVar15 = (longlong)puVar4 - (longlong)puVar4 % (longlong)local_d0;

+                  local_100 = (undefined8 *)(lVar15 + (longlong)local_d0);

+                  local_138 = (undefined8 *)(puVar17 + -((longlong)puVar17 % local_a8));

+                  lVar15 = lVar15 / (longlong)local_d0;

+                  lVar16 = SUB168(SEXT816(-0x7fdff7fdff7fdff7) * SEXT816(lVar15),8) + lVar15;

+                  local_110 = (undefined8 *)((lVar16 >> 0xd) - (lVar16 >> 0x3f));

+                  local_b8 = local_110;

+                  local_168 = (int)lVar15 + (int)local_110 * -0x3ff0;

+                }

+                puVar7 = (undefined8 *)(ulonglong)local_168;

+                local_148 = puVar7;

+                local_110 = local_b8;

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

+                  local_88 = local_e8;

+                  uStack_80 = uStack_e0;

+                  HsmIBitmapNORMALUnpinBlock((int *)&local_88);

+                  local_e8 = (undefined8 *)((ulonglong)local_e8 & 0xffffffff00000000);

+                  local_118 = 0;

+                }

+                if (uVar2 == (*local_b0 >> 0xc & 7)) {

+                  local_118 = *local_40;

+                }

+                else {

+                  uVar22 = auStack_130[uVar2 + 1];

+                  local_150 = CONCAT44(local_150._4_4_,uVar22);

+                  lVar15 = 0x2000;

+                  if ((uVar22 != 1) && (uVar22 == 2)) {

+                    lVar15 = 0x3000;

+                  }

+                  puVar7 = (undefined8 *)((longlong)local_110 * 0x2000 + lVar15);

+                  uVar14 = uVar21;

+                  uVar8 = HsmiBitmapNORMALLoadFromDisk

+                                    (param_1,uVar2,(ulonglong)puVar7,&local_118,

+                                     (ulonglong *)&local_e8);

+                  iVar3 = (int)uVar8;

+                  puVar19 = (undefined8 *)(uVar8 & 0xffffffff);

+                  local_16c = iVar3;

+                  HsmDbgBreakOnStatus(iVar3);

+                  if (iVar3 < 0) {

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

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

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

+                      WPP_SF_qisdild(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar14,local_110,

+                                     param_1,*param_1,(char *)(param_1 + 4));

+                    }

+                    goto LAB_3;

+                  }

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

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

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

+                    puVar7 = local_110;

+                    WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x6e,local_110,param_1,

+                                  *param_1,(char *)(param_1 + 4));

+                  }

+                }

+                uVar14 = local_d8;

+                iVar3 = (int)puVar19;

+                if (uVar18 == 3) {

+                  bVar24 = uVar2 != 0;

+                  if (bVar24) {

+                    local_c8 = 2;

+                    uVar22 = 3;

+                  }

+                  else {

+                    local_c8 = 3;

+                    uVar22 = 7;

+                  }

+                  local_150 = (ulonglong)(uVar22 & (uint)local_148);

+                  puVar6 = &`HsmBitmapGetNextLevelBlockState'::__l2::level0Masks;

+                  if (bVar24) {

+                    puVar6 = (undefined8 *)&`HsmBitmapGetNextLevelBlockState'::__l2::levelnMasks;

+                  }

+                  bVar10 = *(byte *)((longlong)puVar6 + local_150);

+                  bVar9 = *(byte *)((((ulonglong)local_148 & 0xffffffff) >> (sbyte)local_c8) +

+                                   local_118) & bVar10;

+                  if (bVar9 == bVar10) {

+                    uVar22 = 3;

+                  }

+                  else {

+                    uVar22 = 0;

+                    if ((bVar9 != 0) && (uVar22 = 4, bVar24)) {

+                      uVar22 = (*(byte *)((longlong)

+                                          &`HsmBitmapGetNextLevelBlockState'::__l2::levelnStates +

+                                         local_150) < bVar9) + 1;

+                    }

+                  }

+                  auStack_130[local_d8] = uVar22;

+                  if (iVar3 < 0) {

+                    puVar17 = WPP_GLOBAL_Control;

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

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

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

+                      uVar12 = 0x6f;

+LAB_4:

+                      puVar17 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

+                      WPP_SF_qisdqdd(puVar17,uVar12,param_1 + 4,param_1,*param_1,

+                                     (char *)(param_1 + 4));

+                    }

+LAB_5:

+                    uVar2 = HsmiBitmapTranslateIOStatus(puVar17,iVar3);

+                    puVar19 = (undefined8 *)(ulonglong)uVar2;

+                    HsmDbgBreakOnStatus(uVar2);

+                    goto LAB_3;

+                  }

+                  uVar22 = auStack_130[uVar14];

+                  if ((uVar22 == 3) ||

+                     (puVar7 = (undefined8 *)CONCAT71((int7)((ulonglong)puVar7 >> 8),bVar10),

+                     uVar22 == 0)) {

+                    uVar18 = (uint)(uVar22 == 3);

+                    local_164 = (uint)(uVar22 == 3);

+                    local_150 = (ulonglong)local_164;

+                    puVar7 = (undefined8 *)WPP_GLOBAL_Control;

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

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

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

+                      WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x70,

+                                    WPP_GLOBAL_Control,param_1,*param_1,(char *)(param_1 + 4));

+                      local_164 = (uint)local_150;

+                      uVar18 = (uint)local_150;

+                    }

+                  }

+                }

+                local_c8 = CONCAT44(local_c8._4_4_,uVar18);

+                if (uVar18 != 3) {

+                  while( true ) {

+                    if ((((longlong)local_160 <= (longlong)puVar4) ||

+                        ((-(ulonglong)(local_174 != 0) & 0xffffffffffffc010) + 0x7fe0 <=

+                         ((ulonglong)local_148 & 0xffffffff))) ||

+                       (((uint)local_148 & local_120 - 1U) == 0)) goto LAB_6;

+                    bVar24 = uVar2 != 0;

+                    if (bVar24) {

+                      local_150 = 2;

+                      uVar22 = 3;

+                    }

+                    else {

+                      local_150 = 3;

+                      uVar22 = 7;

+                    }

+                    local_88 = (undefined8 *)(ulonglong)(uVar22 & (uint)local_148);

+                    puVar7 = &`HsmBitmapGetNextLevelBlockState'::__l2::level0Masks;

+                    if (bVar24) {

+                      puVar7 = (undefined8 *)&`HsmBitmapGetNextLevelBlockState'::__l2::levelnMasks;

+                    }

+                    bVar10 = *(byte *)((((ulonglong)local_148 & 0xffffffff) >> (sbyte)local_150) +

+                                      local_118) & *(byte *)((longlong)puVar7 + (longlong)local_88);

+                    if (bVar10 == *(byte *)((longlong)puVar7 + (longlong)local_88)) {

+                      puVar7 = (undefined8 *)0x3;

+                    }

+                    else {

+                      puVar7 = puVar11;

+                      if ((bVar10 != 0) && (puVar7 = (undefined8 *)0x4, bVar24)) {

+                        puVar7 = (undefined8 *)

+                                 (ulonglong)((*(byte *)(local_88 + 0x28004583) < bVar10) + 1);

+                      }

+                    }

+                    auStack_130[local_d8] = (uint)puVar7;

+                    if (iVar3 < 0) {

+                      puVar17 = WPP_GLOBAL_Control;

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

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

+                         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_5;

+                      uVar12 = 0x71;

+                      goto LAB_4;

+                    }

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

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

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

+                      puVar7 = param_1 + 4;

+                      WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x72,puVar7,param_1,

+                                    *param_1,(char *)puVar7);

+                    }

+                    if (((uVar18 == 1) && (auStack_130[local_d8] == 0)) ||

+                       ((uVar18 == 0 && (auStack_130[local_d8] == 3)))) break;

+                    if ((auStack_130[uVar21] != 3) && (auStack_130[uVar21] != 0))

+                    goto LAB_6;

+                    if ((longlong)puVar4 < (longlong)local_100) {

+                      local_128 = local_100;

+                      puVar4 = local_100;

+                    }

+                    else {

+                      local_128 = (undefined8 *)((longlong)puVar4 + (longlong)local_d0);

+                      puVar4 = (undefined8 *)((longlong)puVar4 + (longlong)local_d0);

+                    }

+                    local_128 = puVar4;

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

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

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

+                      WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x74,puVar7,param_1,

+                                    *param_1,(char *)(param_1 + 4));

+                    }

+                    local_168 = (int)local_148 + 1;

+                    local_148 = (undefined8 *)(ulonglong)local_168;

+                  }

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

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

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

+                    WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x73,puVar7,param_1,

+                                  *param_1,(char *)(param_1 + 4));

+                  }

+                  bVar1 = true;

+LAB_6:

+                  if (((uint)local_148 & local_120 - 1U) == 0) {

+                    while ((longlong)puVar4 < (longlong)local_160) {

+                      uVar22 = local_120 + (int)local_148;

+                      puVar7 = (undefined8 *)(ulonglong)uVar22;

+                      if ((undefined8 *)

+                          ((-(ulonglong)(local_174 != 0) & 0xffffffffffffc010) + 0x7fe0) <= puVar7)

+                      goto LAB_7;

+                      uVar23 = 0xffffffff;

+                      if ((int)local_c8 != 1) {

+                        uVar23 = 0;

+                      }

+                      if (*(uint *)((((ulonglong)local_148 & 0xffffffff) >>

+                                    (3U - (local_90 != 0) & 0x3f)) + local_118) != uVar23)

+                      goto LAB_7;

+                      local_148 = (undefined8 *)(ulonglong)uVar22;

+                      local_128 = local_138;

+                      if ((longlong)local_138 <= (longlong)puVar4) {

+                        local_128 = (undefined8 *)((longlong)puVar4 + local_a8);

+                      }

+                      puVar4 = local_128;

+                      local_168 = uVar22;

+                      if (iVar3 < 0) {

+                        puVar17 = WPP_GLOBAL_Control;

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

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

+                           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_5;

+                        uVar12 = 0x75;

+                        goto LAB_4;

+                      }

+                    }

+                  }

+                }

+LAB_8:

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

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

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

+                  WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x7b,puVar7,param_1,

+                                *param_1,(char *)(param_1 + 4));

+                }

+                bVar24 = local_174 != 0;

+                local_174 = -local_174;

+                if (((ulonglong)local_148 & 0xffffffff) ==

+                    (-(ulonglong)bVar24 & 0xffffffffffffc010) + 0x7fe0) {

+                  uVar2 = uVar2 + 2;

+                }

+                if (((!bVar1) && ((longlong)puVar4 < (longlong)local_160)) &&

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

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

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

+                  WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x7c,param_1 + 4,param_1,

+                                *param_1,(char *)(param_1 + 4));

+                }

+                uVar2 = uVar2 - 1;

+                puVar13 = local_b0;

+              }

+              puVar7 = local_108;

+              if ((local_160 != (undefined8 *)0x0) && ((longlong)local_160 < (longlong)puVar4)) {

+                local_128 = local_160;

+                puVar4 = local_160;

+              }

+            }

+          }

+          if ((longlong)puVar4 < (longlong)puVar7) {

+            puVar7 = puVar4;

+          }

+          *param_6 = (longlong)puVar7;

+          *param_5 = uVar18 == 1;

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

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

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

+            WPP_SF_qisiil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),param_1 + 4,param_6,param_1,

+                          *param_1,(char *)(param_1 + 4));

+          }

+        }

+        else {

+          *param_5 = 1;

+          puVar11 = (undefined8 *)param_1[1];

+          if ((longlong)local_108 < (longlong)param_1[1]) {

+            puVar11 = local_108;

+          }

+          *param_6 = (longlong)puVar11;

+        }

+      }

+      else {

+        *param_5 = 1;

+        *param_6 = (longlong)puVar4;

+      }

+    }

+  }

+LAB_3:

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

+    FltReleasePushLockEx(param_1 + 6,0);

+  }

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

+    local_68 = local_e8;

+    uStack_60 = uStack_e0;

+    HsmIBitmapNORMALUnpinBlock((int *)&local_68);

+  }

+  return puVar19;

+LAB_7:

+  uVar22 = (uint)local_148;

+  if (((longlong)local_160 <= (longlong)puVar4) ||

+     ((-(ulonglong)(local_174 != 0) & 0xffffffffffffc010) + 0x7fe0 <=

+      ((ulonglong)local_148 & 0xffffffff))) goto LAB_8;

+  bVar24 = uVar2 != 0;

+  if (bVar24) {

+    local_c8 = (ulonglong)local_c8._4_4_ << 0x20;

+    local_138 = (undefined8 *)0x2;

+    uVar23 = 3;

+  }

+  else {

+    local_c8 = CONCAT44(local_c8._4_4_,1);

+    local_138 = (undefined8 *)0x3;

+    uVar23 = 7;

+  }

+  local_88 = (undefined8 *)(ulonglong)(uVar23 & uVar22);

+  puVar7 = &`HsmBitmapGetNextLevelBlockState'::__l2::level0Masks;

+  if (bVar24) {

+    puVar7 = (undefined8 *)&`HsmBitmapGetNextLevelBlockState'::__l2::levelnMasks;

+  }

+  bVar10 = *(byte *)((((ulonglong)local_148 & 0xffffffff) >> (sbyte)local_138) + local_118) &

+           *(byte *)((longlong)puVar7 + (longlong)local_88);

+  if (bVar10 == *(byte *)((longlong)puVar7 + (longlong)local_88)) {

+    puVar7 = (undefined8 *)0x3;

+  }

+  else {

+    puVar7 = puVar11;

+    if ((bVar10 != 0) && (puVar7 = (undefined8 *)0x4, bVar24)) {

+      puVar7 = (undefined8 *)(ulonglong)((*(byte *)(local_88 + 0x28004583) < bVar10) + 1);

+    }

+  }

+  auStack_130[uVar21] = (uint)puVar7;

+  if (iVar3 < 0) {

+    puVar17 = WPP_GLOBAL_Control;

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

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

+    goto LAB_5;

+    uVar12 = 0x77;

+    goto LAB_4;

+  }

+  if (((uVar18 == 1) && (auStack_130[uVar21] == 0)) || ((uVar18 == 0 && (auStack_130[uVar21] == 3)))

+     ) {

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

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

+    {

+      WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x78,puVar7,param_1,*param_1,

+                    (char *)(param_1 + 4));

+    }

+    bVar1 = true;

+    goto LAB_8;

+  }

+  uVar23 = auStack_130[uVar21];

+  puVar7 = (undefined8 *)(ulonglong)uVar23;

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

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

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

+    {

+      WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x7a,puVar7,param_1,*param_1,

+                    (char *)(param_1 + 4));

+    }

+    goto LAB_8;

+  }

+  if ((longlong)puVar4 < (longlong)local_100) {

+    local_128 = local_100;

+    puVar4 = local_100;

+  }

+  else {

+    local_128 = (undefined8 *)((longlong)puVar4 + (longlong)local_d0);

+    puVar4 = (undefined8 *)((longlong)puVar4 + (longlong)local_d0);

+  }

+  local_128 = puVar4;

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

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+    WPP_SF_qisdli(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x79,puVar7,param_1,*param_1,

+                  (char *)(param_1 + 4));

+    uVar22 = (uint)local_148;

+  }

+  local_168 = uVar22 + 1;

+  local_148 = (undefined8 *)(ulonglong)local_168;

+  goto LAB_7;

 }
```

## `HsmpBitmapIsReparseBufferSupported`  (modified)

```diff
--- HsmpBitmapIsReparseBufferSupported
+++ HsmpBitmapIsReparseBufferSupported
@@ -1,148 +1,263 @@
 

 int HsmpBitmapIsReparseBufferSupported(int *param_1,uint param_2)

 

 {

-  int iVar1;

-  undefined4 uVar2;

+  ushort uVar1;

+  ushort uVar2;

   uint uVar3;

-  char cVar4;

-  uint uVar5;

-  longlong lVar6;

-  ulonglong uVar7;

-  undefined4 in_register_00000014;

+  byte bVar4;

+  int iVar5;

+  uint uVar6;

+  uint uVar7;

   ulonglong uVar8;

-  longlong unaff_RBX;

-  longlong unaff_RSI;

-  uint *_Dst;

-  undefined8 unaff_RDI;

-  int iVar9;

-  ulonglong in_R8;

-  uint *puVar10;

-  uint uVar11;

-  longlong unaff_R14;

-  uint *_Src;

-  undefined4 in_XMM0_Da;

-  ulonglong local_res20;

-  ulonglong uStack0000000000000028;

-  undefined8 in_stack_00000038;

-  wchar_t *in_stack_00000040;

-  int iStack0000000000000080;

+  undefined2 uVar9;

+  byte bVar10;

+  int iVar11;

+  byte local_res8 [8];

+  byte local_res18 [8];

+  byte local_res20 [8];

   

-  if (*(longlong *)(*(longlong *)(*(longlong *)(unaff_RBX + 0x10) + 0x10) + 0x20) == unaff_R14) {

-    uVar8 = 0;

-    if (unaff_RBX != 0) {

-      lVar6 = FltGetRequestorProcess(in_XMM0_Da,CONCAT44(in_register_00000014,param_2));

-      cVar4 = HsmOsIsPassThroughModeEnabled(lVar6);

-      uVar8 = local_res20;

-      if (cVar4 != '\0') goto LAB_0;

+  bVar4 = 0;

+  bVar10 = 0;

+  local_res20[0] = 0;

+  local_res18[0] = 0;

+  uVar8 = Feature_Cldflt_BitmapNullValueCheck__private_IsEnabledDeviceUsageNoInline();

+  if (((int)uVar8 == 0) || (param_1 != (int *)0x0)) {

+    local_res8[0] = 0;

+    iVar11 = 0;

+    if (((0x17 < param_2) && (iVar11 = 1, *param_1 == 0x70527442)) &&

+       (((*(byte *)(param_1 + 3) & 2) == 0 ||

+        (iVar5 = RtlComputeCrc32(0,param_1 + 2,param_2 - 8), iVar11 = 2, param_1[1] == iVar5)))) {

+      uVar8 = 0;

+      uVar3 = param_1[2];

+      iVar11 = 3;

+      if (uVar3 <= param_2) {

+        uVar1 = *(ushort *)((longlong)param_1 + 0xe);

+        iVar11 = 4;

+        if (uVar1 != 0) {

+          iVar11 = 5;

+          if ((uint)uVar1 * 8 + 0x10 < uVar3) {

+            iVar11 = 0x10000;

+            iVar5 = 0;

+            while( true ) {

+              uVar6 = (uint)uVar1;

+              if (4 < uVar1) {

+                uVar6 = 5;

+              }

+              if (uVar6 <= (uint)uVar8) break;

+              if ((((0x11 < *(ushort *)(param_1 + uVar8 * 2 + 4)) ||

+                   (((uVar6 = param_1[uVar8 * 2 + 5], uVar6 != 0 && (uVar6 < (uint)uVar1 * 8 + 0x10)

+                     ) || (uVar3 < uVar6)))) ||

+                  ((uVar2 = *(ushort *)((longlong)param_1 + uVar8 * 8 + 0x12), uVar3 < uVar2 ||

+                   (uVar7 = uVar2 + uVar6, uVar7 < uVar6)))) || (uVar3 < uVar7)) goto LAB_0;

+              iVar11 = iVar11 + 1;

+              uVar8 = (ulonglong)((uint)uVar8 + 1);

+            }

+            uVar3 = param_1[2];

+            iVar11 = 0x20000;

+            if ((((0x17 < uVar3) && (*(ushort *)((longlong)param_1 + 0xe) != 0)) &&

+                (*(ushort *)(param_1 + 4) < 0x12)) &&

+               ((((uVar6 = param_1[5], uVar6 == 0 ||

+                  (((uint)*(ushort *)((longlong)param_1 + 0xe) * 8 + 0x10 <= uVar6 &&

+                   (uVar6 <= uVar3)))) && (*(ushort *)((longlong)param_1 + 0x12) <= uVar3)) &&

+                (((uVar7 = *(ushort *)((longlong)param_1 + 0x12) + uVar6, uVar6 <= uVar7 &&

+                  (uVar7 <= uVar3)) &&

+                 ((*(ushort *)(param_1 + 4) == 7 && (*(short *)((longlong)param_1 + 0x12) == 1))))))

+               )) {

+              memmove(local_res8,(void *)((ulonglong)(uint)param_1[5] + (longlong)param_1),1);

+              iVar11 = 0x20001;

+              if (local_res8[0] < 2) {

+                uVar3 = param_1[2];

+                iVar11 = -0x3ffffddb;

+                if ((((((uVar3 < 0x18) || (*(ushort *)((longlong)param_1 + 0xe) < 3)) ||

+                      (uVar3 < 0x28)) ||

+                     ((0x11 < *(ushort *)(param_1 + 8) ||

+                      ((uVar6 = param_1[9], uVar6 != 0 &&

+                       ((uVar6 < (uint)*(ushort *)((longlong)param_1 + 0xe) * 8 + 0x10 ||

+                        (uVar3 < uVar6)))))))) || (uVar3 < *(ushort *)((longlong)param_1 + 0x22)))

+                   || (((uVar7 = *(ushort *)((longlong)param_1 + 0x22) + uVar6, uVar7 < uVar6 ||

+                        (uVar3 < uVar7)) ||

+                       ((*(ushort *)(param_1 + 8) != 7 ||

+                        (*(short *)((longlong)param_1 + 0x22) != 1)))))) {

+                  iVar5 = -0x3ffffddb;

+                }

+                else {

+                  memmove(local_res18,(void *)((ulonglong)(uint)param_1[9] + (longlong)param_1),1);

+                  bVar4 = local_res18[0];

+                }

+                HsmDbgBreakOnStatus(iVar5);

+                if (iVar5 < 0) {

+                  HsmDbgBreakOnCorruption();

+                  HsmDbgBreakOnStatus(-0x3fff30fe);

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

+                    return -0x3fff30fe;

+                  }

+                  if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                    return -0x3fff30fe;

+                  }

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

+                    return -0x3fff30fe;

+                  }

+                  uVar9 = 0xa2;

+                  goto LAB_1;

+                }

+                if (bVar4 != 0) {

+                  uVar8 = Feature_720257338__private_IsEnabledDeviceUsageNoInline();

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

+                    if (*(ushort *)((longlong)param_1 + 0xe) < 4) {

+                      HsmDbgBreakOnCorruption();

+                      HsmDbgBreakOnStatus(-0x3fff30fe);

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

+                        return -0x3fff30fe;

+                      }

+                      if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                        return -0x3fff30fe;

+                      }

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

+                        return -0x3fff30fe;

+                      }

+                      uVar9 = 0xa4;

+                      goto LAB_1;

+                    }

+                  }

+                  else if (*(ushort *)((longlong)param_1 + 0xe) < 5) {

+                    HsmDbgBreakOnCorruption();

+                    HsmDbgBreakOnStatus(-0x3fff30fe);

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

+                      return -0x3fff30fe;

+                    }

+                    if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                      return -0x3fff30fe;

+                    }

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

+                      return -0x3fff30fe;

+                    }

+                    uVar9 = 0xa3;

+                    goto LAB_1;

+                  }

+                  if (param_1[0xd] == 0) {

+                    HsmDbgBreakOnCorruption();

+                    HsmDbgBreakOnStatus(-0x3fff30fe);

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

+                      return -0x3fff30fe;

+                    }

+                    if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                      return -0x3fff30fe;

+                    }

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

+                      return -0x3fff30fe;

+                    }

+                    uVar9 = 0xa5;

+                    goto LAB_1;

+                  }

+                  if (0x1000 < *(ushort *)((longlong)param_1 + 0x32)) {

+                    HsmDbgBreakOnCorruption();

+                    HsmDbgBreakOnStatus(-0x3fff30fe);

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

+                      return -0x3fff30fe;

+                    }

+                    if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                      return -0x3fff30fe;

+                    }

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

+                      return -0x3fff30fe;

+                    }

+                    WPP_SF_ddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xa6,

+                               &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,

+                               (uint)*(ushort *)((longlong)param_1 + 0x32));

+                    return -0x3fff30fe;

+                  }

+                }

+                if (1 < bVar4) {

+                  HsmDbgBreakOnCorruption();

+                  HsmDbgBreakOnStatus(-0x3fff30fe);

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

+                    return -0x3fff30fe;

+                  }

+                  if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                    return -0x3fff30fe;

+                  }

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

+                    return -0x3fff30fe;

+                  }

+                  WPP_SF_ddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xa7,

+                             &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,(uint)bVar4);

+                  return -0x3fff30fe;

+                }

+                uVar3 = param_1[2];

+                if (((((((0x17 < uVar3) && (1 < *(ushort *)((longlong)param_1 + 0xe))) &&

+                       (0x1f < uVar3)) && (*(ushort *)(param_1 + 6) < 0x12)) &&

+                     ((uVar6 = param_1[7], uVar6 == 0 ||

+                      (((uint)*(ushort *)((longlong)param_1 + 0xe) * 8 + 0x10 <= uVar6 &&

+                       (uVar6 <= uVar3)))))) && (*(ushort *)((longlong)param_1 + 0x1a) <= uVar3)) &&

+                   (((uVar7 = *(ushort *)((longlong)param_1 + 0x1a) + uVar6, uVar6 <= uVar7 &&

+                     (uVar7 <= uVar3)) &&

+                    ((*(ushort *)(param_1 + 6) == 7 && (*(short *)((longlong)param_1 + 0x1a) == 1)))

+                    ))) {

+                  memmove(local_res20,(void *)((ulonglong)(uint)param_1[7] + (longlong)param_1),1);

+                  bVar10 = local_res20[0];

+                  iVar11 = 0;

+                }

+                HsmDbgBreakOnStatus(iVar11);

+                if (-1 < iVar11) {

+                  if ((byte)(bVar10 - 1) < 0x14) {

+                    return iVar11;

+                  }

+                  HsmDbgBreakOnCorruption();

+                  HsmDbgBreakOnStatus(-0x3fff30fe);

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

+                    return -0x3fff30fe;

+                  }

+                  if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                    return -0x3fff30fe;

+                  }

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

+                    return -0x3fff30fe;

+                  }

+                  WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xa9,

+                            &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,(uint)bVar10);

+                  return -0x3fff30fe;

+                }

+                HsmDbgBreakOnCorruption();

+                HsmDbgBreakOnStatus(-0x3fff30fe);

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

+                  return -0x3fff30fe;

+                }

+                if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                  return -0x3fff30fe;

+                }

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

+                  return -0x3fff30fe;

+                }

+                uVar9 = 0xa8;

+                goto LAB_1;

+              }

+            }

+          }

+        }

+      }

+    }

+LAB_0:

+    HsmDbgBreakOnCorruption();

+    HsmDbgBreakOnStatus(-0x3fff30fe);

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

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

+    {

+      WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xa1,

+                &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,iVar11);

     }

   }

   else {

-LAB_0:

-    FltReleaseContext();

-    uVar8 = 0;

-  }

-  if (uVar8 == 0) {

-    return 0;

-  }

-  uStack0000000000000028 = uVar8;

-  lVar6 = FltGetRequestorProcess();

-  cVar4 = HsmOsIsPassThroughModeEnabled(lVar6);

-  if (cVar4 != '\0') goto LAB_1;

-  in_R8 = 0;

-  HsmpTracePostCallbackEnter(unaff_RSI,unaff_RDI,'\0','\x01');

-  iVar1 = *(int *)(*(longlong *)(unaff_RSI + 0x10) + 0x20);

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

-  cVar4 = HsmOsGetPlaceholderCompatMode(unaff_RSI);

-  uVar7 = HsmOsDisguisePlaceholder(cVar4,(byte)((uint)uVar2 >> 8) & 1);

-  if ((char)uVar7 != '\0') {

-    lVar6 = *(longlong *)(*(longlong *)(unaff_RSI + 0x10) + 0x28);

-    iVar9 = -1;

-    in_R8 = 0xffffffff;

-    if (iVar1 == 0x12) {

-LAB_2:

-      iVar9 = 0x20;

-      in_R8 = 0xffffffff;

-    }

-    else if (iVar1 == 0x22) {

-      iVar9 = 0x30;

-      in_R8 = 0xffffffff;

-    }

-    else if (iVar1 == 0x23) {

-      iVar9 = 0;

-      in_R8 = 4;

-    }

-    else {

-      if (iVar1 == 4) goto LAB_2;

-      if (((iVar1 == 0x44) || (iVar1 == 0x46)) || (iVar1 == 0x4d)) {

-        iVar9 = 0x38;

-        in_R8 = 0x3c;

-      }

-    }

-    if ((-1 < iVar9) &&

-       ((*(int *)(unaff_RSI + 0x18) != -0x7ffffffb ||

-        ((longlong)iVar9 + 4U <= (ulonglong)*(uint *)(*(longlong *)(unaff_RSI + 0x10) + 0x18))))) {

-      uVar5 = *(uint *)(iVar9 + lVar6) & 0xffffe9ff;

-      if (uVar5 == 0) {

-        uVar5 = 0x80;

-      }

-      *(uint *)(iVar9 + lVar6) = uVar5;

-    }

-    iVar9 = (int)in_R8;

-    if ((-1 < iVar9) &&

-       ((*(int *)(unaff_RSI + 0x18) != -0x7ffffffb ||

-        ((longlong)iVar9 + 4U <= (ulonglong)*(uint *)(*(longlong *)(unaff_RSI + 0x10) + 0x18))))) {

-      *(undefined4 *)(iVar9 + lVar6) = 0;

+    HsmDbgBreakOnStatus(-0x3fff30fe);

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

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

+    {

+      uVar9 = 0xa0;

+LAB_1:

+      WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,

+               &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,0xc000cf02);

     }

   }

-  if (iVar1 == 0x16) {

-    in_stack_00000038 = 0x540052;

-    in_stack_00000040 = L":${3D0CE612-FDEE-43f7-8ACA-957BEC0CCBA0}.";

-    _iStack0000000000000080 = *(uint **)(*(longlong *)(unaff_RSI + 0x10) + 0x28);

-    uVar5 = *(uint *)(unaff_RSI + 0x20);

-    _Src = _iStack0000000000000080;

-    _Dst = (uint *)0x0;

-    uVar11 = uVar5;

-    while (puVar10 = _Dst, _Dst = _Src, _Dst != (uint *)0x0) {

-      uVar3 = *_Dst;

-      if ((uVar3 == 0) || ((ulonglong)uVar11 < (ulonglong)uVar3 + 0x20)) {

-        _Src = (uint *)0x0;

-      }

-      else {

-        _Src = (uint *)((ulonglong)uVar3 + (longlong)_Dst);

-      }

-      uStack0000000000000028 = (ulonglong)CONCAT22((short)_Dst[1],(short)_Dst[1]);

-      in_R8 = CONCAT71((int7)(in_R8 >> 8),1);

-      cVar4 = RtlPrefixUnicodeString(&stack0x00000038);

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

-        if (_Src == (uint *)0x0) {

-          if (puVar10 == (uint *)0x0) {

-            uVar11 = (int)_Dst - iStack0000000000000080;

-          }

-          else {

-            *puVar10 = 0;

-            uVar11 = (puVar10[1] - iStack0000000000000080) + 0x18 + (int)puVar10;

-          }

-          break;

-        }

-        in_R8 = (ulonglong)((iStack0000000000000080 - (int)_Src) + uVar11);

-        uVar11 = uVar11 - *_Dst;

-        memmove(_Dst,_Src,in_R8);

-        _Src = _Dst;

-        _Dst = puVar10;

-      }

-    }

-    if (uVar11 < uVar5) {

-      in_R8 = (ulonglong)(uVar5 - uVar11);

-      memset((void *)((ulonglong)uVar11 + (longlong)_iStack0000000000000080),0,in_R8);

-      *(ulonglong *)(unaff_RSI + 0x20) = (ulonglong)uVar11;

-    }

-  }

-LAB_1:

-  if (uVar8 != 0) {

-    FltReleaseContext();

-    HsmpTracePostCallbackExit(0,unaff_RSI,in_R8,'\x01');

-  }

-  return 0;

+  return -0x3fff30fe;

 }
```

## `CldHsmNotifyPreOperation`  (modified)

```diff
--- CldHsmNotifyPreOperation
+++ CldHsmNotifyPreOperation
@@ -1,29 +1,206 @@
 

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

-

-undefined4

-CldHsmNotifyPreOperation

-          (longlong param_1,uint param_2,uint *param_3,longlong *param_4,undefined8 param_5,

-          undefined4 param_6,void *param_7,undefined *param_8,undefined8 param_9,void *param_10)

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

+

+void CldHsmNotifyPreOperation

+               (longlong param_1,uint param_2,uint *param_3,longlong *param_4,undefined8 param_5,

+               undefined4 param_6,void *param_7,undefined *param_8,undefined8 param_9,void *param_10

+               )

 

 {

-  char *in_RAX;

-  undefined4 unaff_EBX;

-  undefined8 *unaff_RSI;

-  longlong unaff_RDI;

-  undefined8 unaff_R12;

-  longlong unaff_R14;

+  bool bVar1;

+  int iVar2;

+  ulonglong uVar3;

+  undefined8 *puVar4;

+  uint *puVar5;

+  undefined8 uVar6;

+  ulonglong uVar7;

+  undefined2 uVar8;

+  uint uVar9;

+  uint *puVar10;

+  undefined *puVar12;

+  void *pvVar13;

+  longlong *plVar14;

+  longlong *plVar16;

+  uint local_res20 [2];

+  void *local_48;

+  undefined8 *local_40;

+  uint *puVar11;

+  longlong *plVar15;

   

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

-  if ((*in_RAX != '\0') && (1 < *(byte *)(param_1 + 0x29))) {

-    WPP_SF_iiqqLd(*(undefined8 *)(param_1 + 0x18),*(undefined8 *)*unaff_RSI,param_3,unaff_R12);

-  }

-  if (unaff_R14 != 0) {

-    MmUnlockPages();

-  }

-  if (unaff_RDI != 0) {

-    IoFreeMdl();

-  }

-  return unaff_EBX;

+  puVar11 = (uint *)0x0;

+  puVar10 = (uint *)0x0;

+  local_48 = (void *)0x0;

+  local_res20[0] = 0;

+  plVar15 = (longlong *)0x0;

+  plVar14 = (longlong *)0x0;

+  bVar1 = false;

+  local_40 = *(undefined8 **)(param_4[2] + 0x20);

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

+    iVar2 = -0x3fff30ee;

+    HsmDbgBreakOnStatus(-0x3fff30ee);

+    puVar5 = puVar11;

+    plVar16 = plVar15;

+  }

+  else {

+    puVar5 = puVar10;

+    plVar16 = plVar14;

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

+      iVar2 = -0x3fff30ff;

+      HsmDbgBreakOnStatus(-0x3fff30ff);

+      puVar5 = puVar11;

+      plVar16 = plVar15;

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

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

+         (puVar5 = puVar10, plVar16 = plVar14, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+        uVar8 = 0x71;

+        puVar5 = puVar11;

+        plVar16 = plVar15;

+LAB_1:

+        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar8,

+                    &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_3);

+      }

+    }

+    else {

+      if (param_4[4] == 0) {

+        iVar2 = CldStreamOpen(param_4);

+        HsmDbgBreakOnStatus(iVar2);

+        if (iVar2 < 0) {

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

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

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

+            uVar8 = 0x72;

+            puVar5 = puVar11;

+            plVar16 = plVar15;

+            goto LAB_1;

+          }

+          goto LAB_2;

+        }

+      }

+      plVar16 = (longlong *)param_4[4];

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

+        FltGetIoPriorityHint(param_3);

+      }

+      uVar7 = HsmOsGetProcessId(param_1);

+      uVar3 = HsmOsGetProcessSessionId(param_1);

+      uVar9 = (uint)uVar3;

+      puVar4 = (undefined8 *)HsmOsGetVmGuid(param_1);

+      puVar5 = CldiStreamAllocateRequest

+                         (puVar4,uVar9,(uint)uVar7,plVar16,3,param_5,param_8,param_9,0,

+                          (undefined8 *)0x0);

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

+        iVar2 = -0x3fffff66;

+        HsmDbgBreakOnStatus(-0x3fffff66);

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

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

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

+          uVar8 = 0x73;

+          goto LAB_1;

+        }

+      }

+      else {

+        puVar5[0x4c] = param_2;

+        CldiStreamCdqACQUIRE(*(longlong *)(*plVar16 + 8) + 0x90);

+        bVar1 = true;

+        uVar7 = Feature_3667029304__private_IsEnabledDeviceUsageNoInline();

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

+          pvVar13 = *(void **)(*(longlong *)*plVar16 + 0x30);

+          uVar9 = *(uint *)(*(longlong *)*plVar16 + 0x38);

+        }

+        else {

+          uVar6 = HsmCaptureFileIdentity(*param_4,&local_48,local_res20);

+          iVar2 = (int)uVar6;

+          HsmDbgBreakOnStatus(iVar2);

+          pvVar13 = local_48;

+          uVar9 = local_res20[0];

+          if (iVar2 < 0) {

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

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

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

+              uVar8 = 0x74;

+              goto LAB_1;

+            }

+            goto LAB_2;

+          }

+        }

+        uVar6 = HsmpGetStreamSize(*param_4);

+        puVar12 = *(undefined **)(*(longlong *)(*(longlong *)*plVar16 + 0x10) + 0x20);

+        uVar7 = CldSyncSendPreNotification

+                          (local_40,5,puVar12,*(longlong *)(puVar5 + 0x1c),puVar5[0x4c],

+                           *(undefined8 *)(puVar5 + 0xe),

+                           *(undefined8 *)(*(longlong *)*plVar16 + 0x28),pvVar13,uVar9,param_6,uVar6

+                           ,param_7,param_10);

+        iVar2 = (int)uVar7;

+        HsmDbgBreakOnStatus(iVar2);

+        if (iVar2 < 0) {

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

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

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

+            WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x75,

+                         &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_3);

+          }

+        }

+        else {

+          puVar10 = param_3;

+          iVar2 = CldiStreamInsertIntoCancelSafeQueue(plVar16,param_3,puVar12,puVar5);

+          HsmDbgBreakOnStatus(iVar2);

+          if (iVar2 < 0) {

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

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

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

+              WPP_SF_qqqi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x76,puVar12,param_3);

+            }

+          }

+          else {

+            CldiStreamCdqRELEASE(*(longlong *)(*plVar16 + 8) + 0x90);

+            bVar1 = false;

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

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

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

+              puVar10 = (uint *)0x77;

+              WPP_SF_qqqi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x77,puVar12,param_3);

+            }

+            puVar5 = (uint *)0x0;

+            CldiStreamStartCountdownTimer('\0',puVar10,puVar12);

+          }

+        }

+      }

+    }

+  }

+LAB_2:

+  uVar7 = Feature_3667029304__private_IsEnabledDeviceUsageNoInline();

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

+    HsmFreeFileIdentity((longlong)local_48);

+  }

+  uVar7 = Feature_2089223483__private_IsEnabledDeviceUsageNoInline();

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

+    if (bVar1) {

+      CldiStreamCdqRELEASE(*(longlong *)(*plVar16 + 8) + 0x90);

+    }

+    if ((iVar2 < 0) && (param_8 != (undefined *)0x0)) {

+      (*(code *)param_8)(param_9,iVar2,0);

+    }

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

+      return;

+    }

+    CldiStreamDeleteRequest(puVar5);

+    return;

+  }

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

+    if (!bVar1) {

+      CldiStreamCdqACQUIRE(*(longlong *)(*plVar16 + 8) + 0x90);

+      bVar1 = true;

+    }

+    CldiStreamDeleteRequest(puVar5);

+    uVar7 = Feature_4003697978__private_IsEnabledDeviceUsageNoInline();

+    if ((int)uVar7 != 0) goto LAB_3;

+  }

+  if (bVar1) {

+    CldiStreamCdqRELEASE(*(longlong *)(*plVar16 + 8) + 0x90);

+  }

+LAB_3:

+  if ((iVar2 < 0) && (param_8 != (undefined *)0x0)) {

+    (*(code *)param_8)(param_9,iVar2,0);

+  }

+  return;

 }
```

## `CldStreamQueryProgress`  (modified)

```diff
--- CldStreamQueryProgress
+++ CldStreamQueryProgress
@@ -1,226 +1,713 @@
 

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

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

 

 ulonglong CldStreamQueryProgress(uint param_1,longlong param_2,uint param_3,uint *param_4)

 

 {

-  longlong lVar1;

-  undefined8 uVar2;

-  undefined4 *puVar3;

-  uint uVar4;

-  uint uVar5;

-  char *in_RAX;

-  ulonglong uVar6;

-  undefined4 in_register_0000000c;

-  undefined2 uVar7;

-  longlong unaff_RBP;

-  uint *unaff_RSI;

-  longlong unaff_RDI;

-  longlong lVar8;

-  undefined *puVar9;

-  undefined4 *unaff_R12;

-  longlong unaff_R13;

-  undefined8 *unaff_R14;

-  longlong unaff_R15;

+  longlong *******ppppppplVar1;

+  longlong *****ppppplVar2;

+  code *pcVar3;

+  undefined4 uVar4;

+  undefined4 uVar5;

+  longlong *******ppppppplVar6;

+  char cVar7;

+  byte bVar8;

+  uint uVar9;

+  undefined4 uVar10;

+  int iVar11;

+  uint uVar12;

+  longlong lVar13;

+  longlong ******pppppplVar14;

+  longlong *****ppppplVar15;

+  longlong ****pppplVar16;

+  void *pvVar17;

+  longlong ****pppplVar18;

+  longlong ****pppplVar19;

+  ulonglong uVar20;

+  longlong **pplVar21;

+  undefined2 uVar22;

+  ulonglong uVar23;

+  longlong *****ppppplVar24;

+  longlong *plVar25;

+  longlong ******pppppplVar26;

+  longlong ******pppppplVar27;

+  uint uVar28;

+  undefined8 uVar29;

+  byte local_198 [8];

+  longlong ******local_190;

+  longlong ******local_188;

+  int local_180;

+  longlong local_178;

+  int local_170;

+  uint local_16c;

+  longlong local_168;

+  longlong *****local_160;

+  uint local_158;

+  longlong ****local_150;

+  longlong ****local_148;

+  longlong local_140;

+  longlong ******local_138;

+  longlong ******local_130;

+  longlong ******local_128;

+  longlong *****local_120;

+  int local_118;

+  uint local_114;

+  uint local_110;

+  longlong ****local_108;

+  longlong ****local_100;

+  undefined8 local_f8;

+  undefined8 uStack_f0;

+  undefined8 local_e8;

+  undefined8 uStack_e0;

+  undefined8 local_d8;

+  longlong *******ppppppplStack_d0;

+  longlong *******local_c8;

+  longlong ******local_c0;

+  undefined8 local_b8;

+  undefined8 uStack_b0;

+  undefined8 local_a8;

+  undefined8 uStack_a0;

+  undefined8 local_98;

+  undefined8 *******pppppppuStack_90;

+  undefined8 *******local_88;

+  longlong ****local_80;

+  undefined8 local_78;

+  longlong ****local_70;

+  longlong *****local_68;

+  byte *local_60;

+  longlong ****local_58;

+  longlong local_50;

+  undefined8 local_48;

+  undefined8 uStack_40;

   

-  *unaff_RSI = *unaff_RSI & (uint)in_RAX;

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

-  uVar4 = HsmpAcquireSyncOpRundownProtection(unaff_RDI,CONCAT44(in_register_0000000c,param_1));

-  HsmDbgBreakOnStatus(uVar4);

-  if ((int)uVar4 < 0) {

+  pppppplVar26 = (longlong ******)0x0;

+  pppppplVar27 = (longlong ******)0x0;

+  local_188 = (longlong ******)0x0;

+  local_170 = 0;

+  local_180 = 0;

+  local_140 = 0;

+  lVar13 = IoGetCurrentProcess();

+  local_118 = HsmOsGetProcessSessionIdFromEproccess(lVar13);

+  local_b8 = 0;

+  uStack_b0 = 0;

+  local_a8 = 0;

+  uStack_a0 = 0;

+  local_98 = 0;

+  pppppppuStack_90 = (undefined8 *******)0x0;

+  local_88 = (undefined8 *******)0x0;

+  local_f8 = 0;

+  uStack_f0 = 0;

+  local_e8 = 0;

+  uStack_e0 = 0;

+  local_d8 = 0;

+  ppppppplStack_d0 = (longlong *******)0x0;

+  local_c8 = (longlong *******)0x0;

+  local_178 = 0;

+  local_168 = 0;

+  local_148 = (longlong ****)0x0;

+  local_150 = (longlong ****)0x0;

+  local_198[0] = 0;

+  KeEnterCriticalRegion();

+  uVar9 = CldiStreamStopCountdownTimer();

+  HsmDbgBreakOnStatus(uVar9);

+  if (-1 < (int)uVar9) {

+    local_88 = &pppppppuStack_90;

+    pppppppuStack_90 = &pppppppuStack_90;

+    local_c8 = (longlong *******)&ppppppplStack_d0;

+    ppppppplStack_d0 = (longlong *******)&ppppppplStack_d0;

+    KeEnterCriticalRegion();

+    ExAcquireResourceExclusiveLite(&DAT_0,1);

+    if ((longlong ********)DAT_1[1] == &DAT_1) {

+      ppppppplStack_d0 = DAT_1;

+      local_c8 = (longlong *******)&DAT_1;

+      DAT_1[1] = (longlong ******)&ppppppplStack_d0;

+      DAT_1 = (longlong *******)&ppppppplStack_d0;

+      if ((longlong ********)*DAT_2 == &DAT_14002a798) {

+        pppppppuStack_90 = &DAT_1;

+        local_88 = DAT_2;

+        *DAT_2 = &pppppppuStack_90;

+        DAT_2 = &pppppppuStack_90;

+        ppppppplVar1 = ppppppplStack_d0;

+LAB_3:

+        do {

+          ppppppplStack_d0 = ppppppplVar1;

+          ppppppplVar6 = ppppppplStack_d0;

+          uVar12 = 0;

+          if ((undefined8 ********)ppppppplStack_d0 == &pppppppuStack_90) goto LAB_4;

+          local_130 = (longlong ******)0x0;

+          local_128 = (longlong ******)0x0;

+          (*ppppppplStack_d0)[1] = (longlong *****)&ppppppplStack_d0;

+          *local_c8 = (longlong ******)ppppppplStack_d0;

+          ppppppplVar1 = (longlong *******)*ppppppplStack_d0;

+          *ppppppplStack_d0 = (longlong ******)&ppppppplStack_d0;

+          ppppppplStack_d0[1] = (longlong ******)local_c8;

+          local_c8 = ppppppplStack_d0;

+          local_114 = *(uint *)(ppppppplStack_d0 + -5);

+        } while (local_114 == 0);

+        uVar28 = local_114 & 0xffff;

+        local_158 = *(uint *)((longlong)ppppppplStack_d0 + 0x2c);

+        local_48 = ppppppplStack_d0[3];

+        uStack_40 = ppppppplStack_d0[4];

+        local_c0 = ppppppplStack_d0[0xb];

+        if (ppppppplStack_d0[7] == (longlong ******)0x0) {

+          local_138 = ppppppplStack_d0[0xc];

+        }

+        else {

+          local_138 = (longlong ******)ppppppplStack_d0[7][5];

+        }

+        pppppplVar27 = ppppppplStack_d0[10];

+        local_190 = (longlong ******)*pppppplVar27;

+        local_120 = local_190[1];

+        pppplVar16 = local_190[2][4];

+        local_16c = uVar28;

+        local_100 = pppplVar16;

+        ppppppplStack_d0 = ppppppplVar1;

+        lVar13 = CldSyncGetSyncProviderProcess((longlong)pppplVar16);

+        local_108 = (longlong ****)(**pppppplVar27)[5];

+        if (pppppplVar27[7] == (longlong *****)0x0) {

+          uVar10 = *(undefined4 *)(ppppppplVar6 + 5);

+        }

+        else {

+          uVar10 = *(undefined4 *)(pppppplVar27[7] + 10);

+        }

+        local_160 = (longlong *****)CONCAT44(local_160._4_4_,uVar10);

+        ppppppplVar1 = ppppppplStack_d0;

+        if ((lVar13 == 0) || ((param_1 >> (uVar28 - 1 & 0x1f) & 1) == 0)) goto LAB_3;

+        iVar11 = HsmOsGetProcessSessionIdFromEproccess(lVar13);

+        cVar7 = HsmOsIsInSameSession(iVar11,(int)local_160,local_118);

+        ppppppplVar1 = ppppppplStack_d0;

+        if (cVar7 == '\0') goto LAB_3;

+        if (local_16c == 1) {

+          local_130 = ppppppplVar6[0x27];

+          local_128 = ppppppplVar6[0x28];

+        }

+        uVar20 = Feature_4003697978__private_IsEnabledDeviceUsageNoInline();

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

+          ExReleaseResourceLite(&DAT_0);

+          KeLeaveCriticalRegion();

+          lVar13 = CldSyncReferenceStream((longlong)pppplVar16,local_108,0);

+          local_140 = lVar13;

+        }

+        else {

+          uVar20 = CldiSyncReferenceRoot((longlong)pppplVar16);

+          ppppppplVar1 = ppppppplStack_d0;

+          if ((int)uVar20 < 0) goto LAB_3;

+          ExReleaseResourceLite(&DAT_0);

+          KeLeaveCriticalRegion();

+          lVar13 = CldSyncReferenceStream((longlong)pppplVar16,local_108,0);

+          local_140 = lVar13;

+          ExReleaseRundownProtection(pppplVar16 + 0xb);

+        }

+        if (lVar13 == 0) {

+LAB_5:

+          KeEnterCriticalRegion();

+          ExAcquireResourceExclusiveLite(&DAT_0,1);

+          ppppppplVar1 = ppppppplStack_d0;

+          goto LAB_3;

+        }

+        uVar20 = (ulonglong)(local_180 - 1U);

+        pppppplVar14 = pppppplVar26;

+        if (0 < (int)(local_180 - 1U)) {

+          do {

+            uVar23 = (longlong)(int)((int)uVar20 + (uint)pppppplVar14) / 2;

+            iVar11 = (int)uVar23;

+            uVar12 = iVar11 + 1;

+            if (pppppplVar27 <= local_188[(longlong)iVar11 * 2]) {

+              uVar20 = uVar23 & 0xffffffff;

+              uVar12 = (uint)pppppplVar14;

+            }

+            pppppplVar14 = (longlong ******)(ulonglong)uVar12;

+          } while ((int)uVar12 < (int)uVar20);

+        }

+        if (((int)uVar12 < local_180) &&

+           ((longlong ******)local_188[(longlong)(int)uVar12 * 2] == pppppplVar27)) {

+          ppppplVar15 = local_188[(longlong)(int)uVar12 * 2 + 1];

+          goto LAB_6;

+        }

+        if (local_180 == local_170) {

+          local_160 = (longlong *****)CONCAT44(local_160._4_4_,local_170 + 4);

+          pppppplVar14 = (longlong ******)

+                         ExAllocatePool2(0x100,(longlong)(local_170 + 4) << 4,0x67706c43);

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

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

+              memmove(pppppplVar14,local_188,(longlong)local_170 << 4);

+              ExFreePoolWithTag(local_188);

+            }

+            memset(pppppplVar14 + (longlong)local_170 * 2,0,0x40);

+            local_170 = (int)local_160;

+            local_188 = pppppplVar14;

+            goto LAB_7;

+          }

+          uVar9 = 0xc000009a;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          pppppplVar26 = local_188;

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

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

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_8;

+          uVar22 = 0x44;

+        }

+        else {

+LAB_7:

+          if ((int)uVar12 < local_180) {

+            memmove(local_188 + (longlong)(int)uVar12 * 2 + 2,local_188 + (longlong)(int)uVar12 * 2,

+                    (longlong)(int)(local_180 - uVar12) << 4);

+          }

+          pppppplVar14 = local_188 + (longlong)(int)uVar12 * 2;

+          *pppppplVar14 = (longlong *****)0x0;

+          pppppplVar14[1] = (longlong *****)0x0;

+          FltReferenceContext(**pppppplVar27);

+          *pppppplVar14 = (longlong *****)pppppplVar27;

+          local_180 = local_180 + 1;

+          ppppplVar15 = (longlong *****)ExAllocatePool2(0x100,0xc0,0x67706c43);

+          local_160 = ppppplVar15;

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

+            pppppplVar14[1] = ppppplVar15;

+            uVar12 = 1 << ((char)local_16c - 1U & 0x1f);

+            *(uint *)((longlong)ppppplVar15 + 0x44) = uVar12;

+            if ((int)local_114 < 0) {

+              uVar12 = uVar12 | 0x80000000;

+              *(uint *)((longlong)ppppplVar15 + 0x44) = uVar12;

+            }

+            if ((local_114 & 0x40000000) != 0) {

+              *(uint *)((longlong)ppppplVar15 + 0x44) = uVar12 | 0x40000000;

+            }

+            pppppplVar14 = pppppplVar26;

+            if ((local_100 != (longlong ****)0x0) && (local_100[0xc] != (longlong ***)0x0)) {

+              pppppplVar14 = (longlong ******)(ulonglong)*(uint *)(local_100[0xc] + 0x10);

+            }

+            ppppplVar15[0xd] = (longlong ****)pppppplVar14;

+            pppppplVar14 = pppppplVar26;

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

+              pppppplVar14 = (longlong ******)*local_100;

+            }

+            ppppplVar15[0xe] = (longlong ****)pppppplVar14;

+            ppppplVar15[0xf] = local_108;

+            if (local_16c - 1 < 2) {

+              pppplVar16 = *local_120;

+              uVar10 = *(undefined4 *)((longlong)pppplVar16 + 0x34);

+              uVar4 = *(undefined4 *)(pppplVar16 + 7);

+              uVar5 = *(undefined4 *)((longlong)pppplVar16 + 0x3c);

+              *(undefined4 *)(ppppplVar15 + 0x11) = *(undefined4 *)(pppplVar16 + 6);

+              *(undefined4 *)((longlong)ppppplVar15 + 0x8c) = uVar10;

+              *(undefined4 *)(ppppplVar15 + 0x12) = uVar4;

+              *(undefined4 *)((longlong)ppppplVar15 + 0x94) = uVar5;

+              ppppplVar15[0x13] = (longlong ****)(**pppppplVar27)[2][4];

+              if (local_16c == 1) {

+                cVar7 = FsRtlInitializeBaseMcbEx(ppppplVar15,1);

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

+                  cVar7 = FsRtlInitializeBaseMcbEx(ppppplVar15 + 3,1);

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

+                    pppplVar16 = (longlong ****)HsmpGetStreamSize((longlong)*local_190);

+                    ppppplVar15[0x17] = pppplVar16;

+                    goto LAB_6;

+                  }

+                  uVar9 = 0xc000009a;

+                  HsmDbgBreakOnStatus(-0x3fffff66);

+                  pppppplVar26 = local_188;

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

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

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

+                    uVar22 = 0x47;

+                    goto LAB_9;

+                  }

+                  goto LAB_8;

+                }

+                uVar9 = 0xc000009a;

+                HsmDbgBreakOnStatus(-0x3fffff66);

+                pppppplVar26 = local_188;

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

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

+                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_8;

+                uVar22 = 0x46;

+                goto LAB_9;

+              }

+            }

+LAB_6:

+            if ((ppppplVar15[9] == (longlong ****)0x0) ||

+               ((longlong)local_c0 < (longlong)ppppplVar15[9])) {

+              ppppplVar15[9] = (longlong ****)local_c0;

+            }

+            if ((longlong)ppppplVar15[10] < (longlong)local_138) {

+              ppppplVar15[10] = (longlong ****)local_138;

+            }

+            if (*(int *)(ppppplVar15 + 6) == 0) {

+              *(uint *)(ppppplVar15 + 6) = local_158;

+            }

+            *(undefined4 *)((longlong)ppppplVar15 + 0x34) = (undefined4)local_48;

+            *(undefined4 *)(ppppplVar15 + 7) = local_48._4_4_;

+            *(undefined4 *)((longlong)ppppplVar15 + 0x3c) = (undefined4)uStack_40;

+            *(undefined4 *)(ppppplVar15 + 8) = uStack_40._4_4_;

+            if (local_16c == 1) {

+              lVar13 = ((ulonglong)~*(uint *)((longlong)**pppppplVar27 + 0x1c) & 2) * 0x800;

+              uVar20 = ~(lVar13 - 1U);

+              uVar23 = uVar20 & (ulonglong)local_130;

+              lVar13 = ((longlong)local_130 + (longlong)local_128 + lVar13 + -1 & uVar20) - uVar23;

+              if ((0 < lVar13) &&

+                 (cVar7 = FsRtlAddBaseMcbEntry(ppppplVar15,uVar23,uVar23,lVar13), cVar7 == '\0')) {

+                HsmDbgBreakOnStatus(-0x3fffff66);

+                pppppplVar26 = local_188;

+                uVar9 = 0xc000009a;

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

+                   ((uVar9 = 0xc000009a, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0 &&

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

+                  uVar22 = 0x48;

+                  goto LAB_9;

+                }

+                goto LAB_8;

+              }

+              if ((lVar13 == 0) &&

+                 (pvVar17 = CldSyncGetRootInfo((longlong)local_190[2][4]), pvVar17 != (void *)0x0))

+              {

+                TlmWriteZeroRangeQueryProgress

+                          ((**pppppplVar27)[2][4],ppppplVar15[0x17],ppppplVar15[0xb],

+                           ppppplVar15[0xc],ppppplVar15[0x14],ppppplVar15[0x15],ppppplVar15[0x16],0,

+                           0,(longlong)pvVar17,0);

+                ExFreePoolWithTag(pvVar17,0x69726943);

+              }

+            }

+            CldiSyncReleaseRundown(local_140);

+            local_140 = 0;

+            goto LAB_5;

+          }

+          uVar9 = 0xc000009a;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          pppppplVar26 = local_188;

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

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

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_8;

+          uVar22 = 0x45;

+        }

+LAB_9:

+        uVar9 = 0xc000009a;

+        pppppplVar14 = local_190;

+LAB_10:

+        WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar22,

+                   &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,pppppplVar14);

+        pppppplVar26 = local_188;

+        goto LAB_8;

+      }

+    }

+    goto LAB_11;

+  }

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

+      (pppppplVar26 = pppppplVar27, (*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)) &&

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

+    WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x43,

+             &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,uVar9);

+  }

+  goto LAB_8;

+LAB_12:

+  pppppplVar27 = (longlong ******)((longlong)local_190 + local_168);

+  goto LAB_13;

+LAB_4:

+  ExReleaseResourceLite(&DAT_0,ppppppplStack_d0);

+  KeLeaveCriticalRegion();

+  pppplVar16 = (longlong ****)(longlong)local_180;

+  local_158 = local_180 * 0x90;

+  *param_4 = local_158;

+  pppppplVar27 = local_188;

+  pppppplVar14 = pppppplVar26;

+  pppplVar18 = pppplVar16;

+  if (param_3 < local_158) {

+    uVar9 = 0x801c0001;

+    HsmDbgBreakOnStatus(-0x7fe3ffff);

+    pppppplVar26 = local_188;

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

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

-    {

-      puVar9 = WPP_GLOBAL_Control;

-      HsmpGetStreamSize(unaff_RDI);

-      WPP_SF_qLiid(*(undefined8 *)(puVar9 + 0x18),0xba,

-                   &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,unaff_RDI);

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

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

+      WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x49,

+               &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,0x801c0001);

+      pppppplVar26 = local_188;

     }

-    goto LAB_0;

-  }

-  func_0x00014007c7f4();

-  FltAcquirePushLockExclusiveEx(*(longlong *)(unaff_RDI + 0x10) + 0x18,0);

-  *(undefined1 *)(unaff_RBP + -0x71) = 1;

-  uVar6 = HsmpIsPlaceholder(unaff_RDI);

-  if ((char)uVar6 == '\0') goto LAB_1;

-  lVar1 = *(longlong *)(unaff_RBP + -0x51);

-  if ((int)(*(uint *)(lVar1 + 0x28) >> 5 & 1) < *(int *)(*(longlong *)(lVar1 + 0x10) + 0x4c)) {

-    lVar8 = 1;

-    FltFlushBuffers2(*(undefined8 *)(unaff_R13 + 0x20),*(undefined8 *)(unaff_RBP + -0x59),1,0);

-    if (*(int *)(*(longlong *)(lVar1 + 0x10) + 0x4c) <=

-        (int)CONCAT71((int7)((ulonglong)unaff_R12 >> 8),(*(uint *)(lVar1 + 0x28) & 0x20) != 0))

-    goto LAB_2;

-    uVar4 = 0xc000cf14;

-    HsmDbgBreakOnStatus(-0x3fff30ec);

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

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

-    goto LAB_1;

-    uVar7 = 0xbb;

-LAB_3:

-    WPP_SF_qqiqiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar7,lVar8,

-                   *(undefined8 *)(unaff_RBP + -0x69));

   }

   else {

-LAB_2:

-    lVar8 = unaff_RBP + -0x39;

-    uVar4 = FltQueryInformationFile

-                      (*(undefined8 *)(unaff_R13 + 0x20),*(undefined8 *)(unaff_RBP + -0x59),lVar8,

-                       0x28,4);

-    HsmDbgBreakOnStatus(uVar4);

-    if ((int)uVar4 < 0) {

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

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

-         ) {

-        uVar7 = 0xbc;

-        goto LAB_3;

-      }

-    }

-    else {

-      uVar5 = (uint)*(undefined8 *)(unaff_RBP + -0x19);

-      if ((uVar5 >> 0x13 & 1) == 0) {

-        lVar8 = *(longlong *)(unaff_RBP + -0x59);

-        uVar4 = HsmpCldGetSyncPolicy(unaff_R13,unaff_RDI,lVar8,5,(uint *)(unaff_RBP + -0x6d));

-        HsmDbgBreakOnStatus(uVar4);

-        if ((int)uVar4 < 0) {

+    while (local_100 = pppplVar18, local_138 = pppppplVar27, local_130 = pppppplVar14,

+          (longlong)pppppplVar14 < (longlong)pppplVar16) {

+      ppppplVar15 = *pppppplVar27;

+      pppppplVar14 = (longlong ******)*ppppplVar15;

+      ppppplVar2 = pppppplVar27[1];

+      ppppplVar2[0xb] = ppppplVar15[6];

+      ppppplVar2[0xc] = ppppplVar15[5];

+      if ((*(uint *)((longlong)ppppplVar2 + 0x44) & 2) == 0) {

+        local_148 = (longlong ****)0x0;

+        while (pppppplVar27 = pppppplVar26, (longlong)local_148 < (longlong)ppppplVar2[0x17]) {

+          local_128 = (longlong ******)*pppppplVar14;

+          if (local_128[0x14] != (longlong *****)0x0) {

+            FltAcquirePushLockSharedEx(local_128[0x14] + 5,0);

+          }

+          ppppplVar24 = ppppplVar2 + 0x17;

+          bVar8 = (byte)(*(uint *)((longlong)local_128 + 0x1c) >> 6) & 1;

+          if (local_128[0x14][7] == (longlong ****)0x0) {

+            uVar9 = uVar12;

+            local_198[0] = bVar8;

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

+              local_150 = (longlong ****)0x7fffffffffffffff;

+            }

+            else {

+              local_150 = *ppppplVar24;

+            }

+          }

+          else {

+            local_78 = 7;

+            local_50 = 0;

+            local_70 = (longlong ****)&local_148;

+            local_60 = local_198;

+            local_58 = (longlong ****)&local_150;

+            local_80 = local_128[0x14][7];

+            local_68 = ppppplVar24;

+            uVar9 = HsmExpandKernelStackAndCallout(HsmpBitmapQueryRangeExCallout,(int *)&local_50);

+            HsmDbgBreakOnStatus(uVar9);

+            HsmDbgBreakOnStatus(uVar9);

+          }

+          HsmpReleaseBitmapLock((longlong)local_128);

+          HsmDbgBreakOnStatus(uVar9);

+          if ((int)uVar9 < 0) {

+            pppppplVar26 = local_188;

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

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

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_8;

+            uVar22 = 0x4a;

+            goto LAB_10;

+          }

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

+            local_120 = (longlong *****)((longlong)local_150 - (longlong)local_148);

+            if ((0 < (longlong)local_120) &&

+               (cVar7 = FsRtlAddBaseMcbEntry(ppppplVar2 + 3,local_148,local_148,local_120),

+               cVar7 == '\0')) {

+              uVar9 = 0xc000009a;

+              HsmDbgBreakOnStatus(-0x3fffff66);

+              pppppplVar26 = local_188;

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

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

+                  ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_8;

+              uVar22 = 0x4b;

+              goto LAB_14;

+            }

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

+               (local_120 = CldSyncGetRootInfo((longlong)pppppplVar14[2][4]),

+               local_120 != (longlong *****)0x0)) {

+              TlmWriteZeroRangeQueryProgress

+                        ((**ppppplVar15)[2][4],ppppplVar2[0x17],ppppplVar2[0xb],ppppplVar2[0xc],

+                         ppppplVar2[0x14],ppppplVar2[0x15],ppppplVar2[0x16],0,0,(longlong)local_120,

+                         1);

+              ExFreePoolWithTag(local_120,0x69726943);

+            }

+            ppppplVar2[0x16] =

+                 (longlong ****)

+                 ((longlong)local_150 + ((longlong)ppppplVar2[0x16] - (longlong)local_148));

+          }

+          local_148 = local_150;

+        }

+        while (local_190 = pppppplVar27,

+              cVar7 = FsRtlLookupBaseMcbEntry(ppppplVar2,pppppplVar27,&local_178,&local_168,0,0,0),

+              pppppplVar27 = pppppplVar26, cVar7 != '\0') {

+          if (local_168 == 0) {

+            uVar9 = 0xc000cf12;

+            HsmDbgBreakOnStatus(-0x3fff30ee);

+            pppppplVar27 = local_190;

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

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

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

+              WPP_SF_qiiiiiiiDiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4c,(**ppppplVar15)[2]

+                                  ,pppppplVar14);

+            }

+            pvVar17 = CldSyncGetRootInfo((longlong)pppppplVar14[2][4]);

+            pppppplVar26 = local_188;

+            if (pvVar17 == (void *)0x0) goto LAB_8;

+            pplVar21 = (**ppppplVar15)[2];

+            uVar29 = 2;

+            pppplVar16 = ppppplVar2[0x16];

+            pppplVar18 = ppppplVar2[0x15];

+            goto LAB_15;

+          }

+          if (local_178 != -1) {

+            ppppplVar2[0x15] = (longlong ****)((longlong)ppppplVar2[0x15] + local_168);

+          }

+          pppppplVar27 = (longlong ******)((longlong)local_190 + local_168);

+        }

+LAB_13:

+        local_190 = pppppplVar27;

+        cVar7 = FsRtlLookupBaseMcbEntry(ppppplVar2 + 3,pppppplVar27,&local_178,&local_168,0,0,0);

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

+          if (local_168 != 0) {

+            if ((local_178 == -1) ||

+               (cVar7 = FsRtlRemoveBaseMcbEntry(ppppplVar2,local_190), cVar7 != '\0'))

+            goto LAB_12;

+            uVar9 = 0xc000009a;

+            HsmDbgBreakOnStatus(-0x3fffff66);

+            pppppplVar26 = local_188;

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

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

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

+              uVar22 = 0x4e;

+LAB_14:

+              uVar9 = 0xc000009a;

+              goto LAB_10;

+            }

+            goto LAB_8;

+          }

+          uVar9 = 0xc000cf12;

+          HsmDbgBreakOnStatus(-0x3fff30ee);

+          pppppplVar27 = local_190;

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

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

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

              (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xbe,

-                         &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,

-                         *(undefined8 *)(unaff_RBP + -0x69));

-          }

-        }

-        else {

-          uVar4 = *(uint *)(unaff_RBP + -0x6d);

-          if ((*(uint *)(unaff_RDI + 0x1c) & 2) == 0) {

-            if (3 < ((byte)uVar4 & 0xf)) {

-LAB_4:

-              uVar4 = 0xc000cf20;

-              HsmDbgBreakOnStatus(-0x3fff30e0);

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

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

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

-                uVar7 = 0xbf;

-                goto LAB_3;

-              }

-              goto LAB_1;

-            }

-          }

-          else if (0x3f < (uVar4 & 0xf0)) goto LAB_4;

-          if ((*(uint *)(unaff_RDI + 0x1c) >> 0xd & 1) == 0) {

-            uVar4 = 0xc000cf08;

-            HsmDbgBreakOnStatus(-0x3fff30f8);

+            WPP_SF_qiiiiiiiDiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4d,(**ppppplVar15)[2],

+                                pppppplVar14);

+          }

+          pvVar17 = CldSyncGetRootInfo((longlong)pppppplVar14[2][4]);

+          pppppplVar26 = local_188;

+          if (pvVar17 == (void *)0x0) goto LAB_8;

+          uVar29 = 3;

+          goto LAB_16;

+        }

+        ppppplVar2[0x14] = ppppplVar2[0x15];

+        local_190 = pppppplVar26;

+        while (cVar7 = FsRtlLookupBaseMcbEntry(ppppplVar2,local_190,&local_178,&local_168,0,0,0),

+              cVar7 != '\0') {

+          if (local_168 == 0) {

+            uVar9 = 0xc000cf12;

+            HsmDbgBreakOnStatus(-0x3fff30ee);

+            pppppplVar27 = local_190;

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

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

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

                (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-              uVar7 = 0xc1;

-              goto LAB_3;

-            }

-          }

-          else {

-            FltReleasePushLockEx(*(longlong *)(unaff_RDI + 0x10) + 0x18,0);

-            *(char *)(unaff_RBP + -0x71) = (char)unaff_R12;

-            func_0x00014007c778();

-            unaff_R12 = (undefined4 *)ExAllocatePool2(0x100,0x20,0x63447348);

-            if (unaff_R12 == (undefined4 *)0x0) {

-              uVar4 = 0xc000009a;

-              HsmDbgBreakOnStatus(-0x3fffff66);

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

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

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

-                puVar9 = WPP_GLOBAL_Control;

-                HsmpGetStreamSize(unaff_RDI);

-                uVar7 = 0xc2;

-LAB_5:

-                uVar4 = 0xc000009a;

-                WPP_SF_qLiid(*(undefined8 *)(puVar9 + 0x18),uVar7,

-                             &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,unaff_RDI);

-              }

-            }

-            else {

-              uVar2 = *(undefined8 *)(unaff_RBP + -0x51);

-              lVar1 = *(longlong *)(unaff_RBP + -0x69);

-              *unaff_R12 = 0x63447348;

-              *(longlong *)(unaff_R12 + 2) = lVar1;

-              unaff_R12[7] = uVar4;

-              *(undefined8 *)(unaff_R12 + 4) = uVar2;

-              FltReferenceContext(uVar2);

-              puVar3 = *(undefined4 **)(unaff_RBP + -0x49);

-              unaff_R12[6] = *puVar3;

-              *puVar3 = 0;

-              unaff_R14 = (undefined8 *)ExAllocatePool2(0x102,0x1c);

-              if (unaff_R14 == (undefined8 *)0x0) {

-                uVar4 = 0xc000009a;

-                HsmDbgBreakOnStatus(-0x3fffff66);

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

-                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

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

-                  puVar9 = WPP_GLOBAL_Control;

-                  HsmpGetStreamSize(unaff_RDI);

-                  uVar7 = 0xc3;

-                  goto LAB_5;

-                }

-              }

-              else {

-                *unaff_R14 = 0x634e7348;

-                *(undefined4 *)(unaff_R14 + 1) = 0x18;

-                *(undefined4 *)((longlong)unaff_R14 + 0xc) = 0x10000;

-                unaff_R14[2] = 0;

-                uVar4 = HsmpComputeDehydrationReason(*(uint *)(unaff_R15 + 8));

-                if ((*(short *)((longlong)unaff_R14 + 0xe) != 0) &&

-                   (((ulonglong)*(uint *)(unaff_R14 + 1) + 3 & 0xfffffffffffffffc) + 4 < 0x1d)) {

-                  uVar5 = *(uint *)(unaff_R14 + 1) + 3 & 0xfffffffc;

-                  *(uint *)(unaff_R14 + 1) = uVar5;

-                  if (*(short *)(unaff_R14 + 2) != 0) {

-                    *(ushort *)((longlong)unaff_R14 + 0xc) =

-                         *(ushort *)((longlong)unaff_R14 + 0xc) | 1;

-                  }

-                  *(undefined4 *)(unaff_R14 + 2) = 0x4000a;

-                  *(uint *)((longlong)unaff_R14 + 0x14) = uVar5;

-                  *(uint *)((ulonglong)uVar5 + (longlong)unaff_R14) = uVar4;

-                  *(int *)(unaff_R14 + 1) = *(int *)(unaff_R14 + 1) + 4;

-                }

-                HsmpCldNotifyPreOperation

-                          (3,lVar1,0,unaff_R14,HsmiOpDehydrateNotificationCallback,unaff_R12);

-                unaff_R12 = (undefined4 *)0x0;

-                uVar4 = 0x103;

-              }

-            }

-          }

+              WPP_SF_qiiiiiiiDiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4f,(**ppppplVar15)[2]

+                                  ,pppppplVar14);

+            }

+            pvVar17 = CldSyncGetRootInfo((longlong)pppppplVar14[2][4]);

+            pppppplVar26 = local_188;

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

+              uVar29 = 4;

+LAB_16:

+              pplVar21 = (**ppppplVar15)[2];

+              pppplVar16 = ppppplVar2[0x16];

+              pppplVar18 = ppppplVar2[0x15];

+LAB_15:

+              uVar9 = 0xc000cf12;

+              TlmWriteZeroRangeQueryProgress

+                        (pplVar21[4],ppppplVar2[0x17],ppppplVar2[0xb],ppppplVar2[0xc],

+                         ppppplVar2[0x14],pppplVar18,pppplVar16,local_178,pppppplVar27,

+                         (longlong)pvVar17,uVar29);

+              ExFreePoolWithTag(pvVar17,0x69726943);

+              pppppplVar26 = local_188;

+            }

+            goto LAB_8;

+          }

+          if (local_178 != -1) {

+            ppppplVar2[0x14] = (longlong ****)((longlong)ppppplVar2[0x14] - local_168);

+          }

+          local_190 = (longlong ******)((longlong)local_190 + local_168);

+        }

+        pppplVar18 = (longlong ****)HsmpGetStreamSize((longlong)**ppppplVar15);

+        pppplVar16 = ppppplVar2[0x14];

+        if ((longlong)pppplVar18 < (longlong)ppppplVar2[0x14]) {

+          pppplVar16 = pppplVar18;

+        }

+        ppppplVar2[0x14] = pppplVar16;

+        pppplVar19 = (longlong ****)HsmpGetStreamSize((longlong)**ppppplVar15);

+        pppplVar18 = ppppplVar2[0x15];

+        pppplVar16 = local_100;

+        if ((longlong)pppplVar19 < (longlong)ppppplVar2[0x15]) {

+          pppplVar18 = pppplVar19;

         }

       }

       else {

-        uVar4 = 0xc000cf0b;

-        if ((uVar5 & 0x180000) != 0x180000) {

-          uVar4 = 0xc000cf15;

-        }

-        HsmDbgBreakOnStatus(uVar4);

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

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

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

-          uVar7 = 0xbd;

-          goto LAB_3;

-        }

+        ppppplVar2[0x14] = ppppplVar15[0xb];

+        pppplVar18 = ppppplVar15[10];

       }

+      ppppplVar2[0x15] = pppplVar18;

+      pppppplVar27 = local_138 + 2;

+      pppplVar18 = local_100;

+      pppppplVar14 = (longlong ******)((longlong)local_130 + 1);

+    }

+    ProbeForWrite(param_2,local_158,1);

+    local_110 = 0;

+    while (iVar11 = (int)pppppplVar26, pppppplVar26 = local_188, iVar11 < local_180) {

+      ppppplVar15 = local_188[(longlong)iVar11 * 2 + 1];

+      plVar25 = (longlong *)((longlong)iVar11 * 0x90 + param_2);

+      pppplVar16 = ppppplVar15[7];

+      *plVar25 = (longlong)ppppplVar15[6];

+      plVar25[1] = (longlong)pppplVar16;

+      pppplVar16 = ppppplVar15[9];

+      plVar25[2] = (longlong)ppppplVar15[8];

+      plVar25[3] = (longlong)pppplVar16;

+      pppplVar16 = ppppplVar15[0xb];

+      plVar25[4] = (longlong)ppppplVar15[10];

+      plVar25[5] = (longlong)pppplVar16;

+      pppplVar16 = ppppplVar15[0xd];

+      plVar25[6] = (longlong)ppppplVar15[0xc];

+      plVar25[7] = (longlong)pppplVar16;

+      pppplVar16 = ppppplVar15[0xf];

+      plVar25[8] = (longlong)ppppplVar15[0xe];

+      plVar25[9] = (longlong)pppplVar16;

+      pppplVar16 = ppppplVar15[0x11];

+      plVar25[10] = (longlong)ppppplVar15[0x10];

+      plVar25[0xb] = (longlong)pppplVar16;

+      pppplVar16 = ppppplVar15[0x13];

+      plVar25[0xc] = (longlong)ppppplVar15[0x12];

+      plVar25[0xd] = (longlong)pppplVar16;

+      pppplVar16 = ppppplVar15[0x15];

+      plVar25[0xe] = (longlong)ppppplVar15[0x14];

+      plVar25[0xf] = (longlong)pppplVar16;

+      pppplVar16 = ppppplVar15[0x17];

+      plVar25[0x10] = (longlong)ppppplVar15[0x16];

+      plVar25[0x11] = (longlong)pppplVar16;

+      local_110 = iVar11 + 1;

+      pppppplVar26 = (longlong ******)(ulonglong)local_110;

     }

   }

-LAB_1:

-  HsmpReleaseSyncOpRundownProtection(unaff_RDI);

-  if (*(char *)(unaff_RBP + -0x71) != '\0') {

-    func_0x00014007c778();

-    FltReleasePushLockEx(*(longlong *)(unaff_RDI + 0x10) + 0x18,0);

+LAB_8:

+  if (local_140 != 0) {

+    CldiSyncReleaseRundown(local_140);

   }

-  if (unaff_R14 != (undefined8 *)0x0) {

-    ExFreePoolWithTag(unaff_R14,0x634e7348);

+  KeEnterCriticalRegion();

+  ExAcquireResourceExclusiveLite(&DAT_0,1);

+  if (((undefined8 ********)pppppppuStack_90[1] == &pppppppuStack_90) &&

+     ((undefined8 ********)*local_88 == &pppppppuStack_90)) {

+    *local_88 = pppppppuStack_90;

+    pppppppuStack_90[1] = local_88;

+    if (((longlong ********)ppppppplStack_d0[1] == &ppppppplStack_d0) &&

+       ((longlong ********)*local_c8 == &ppppppplStack_d0)) {

+      *local_c8 = (longlong ******)ppppppplStack_d0;

+      ppppppplStack_d0[1] = (longlong ******)local_c8;

+      ExReleaseResourceLite(&DAT_0);

+      KeLeaveCriticalRegion();

+      CldiStreamRestartCountdownTimer();

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

+        lVar13 = (longlong)local_180;

+        pppppplVar27 = pppppplVar26;

+        if (0 < lVar13) {

+          do {

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

+              FltReleaseContext(***pppppplVar26);

+            }

+            ppppplVar15 = pppppplVar26[1];

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

+              if (ppppplVar15[2] != (longlong ****)0x0) {

+                FsRtlUninitializeBaseMcb(ppppplVar15);

+              }

+              if (ppppplVar15[5] != (longlong ****)0x0) {

+                FsRtlUninitializeBaseMcb(ppppplVar15 + 3);

+              }

+              ExFreePoolWithTag(ppppplVar15,0x67706c43);

+            }

+            pppppplVar26 = pppppplVar26 + 2;

+            lVar13 = lVar13 + -1;

+            pppppplVar27 = local_188;

+          } while (lVar13 != 0);

+        }

+        ExFreePoolWithTag(pppppplVar27,0x67706c43);

+      }

+      KeLeaveCriticalRegion();

+      return (ulonglong)uVar9;

+    }

   }

-  if (unaff_R12 != (undefined4 *)0x0) {

-    **(undefined4 **)(unaff_RBP + -0x49) = unaff_R12[6];

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

-      FltReleaseContext();

-    }

-    ExFreePoolWithTag(unaff_R12,0x63447348);

-  }

-LAB_0:

-  return (ulonglong)uVar4;

+LAB_11:

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

+  (*pcVar3)(3);

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

+  uVar20 = (*pcVar3)();

+  return uVar20;

 }
```

## `HsmOsCheckAppCompatPolicy`  (modified)

```diff
--- HsmOsCheckAppCompatPolicy
+++ HsmOsCheckAppCompatPolicy
@@ -1,130 +1,165 @@
 

-/* WARNING: Instruction at (ram,0x000140008021) overlaps instruction at (ram,0x000140008020)

-    */

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

 

 uint * HsmOsCheckAppCompatPolicy(undefined8 *param_1,int param_2,char *param_3)

 

 {

-  byte *pbVar1;

-  byte bVar2;

-  int iVar3;

+  uint uVar1;

+  undefined8 uVar2;

+  longlong lVar3;

   longlong lVar4;

-  uint *puVar5;

-  uint *in_RAX;

-  undefined8 uVar6;

-  undefined4 in_register_00000014;

-  longlong unaff_RBX;

+  ulonglong uVar5;

+  undefined8 *puVar6;

   uint *puVar7;

-  uint unaff_EDI;

-  char unaff_R12B;

-  uint uVar8;

-  uint *unaff_R14;

-  uint uStackX_24;

-  uint *puStack0000000000000028;

-  longlong in_stack_00000030;

+  uint *puVar8;

+  uint *puVar9;

+  bool bVar10;

+  undefined1 auStack_98 [32];

+  undefined8 local_78;

+  undefined8 uStack_70;

+  undefined8 local_68;

+  undefined8 local_60;

+  undefined8 uStack_58;

+  undefined8 local_50;

+  undefined8 uStack_48;

+  undefined8 local_40;

+  undefined8 uStack_38;

+  ulonglong local_30;

   

-  pbVar1 = (byte *)((longlong)param_1 + -0x75);

-  bVar2 = *pbVar1;

-  *pbVar1 = *pbVar1 - (byte)param_1;

-  if (bVar2 < (byte)param_1) {

-    return in_RAX;

+  local_30 = __security_cookie ^ (ulonglong)auStack_98;

+  puVar7 = (uint *)0x0;

+  bVar10 = false;

+  local_68 = 0;

+  *param_3 = '\0';

+  puVar6 = &local_78;

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

+    puVar6 = param_1;

   }

-  KeStackAttachProcess(param_1,CONCAT44(in_register_00000014,param_2),(char)param_3);

-  puVar7 = unaff_R14;

-  if (*(longlong *)(unaff_RBX + 0x10) == 0) {

-    uVar6 = PsGetCurrentProcess();

-    lVar4 = PsGetProcessWow64Process(uVar6);

-    if (lVar4 != 0) {

-      uVar6 = PsGetCurrentProcess();

-      goto LAB_0;

+  local_60 = 0;

+  uStack_58 = 0;

+  local_50 = 0;

+  uStack_48 = 0;

+  local_40 = 0;

+  uStack_38 = 0;

+  local_78 = 0;

+  uStack_70 = 0;

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

+    uVar2 = PsGetCurrentProcess();

+    puVar6[2] = uVar2;

+  }

+  lVar4 = puVar6[1];

+  if (lVar4 == 0) {

+    if ((puVar6 == (undefined8 *)0x0) || (lVar4 = puVar6[2], lVar4 == 0)) {

+      lVar4 = PsGetCurrentProcess();

     }

-    uVar6 = PsGetCurrentProcess();

-    lVar4 = PsGetProcessPeb(uVar6);

-    if (lVar4 != 0) {

-      uVar6 = PsGetCurrentProcess();

-      goto LAB_1;

+    lVar3 = PsGetCurrentProcess();

+    bVar10 = lVar4 != lVar3;

+    if (bVar10) {

+      KeStackAttachProcess(lVar4,&local_60);

     }

-  }

-  else {

-    lVar4 = PsGetProcessWow64Process();

-    uVar6 = *(undefined8 *)(unaff_RBX + 0x10);

-    if (lVar4 == 0) {

-      lVar4 = PsGetProcessPeb();

-      if (lVar4 != 0) {

-        uVar6 = *(undefined8 *)(unaff_RBX + 0x10);

+    puVar8 = puVar7;

+    puVar9 = puVar7;

+    if ((puVar6 == (undefined8 *)0x0) || (puVar6[2] == 0)) {

+      uVar2 = PsGetCurrentProcess();

+      lVar4 = PsGetProcessWow64Process(uVar2);

+      if (lVar4 == 0) {

+        uVar2 = PsGetCurrentProcess();

+        lVar4 = PsGetProcessPeb(uVar2);

+        if (lVar4 != 0) {

+          uVar2 = PsGetCurrentProcess();

+          lVar4 = PsGetProcessPeb(uVar2);

+          puVar9 = (uint *)(lVar4 + 0x2c8);

+        }

+      }

+      else {

+        uVar2 = PsGetCurrentProcess();

+        lVar4 = PsGetProcessWow64Process(uVar2);

+        puVar9 = (uint *)(lVar4 + 0x1d8);

+      }

+      if (puVar6 != (undefined8 *)0x0) goto LAB_0;

 LAB_1:

-        lVar4 = PsGetProcessPeb(uVar6);

-        puVar7 = (uint *)(lVar4 + 0x7a8);

+      uVar2 = PsGetCurrentProcess();

+      lVar4 = PsGetProcessWow64Process(uVar2);

+      if (lVar4 == 0) {

+        uVar2 = PsGetCurrentProcess();

+        lVar4 = PsGetProcessPeb(uVar2);

+        if (lVar4 != 0) {

+          uVar2 = PsGetCurrentProcess();

+          goto LAB_2;

+        }

+      }

+      else {

+        uVar2 = PsGetCurrentProcess();

+LAB_3:

+        lVar4 = PsGetProcessWow64Process(uVar2);

+        puVar8 = (uint *)(lVar4 + 0x460);

       }

     }

     else {

+      lVar4 = PsGetProcessWow64Process();

+      if (lVar4 == 0) {

+        lVar4 = PsGetProcessPeb();

+        if (lVar4 != 0) {

+          lVar4 = PsGetProcessPeb(puVar6[2]);

+          puVar9 = (uint *)(lVar4 + 0x2c8);

+        }

+      }

+      else {

+        lVar4 = PsGetProcessWow64Process(puVar6[2]);

+        puVar9 = (uint *)(lVar4 + 0x1d8);

+      }

 LAB_0:

-      lVar4 = PsGetProcessWow64Process(uVar6);

-      puVar7 = (uint *)(lVar4 + 0x460);

+      if (puVar6[2] == 0) goto LAB_1;

+      lVar4 = PsGetProcessWow64Process();

+      uVar2 = puVar6[2];

+      if (lVar4 != 0) goto LAB_3;

+      lVar4 = PsGetProcessPeb();

+      if (lVar4 == 0) goto LAB_4;

+      uVar2 = puVar6[2];

+LAB_2:

+      lVar4 = PsGetProcessPeb(uVar2);

+      puVar8 = (uint *)(lVar4 + 0x7a8);

     }

   }

-  puVar5 = unaff_R14;

-  puStack0000000000000028 = puVar7;

-  if (*(longlong *)(unaff_RBX + 0x10) == 0) {

-    uVar6 = PsGetCurrentProcess();

-    lVar4 = PsGetProcessWow64Process(uVar6);

-    if (lVar4 != 0) {

-      uVar6 = PsGetCurrentProcess();

-      goto LAB_2;

-    }

-    uVar6 = PsGetCurrentProcess();

-    lVar4 = PsGetProcessPeb(uVar6);

-    if (lVar4 == 0) goto LAB_3;

-    uVar6 = PsGetCurrentProcess();

+  else if (puVar6 == (undefined8 *)0x0) {

+    puVar9 = (uint *)&DAT_5;

+    puVar8 = (uint *)0x28;

   }

   else {

-    lVar4 = PsGetProcessWow64Process();

-    uVar6 = *(undefined8 *)(unaff_RBX + 0x10);

-    if (lVar4 != 0) {

-LAB_2:

-      lVar4 = PsGetProcessWow64Process(uVar6);

-      puVar5 = (uint *)(lVar4 + 0xb4);

-      goto LAB_3;

+    puVar9 = (uint *)(lVar4 + 0x20);

+    puVar8 = (uint *)(lVar4 + 0x28);

+  }

+LAB_4:

+  if (param_2 == 3) {

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

+      puVar7 = (uint *)puVar6[2];

     }

-    lVar4 = PsGetProcessPeb();

-    if (lVar4 == 0) goto LAB_3;

-    uVar6 = *(undefined8 *)(unaff_RBX + 0x10);

+    uVar2 = HsmiOsIsForegroundHydrator((longlong)puVar7,puVar9,puVar8,param_3);

+    uVar1 = (uint)uVar2;

   }

-  lVar4 = PsGetProcessPeb(uVar6);

-  puVar5 = (uint *)(lVar4 + 0x128);

-LAB_3:

-  if ((puVar7 != (uint *)0x0) && ((*puVar7 & 0x40) != 0)) {

-    unaff_R12B = '\x01';

-    unaff_EDI = *puVar7 >> 7 & 1;

-    uStackX_24 = unaff_EDI;

+  else {

+    if (param_2 != 0) {

+      if (param_2 == 1) {

+        uVar1 = HsmiOsIsFullHydrationEnabled(puVar9);

+        *param_3 = (char)uVar1;

+      }

+      else if (param_2 == 2) {

+        uVar1 = HsmiOsIsFullHydrationOnOpenEnabled(puVar9);

+        *param_3 = (char)uVar1;

+      }

+      else {

+        puVar7 = (uint *)0xc00000e5;

+      }

+      goto LAB_6;

+    }

+    uVar5 = HsmiOsIsHydrationDisallowed((longlong)puVar6,puVar9,puVar8,param_3);

+    uVar1 = (uint)uVar5;

   }

-  if (puVar5 != (uint *)0x0) {

-    uVar8 = (uint)unaff_R14;

-    if (*puVar5 == 2) {

-      uVar8 = 2;

-    }

-    unaff_EDI = uVar8 | unaff_EDI & 0xfffffffd;

-    uStackX_24 = unaff_EDI;

+  puVar7 = (uint *)(ulonglong)uVar1;

+LAB_6:

+  if (bVar10) {

+    KeUnstackDetachProcess(&local_60);

   }

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

-    iVar3 = func_0x000140008214();

-    if (((-1 < iVar3) && (in_stack_00000030 != 0)) && (*(longlong *)(in_stack_00000030 + 8) != 0)) {

-      bVar2 = RtlPrefixUnicodeString(&DAT_4,in_stack_00000030,1);

-      unaff_EDI = bVar2 & 1 | unaff_EDI & 0xfffffffe;

-      uStackX_24 = unaff_EDI;

-    }

-    if (puVar7 != (uint *)0x0) {

-      LOCK();

-      *puVar7 = *puVar7 | (unaff_EDI & 1) << 7 | 0x40;

-      UNLOCK();

-      unaff_EDI = uStackX_24;

-    }

-  }

-  if (in_stack_00000030 != 0) {

-    ExFreePoolWithTag(in_stack_00000030,0);

-  }

-  KeUnstackDetachProcess(&stack0x00000040);

-  return (uint *)(ulonglong)unaff_EDI;

+  return puVar7;

 }
```

## `CldiStreamPrepareRequestForNonCdqCompletion`  (modified)

```diff
--- CldiStreamPrepareRequestForNonCdqCompletion
+++ CldiStreamPrepareRequestForNonCdqCompletion
@@ -1,19 +1,45 @@
-

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

 

 char CldiStreamPrepareRequestForNonCdqCompletion(uint *param_1)

 

 {

-  char cVar1;

-  undefined8 in_RDX;

-  undefined8 in_R8;

-  int in_R9D;

-  longlong in_R11;

+  uint *puVar1;

+  longlong lVar2;

+  longlong *plVar3;

+  code *pcVar4;

+  char cVar5;

+  ulonglong uVar6;

   

-  *(undefined8 *)(in_R11 + -0x50) = in_R8;

-  *(undefined8 *)(in_R11 + -0x58) = in_RDX;

-  cVar1 = (*(code *)0x20538d49)

-                    (param_1,in_R9D + -0x2a,&WPP_028866cd16db3b910821a8d7e4c3d7b2_Traceguids);

-  return cVar1;

+  cVar5 = (char)param_1[0x1a];

+  if ((cVar5 == '\0') && (cVar5 = CldiStreamPrepareRequestForMoreProcessing(param_1), !(bool)cVar5))

+  {

+    return (bool)cVar5;

+  }

+  puVar1 = param_1 + 2;

+  lVar2 = *(longlong *)puVar1;

+  if ((*(uint **)(lVar2 + 8) == puVar1) &&

+     (plVar3 = *(longlong **)(param_1 + 4), (uint *)*plVar3 == puVar1)) {

+    *plVar3 = lVar2;

+    *(longlong **)(lVar2 + 8) = plVar3;

+    *(uint **)(param_1 + 4) = puVar1;

+    *(uint **)puVar1 = puVar1;

+    uVar6 = Feature_2089223483__private_IsEnabledDeviceUsageNoInline();

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

+      puVar1 = param_1 + 6;

+      lVar2 = *(longlong *)puVar1;

+      if ((*(uint **)(lVar2 + 8) != puVar1) ||

+         (plVar3 = *(longlong **)(param_1 + 8), (uint *)*plVar3 != puVar1)) goto LAB_0;

+      *plVar3 = lVar2;

+      *(longlong **)(lVar2 + 8) = plVar3;

+      *(uint **)(param_1 + 8) = puVar1;

+      *(uint **)puVar1 = puVar1;

+    }

+    return cVar5;

+  }

+LAB_0:

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

+  (*pcVar4)(3);

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

+  cVar5 = (*pcVar4)();

+  return cVar5;

 }
```

## `HsmiMarkFileRangeNoLock`  (modified)

```diff
--- HsmiMarkFileRangeNoLock
+++ HsmiMarkFileRangeNoLock
@@ -1,14 +1,127 @@
-

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

 

 int HsmiMarkFileRangeNoLock

               (longlong param_1,int param_2,ulonglong param_3,ulonglong param_4,byte param_5)

 

 {

-  longlong in_RAX;

+  longlong lVar1;

+  byte bVar2;

+  int iVar3;

+  longlong lVar4;

+  undefined8 *puVar5;

+  uint uVar6;

+  longlong lVar7;

+  ulonglong uVar8;

+  int local_res10 [2];

+  ulonglong local_res18;

+  ulonglong local_res20;

   

-  *(char *)(in_RAX + -0x75) = *(char *)(in_RAX + -0x75) + (char)param_1;

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

-  halt_baddata();

+  lVar1 = *(longlong *)(param_1 + 0x10);

+  lVar7 = param_1;

+  uVar8 = param_3;

+  local_res10[0] = param_2;

+  local_res18 = param_3;

+  local_res20 = param_4;

+  if (((longlong)param_3 < 1) && (lVar4 = HsmpGetStreamSize(param_1), lVar4 <= (longlong)param_4)) {

+    if (param_2 == 0x4244) {

+      uVar6 = ((uint)param_5 << 6 ^ *(uint *)(lVar7 + 0x1c)) & 0x40 ^ *(uint *)(lVar7 + 0x1c) | 0x80

+      ;

+    }

+    else if (param_2 == 0x424d) {

+      uVar6 = ((uint)param_5 << 10 ^ *(uint *)(lVar7 + 0x1c)) & 0x400 ^ *(uint *)(lVar7 + 0x1c) |

+              0x800;

+    }

+    else {

+      if (param_2 != 0x4256) goto LAB_0;

+      uVar6 = ((uint)param_5 << 8 ^ *(uint *)(lVar7 + 0x1c)) & 0x100 ^ *(uint *)(lVar7 + 0x1c) |

+              0x200;

+    }

+    *(uint *)(param_1 + 0x1c) = uVar6;

+LAB_0:

+    HsmiDeleteExternalBitmap(param_1,param_2);

+    HsmiReleaseBitmap(param_1,local_res10[0]);

+    return 0;

+  }

+  lVar4 = HsmpGetStreamSize(lVar7);

+  if (lVar4 <= (longlong)param_4) {

+    param_4 = HsmpGetStreamSize(lVar7);

+    local_res20 = param_4;

+  }

+  if ((longlong)param_4 <= (longlong)param_3) {

+    return 0;

+  }

+  puVar5 = (undefined8 *)0x0;

+  bVar2 = 0;

+  if (param_2 == 0x4244) {

+    puVar5 = *(undefined8 **)(*(longlong *)(param_1 + 0xa0) + 0x38);

+    bVar2 = *(byte *)(param_1 + 0x1c) >> 6;

+LAB_1:

+    bVar2 = bVar2 & 1;

+  }

+  else {

+    if (param_2 == 0x424d) {

+      puVar5 = *(undefined8 **)(*(longlong *)(param_1 + 0xa0) + 0x48);

+      bVar2 = (byte)(*(uint *)(param_1 + 0x1c) >> 10);

+      goto LAB_1;

+    }

+    if (param_2 == 0x4256) {

+      puVar5 = *(undefined8 **)(*(longlong *)(param_1 + 0xa0) + 0x40);

+      bVar2 = (byte)((uint)*(undefined4 *)(param_1 + 0x1c) >> 8);

+      goto LAB_1;

+    }

+  }

+  if (param_5 == 0) {

+    if ((bVar2 == 0) && (puVar5 == (undefined8 *)0x0)) {

+      return 0;

+    }

+  }

+  else if (bVar2 != 0) {

+    return 0;

+  }

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

+    iVar3 = HsmiExpandBitmapNoLock(param_1,param_2);

+    HsmDbgBreakOnStatus(iVar3);

+    if (iVar3 < 0) {

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

+        return iVar3;

+      }

+      if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+        return iVar3;

+      }

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

+        return iVar3;

+      }

+      WPP_SF_qisiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),WPP_GLOBAL_Control,uVar8,param_1,

+                    *(undefined8 *)(lVar1 + 0x20),(char *)local_res10);

+      return iVar3;

+    }

+    puVar5 = (undefined8 *)HsmiGetBitmap(param_1,local_res10[0],(byte *)0x0);

+  }

+  uVar6 = *(uint *)(puVar5 + 2);

+  if (param_5 == 0) {

+    if ((uVar6 & 7) != 0) goto LAB_2;

+    iVar3 = 2;

+  }

+  else {

+    if ((uVar6 & 7) != 0) {

+LAB_2:

+      if ((uVar6 & 7) == 1) {

+        iVar3 = HsmIBitmapVOLATILEMarkRangeEx((longlong)puVar5,&local_res18,&local_res20);

+      }

+      else {

+        iVar3 = -0x3fffff1b;

+      }

+      goto LAB_3;

+    }

+    iVar3 = 0;

+  }

+  iVar3 = HsmIBitmapNORMALMarkRangeEx(puVar5,&local_res18,&local_res20,iVar3);

+LAB_3:

+  HsmDbgBreakOnStatus(iVar3);

+  if ((((iVar3 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

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

+    WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x16,

+                 &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+  }

+  return iVar3;

 }
```

## `HsmiBitmapNORMALLookupMcbMapping`  (modified)

```diff
--- HsmiBitmapNORMALLookupMcbMapping
+++ HsmiBitmapNORMALLookupMcbMapping
@@ -1,73 +1,85 @@
 

 undefined8

 HsmiBitmapNORMALLookupMcbMapping

           (longlong param_1,ulonglong param_2,longlong param_3,longlong *param_4,undefined1 *param_5

           )

 

 {

-  longlong *plVar1;

-  char cVar2;

+  undefined8 *puVar1;

+  bool bVar2;

   undefined8 uVar3;

-  undefined8 *unaff_RBX;

-  longlong unaff_RDI;

-  undefined8 uVar4;

-  undefined4 unaff_R15D;

+  longlong lVar4;

+  longlong lVar5;

+  longlong lVar6;

+  int iVar7;

+  char cVar8;

+  longlong lVar9;

+  char cVar10;

+  char local_res18 [8];

+  longlong local_res20;

   

-  do {

-    WPP_SF_qiD(param_1,0x2a,param_3,unaff_RBX);

+  bVar2 = false;

+  cVar10 = '\x03';

+  *param_5 = 0;

+  lVar5 = *param_4;

+  lVar9 = lVar5 + param_3;

+  lVar6 = param_3;

+  cVar8 = '\x03';

+  if (param_3 < lVar9) {

     do {

-      FltReleasePushLockEx();

-      uVar4 = 0xc000cf01;

-      if ((*(uint *)(*(longlong *)**(undefined8 **)(unaff_RDI + 8) + 0x1c) & 2) == 0) {

-        CldiSyncTransferOrAckDataByObject

-                  (unaff_RDI,0,0xc000cf01,(byte)((uint)*(undefined4 *)(unaff_RBX + 5) >> 8) & 1,0,

-                   (undefined *)0xffffffffffffffff,0);

+      cVar8 = cVar10;

+      if (bVar2) break;

+      lVar9 = (lVar5 - lVar6) + param_3;

+      local_res20 = lVar9;

+      for (iVar7 = 0; iVar7 < 2; iVar7 = iVar7 + 1) {

+        local_res18[0] = '\0';

+        if (iVar7 == 0) {

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

+            lVar5 = param_1 + 0x40;

+            lVar4 = 0x70;

+LAB_0:

+            puVar1 = (undefined8 *)(lVar4 + param_1);

+            if (((undefined8 *)*puVar1 == puVar1) ||

+               (uVar3 = HsmiBitmapNORMALLookupMcbGroupMapping

+                                  (puVar1,lVar5,lVar6,&local_res20,local_res18), lVar9 = local_res20

+               , (char)uVar3 == '\0')) {

+              if (iVar7 == 1) {

+                if (cVar10 == '\x03') {

+                  lVar6 = lVar6 + lVar9;

+                }

+                goto LAB_1;

+              }

+            }

+            else {

+              if (cVar10 == '\x03') {

+                cVar10 = local_res18[0] != '\0';

+              }

+              if ((bool)local_res18[0] != (cVar10 == '\x01')) {

+LAB_1:

+                bVar2 = true;

+                break;

+              }

+              lVar6 = lVar6 + local_res20;

+            }

+          }

+        }

+        else if ((param_2 & 2) != 0) {

+          lVar5 = 0;

+          lVar4 = 0x80;

+          goto LAB_0;

+        }

       }

-      else {

-        CldiSyncTransferPlaceholdersByObject(unaff_RDI,0,0xc000cf01,0,0,(void *)0x0,0);

-      }

-      CldiSyncReleaseRundown(unaff_RDI);

-      uVar3 = 0;

-      FltAcquirePushLockExclusiveEx();

-      if (unaff_RBX[0xc] == 0) {

-LAB_0:

-        uVar4 = FltReleasePushLockEx();

-        return uVar4;

-      }

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

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

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

-        WPP_SF_qq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar3,uVar4,unaff_RBX);

-      }

-      *unaff_RBX = 0;

-      unaff_RBX[0xc] = 0;

-      *(undefined4 *)(unaff_RBX + 6) = unaff_R15D;

-      do {

-        do {

-          do {

-            unaff_RDI = RtlEnumerateGenericTableWithoutSplayingAvl(unaff_RBX + 0xe);

-            if (unaff_RDI == 0) {

-              *(undefined4 *)((longlong)unaff_RBX + 0x2c) = 0;

-              CldiSyncSetSyncStatusOnRoot((longlong)unaff_RBX,(void *)0x0,0);

-              goto LAB_0;

-            }

-            plVar1 = *(longlong **)(unaff_RDI + 8);

-          } while (plVar1 == (longlong *)0x0);

-          uVar4 = 0;

-          CldStreamSetSyncStatus(plVar1,(void *)0x0,0);

-          if ((*(uint *)(*(longlong *)*plVar1 + 0x1c) & 2) == 0) {

-            uVar4 = 0xc000cf01;

-            HsmpCompletePendedDehydrationRequests(*(longlong *)*plVar1,'\0',0xc000cf01);

-          }

-          cVar2 = func_0x00014006bb00(*(undefined8 *)(unaff_RDI + 8));

-        } while (cVar2 == '\0');

-        uVar4 = CldiSyncAcquireRundown(unaff_RDI,0,uVar4);

-      } while ((char)uVar4 == '\0');

-    } while ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

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

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

-    param_3 = (longlong)&WPP_028866cd16db3b910821a8d7e4c3d7b2_Traceguids;

-    param_1 = *(longlong *)(WPP_GLOBAL_Control + 0x18);

-  } while( true );

+      lVar5 = *param_4;

+      lVar9 = lVar5 + param_3;

+      cVar8 = cVar10;

+    } while (lVar6 < lVar9);

+  }

+  *param_5 = cVar8 == '\x01';

+  lVar5 = *param_4 + param_3;

+  if (lVar6 < *param_4 + param_3) {

+    lVar5 = lVar6;

+  }

+  *param_4 = lVar5 - param_3;

+  return CONCAT71((int7)((ulonglong)lVar9 >> 8),cVar8 != '\x03');

 }
```

## `CldStreamCdqREMOVE_IO`  (modified)

```diff
--- CldStreamCdqREMOVE_IO
+++ CldStreamCdqREMOVE_IO
@@ -1,10 +1,20 @@
-

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

 

 void CldStreamCdqREMOVE_IO(undefined8 param_1,longlong param_2)

 

 {

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

-  halt_baddata();

+  ulonglong uVar1;

+  undefined8 *puVar2;

+  

+  for (puVar2 = *(undefined8 **)(param_2 + 0x30); puVar2 != (undefined8 *)(param_2 + 0x30);

+      puVar2 = (undefined8 *)*puVar2) {

+    uVar1 = Feature_2089223483__private_IsEnabledDeviceUsageNoInline();

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

+      CldiStreamPrepareRequestForCdqCompletion((uint *)(puVar2 + -3));

+    }

+    else {

+      CldiStreamPrepareRequestForNonCdqCompletion((uint *)(puVar2 + -3));

+    }

+  }

+  return;

 }
```

## `CldiSyncTransferOrAckData`  (modified)

```diff
--- CldiSyncTransferOrAckData
+++ CldiSyncTransferOrAckData
@@ -1,14 +1,32 @@
 

 uint CldiSyncTransferOrAckData

                (longlong param_1,undefined8 param_2,uint param_3,uint param_4,char param_5,

                ulonglong param_6,undefined *param_7,longlong param_8)

 

 {

-  code *pcVar1;

-  uint uVar2;

+  uint uVar1;

+  longlong lVar2;

+  undefined8 uVar3;

+  undefined8 uVar4;

   

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

-  uVar2 = (*pcVar1)();

-  return uVar2;

+  uVar4 = 0;

+  uVar3 = param_2;

+  lVar2 = CldSyncReferenceStream(param_1,param_2,0);

+  if (lVar2 == 0) {

+    uVar1 = 0xc000cf1b;

+    HsmDbgBreakOnStatus(-0x3fff30e5);

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

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

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

+      WPP_SF_iDqiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar3,uVar4,param_2);

+    }

+  }

+  else {

+    uVar1 = CldiSyncTransferOrAckDataByObject

+                      (lVar2,(ulonglong)param_3,(ulonglong)param_4,param_5,param_6,param_7,param_8);

+    HsmDbgBreakOnStatus(uVar1);

+    CldiSyncReleaseRundown(lVar2);

+  }

+  return uVar1;

 }
```

## `HsmpCldGetSyncPolicyByPath`  (modified)

```diff
--- HsmpCldGetSyncPolicyByPath
+++ HsmpCldGetSyncPolicyByPath
@@ -1,29 +1,84 @@
 

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

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

 

 uint HsmpCldGetSyncPolicyByPath(longlong param_1,ushort *param_2,uint *param_3)

 

 {

-  char *pcVar1;

-  code *pcVar2;

-  char in_AL;

-  char cVar3;

-  undefined7 in_register_00000001;

-  char cVar4;

+  undefined8 uVar1;

+  uint uVar2;

+  uint uVar3;

+  longlong lVar4;

+  longlong lVar5;

+  longlong local_res8;

+  longlong local_res18;

+  longlong local_res20;

   

-  cVar4 = (char)param_1;

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

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

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

-  *pcVar1 = *pcVar1 + cVar4;

-  cVar3 = in_AL + '\x03';

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

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

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

-  *pcVar1 = *pcVar1 + cVar4;

-  pcVar2 = (code *)swi(0xfd);

-  (*pcVar2)();

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

-  halt_baddata();

+  local_res20 = 0;

+  lVar5 = 0;

+  local_res18 = 0;

+  local_res8 = 0;

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

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

+  *param_3 = uVar2;

+  lVar4 = (*DAT_1)(uVar1,param_2);

+  if (lVar4 != 0) {

+    return 0;

+  }

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

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

+    WPP_SF_i(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x24,

+             &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+  }

+  uVar2 = HsmiCldOpenSyncRoot(param_1,param_2,&local_res20,&local_res18);

+  HsmDbgBreakOnStatus(uVar2);

+  lVar4 = local_res18;

+  if ((int)uVar2 < 0) {

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

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

+    {

+      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x25,

+                &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+      lVar5 = 0;

+    }

+  }

+  else {

+    if (local_res18 == 0) {

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

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

+         ) {

+        WPP_SF_i(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x26,

+                 &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+        lVar5 = 0;

+      }

+      goto LAB_2;

+    }

+    uVar2 = HsmiCldLoadSyncRootInfoByFileObject(param_1,local_res18,&local_res8);

+    HsmDbgBreakOnStatus(uVar2);

+    lVar5 = local_res8;

+    if ((int)uVar2 < 0) {

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

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

+         ) {

+        WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x27,

+                  &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+        lVar5 = local_res8;

+      }

+    }

+    else {

+      uVar3 = HsmiCldBuildSyncPolicy(local_res8);

+      *param_3 = uVar3;

+    }

+  }

+  if (lVar4 != 0) {

+    ObfDereferenceObject(lVar4);

+  }

+LAB_2:

+  if (local_res20 != 0) {

+    FltClose();

+  }

+  if (lVar5 != 0) {

+    ExFreePoolWithTag(lVar5,0x69537348);

+  }

+  return uVar2;

 }
```

## `HsmiRecallInitiateHydration`  (modified)

```diff
--- HsmiRecallInitiateHydration
+++ HsmiRecallInitiateHydration
@@ -1,23 +1,367 @@
 

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

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

 

 undefined1 HsmiRecallInitiateHydration(longlong param_1,undefined8 param_2,undefined8 param_3)

 

 {

-  undefined1 unaff_BL;

-  longlong unaff_RSI;

-  undefined *puVar1;

-  unkbyte10 in_ST0;

-  undefined8 uStack0000000000000028;

+  uint *puVar1;

+  char cVar2;

+  longlong lVar3;

+  uint uVar4;

+  int iVar5;

+  uint uVar6;

+  longlong lVar7;

+  undefined *puVar8;

+  ulonglong uVar9;

+  longlong lVar10;

+  ulonglong uVar11;

+  longlong *plVar12;

+  ulonglong *puVar13;

+  ulonglong *puVar14;

+  longlong *plVar15;

+  undefined8 uVar16;

+  longlong *plVar17;

+  ulonglong *puVar18;

+  undefined1 uVar19;

+  undefined *puVar20;

+  byte local_res8 [8];

+  char local_res10;

+  char local_res18;

+  char local_res20;

+  ulonglong in_stack_fffffffffffffe68;

+  undefined8 in_stack_fffffffffffffe70;

+  undefined4 uVar21;

+  longlong local_100;

+  uint local_f8;

+  ulonglong local_f0;

+  undefined8 local_e8;

+  uint local_e0;

+  longlong local_d8;

+  undefined8 local_d0;

+  longlong *local_c8;

+  longlong local_c0;

+  longlong *local_b8;

+  ulonglong *local_b0;

+  ulonglong local_a8;

+  longlong local_a0;

+  ulonglong local_98;

+  longlong *local_90;

+  longlong local_88;

+  ulonglong local_80;

+  longlong *local_78;

+  ulonglong local_70;

+  longlong local_68;

+  ulonglong *local_60;

+  longlong local_58;

   

-  *(unkbyte10 *)(param_1 + 0x68) = in_ST0;

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

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-    puVar1 = WPP_GLOBAL_Control;

-    uStack0000000000000028 = HsmpGetStreamSize(unaff_RSI);

-    WPP_SF_qLiid(*(undefined8 *)(puVar1 + 0x18),0x25,

-                 &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,unaff_RSI);

-  }

-  return unaff_BL;

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

+  puVar13 = (ulonglong *)0x0;

+  local_60 = (ulonglong *)0x0;

+  local_d8 = 0;

+  local_98 = 0;

+  local_e0 = 0;

+  local_res10 = '\0';

+  local_res18 = '\0';

+  local_res20 = '\0';

+  local_f8 = 0;

+  local_68 = 0;

+  puVar18 = puVar13;

+  if ((*(uint *)(param_1 + 0x30) & 0x200) == 0) {

+    puVar18 = *(ulonglong **)(param_1 + 0x18);

+  }

+  local_c0 = *(longlong *)(param_1 + 0x70);

+  lVar3 = *(longlong *)(param_1 + 0x78);

+  local_a0 = *(longlong *)(lVar3 + 0x10);

+  local_e8 = *(undefined8 *)(local_a0 + 0x20);

+  local_d0 = *(undefined8 *)(local_a0 + 0x10);

+  local_b0 = puVar13;

+  if (local_c0 != 0) {

+    local_b0 = *(ulonglong **)(local_c0 + 0x48);

+  }

+  local_58 = *(longlong *)(param_1 + 0x68);

+  if ((local_b0 == (ulonglong *)0x0) && (puVar18 != (ulonglong *)0x0)) {

+    local_b0 = HsmpCreateProcessInfo(local_58);

+    local_60 = local_b0;

+  }

+  HsmpAcquireReparseUpdateLock(lVar3,'\0');

+  HsmpAcquireBitmapLock(lVar3,'\0');

+  local_100 = HsmpGetStreamSize(lVar3);

+  LOCK();

+  *(int *)(param_1 + 0x34) = *(int *)(param_1 + 0x34) + 1;

+  UNLOCK();

+  if (local_100 <= *(longlong *)(param_1 + 0x48)) goto LAB_0;

+  if (((puVar18 != (ulonglong *)0x0) &&

+      (cVar2 = *(char *)(puVar18[2] + 4), puVar13 = (ulonglong *)0x0,

+      cVar2 == '\x03' || cVar2 == '\x04')) && (*(char *)(puVar18[2] + 5) != '\x02')) {

+    uVar4 = FltLockUserBuffer(puVar18);

+    puVar13 = (ulonglong *)(ulonglong)uVar4;

+    HsmDbgBreakOnStatus(uVar4);

+    if ((int)uVar4 < 0) {

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

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

+         ) {

+        WPP_SF_qqqqLiqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x21,WPP_GLOBAL_Control,param_1)

+        ;

+      }

+    }

+    else {

+      uVar9 = puVar18[2];

+      if (((*(char *)(uVar9 + 4) == '\x03') && (*(char *)(uVar9 + 5) != '\x02')) &&

+         (((*(uint *)(param_1 + 0x28) >> 8 & 1) == 0 &&

+          (((byte)*(uint *)(param_1 + 0x28) & 0xf) < 3)))) {

+        local_98 = *(ulonglong *)(uVar9 + 0x28);

+        lVar10 = *(longlong *)(uVar9 + 0x38);

+        local_res10 = '\x01';

+        if ((*(byte *)(lVar10 + 10) & 5) == 0) {

+          param_3 = 1;

+          local_d8 = MmMapLockedPagesSpecifyCache

+                               (lVar10,0,1,0,in_stack_fffffffffffffe68 & 0xffffffff00000000,

+                                CONCAT44(uVar21,0x40000010));

+        }

+        else {

+          local_d8 = *(longlong *)(lVar10 + 0x18);

+        }

+        if (local_d8 == 0) {

+          puVar13 = (ulonglong *)0xc000009a;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) goto LAB_0;

+          if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) goto LAB_0;

+          if ((byte)WPP_GLOBAL_Control[0x29] < 2) goto LAB_0;

+          WPP_SF_qqqqLiqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x22,param_3,param_1);

+          goto LAB_0;

+        }

+        local_e0 = *(uint *)(*(longlong *)(puVar18[2] + 0x38) + 0x28);

+      }

+    }

+  }

+  do {

+    uVar4 = *(uint *)(param_1 + 0x30) >> 6 & 7;

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

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

+    {

+      WPP_SF_qqllcclqqLiqiii

+                (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x23,*(undefined8 *)(param_1 + 0x48),

+                 param_1);

+    }

+    uVar6 = *(uint *)(lVar3 + 0x1c);

+    *(uint *)(param_1 + 0x30) = *(uint *)(param_1 + 0x30) & 0xffffffdf;

+    uVar9 = (ulonglong)(~uVar6 & 2);

+    local_f0 = ~-(ulonglong)((uVar6 & 2) != 0) & 0xfffffffffffff000 & *(ulonglong *)(param_1 + 0x48)

+    ;

+    local_78 = (longlong *)

+               (*(longlong *)(param_1 + 0x50) + -1 + uVar9 * 0x800 + *(ulonglong *)(param_1 + 0x48)

+               & uVar9 * -0x800);

+    local_70 = local_f0;

+    if ((longlong)local_f0 < (longlong)local_78) {

+      do {

+        if (local_100 <= (longlong)local_f0) break;

+        puVar14 = &local_f0;

+        local_res8[0] = 0;

+        local_88 = 0;

+        local_a8 = 0;

+        local_c8 = (longlong *)0x0;

+        local_b8 = (longlong *)0x0;

+        iVar5 = 0x4244;

+        if (uVar4 != 1) {

+          iVar5 = 0x4256;

+        }

+        uVar6 = HsmiQueryFileRangeNoLock(lVar3,iVar5,puVar14,&local_100,local_res8,&local_b8);

+        puVar13 = (ulonglong *)(ulonglong)uVar6;

+        HsmDbgBreakOnStatus(uVar6);

+        if ((int)uVar6 < 0) {

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

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

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

+            WPP_SF_qqqqLiqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x24,puVar14,local_e8);

+          }

+          goto LAB_1;

+        }

+        plVar17 = local_b8;

+        if ((longlong)local_78 < (longlong)local_b8) {

+          plVar17 = local_78;

+        }

+        local_90 = plVar17;

+        if (local_res8[0] == 0) {

+          local_res20 = '\x01';

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

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

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

+            WPP_SF_qqllcclqqLiqiii

+                      (*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x25,

+                       *(undefined8 *)(param_1 + 0x48),param_1);

+          }

+          lVar10 = local_d8;

+          if (local_d8 != 0) {

+            uVar9 = *(ulonglong *)(puVar18[2] + 0x28);

+            uVar11 = uVar9;

+            if ((longlong)uVar9 < (longlong)local_f0) {

+              uVar11 = local_f0;

+            }

+            local_88 = uVar11 - uVar9;

+          }

+          if ((((*(uint *)(param_1 + 0x28) & 0x100) != 0) &&

+              (lVar7 = IoGetTopLevelIrp(), lVar7 != 0)) && (*(char *)(puVar18[2] + 4) != -1)) {

+            puVar13 = (ulonglong *)0xc00000e5;

+            HsmDbgBreakOnStatus(-0x3fffff1b);

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

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              WPP_SF_qqLiqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x26,

+                              &WPP_7b493afee855349cd64b6fd5ca5bddac_Traceguids,local_d0);

+              puVar13 = (ulonglong *)0xc00000e5;

+            }

+            goto LAB_1;

+          }

+          LOCK();

+          *(int *)(param_1 + 0x34) = *(int *)(param_1 + 0x34) + 1;

+          UNLOCK();

+          local_80 = local_f0;

+          if (lVar10 != 0) {

+            local_a8 = local_98;

+            if ((longlong)local_98 < (longlong)local_f0) {

+              local_a8 = local_f0;

+            }

+            local_c8 = local_90;

+            if ((longlong)(local_98 + local_e0) < (longlong)local_90) {

+              local_c8 = (longlong *)(local_98 + local_e0);

+            }

+          }

+          if (local_c0 != 0) {

+            TlmInitializeCorrelationVector(local_c0,(undefined8 *)0x0);

+          }

+          plVar17 = local_90;

+          puVar1 = (uint *)(param_1 + 0x2c);

+          uVar6 = *puVar1;

+          if (uVar4 == 1) {

+            local_f8 = 0;

+            *puVar1 = uVar6 | 0x20;

+            uVar6 = uVar6 & 0xffffffbf | 0x20;

+          }

+          else {

+            if ((uVar6 & 0x20) == 0) {

+              local_f8 = 1;

+            }

+            uVar6 = uVar6 | 0x40;

+          }

+          *puVar1 = uVar6;

+          if (((byte)*(undefined4 *)(param_1 + 0x30) & 0x1f) == 4) {

+LAB_2:

+            local_f8 = local_f8 | 2;

+            if (local_c0 != 0) goto LAB_3;

+LAB_4:

+            puVar8 = *(undefined **)(lVar3 + 0x68);

+          }

+          else {

+            if (local_c0 == 0) goto LAB_4;

+            if ((*(uint *)(local_c0 + 0x28) & 0x400) != 0) goto LAB_2;

+LAB_3:

+            puVar8 = *(undefined **)(local_c0 + 0x60);

+          }

+          puVar20 = &DAT_5;

+          if (puVar8 != (undefined *)0x0) {

+            puVar20 = puVar8;

+          }

+          plVar15 = &local_68;

+          if (((byte)*(undefined4 *)(param_1 + 0x28) & 0xf) < 3) {

+            plVar15 = (longlong *)0x0;

+          }

+          plVar12 = (longlong *)0x0;

+          if ((longlong)local_90 < (longlong)local_b8) {

+            plVar12 = local_90;

+          }

+          iVar5 = (int)local_c8 - (int)local_a8;

+          local_c8 = (longlong *)CONCAT44(local_c8._4_4_,iVar5);

+          local_80 = local_f0;

+          (*DAT_6)(local_58,puVar18,*(undefined8 *)(lVar3 + 8),param_1 + 0x58,local_f8,

+                           local_f0,(longlong)local_90 - local_f0,plVar12,

+                           (longlong)local_b8 - (longlong)local_90,*(undefined4 *)(param_1 + 0x2c),

+                           local_d8 + local_88,local_a8,iVar5,HsmiRecallHydrationCompletionCallback,

+                           *(undefined8 *)(param_1 + 0xa0),*(undefined4 *)(param_1 + 0xa8),param_1,

+                           plVar15,local_b0,puVar20);

+          *(uint *)(param_1 + 0x30) = *(uint *)(param_1 + 0x30) | 0x20;

+        }

+        else {

+          local_res18 = '\x01';

+        }

+        uVar9 = (ulonglong)(~*(uint *)(lVar3 + 0x1c) & 2);

+        local_f0 = uVar9 * 0x800 + -1 + (longlong)plVar17 & uVar9 * -0x800;

+      } while ((longlong)local_f0 < (longlong)local_78);

+    }

+    uVar9 = local_70;

+    plVar17 = local_78;

+    if (((local_res10 == '\0') || (local_res18 == '\0')) || (local_res20 == '\0')) {

+LAB_0:

+      if (-1 < (int)puVar13) goto LAB_7;

+LAB_1:

+      uVar19 = 0;

+    }

+    else {

+      uVar16 = 0;

+      plVar15 = (longlong *)(param_1 + 0x80);

+      iVar5 = 0x4244;

+      if (uVar4 != 1) {

+        iVar5 = 0x4256;

+      }

+      lVar10 = HsmiGetBitmap(lVar3,iVar5,(byte *)0x0);

+      uVar4 = HsmpBitmapCreateSnapshot(uVar9,(longlong)plVar17,uVar16,lVar10,plVar15);

+      puVar13 = (ulonglong *)(ulonglong)uVar4;

+      HsmDbgBreakOnStatus(uVar4);

+      if ((int)uVar4 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          WPP_SF_qqqqLiqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x27,uVar16,local_e8);

+        }

+        goto LAB_1;

+      }

+LAB_7:

+      if ((*(uint *)(param_1 + 0x30) & 0x20) == 0) goto LAB_1;

+      uVar19 = 1;

+    }

+    lVar10 = 0;

+    if ((((int)puVar13 < 0) || (((byte)*(undefined4 *)(param_1 + 0x28) & 0xf) != 2)) ||

+       ((*(uint *)(param_1 + 0x30) & 0x200) == 0)) break;

+    LOCK();

+    iVar5 = *(int *)(param_1 + 0x34);

+    if (iVar5 == 0) {

+      *(int *)(param_1 + 0x34) = 0;

+      iVar5 = 0;

+    }

+    UNLOCK();

+    if (iVar5 != 1) break;

+    uVar4 = *(uint *)(param_1 + 0x30);

+    if (((uVar4 & 0x1c0) == 0x40) && ((*(uint *)(param_1 + 0x28) & 0x100) != 0)) {

+      *(uint *)(param_1 + 0x30) = (uVar4 + 0x40 ^ uVar4) & 0x1c0 ^ uVar4;

+    }

+    else {

+      if ((*(longlong *)(param_1 + 0x48) < local_100) || ((uVar4 >> 10 & 1) != 0)) {

+        lVar10 = *(longlong *)(param_1 + 0x50) + *(longlong *)(param_1 + 0x48);

+      }

+      else {

+        uVar4 = uVar4 | 0x400;

+        *(uint *)(param_1 + 0x30) = uVar4;

+      }

+      *(longlong *)(param_1 + 0x48) = lVar10;

+      lVar7 = local_100;

+      if (lVar10 + 0x1000 < local_100) {

+        lVar7 = lVar10 + 0x1000;

+      }

+      *(longlong *)(param_1 + 0x50) = lVar7 - lVar10;

+      if (lVar10 < local_100) {

+        *(uint *)(param_1 + 0x2c) = *(uint *)(param_1 + 0x2c) & 0xffffffdf;

+        *(uint *)(param_1 + 0x30) = uVar4 & 0xfffffe7f | 0x40;

+      }

+    }

+  } while (*(longlong *)(param_1 + 0x48) < local_100);

+  HsmpReleaseBitmapLock(lVar3);

+  FltReleasePushLockEx(*(longlong *)(lVar3 + 0x10) + 0x18,0);

+  HsmiRecallHydrationCompletionCallback(param_1,(int)puVar13);

+  if (local_68 != 0) {

+    KeSetEvent(local_68,0,0);

+  }

+  if (local_60 != (ulonglong *)0x0) {

+    ExFreePoolWithTag(local_60,0x69507348);

+  }

+  return uVar19;

 }
```

## `HsmiOpSetPinStateInternal`  (modified)

```diff
--- HsmiOpSetPinStateInternal
+++ HsmiOpSetPinStateInternal
@@ -1,13 +1,94 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 int HsmiOpSetPinStateInternal(longlong param_1,undefined8 param_2,uint param_3,uint param_4)

 

 {

-  byte *pbVar1;

-  int in_EAX;

-  undefined4 in_register_00000004;

+  uint uVar1;

+  int iVar2;

+  undefined2 uVar3;

+  uint uVar4;

+  undefined1 auStack_88 [32];

+  undefined8 local_68;

+  int local_60;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  undefined8 local_48;

+  undefined8 local_40;

+  uint local_38;

+  undefined4 local_34;

+  ulonglong local_30;

   

-  pbVar1 = (byte *)(CONCAT44(in_register_00000004,in_EAX) + -0x73);

-  *pbVar1 = *pbVar1 ^ (byte)param_1;

-  return in_EAX;

+  local_30 = __security_cookie ^ (ulonglong)auStack_88;

+  uVar4 = 0x80000;

+  if ((param_3 & 0x80000) == 0) {

+    uVar1 = -(uint)((param_3 & 0x100000) != 0) & 2;

+  }

+  else {

+    uVar1 = (-(uint)((param_3 & 0x100000) != 0) & 2) + 1;

+  }

+  if (uVar1 == param_4) {

+    return 0;

+  }

+  local_34 = 0;

+  if ((int)param_4 < 0) {

+    iVar2 = HsmpPrepareForMgmtOperation(param_1,param_2,8,'\0');

+    HsmDbgBreakOnStatus(iVar2);

+    if (iVar2 < 0) {

+      if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+        return iVar2;

+      }

+      if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+        return iVar2;

+      }

+      if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+        return iVar2;

+      }

+      uVar3 = 0x2e;

+      goto LAB_0;

+    }

+  }

+  local_40 = 0;

+  local_48 = 0;

+  uVar1 = param_4 & 0xffff;

+  local_58 = 0;

+  uStack_50 = 0;

+  if (uVar1 != 1) {

+    if (uVar1 == 2) {

+      uVar4 = 0x100000;

+    }

+    else {

+      uVar4 = 0;

+      if (uVar1 == 3) {

+        uVar4 = 0x180000;

+      }

+    }

+  }

+  local_68 = CONCAT44(local_68._4_4_,4);

+  local_38 = param_3 & 0xffe7ffff | uVar4;

+  if (local_38 == 0) {

+    local_38 = 0x80;

+  }

+  iVar2 = FltSetInformationFile(*(undefined8 *)(param_1 + 0x20),param_2,&local_58,0x28);

+  HsmDbgBreakOnStatus(iVar2);

+  if (-1 < iVar2) {

+    return iVar2;

+  }

+  if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+    return iVar2;

+  }

+  if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+    return iVar2;

+  }

+  if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+    return iVar2;

+  }

+  uVar3 = 0x2f;

+LAB_0:

+  local_68 = param_2;

+  local_60 = iVar2;

+  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar3,

+             &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,param_1);

+  return iVar2;

 }
```

## `HsmiCompleteBitmapCommit`  (modified)

```diff
--- HsmiCompleteBitmapCommit
+++ HsmiCompleteBitmapCommit
@@ -1,10 +1,18 @@
-

-/* WARNING: Control flow encountered bad instruction data */

 

 void HsmiCompleteBitmapCommit(longlong param_1,int param_2,int param_3,longlong param_4)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  longlong *plVar1;

+  

+  if (param_4 != 0) {

+    if (-1 < param_3) {

+      plVar1 = (longlong *)HsmiGetBitmap(param_1,param_2,(byte *)0x0);

+      if ((*(uint *)(plVar1 + 2) & 7) == 0) {

+        HsmIBitmapNORMALCompleteCommit(plVar1);

+      }

+    }

+    ExFreePoolWithTag(param_4,0x70527348);

+  }

+  return;

 }
```

## `CldiStreamSignalEvents`  (modified)

```diff
--- CldiStreamSignalEvents
+++ _tlgKeywordOn
@@ -1,46 +1,14 @@
 

-void CldiStreamSignalEvents(char param_1,undefined8 param_2,undefined8 param_3)

+undefined1 _tlgKeywordOn(longlong param_1,ulonglong param_2)

 

 {

-  char cVar1;

-  undefined8 *puVar2;

+  undefined1 uVar1;

   

-  if (param_1 == '\0') {

-    KeClearEvent();

+  if ((param_2 == 0) ||

+     ((uVar1 = 0, (*(ulonglong *)(param_1 + 0x10) & param_2) != 0 &&

+      (uVar1 = 0, (*(ulonglong *)(param_1 + 0x18) & param_2) == *(ulonglong *)(param_1 + 0x18))))) {

+    uVar1 = 1;

   }

-  else {

-    param_3 = 0;

-    KeSetEvent(DAT_0,0);

-  }

-  puVar2 = DAT_1;

-  if (DAT_2 == 0) {

-    cVar1 = DAT_3;

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-       (4 < (byte)WPP_GLOBAL_Control[0x29])) {

-      WPP_SF_(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),10,

-              &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids);

-      cVar1 = DAT_3;

-    }

-  }

-  else {

-    for (; (undefined8 **)puVar2 != &DAT_1; puVar2 = (undefined8 *)*puVar2) {

-      if (param_1 == '\0') {

-        ZwResetEvent(puVar2[4],0);

-      }

-      else {

-        ZwSetEvent();

-      }

-    }

-    cVar1 = param_1;

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        (cVar1 = param_1, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-       (cVar1 = param_1, 4 < (byte)WPP_GLOBAL_Control[0x29])) {

-      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xb,param_3,DAT_2);

-      cVar1 = param_1;

-    }

-  }

-  DAT_3 = cVar1;

-  return;

+  return uVar1;

 }
```

## `HsmFltPreSetRenameInformation`  (modified)

```diff
--- HsmFltPreSetRenameInformation
+++ HsmFltPreSetRenameInformation
@@ -1,56 +1,645 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 int HsmFltPreSetRenameInformation

               (longlong param_1,longlong param_2,ulonglong param_3,longlong param_4,longlong param_5

               ,undefined8 *param_6)

 

 {

-  longlong lVar1;

-  int iVar2;

-  ulonglong in_RAX;

-  byte *pbVar3;

-  undefined2 uVar4;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  uint unaff_R15D;

-  undefined4 in_stack_00000020;

-  longlong *in_stack_00000038;

+  ushort uVar1;

+  uint *puVar2;

+  char cVar3;

+  ushort uVar4;

+  uint uVar5;

+  int iVar6;

+  ulonglong uVar7;

+  longlong lVar8;

+  short sVar9;

+  undefined8 uVar10;

+  ulonglong uVar11;

+  undefined2 uVar12;

+  ulonglong uVar13;

+  int iVar14;

+  uint uVar15;

+  void *_Dst;

+  undefined8 *puVar16;

+  undefined1 auStackY_2c8 [32];

+  char local_248;

+  char local_247;

+  uint local_244;

+  ulonglong local_240;

+  uint local_238 [2];

+  ulonglong local_230;

+  uint local_228 [2];

+  ulonglong local_220;

+  undefined8 *local_218;

+  ulonglong local_210;

+  longlong local_208;

+  longlong local_200;

+  ulonglong local_1f8;

+  ulonglong local_1f0;

+  uint *puStack_1e8;

+  ulonglong local_1e0;

+  longlong local_1d8;

+  longlong local_1d0;

+  ushort local_1c8 [4];

+  void *pvStack_1c0;

+  undefined8 local_1b8;

+  ulonglong local_1b0;

+  ulonglong local_1a8;

+  int *local_1a0;

+  undefined4 local_198;

+  void *local_190;

+  wchar_t *local_188;

+  ulonglong local_180;

+  ulonglong local_178;

+  undefined8 *local_170;

+  longlong local_168;

+  ulonglong uStack_160;

+  int *local_158;

+  longlong lStack_150;

+  ulonglong local_148;

+  ulonglong uStack_140;

+  undefined1 local_138 [5];

+  undefined1 uStack_133;

+  undefined2 uStack_132;

+  longlong local_130;

+  ushort local_128 [4];

+  longlong lStack_120;

+  undefined8 local_118;

+  undefined8 uStack_110;

+  longlong local_108;

+  undefined8 uStack_100;

+  undefined8 local_f8;

+  ulonglong uStack_f0;

+  undefined2 local_e8;

+  undefined8 local_e6;

+  undefined8 uStack_de;

+  undefined4 local_d6;

+  undefined2 local_d2;

+  undefined8 local_d0;

+  undefined8 local_c8;

+  undefined8 local_c0;

+  undefined8 uStack_b8;

+  ulonglong local_a8 [7];

+  uint local_70;

+  uint local_6c;

+  ulonglong local_58;

   

-  pbVar3 = (byte *)(in_RAX & 0xffffffffffffff20);

-  *pbVar3 = *pbVar3 - (byte)pbVar3;

-  *pbVar3 = *pbVar3 & (byte)pbVar3;

-  iVar2 = HsmpOpenFileByPath(param_1,param_2,(int)param_3,param_4,in_stack_00000020,param_5,param_6,

-                             in_stack_00000038);

-  HsmDbgBreakOnStatus(iVar2);

-  lVar1 = *(longlong *)(unaff_RBP + -0x18);

-  if (iVar2 < 0) {

+  local_58 = __security_cookie ^ (ulonglong)auStackY_2c8;

+  local_170 = param_6;

+  local_130 = param_5;

+  iVar14 = 1;

+  local_200 = *(longlong *)(param_5 + 0x18);

+  uVar11 = *(ulonglong *)(param_5 + 0x20);

+  lVar8 = *(longlong *)(param_4 + 0x10);

+  iVar6 = *(int *)(lVar8 + 0x20);

+  puVar2 = *(uint **)(lVar8 + 0x38);

+  local_1d8 = 0;

+  if ((param_2 == 0) || (*(longlong *)(param_2 + 0x10) == 0)) {

+    local_240 = 0;

+  }

+  else {

+    local_240 = *(ulonglong *)(*(longlong *)(param_2 + 0x10) + 0x20);

+  }

+  local_1b0 = 0;

+  local_1e0 = 0;

+  local_178 = 0;

+  local_210 = *(ulonglong *)(lVar8 + 0x28);

+  puVar16 = (undefined8 *)0x0;

+  local_1a8 = 0;

+  local_1f8 = 0;

+  local_238[0] = 0;

+  local_228[0] = 0;

+  local_218 = (undefined8 *)0x0;

+  local_247 = '\0';

+  local_1c8[0] = 0;

+  local_1c8[1] = 0;

+  local_1c8[2] = 0;

+  local_1c8[3] = 0;

+  pvStack_1c0 = (void *)0x0;

+  local_128[0] = 0;

+  local_128[1] = 0;

+  local_128[2] = 0;

+  local_128[3] = 0;

+  lStack_120 = 0;

+  if (((iVar6 == 10) && ((char)*puVar2 != '\0')) || ((iVar6 == 0x41 && ((*puVar2 & 1) != 0)))) {

+    local_248 = '\x01';

+  }

+  else {

+    local_248 = '\0';

+  }

+  if (iVar6 == 0x41) {

+    local_244 = CONCAT31(local_244._1_3_,1);

+    if ((*puVar2 & 2) == 0) goto LAB_0;

+  }

+  else {

+LAB_0:

+    local_244 = local_244 & 0xffffff00;

+  }

+  local_f8 = 0;

+  local_118 = 0;

+  uStack_110 = 0;

+  uStack_f0 = uStack_f0 & 0xffffffff00000000;

+  local_108 = 0;

+  uStack_100 = 0;

+  local_c0 = 0;

+  uStack_b8 = 0;

+  local_220 = uVar11;

+  local_180 = param_3;

+  memset(local_a8,0,0x48);

+  local_1d0 = 0;

+  local_208 = 0;

+  local_230 = 0;

+  local_168 = 0;

+  uStack_160 = 0;

+  _local_138 = 0;

+  local_158 = (int *)0x0;

+  lStack_150 = 0;

+  local_148 = 0;

+  uStack_140 = 0;

+  local_1a0 = (int *)HsmpAcquireFileNameLock(param_1,param_2,param_4);

+  lVar8 = local_200;

+  if (local_1a0 == (int *)0x0) {

+    iVar14 = 4;

+    goto LAB_1;

+  }

+  if (param_2 != 0) {

+LAB_2:

+    if (((local_210 != 0) || (puVar2[4] < 2)) || ((short)puVar2[5] != 0x3a)) goto LAB_3;

+    local_190 = (void *)0x540052;

+    uVar1 = (ushort)puVar2[4];

+    local_188 = L":${3D0CE612-FDEE-43f7-8ACA-957BEC0CCBA0}.";

+    uVar4 = uVar1;

+    if (0x52 < uVar1) {

+      uVar4 = 0x52;

+    }

+    local_1f0 = (ulonglong)CONCAT22(uVar1,uVar4);

+    puStack_1e8 = puVar2 + 5;

+    cVar3 = RtlEqualUnicodeString(&local_1f0,&local_190,1);

+    if (cVar3 == '\0') goto LAB_3;

+    uVar5 = 0xc000cf18;

+    HsmDbgBreakOnStatus(-0x3fff30e8);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      uVar12 = 0x27;

+      uVar5 = 0xc000cf18;

+      goto LAB_4;

+    }

+    goto LAB_5;

+  }

+  param_2 = HsmpGetStreamContext(param_4,local_200,uVar11);

+  if (param_2 != 0) {

+    local_247 = '\x01';

+    goto LAB_2;

+  }

+  local_247 = '\0';

+LAB_3:

+  uVar11 = local_220;

+  uVar5 = FltGetDestinationFileNameInformation

+                    (lVar8,local_220,*(undefined8 *)(puVar2 + 2),puVar2 + 5);

+  HsmDbgBreakOnStatus(uVar5);

+  if ((int)uVar5 < 0) {

     if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

-    goto LAB_0;

-    uVar4 = 0x2d;

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_5;

+    uVar12 = 0x28;

+    uVar10 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+LAB_6:

+    WPP_SF_qqqiqd(uVar10,uVar12,&WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

+    goto LAB_5;

+  }

+  if (((char)local_244 == '\0') && (param_2 == 0)) {

+LAB_7:

+    local_190 = pvStack_1c0;

+    local_244 = CONCAT22(local_244._2_2_,local_1c8[0]);

+    goto LAB_8;

+  }

+  local_d6 = 0;

+  local_e8 = 0x28;

+  local_d2 = 0;

+  local_e6 = 0;

+  uStack_de = 0;

+  local_c8 = 1;

+  local_d0 = IoGetTransactionParameterBlock(uVar11);

+  local_108 = local_1d8 + 8;

+  local_118 = CONCAT44(local_118._4_4_,0x30);

+  uStack_110 = 0;

+  uStack_100 = CONCAT44(uStack_100._4_4_,0x240);

+  local_f8 = 0;

+  uStack_f0 = 0;

+  uVar5 = FltQueryInformationByName(DAT_9,local_200,&local_118,&local_c0);

+  HsmDbgBreakOnStatus(uVar5);

+  if ((int)uVar5 < 0) {

+    if ((uVar5 == 0xc0000034) || (uVar5 == 0xc000003a)) goto LAB_10;

+LAB_11:

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      uVar12 = 0x2c;

+LAB_12:

+      WPP_SF_qqqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                    &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

+    }

+LAB_13:

+    if (-1 < (int)uVar5) {

+      puVar16 = (undefined8 *)0x0;

+      goto LAB_1;

+    }

+  }

+  else if (local_a8[0] == local_240) {

+LAB_10:

+    uVar13 = local_210;

+    local_1f0 = local_230;

+    if (param_2 == 0) goto LAB_7;

+    uVar7 = (ulonglong)*(ushort *)(local_1d8 + 0x18);

+    sVar9 = *(short *)(local_1d8 + 8) - *(ushort *)(local_1d8 + 0x18);

+    pvStack_1c0 = (void *)(*(longlong *)(local_1d8 + 0x10) + uVar7);

+    local_244 = CONCAT22(local_244._2_2_,sVar9);

+    local_1c8[1] = sVar9;

+    local_1c8[0] = sVar9;

+    local_190 = pvStack_1c0;

+    if ((local_210 == 0) ||

+       (((ulonglong)*(ushort *)(param_1 + 0x40) == uVar7 + 2 &&

+        (iVar6 = memcmp(*(void **)(param_1 + 0x48),*(void **)(local_1d8 + 0x20),uVar7), iVar6 == 0))

+       )) {

+      local_210 = -(ulonglong)(uVar13 != 0) & local_1f8;

+      uVar13 = uVar11;

+      uVar5 = HsmiCldGetSyncRootFileIdByFileObject

+                        (param_1,uVar11,&local_1a8,(int *)local_238,local_228);

+      local_228[0] = uVar5;

+      HsmDbgBreakOnStatus(uVar5);

+      if (((int)uVar5 < 0) &&

+         ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control &&

+           (uVar13 = (ulonglong)*(uint *)(WPP_GLOBAL_Control + 0x2c),

+           (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (2 < (byte)WPP_GLOBAL_Control[0x29])

+          ))) {

+        uVar13 = 0x34;

+        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x34,

+                    &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+      }

+      HsmDbgBreakOnStatus(uVar5);

+      uVar5 = 0;

+      if (local_228[0] != 0xc000cf13) {

+        uVar5 = local_228[0];

+      }

+      if ((int)uVar5 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          uVar12 = 0x2e;

+LAB_4:

+          uVar10 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+          goto LAB_6;

+        }

+      }

+      else {

+        uVar5 = HsmiQueryFullFilePath(local_200,uVar13,uVar11,0x102,(undefined4 *)local_128);

+        HsmDbgBreakOnStatus(uVar5);

+        if ((int)uVar5 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            uVar12 = 0x2f;

+            goto LAB_4;

+          }

+        }

+        else {

+          uVar5 = HsmiCldGetSyncRootFileIdByPath(param_1,local_128,&local_178);

+          HsmDbgBreakOnStatus(uVar5);

+          if (uVar5 == 0xc000cf13) {

+            local_1e0 = 0;

+          }

+          else {

+            if ((int)uVar5 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                uVar12 = 0x30;

+                goto LAB_4;

+              }

+              goto LAB_5;

+            }

+            local_1e0 = local_178;

+          }

+          if (local_1e0 == local_240) {

+            local_248 = '\0';

+            lVar8 = FltGetRequestorProcess(param_4);

+            uVar5 = HsmpCldCheckSyncProviderAccess(param_1,param_2,uVar11,lVar8,&local_248);

+            HsmDbgBreakOnStatus(uVar5);

+            if (-1 < (int)uVar5) {

+              if (local_248 != '\0') {

+                local_1f8 = local_1e0;

+                goto LAB_8;

+              }

+              uVar5 = 0xc000cf18;

+            }

+            if ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) {

+              if (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                uVar12 = 0x31;

+                goto LAB_12;

+              }

+              goto LAB_13;

+            }

+          }

+          else {

+            uVar5 = HsmiCldGetSyncRootFileIdByPath(param_1,local_1c8,&local_210);

+            HsmDbgBreakOnStatus(uVar5);

+            if (uVar5 == 0xc000cf13) {

+              local_1f8 = 0;

+            }

+            else {

+              if ((int)uVar5 < 0) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  uVar12 = 0x32;

+                  goto LAB_4;

+                }

+                goto LAB_5;

+              }

+              local_1f8 = local_210;

+            }

+LAB_8:

+            uVar5 = FltQueryInformationFile

+                              (*(undefined8 *)(param_1 + 0x20),*(undefined8 *)(local_130 + 0x20),

+                               &local_1b0,8);

+            HsmDbgBreakOnStatus(uVar5);

+            if ((int)uVar5 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_5;

+              uVar12 = 0x33;

+LAB_14:

+              WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                           &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

+            }

+            else {

+              uVar11 = local_1b0 & 0x10;

+              uVar13 = local_1b0 & 0x10;

+              uStack_160 = local_180;

+              if (local_180 != 0) {

+                FltReferenceContext(local_180);

+              }

+              local_168 = param_1;

+              FltReferenceContext(param_1);

+              local_158 = local_1a0;

+              local_1a0 = (int *)0x0;

+              local_148 = local_1a8;

+              uStack_140 = local_1f8;

+              local_138 = (undefined1  [5])CONCAT14(uVar11 != 0,(undefined4)local_1b0);

+              lVar8 = param_2;

+              uVar11 = local_1f8;

+              lStack_150 = param_4;

+              uVar7 = HsmpIsPlaceholder(param_2);

+              if (((char)uVar7 == '\0') || (1 < local_238[0])) {

+LAB_15:

+                _local_138 = (uint6)(uint5)local_138;

+              }

+              else {

+                _local_138 = CONCAT15(1,local_138);

+                if (local_1e0 == 0) goto LAB_15;

+              }

+              uVar7 = HsmpIsPlaceholder(lVar8);

+              uVar5 = local_244;

+              if (((char)uVar7 == '\0') || (local_1a8 == 0)) {

+                iVar14 = HsmiInfoPrepareForPostRename(&local_168,0,local_170);

+                puVar16 = (undefined8 *)0x0;

+                goto LAB_1;

+              }

+              local_238[0] = (-(uint)(uVar13 != 0) & 0x10) + 0x20;

+              if (uVar11 != 0) {

+                local_238[0] = local_238[0] | 0x40;

+              }

+              uVar15 = (local_244 & 0xffff) + 0x1a;

+              local_180 = (ulonglong)uVar15;

+              local_218 = (undefined8 *)ExAllocatePool2(0x102,uVar15,0x634e7348);

+              _Dst = (void *)0x0;

+              if (local_218 == (undefined8 *)0x0) {

+                uVar5 = 0xc000009a;

+                HsmDbgBreakOnStatus(-0x3fffff66);

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  uVar12 = 0x34;

+                  uVar5 = 0xc000009a;

+                  goto LAB_14;

+                }

+              }

+              else {

+                *local_218 = 0x634e7348;

+                uVar5 = (uVar5 & 0xffff) + 2;

+                *(undefined4 *)(local_218 + 1) = 0x18;

+                *(undefined4 *)((longlong)local_218 + 0xc) = 0x10000;

+                local_218[2] = 0;

+                if (((0x17 < uVar15) && (uVar5 < 0x10001)) &&

+                   (((ulonglong)*(uint *)(local_218 + 1) + 3 & 0xfffffffffffffffc) +

+                    (ulonglong)uVar5 <= local_180)) {

+                  uVar15 = *(uint *)(local_218 + 1) + 3 & 0xfffffffc;

+                  *(short *)((longlong)local_218 + 0x12) = (short)uVar5;

+                  *(uint *)((longlong)local_218 + 0x14) = uVar15;

+                  *(undefined2 *)(local_218 + 2) = 0x11;

+                  _Dst = (void *)((ulonglong)uVar15 + (longlong)local_218);

+                  *(uint *)(local_218 + 1) = (uVar5 & 0xffff) + uVar15;

+                }

+                uVar11 = (ulonglong)(ushort)local_244;

+                memmove(_Dst,local_190,(ulonglong)(ushort)local_244);

+                *(undefined2 *)(uVar11 + (longlong)_Dst) = 0;

+                local_1b8 = 0;

+                local_1c8[0] = 0;

+                local_1c8[1] = 0;

+                local_1c8[2] = 0;

+                local_1c8[3] = 0;

+                pvStack_1c0 = (void *)0x0;

+                KeInitializeEvent(local_1c8,1,0);

+                *(ushort **)(param_4 + 0x40) = local_1c8;

+                HsmpCldNotifyPreOperation

+                          (5,param_4,local_238[0],local_218,HsmiInfoRenameNotificationCallback,

+                           param_4);

+                uVar5 = FltCancellableWaitForSingleObject(local_1c8,0,param_4);

+                HsmDbgBreakOnStatus(uVar5);

+                if ((uVar5 == 0xc000004b) || (uVar5 == 0xc0000120)) {

+                  FltCancelIo(param_4);

+                  KeWaitForSingleObject(local_1c8,0,0,0);

+                }

+                *(undefined8 *)(param_4 + 0x40) = 0;

+                if (-1 < (int)uVar5) {

+                  iVar14 = HsmiInfoPrepareForPostRename

+                                     (&local_168,*(uint *)(param_4 + 0x18),local_170);

+                  puVar16 = local_218;

+                  goto LAB_1;

+                }

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  uVar12 = 0x35;

+                  goto LAB_14;

+                }

+              }

+            }

+          }

+        }

+      }

+    }

+    else {

+      uVar5 = 0xc00000d4;

+      HsmDbgBreakOnStatus(-0x3fffff2c);

+      local_230 = local_1f0;

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        WPP_SF_qqqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2d,

+                      &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

+        local_230 = local_1f0;

+      }

+    }

   }

   else {

-    iVar2 = HsmpPrepareForMgmtOperation(unaff_RSI,lVar1,unaff_R15D,'\0');

-    HsmDbgBreakOnStatus(iVar2);

-    if (-1 < iVar2) {

-      iVar2 = HsmiUpdateFileAttributes

-                        (*(undefined8 *)(unaff_RSI + 0x20),lVar1,*(uint *)(unaff_RBP + -0x20));

-      HsmDbgBreakOnStatus(iVar2);

-      goto LAB_0;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

-    goto LAB_0;

-    uVar4 = 0x2e;

-  }

-  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar4,

-             &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,unaff_RSI);

-LAB_0:

-  if (lVar1 != 0) {

-    ObfDereferenceObject(lVar1);

-  }

-  if (*(longlong *)(unaff_RBP + -0x10) != 0) {

+    if ((char)local_244 == '\0') {

+      if (param_2 != 0) {

+        if (local_248 == '\0') goto LAB_16;

+        if ((local_70 & 0x10) != 0) {

+          uVar5 = 0xc00000ba;

+          goto LAB_17;

+        }

+        if ((local_70 & 1) != 0) {

+          iVar6 = -0x3fffffde;

+          uVar5 = 0xc0000022;

+          goto LAB_18;

+        }

+      }

+      goto LAB_10;

+    }

+    if (local_248 == '\0') {

+LAB_16:

+      uVar5 = 0xc0000035;

+LAB_17:

+      HsmDbgBreakOnStatus(uVar5);

+      goto LAB_11;

+    }

+    if ((((local_70 & 0x10) != 0) && ((local_6c & 0xffff0fff) == 0x9000001a)) &&

+       ((local_70 & 0x440000) != 0)) {

+      uVar5 = 0xc0000022;

+      goto LAB_17;

+    }

+    if (param_2 == 0) goto LAB_10;

+    if ((((local_70 & 0x10) == 0) || (local_6c == 0xa000000c)) ||

+       (uVar5 = 1, local_6c == 0xa0000003)) {

+      uVar5 = 0;

+    }

+    if ((*(uint *)(param_2 + 0x1c) >> 1 & 1) != uVar5) {

+      uVar15 = -(uint)((*(uint *)(param_2 + 0x1c) & 2) != 0) & 0x49;

+      uVar5 = uVar15 + 0xc00000ba;

+      iVar6 = uVar15 + 0xc00000ba;

+LAB_18:

+      HsmDbgBreakOnStatus(iVar6);

+LAB_19:

+      if ((int)uVar5 < 0) goto LAB_11;

+      goto LAB_10;

+    }

+    if ((((local_70 & 0x10) == 0) || (local_6c == 0xa000000c)) || (local_6c == 0xa0000003))

+    goto LAB_10;

+    local_198 = 0;

+    local_244 = 0;

+    uVar5 = FltCreateFileEx2(DAT_9,*(undefined8 *)(*(longlong *)(param_4 + 0x10) + 0x10),

+                             &local_1d0,&local_208);

+    HsmDbgBreakOnStatus(uVar5);

+    if ((int)uVar5 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

+         ) goto LAB_5;

+      uVar12 = 0x29;

+      goto LAB_4;

+    }

+    local_230 = ExAllocatePool2(0x100,0x1000,0x62547348);

+    if (local_230 == 0) {

+      uVar5 = 0xc000009a;

+      HsmDbgBreakOnStatus(-0x3fffff66);

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        uVar12 = 0x2a;

+        uVar5 = 0xc000009a;

+        goto LAB_4;

+      }

+    }

+    else {

+      uVar15 = FltQueryDirectoryFile(local_200,local_208,local_230,0x1000);

+      HsmDbgBreakOnStatus(uVar15);

+      uVar5 = 0;

+      if (uVar15 != 0x80000005) {

+        uVar5 = uVar15;

+      }

+      uVar13 = 0;

+      uVar11 = uVar13;

+      if (-1 < (int)uVar5) {

+        while (uVar15 = (uint)uVar13, (uint)uVar11 < 0x1000) {

+          uVar15 = local_244 + 1;

+          uVar13 = (ulonglong)uVar15;

+          local_244 = uVar15;

+          if ((*(uint *)(uVar11 + local_230) == 0) ||

+             (uVar11 = (ulonglong)*(uint *)(uVar11 + local_230), 2 < uVar15)) break;

+        }

+        if (2 < uVar15) {

+          uVar5 = 0xc0000022;

+          HsmDbgBreakOnStatus(-0x3fffffde);

+        }

+        FltClose(local_1d0);

+        local_1d0 = 0;

+        ObfDereferenceObject();

+        local_208 = 0;

+        uVar11 = local_220;

+        goto LAB_19;

+      }

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        uVar12 = 0x2b;

+        goto LAB_4;

+      }

+    }

+  }

+LAB_5:

+  *(uint *)(param_4 + 0x18) = uVar5;

+  *(undefined8 *)(param_4 + 0x20) = 0;

+  iVar14 = 4;

+  puVar16 = local_218;

+LAB_1:

+  if (lStack_120 != 0) {

+    ExFreePoolWithTag(lStack_120,0x73557348);

+  }

+  if (local_1d8 != 0) {

+    FltReleaseFileNameInformation();

+  }

+  if (local_1d0 != 0) {

     FltClose();

   }

-  return iVar2;

+  if (local_208 != 0) {

+    ObfDereferenceObject();

+  }

+  if (local_230 != 0) {

+    ExFreePoolWithTag(local_230,0x62547348);

+  }

+  if (puVar16 != (undefined8 *)0x0) {

+    ExFreePoolWithTag(puVar16,0x634e7348);

+  }

+  if (local_247 != '\0') {

+    FltReleaseContext(param_2);

+  }

+  if (local_168 != 0) {

+    FltReleaseContext();

+  }

+  if (uStack_160 != 0) {

+    FltReleaseContext();

+  }

+  if (local_158 != (int *)0x0) {

+    HsmpReleaseFileNameLock(local_158);

+  }

+  if (local_1a0 != (int *)0x0) {

+    HsmpReleaseFileNameLock(local_1a0);

+  }

+  return iVar14;

 }
```

## `HsmiMarkFileRangeNoLock`  (modified)

```diff
--- HsmiMarkFileRangeNoLock
+++ HsmpRecurseDirectory
@@ -1,127 +1,213 @@
 

-int HsmiMarkFileRangeNoLock

-              (longlong param_1,int param_2,ulonglong param_3,ulonglong param_4,byte param_5)

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+

+int HsmpRecurseDirectory

+              (longlong param_1,undefined8 param_2,undefined8 param_3,uint param_4,char param_5,

+              char param_6,undefined *param_7,undefined *param_8,undefined8 param_9)

 

 {

-  longlong lVar1;

-  byte bVar2;

-  int iVar3;

-  longlong lVar4;

-  undefined8 *puVar5;

-  uint uVar6;

-  longlong lVar7;

-  ulonglong uVar8;

-  int local_res10 [2];

-  ulonglong local_res18;

-  ulonglong local_res20;

+  uint uVar1;

+  undefined8 uVar2;

+  uint *puVar3;

+  char cVar4;

+  int iVar5;

+  int iVar6;

+  uint *puVar7;

+  undefined2 uVar8;

+  uint *puVar9;

+  ulonglong in_stack_fffffffffffffe98;

+  undefined4 uVar10;

+  undefined8 *in_stack_fffffffffffffea0;

+  undefined4 *puVar11;

+  undefined1 local_108;

+  undefined4 local_100 [2];

+  longlong local_f8;

+  longlong local_f0;

+  undefined8 local_e8;

+  uint *local_e0;

+  undefined8 local_d8;

+  wchar_t *local_d0;

+  undefined8 local_c8;

+  wchar_t *local_c0;

+  undefined8 local_b8;

+  undefined8 uStack_b0;

+  undefined8 *local_a8;

+  undefined8 uStack_a0;

+  undefined8 local_98;

+  ulonglong uStack_90;

+  longlong local_88;

+  longlong local_80;

+  longlong local_78;

+  uint local_70;

+  char local_6c;

+  undefined1 local_6b;

+  undefined2 local_6a;

+  undefined *local_68;

+  undefined *local_60;

+  undefined8 local_58;

+  int local_50 [2];

+  undefined8 local_48;

+  undefined8 uStack_40;

   

-  lVar1 = *(longlong *)(param_1 + 0x10);

-  lVar7 = param_1;

-  uVar8 = param_3;

-  local_res10[0] = param_2;

-  local_res18 = param_3;

-  local_res20 = param_4;

-  if (((longlong)param_3 < 1) && (lVar4 = HsmpGetStreamSize(param_1), lVar4 <= (longlong)param_4)) {

-    if (param_2 == 0x4244) {

-      uVar6 = ((uint)param_5 << 6 ^ *(uint *)(lVar7 + 0x1c)) & 0x40 ^ *(uint *)(lVar7 + 0x1c) | 0x80

-      ;

-    }

-    else if (param_2 == 0x424d) {

-      uVar6 = ((uint)param_5 << 10 ^ *(uint *)(lVar7 + 0x1c)) & 0x400 ^ *(uint *)(lVar7 + 0x1c) |

-              0x800;

-    }

-    else {

-      if (param_2 != 0x4256) goto LAB_0;

-      uVar6 = ((uint)param_5 << 8 ^ *(uint *)(lVar7 + 0x1c)) & 0x100 ^ *(uint *)(lVar7 + 0x1c) |

-              0x200;

-    }

-    *(uint *)(param_1 + 0x1c) = uVar6;

+  uVar2 = *(undefined8 *)(param_1 + 0x20);

+  iVar6 = 0;

+  local_d0 = L".";

+  local_d8 = 0x40002;

+  local_c0 = L"..";

+  local_c8 = 0x60004;

+  local_f0 = 0;

+  local_f8 = 0;

+  if (param_7 == (undefined *)0x0) {

 LAB_0:

-    HsmiDeleteExternalBitmap(param_1,param_2);

-    HsmiReleaseBitmap(param_1,local_res10[0]);

-    return 0;

-  }

-  lVar4 = HsmpGetStreamSize(lVar7);

-  if (lVar4 <= (longlong)param_4) {

-    param_4 = HsmpGetStreamSize(lVar7);

-    local_res20 = param_4;

-  }

-  if ((longlong)param_4 <= (longlong)param_3) {

-    return 0;

-  }

-  puVar5 = (undefined8 *)0x0;

-  bVar2 = 0;

-  if (param_2 == 0x4244) {

-    puVar5 = *(undefined8 **)(*(longlong *)(param_1 + 0xa0) + 0x38);

-    bVar2 = *(byte *)(param_1 + 0x1c) >> 6;

-LAB_1:

-    bVar2 = bVar2 & 1;

-  }

-  else {

-    if (param_2 == 0x424d) {

-      puVar5 = *(undefined8 **)(*(longlong *)(param_1 + 0xa0) + 0x48);

-      bVar2 = (byte)(*(uint *)(param_1 + 0x1c) >> 10);

+    puVar7 = (uint *)0x0;

+    local_108 = 1;

+    if ((param_4 & 0x10) != 0) {

+      while( true ) {

+        uVar10 = (undefined4)(in_stack_fffffffffffffe98 >> 0x20);

+        local_100[0] = 0;

+        if ((puVar7 == (uint *)0x0) &&

+           (puVar7 = (uint *)ExAllocatePool2(0x100,0x400,0x64527348), puVar7 == (uint *)0x0)) {

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+             (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0 &&

+              (1 < (byte)WPP_GLOBAL_Control[0x29])))) {

+            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x29,

+                       &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,uVar2);

+          }

+          if (-1 < iVar6) {

+            iVar6 = -0x3fffff66;

+          }

+          goto LAB_1;

+        }

+        puVar11 = local_100;

+        in_stack_fffffffffffffea0 =

+             (undefined8 *)((ulonglong)in_stack_fffffffffffffea0 & 0xffffffffffffff00);

+        in_stack_fffffffffffffe98 = CONCAT44(uVar10,1);

+        iVar5 = FltQueryDirectoryFile

+                          (uVar2,param_3,puVar7,0x400,in_stack_fffffffffffffe98,

+                           in_stack_fffffffffffffea0,0,local_108,puVar11);

+        HsmDbgBreakOnStatus(iVar5);

+        local_108 = 0;

+        if (iVar5 == -0x7ffffffa) goto LAB_1;

+        puVar3 = puVar7;

+        if (iVar5 < 0) break;

+        while (puVar9 = puVar3, puVar9 != (uint *)0x0) {

+          local_98 = 0;

+          uStack_90 = uStack_90 & 0xffffffff00000000;

+          local_b8 = 0;

+          uStack_b0 = 0;

+          local_e0 = puVar9 + 0x10;

+          local_a8 = (undefined8 *)0x0;

+          uStack_a0 = 0;

+          local_48 = 0;

+          uStack_40 = 0;

+          local_e8 = (ulonglong)CONCAT22((short)puVar9[0xf],(short)puVar9[0xf]);

+          uVar1 = puVar9[0xe];

+          cVar4 = RtlEqualUnicodeString(&local_e8,&local_d8,0);

+          if ((cVar4 == '\0') && (cVar4 = RtlEqualUnicodeString(&local_e8), cVar4 == '\0')) {

+            local_a8 = &local_e8;

+            puVar11 = (undefined4 *)((ulonglong)puVar11 & 0xffffffff00000000);

+            in_stack_fffffffffffffea0 = &local_b8;

+            local_b8 = CONCAT44(local_b8._4_4_,0x30);

+            uStack_a0 = CONCAT44(uStack_a0._4_4_,0x240);

+            local_98 = 0;

+            uStack_90 = 0;

+            in_stack_fffffffffffffe98 =

+                 CONCAT44((int)(in_stack_fffffffffffffe98 >> 0x20),(uint)((uVar1 & 0x10) != 0)) |

+                 0x100180;

+            uStack_b0 = param_2;

+            iVar5 = FltCreateFileEx(DAT_2,uVar2,&local_f0,&local_f8,

+                                    in_stack_fffffffffffffe98,in_stack_fffffffffffffea0,&local_48,0,

+                                    puVar11,7,1,0x200020,0,0,0x800);

+            HsmDbgBreakOnStatus(iVar5);

+            if (iVar5 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                uVar8 = 0x2b;

+LAB_3:

+                WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar8,

+                         &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,iVar5);

+              }

+            }

+            else {

+              local_80 = local_f0;

+              local_78 = local_f8;

+              local_70 = puVar9[0xe];

+              local_68 = param_7;

+              local_60 = param_8;

+              local_6a = 0;

+              local_50[0] = 0;

+              local_50[1] = 0;

+              local_6b = 0;

+              local_58 = param_9;

+              local_6c = param_5;

+              local_88 = param_1;

+              iVar5 = HsmExpandKernelStackAndCallout(HsmpRecurseDirectoryCallout,local_50);

+              HsmDbgBreakOnStatus(iVar5);

+              if (-1 < iVar5) goto LAB_4;

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                uVar8 = 0x2c;

+                goto LAB_3;

+              }

+            }

+            if (-1 < iVar6) {

+              iVar6 = iVar5;

+            }

+            if (param_5 != '\0') goto LAB_1;

+          }

+LAB_4:

+          if (local_f0 != 0) {

+            FltClose();

+            local_f0 = 0;

+          }

+          if (local_f8 != 0) {

+            ObfDereferenceObject();

+            local_f8 = 0;

+          }

+          puVar3 = (uint *)0x0;

+          if (*puVar9 != 0) {

+            puVar3 = (uint *)((longlong)puVar9 + (ulonglong)*puVar9);

+          }

+        }

+      }

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2a,

+                   &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,uVar2);

+      }

+      if (-1 < iVar6) {

+        iVar6 = iVar5;

+      }

       goto LAB_1;

     }

-    if (param_2 == 0x4256) {

-      puVar5 = *(undefined8 **)(*(longlong *)(param_1 + 0xa0) + 0x40);

-      bVar2 = (byte)((uint)*(undefined4 *)(param_1 + 0x1c) >> 8);

-      goto LAB_1;

-    }

-  }

-  if (param_5 == 0) {

-    if ((bVar2 == 0) && (puVar5 == (undefined8 *)0x0)) {

-      return 0;

-    }

-  }

-  else if (bVar2 != 0) {

-    return 0;

-  }

-  if (puVar5 == (undefined8 *)0x0) {

-    iVar3 = HsmiExpandBitmapNoLock(param_1,param_2);

-    HsmDbgBreakOnStatus(iVar3);

-    if (iVar3 < 0) {

-      if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-        return iVar3;

-      }

-      if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

-        return iVar3;

-      }

-      if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

-        return iVar3;

-      }

-      WPP_SF_qisiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),WPP_GLOBAL_Control,uVar8,param_1,

-                    *(undefined8 *)(lVar1 + 0x20),(char *)local_res10);

-      return iVar3;

-    }

-    puVar5 = (undefined8 *)HsmiGetBitmap(param_1,local_res10[0],(byte *)0x0);

-  }

-  uVar6 = *(uint *)(puVar5 + 2);

-  if (param_5 == 0) {

-    if ((uVar6 & 7) != 0) goto LAB_2;

-    iVar3 = 2;

   }

   else {

-    if ((uVar6 & 7) != 0) {

-LAB_2:

-      if ((uVar6 & 7) == 1) {

-        iVar3 = HsmIBitmapVOLATILEMarkRangeEx((longlong)puVar5,&local_res18,&local_res20);

-      }

-      else {

-        iVar3 = -0x3fffff1b;

-      }

-      goto LAB_3;

-    }

-    iVar3 = 0;

-  }

-  iVar3 = HsmIBitmapNORMALMarkRangeEx(puVar5,&local_res18,&local_res20,iVar3);

-LAB_3:

-  HsmDbgBreakOnStatus(iVar3);

-  if ((((iVar3 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

-      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-    WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x16,

-                 &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

-  }

-  return iVar3;

+    iVar6 = (*(code *)param_7)(param_1,param_3,param_4,param_9);

+    puVar7 = (uint *)0x0;

+    if ((-1 < iVar6) || (param_5 == '\0')) goto LAB_0;

+    if ((param_4 & 0x10) == 0) goto LAB_5;

+LAB_1:

+    if (param_6 != '\0') goto LAB_5;

+  }

+  if (((-1 < iVar6) || (param_5 == '\0')) &&

+     ((param_8 != (undefined *)0x0 &&

+      (iVar5 = (*(code *)param_8)(param_1,param_3,param_4,param_9), -1 < iVar6)))) {

+    iVar6 = iVar5;

+  }

+LAB_5:

+  if (local_f8 != 0) {

+    ObfDereferenceObject();

+  }

+  if (local_f0 != 0) {

+    FltClose();

+  }

+  if (puVar7 != (uint *)0x0) {

+    ExFreePoolWithTag(puVar7,0x64527348);

+  }

+  return iVar6;

 }
```

## `HsmiFltPostECPCREATE`  (modified)

```diff
--- HsmiFltPostECPCREATE
+++ HsmiFltPostECPCREATE
@@ -1,17 +1,390 @@
 

-ulonglong HsmiFltPostECPCREATE(uint *param_1,longlong param_2,longlong *param_3,int param_4)

+undefined8 HsmiFltPostECPCREATE(uint *param_1,longlong param_2,longlong *param_3,uint param_4)

 

 {

-  uint uVar1;

-  ulonglong in_RAX;

-  longlong unaff_RBX;

-  longlong unaff_R13;

-  undefined *unaff_R14;

+  int *piVar1;

+  code *pcVar2;

+  bool bVar3;

+  bool bVar4;

+  char cVar5;

+  uint uVar6;

+  uint uVar7;

+  longlong lVar8;

+  ulonglong uVar9;

+  undefined8 uVar10;

+  uint uVar11;

+  undefined2 uVar12;

+  uint *puVar13;

+  longlong *plVar14;

+  longlong *plVar15;

+  char *pcVar16;

+  uint uVar17;

+  uint *local_res8;

+  char local_res10 [8];

+  char local_res18 [8];

+  uint local_res20 [2];

+  uint local_68;

+  int *local_60;

+  undefined8 local_58;

+  longlong local_50;

   

-  uVar1 = CldiSyncTransferOrAckData

-                    (unaff_RBX,param_2,(uint)param_3,param_4,'\0',in_RAX,unaff_R14,unaff_R13);

-  HsmDbgBreakOnStatus(uVar1);

-  ExReleaseRundownProtection(unaff_RBX + 0x58);

-  return (ulonglong)uVar1;

+  uVar10 = *(undefined8 *)(param_2 + 0x18);

+  plVar15 = (longlong *)CONCAT71((int7)((ulonglong)param_3 >> 8),1);

+  local_50 = *(longlong *)(param_2 + 0x20);

+  plVar14 = (longlong *)0x0;

+  uVar6 = 0;

+  local_60 = (int *)0x0;

+  uVar11 = 0;

+  uVar17 = 0;

+  local_68 = 0;

+  bVar3 = false;

+  local_res10[0] = '\0';

+  local_res8 = param_1;

+  local_res20[0] = param_4;

+  local_58 = uVar10;

+  HsmpTracePostCallbackEnter((longlong)param_1,param_3,'\x01','\0');

+  FltGetInstanceContext(uVar10,&local_60);

+  if (local_60 == (int *)0x0) goto LAB_0;

+  if (*local_60 == 0x32497348) {

+    KeEnterCriticalRegion();

+    ExAcquireResourceExclusiveLite(local_60 + 2,1);

+    lVar8 = RtlLookupElementGenericTableAvl(local_60 + 0x1c,&local_res8);

+    if (lVar8 != 0) {

+      lVar8 = RtlLookupElementGenericTableAvl(local_60 + 0x36,lVar8 + 8);

+      if (lVar8 != 0) {

+        piVar1 = (int *)(lVar8 + 8);

+        *piVar1 = *piVar1 + -1;

+        if (*piVar1 == 0) {

+          RtlDeleteElementGenericTableAvl(local_60 + 0x36,lVar8);

+        }

+      }

+      RtlDeleteElementGenericTableAvl(local_60 + 0x1c,&local_res8);

+    }

+    ExReleaseResourceLite(local_60 + 2);

+    KeLeaveCriticalRegion();

+    goto LAB_0;

+  }

+  uVar7 = local_res8[6];

+  HsmDbgBreakOnStatus(uVar7);

+  bVar3 = true;

+  if ((int)uVar7 < 0) {

+    uVar11 = 0;

+    if ((((uVar7 != 0xc0000034) && (uVar11 = uVar17, uVar7 != 0xc000003a)) &&

+        ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (4 < (byte)WPP_GLOBAL_Control[0x29]))))

+    {

+      uVar12 = 0x1c;

+      goto LAB_1;

+    }

+  }

+  else {

+LAB_2:

+    do {

+      lVar8 = local_50;

+      for (uVar11 = 0; uVar11 < 0x10; uVar11 = uVar11 + 1) {

+        if ((*(uint *)((longlong)param_3 + (ulonglong)uVar11 * 0x30 + 0x14) & 1) != 0) {

+          plVar14 = (longlong *)(ulonglong)(uVar11 << 0xc | 0x9000001a);

+          break;

+        }

+      }

+      uVar11 = (uint)plVar14;

+      uVar10 = local_58;

+      if (local_res8[6] != 0x104) {

+        if (*(longlong *)(local_50 + 0x18) == 0) goto LAB_3;

+        bVar4 = true;

+        if (uVar11 == 0) {

+LAB_4:

+          if (-1 < (int)uVar7) goto LAB_0;

+          plVar14 = plVar15;

+          if (!bVar4) goto LAB_5;

+        }

+        else {

+          uVar9 = Feature_CLFS_Signing__private_IsEnabledDeviceUsageNoInline();

+          if ((int)uVar9 != 0) {

+            puVar13 = local_res8;

+            plVar15 = plVar14;

+            uVar7 = HsmiIsUnsupportedLogfilePlaceholder

+                              ((longlong)local_60,(longlong)local_res8,uVar11,local_res10);

+            cVar5 = local_res10[0];

+            if ((int)uVar7 < 0) {

+              if (local_res10[0] != '\0') goto LAB_6;

+            }

+            else {

+              if (local_res10[0] == '\0') goto LAB_7;

+LAB_6:

+              uVar7 = 0xc000cf0a;

+              HsmDbgBreakOnStatus(-0x3fff30f6);

+            }

+            uVar10 = local_58;

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_8;

+            pcVar16 = "Encountered an unsupported CLFS Logfile placeholder: ";

+            if (cVar5 == '\0') {

+              pcVar16 = "Failed to check if placeholder is a CLFS Logfile: ";

+            }

+            WPP_SF_sqqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),puVar13,plVar15,pcVar16);

+            bVar4 = true;

+            goto LAB_4;

+          }

+LAB_7:

+          HsmpTracePostCallbackEnter((longlong)local_res8,param_3,'\0','\x01');

+          uVar9 = HsmpSetupContexts((ulonglong)local_60,

+                                    *(undefined4 ***)(*(longlong *)(local_res8 + 4) + 8),uVar11,

+                                    local_res8);

+          uVar7 = (uint)uVar9;

+          HsmDbgBreakOnStatus(uVar7);

+          uVar10 = local_58;

+          plVar15 = plVar14;

+          if (-1 < (int)uVar7) {

+LAB_8:

+            bVar4 = true;

+            uVar10 = local_58;

+            goto LAB_4;

+          }

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            plVar14 = (longlong *)&WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids;

+            WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x22,

+                         &WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids,local_58);

+          }

+        }

+        plVar15 = plVar14;

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          plVar15 = (longlong *)&WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids;

+          WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x23,

+                       &WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids,uVar10);

+        }

+        FltCancelFileOpen(uVar10,lVar8);

+        goto LAB_5;

+      }

+      local_res20[0] = local_res20[0] & 0xffffff00;

+      local_res18[0] = '\0';

+      if ((local_res8[8] & 0xffff0fff) != DAT_9) {

+LAB_3:

+        bVar4 = false;

+        goto LAB_4;

+      }

+      local_68 = local_68 + 1;

+      if (0x100 < local_68) {

+        uVar7 = 0xc0000280;

+        HsmDbgBreakOnStatus(-0x3ffffd80);

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          WPP_SF_qqcqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x1d,plVar15,local_58);

+        }

+        goto LAB_5;

+      }

+      plVar15 = (longlong *)CONCAT71((int7)((ulonglong)plVar15 >> 8),local_68 == 1);

+      uVar9 = HsmiCreateEnsureDirectoryFullyPopulated

+                        ((ulonglong)local_60,local_res8,local_68 == 1,

+                         *(ushort *)(*(longlong *)(local_res8 + 10) + 6),(undefined1 *)local_res20,

+                         local_res18);

+      uVar7 = (uint)uVar9;

+      HsmDbgBreakOnStatus(uVar7);

+      uVar6 = uVar11;

+      if ((int)uVar7 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_5;

+        uVar12 = 0x1e;

+        goto LAB_1;

+      }

+      if (local_res18[0] != '\0') {

+        *(uint *)((longlong)param_3 + 0x14) = *(uint *)((longlong)param_3 + 0x14) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x44) = *(uint *)((longlong)param_3 + 0x44) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x74) = *(uint *)((longlong)param_3 + 0x74) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0xa4) = *(uint *)((longlong)param_3 + 0xa4) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0xd4) = *(uint *)((longlong)param_3 + 0xd4) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x104) = *(uint *)((longlong)param_3 + 0x104) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x134) = *(uint *)((longlong)param_3 + 0x134) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x164) = *(uint *)((longlong)param_3 + 0x164) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x194) = *(uint *)((longlong)param_3 + 0x194) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x1c4) = *(uint *)((longlong)param_3 + 0x1c4) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 500) = *(uint *)((longlong)param_3 + 500) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x224) = *(uint *)((longlong)param_3 + 0x224) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x254) = *(uint *)((longlong)param_3 + 0x254) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x284) = *(uint *)((longlong)param_3 + 0x284) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x2b4) = *(uint *)((longlong)param_3 + 0x2b4) & 0xfffffffd;

+        *(uint *)((longlong)param_3 + 0x2e4) = *(uint *)((longlong)param_3 + 0x2e4) & 0xfffffffd;

+        goto LAB_2;

+      }

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x14) = *(uint *)((longlong)param_3 + 0x14) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x14) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x2a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x44) = *(uint *)((longlong)param_3 + 0x44) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x44) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x5a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x74) = *(uint *)((longlong)param_3 + 0x74) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x74) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x8a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0xa4) = *(uint *)((longlong)param_3 + 0xa4) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0xa4) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0xba) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0xd4) = *(uint *)((longlong)param_3 + 0xd4) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0xd4) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0xea) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x104) = *(uint *)((longlong)param_3 + 0x104) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x104) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x11a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x134) = *(uint *)((longlong)param_3 + 0x134) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x134) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x14a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x164) = *(uint *)((longlong)param_3 + 0x164) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x164) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x17a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x194) = *(uint *)((longlong)param_3 + 0x194) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x194) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x1aa) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x1c4) = *(uint *)((longlong)param_3 + 0x1c4) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x1c4) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x1da) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 500) = *(uint *)((longlong)param_3 + 500) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 500) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x20a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x224) = *(uint *)((longlong)param_3 + 0x224) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x224) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x23a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x254) = *(uint *)((longlong)param_3 + 0x254) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x254) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x26a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x284) = *(uint *)((longlong)param_3 + 0x284) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x284) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x29a) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x2b4) = *(uint *)((longlong)param_3 + 0x2b4) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x2b4) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x2ca) = 0;

+      if ((char)local_res20[0] == '\0') {

+        *(uint *)((longlong)param_3 + 0x2e4) = *(uint *)((longlong)param_3 + 0x2e4) & 0xfffffffe;

+      }

+      else {

+        *(undefined4 *)((longlong)param_3 + 0x2e4) = 0x80000000;

+      }

+      *(undefined2 *)((longlong)param_3 + 0x2fa) = 0;

+      FltSetCallbackDataDirty(local_res8);

+      FltReissueSynchronousIo(*(undefined8 *)(param_2 + 0x18),local_res8);

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        WPP_SF_qqcqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x1f,plVar15,local_58);

+      }

+      uVar7 = local_res8[6];

+      HsmDbgBreakOnStatus(uVar7);

+    } while (-1 < (int)uVar7);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      uVar12 = 0x20;

+LAB_1:

+      plVar15 = (longlong *)&WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids;

+      WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                  &WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids,local_58);

+      uVar11 = uVar6;

+    }

+  }

+LAB_5:

+  local_res8[6] = uVar7;

+  local_res8[8] = 0;

+  local_res8[9] = 0;

+LAB_0:

+  if (param_3 != (longlong *)0x0) {

+    if ((longlong *)*param_3 != param_3) {

+      *(longlong **)(param_3[0x5a] + 8) = param_3;

+      lVar8 = param_3[0x5a];

+      *param_3 = lVar8;

+      if (*(char *)(*(longlong *)(local_res8 + 4) + 4) == '\0') {

+        plVar15 = param_3;

+        FltRemoveOpenReparseEntry(DAT_10);

+      }

+      else {

+        if ((*(longlong **)(lVar8 + 8) != param_3) ||

+           (plVar14 = (longlong *)param_3[1], (longlong *)*plVar14 != param_3)) {

+          pcVar2 = (code *)swi(0x29);

+          (*pcVar2)(3);

+          pcVar2 = (code *)swi(3);

+          uVar10 = (*pcVar2)();

+          return uVar10;

+        }

+        *plVar14 = lVar8;

+        *(longlong **)(lVar8 + 8) = plVar14;

+        FltObjectDereference(DAT_10);

+      }

+    }

+    ExFreeToPagedLookasideList(&DAT_11,param_3);

+  }

+  if (local_60 != (int *)0x0) {

+    if (bVar3) {

+      ExReleaseRundownProtection(local_60 + 0x2c);

+    }

+    FltReleaseContext();

+  }

+  if (uVar11 != 0) {

+    HsmpTracePostCallbackExit(0,(longlong)local_res8,plVar15,'\x01');

+  }

+  return 0;

 }
```

## `HsmIBitmapNORMALPrepareCommit`  (modified)

```diff
--- HsmIBitmapNORMALPrepareCommit
+++ HsmIBitmapNORMALPrepareCommit
@@ -1,17 +1,863 @@
+

+/* WARNING: Type propagation algorithm not settling */

 

 int HsmIBitmapNORMALPrepareCommit

               (ushort *param_1,ushort **param_2,undefined8 param_3,undefined4 *param_4,

               ushort **param_5)

 

 {

-  int unaff_EBX;

-  undefined8 in_stack_000000a0;

-  longlong in_stack_000000a8;

+  ushort *puVar1;

+  int *_Src;

+  int *piVar2;

+  int *piVar3;

+  char cVar4;

+  ushort uVar5;

+  int iVar6;

+  uint uVar7;

+  undefined4 uVar8;

+  longlong lVar9;

+  undefined8 uVar10;

+  uint *puVar11;

+  ulonglong uVar12;

+  undefined8 *puVar13;

+  undefined2 uVar14;

+  ulonglong *puVar15;

+  int iVar16;

+  uint *puVar17;

+  uint uVar18;

+  uint uVar19;

+  ushort **ppuVar20;

+  ulonglong **_Size;

+  ulonglong uVar21;

+  ulonglong **ppuVar22;

+  ushort **ppuVar23;

+  uint uVar24;

+  int iVar25;

+  undefined4 uVar26;

+  undefined4 uVar27;

+  undefined4 uVar28;

+  ushort *local_res8;

+  ushort **local_res10;

+  char local_res18;

+  undefined4 *local_res20;

+  uint *local_148;

+  ulonglong *local_138 [2];

+  char local_128;

+  char local_127 [3];

+  uint local_124;

+  undefined1 local_120 [8];

+  ulonglong *local_118;

+  ulonglong local_110;

+  uint local_108;

+  uint local_104;

+  void *local_100;

+  ulonglong *local_f8;

+  ushort *local_f0;

+  undefined8 local_e8;

+  undefined8 uStack_e0;

+  uint *local_d8;

+  int local_d0 [4];

+  undefined4 *local_c0;

+  uint *local_b8;

+  uint *local_b0;

+  ulonglong local_a8;

+  longlong local_a0;

+  longlong local_98;

+  ulonglong local_90 [3];

+  ushort *local_78;

+  undefined8 uStack_70;

+  ushort **local_68;

+  int local_60 [2];

+  ulonglong local_58 [4];

   

-  ObfDereferenceObject(in_stack_000000a0);

-  if (in_stack_000000a8 != 0) {

-    FltClose();

+  puVar17 = (uint *)0x0;

+  local_a0 = 0;

+  local_124 = 0;

+  local_118 = (ulonglong *)0x0;

+  local_100 = (void *)0x0;

+  uVar26 = 0;

+  uVar27 = 0;

+  uVar28 = 0;

+  local_e8 = (ushort *)0x0;

+  uStack_e0 = 0;

+  local_138[0] = (ulonglong *)((ulonglong)local_138[0] & 0xffffffffff000000);

+  local_127[0] = '\0';

+  local_res18 = '\0';

+  local_128 = '\0';

+  local_148 = *(uint **)(param_1 + 0x4c);

+  param_1[0x4c] = 0;

+  param_1[0x4d] = 0;

+  param_1[0x4e] = 0;

+  param_1[0x4f] = 0;

+  iVar6 = *(int *)(param_1 + 0xc);

+  local_res8 = param_1;

+  local_res10 = param_2;

+  local_res20 = param_4;

+  local_c0 = param_4;

+  local_b8 = local_148;

+  iVar25 = 0;

+  if (-1 < iVar6) {

+    lVar9 = HsmiBitmapNORMALComputeMaxUserFileSize

+                      (1,(ulonglong)(uint)(1 << ((byte)(*(uint *)(param_1 + 8) >> 6) & 0x1f)));

+    if (((longlong)param_2 <= lVar9) && (0x37 < *(uint *)param_5)) {

+      ppuVar20 = (ushort **)&local_128;

+      iVar6 = HsmIBitmapNORMALMayContainDirtyRange

+                        ((longlong)param_1,(longlong)param_2,(undefined1 *)ppuVar20);

+      HsmDbgBreakOnStatus(iVar6);

+      if (iVar6 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          uVar14 = 0x7e;

+LAB_0:

+          WPP_SF_iisd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar14,ppuVar20,param_1,

+                      *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+        }

+      }

+      else {

+        if (local_148 == (uint *)0x0) {

+          ppuVar20 = (ushort **)0x63427348;

+          local_148 = (uint *)ExAllocatePool2(0x102,0x20);

+          local_b8 = local_148;

+        }

+        else if (*(longlong *)(local_148 + 4) != 0) {

+          ExFreePoolWithTag(*(longlong *)(local_148 + 4),0x6d427348);

+        }

+        local_b0 = local_148;

+        if (local_148 == (uint *)0x0) {

+          iVar6 = -0x3fffff66;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            uVar14 = 0x7f;

+LAB_1:

+            iVar6 = -0x3fffff66;

+            goto LAB_0;

+          }

+        }

+        else {

+          local_148[0] = 0;

+          local_148[1] = 0;

+          local_148[2] = 0;

+          local_148[3] = 0;

+          local_148[4] = 0;

+          local_148[5] = 0;

+          local_148[6] = 0;

+          local_148[7] = 0;

+          iVar16 = 0;

+          if (local_128 == '\0') {

+            local_138[0] = (ulonglong *)CONCAT62(local_138[0]._2_6_,0x101);

+            uVar10 = HsmiBitmapNORMALPrepareMcbsForCommit((longlong)param_1,(char *)local_138);

+            iVar6 = (int)uVar10;

+            HsmDbgBreakOnStatus(iVar6);

+            if (iVar6 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x80,

+                         &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,iVar6);

+              }

+              goto LAB_2;

+            }

+            *(ushort ***)local_148 = param_2;

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+              WPP_SF_qis(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x81,ppuVar20,param_1,

+                         *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+            }

+            local_138[0] = (ulonglong *)((ulonglong)local_138[0] & 0xffffffff00000000);

+LAB_3:

+            local_c0[1] = 0;

+            *param_4 = 0x70527442;

+            local_b0 = param_4 + 2;

+            *local_b0 = 0x38;

+            *(undefined2 *)(param_4 + 3) = 0;

+            local_res8 = (ushort *)((longlong)param_4 + 0xe);

+            *local_res8 = 5;

+            *(undefined8 *)(param_4 + 4) = 0;

+            *(undefined8 *)(param_4 + 6) = 0;

+            *(undefined8 *)(param_4 + 8) = 0;

+            *(undefined8 *)(param_4 + 10) = 0;

+            *(undefined8 *)(param_4 + 0xc) = 0;

+            ppuVar22 = (ulonglong **)param_5;

+            if (*(uint *)param_5 < 0x18) {

+              iVar6 = -0x3fffffdd;

+            }

+            else {

+              if (*local_res8 == 0) {

+                iVar6 = -0x3ffffff3;

+              }

+              else {

+                ppuVar22 = (ulonglong **)(ulonglong)*local_b0;

+                if ((ulonglong)*(uint *)param_5 < ((longlong)ppuVar22 + 3U & 0xfffffffffffffffc) + 1

+                   ) {

+                  iVar6 = -0x3fffffdd;

+                }

+                else {

+                  uVar7 = *local_b0 + 3 & 0xfffffffc;

+                  *local_b0 = uVar7;

+                  if (*(short *)(param_4 + 4) != 0) {

+                    *(ushort *)(param_4 + 3) = *(ushort *)(param_4 + 3) | 1;

+                  }

+                  param_4[4] = 0x10007;

+                  param_4[5] = uVar7;

+                  *(undefined1 *)((ulonglong)uVar7 + (longlong)param_4) = 1;

+                  *local_b0 = *local_b0 + 1;

+                  iVar6 = iVar16;

+                }

+              }

+              local_res8 = (ushort *)((longlong)local_c0 + 0xe);

+              local_b0 = local_c0 + 2;

+            }

+            HsmDbgBreakOnStatus(iVar6);

+            if (iVar6 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_4;

+              uVar14 = 0x98;

+LAB_5:

+              WPP_SF_iisd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar14,ppuVar22,param_1,

+                          *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+            }

+            else {

+              uVar7 = *(uint *)param_5;

+              if (uVar7 < 0x18) {

+                iVar6 = -0x3fffffdd;

+              }

+              else {

+                ppuVar22 = (ulonglong **)

+                           ((ulonglong)(*(uint *)(param_1 + 8) >> 6) & 0xffffffffffffff3f);

+                if (*local_res8 < 2) {

+                  iVar6 = -0x3ffffff3;

+                }

+                else if ((uVar7 < 0x20) ||

+                        ((ulonglong)uVar7 < ((ulonglong)*local_b0 + 3 & 0xfffffffffffffffc) + 1)) {

+                  iVar6 = -0x3fffffdd;

+                }

+                else {

+                  *local_b0 = *local_b0 + 3 & 0xfffffffc;

+                  puVar11 = local_b0;

+                  if (*(short *)(param_4 + 6) != 0) {

+                    *(ushort *)(param_4 + 3) = *(ushort *)(param_4 + 3) | 1;

+                    puVar11 = local_c0 + 2;

+                  }

+                  param_4[6] = 0x10007;

+                  uVar7 = *puVar11;

+                  param_4[7] = uVar7;

+                  *(char *)((ulonglong)uVar7 + (longlong)param_4) = (char)ppuVar22;

+                  *puVar11 = *puVar11 + 1;

+                  iVar6 = iVar16;

+                }

+                local_res8 = (ushort *)((longlong)local_c0 + 0xe);

+              }

+              HsmDbgBreakOnStatus(iVar6);

+              if (iVar6 < 0) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  uVar14 = 0x99;

+                  goto LAB_5;

+                }

+              }

+              else {

+                uVar7 = *(uint *)param_5;

+                ppuVar22 = (ulonglong **)(ulonglong)uVar7;

+                if (uVar7 < 0x18) {

+                  iVar6 = -0x3fffffdd;

+                }

+                else {

+                  uVar18 = local_148[6];

+                  if (*local_res8 < 3) {

+                    iVar6 = -0x3ffffff3;

+                  }

+                  else if ((uVar7 < 0x28) ||

+                          (ppuVar22 <

+                           (ulonglong **)

+                           (((ulonglong)(uint)param_4[2] + 3 & 0xfffffffffffffffc) + 1))) {

+                    iVar6 = -0x3fffffdd;

+                  }

+                  else {

+                    uVar7 = param_4[2] + 3 & 0xfffffffc;

+                    param_4[2] = uVar7;

+                    if (*(short *)(param_4 + 8) != 0) {

+                      *(ushort *)(param_4 + 3) = *(ushort *)(param_4 + 3) | 1;

+                    }

+                    param_4[8] = 0x10007;

+                    param_4[9] = uVar7;

+                    *(char *)((ulonglong)uVar7 + (longlong)param_4) =

+                         (char)((int)(uVar18 << 0x1d) >> 0x1d);

+                    param_4[2] = param_4[2] + 1;

+                    iVar6 = iVar16;

+                  }

+                  local_res8 = (ushort *)((longlong)local_c0 + 0xe);

+                }

+                HsmDbgBreakOnStatus(iVar6);

+                if (iVar6 < 0) {

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    uVar14 = 0x9a;

+                    goto LAB_5;

+                  }

+                }

+                else {

+                  uVar7 = *(uint *)param_5;

+                  if (uVar7 < 0x18) {

+LAB_6:

+                    iVar6 = -0x3fffffdd;

+                  }

+                  else {

+                    uVar10 = *(undefined8 *)(local_148 + 2);

+                    if (3 < *local_res8) {

+                      if (0x2f < uVar7) {

+                        ppuVar22 = (ulonglong **)(ulonglong)(uint)param_4[2];

+                        if (((longlong)ppuVar22 + 3U & 0xfffffffffffffffc) + 8 <= (ulonglong)uVar7)

+                        {

+                          uVar7 = param_4[2] + 3 & 0xfffffffc;

+                          param_4[2] = uVar7;

+                          if (*(short *)(param_4 + 10) != 0) {

+                            *(ushort *)(param_4 + 3) = *(ushort *)(param_4 + 3) | 1;

+                          }

+                          param_4[10] = 0x80006;

+                          param_4[0xb] = uVar7;

+                          *(undefined8 *)((ulonglong)uVar7 + (longlong)param_4) = uVar10;

+                          param_4[2] = param_4[2] + 8;

+                          iVar6 = iVar16;

+                          goto LAB_7;

+                        }

+                      }

+                      goto LAB_6;

+                    }

+                    iVar6 = -0x3ffffff3;

+                  }

+LAB_7:

+                  HsmDbgBreakOnStatus(iVar6);

+                  if (-1 < iVar6) {

+                    _Src = *(int **)(local_148 + 4);

+                    if (_Src != (int *)0x0) {

+                      piVar3 = _Src + 0x3ff;

+                      do {

+                        piVar2 = piVar3;

+                        if (piVar2 <= _Src) break;

+                        piVar3 = piVar2 + -1;

+                      } while (piVar2[-1] == _Src[0x3fe]);

+                      uVar7 = *(uint *)param_5;

+                      ppuVar22 = (ulonglong **)(ulonglong)uVar7;

+                      if (uVar7 < 0x18) {

+LAB_8:

+                        iVar6 = -0x3fffffdd;

+                      }

+                      else {

+                        if (4 < *(ushort *)((longlong)param_4 + 0xe)) {

+                          if (0x37 < uVar7) {

+                            uVar5 = ((short)piVar2 - (short)local_148[4]) + 4;

+                            _Size = (ulonglong **)(ulonglong)uVar5;

+                            if ((ulonglong **)

+                                (((ulonglong)(uint)param_4[2] + 3 & 0xfffffffffffffffc) +

+                                (longlong)_Size) <= ppuVar22) {

+                              if (*(short *)(param_4 + 0xc) != 0) {

+                                *(ushort *)(param_4 + 3) = *(ushort *)(param_4 + 3) | 1;

+                              }

+                              uVar7 = param_4[2] + 3 & 0xfffffffc;

+                              param_4[2] = uVar7;

+                              *(undefined2 *)(param_4 + 0xc) = 0x11;

+                              *(ushort *)((longlong)param_4 + 0x32) = uVar5;

+                              param_4[0xd] = uVar7;

+                              if ((int *)((ulonglong)uVar7 + (longlong)param_4) != _Src) {

+                                memmove((int *)((ulonglong)uVar7 + (longlong)param_4),_Src,

+                                        (size_t)_Size);

+                                ppuVar22 = _Size;

+                              }

+                              param_4[2] = param_4[2] + (uint)*(ushort *)((longlong)param_4 + 0x32);

+                              iVar6 = iVar16;

+                              goto LAB_9;

+                            }

+                          }

+                          goto LAB_8;

+                        }

+                        iVar6 = -0x3ffffff3;

+                      }

+LAB_9:

+                      HsmDbgBreakOnStatus(iVar6);

+                      if (iVar6 < 0) {

+                        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                          uVar14 = 0x9c;

+                          goto LAB_5;

+                        }

+                        goto LAB_4;

+                      }

+                    }

+                    *(ushort *)(param_4 + 3) = *(ushort *)(param_4 + 3) & 0xfffd;

+                    param_4[1] = 0;

+                    *(undefined4 *)param_5 = param_4[2];

+                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                       (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                      WPP_SF_qisdiidd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),param_1 + 0x10,

+                                      (ulonglong)(uint)((int)(local_148[6] << 0x1d) >> 0x1d),param_1

+                                      ,*(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                    }

+                    *(uint **)(param_1 + 0x4c) = local_148;

+                    local_148 = puVar17;

+LAB_10:

+                    iVar25 = 0;

+                    iVar16 = (int)local_138[0];

+                    goto LAB_11;

+                  }

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    uVar14 = 0x9b;

+                    goto LAB_5;

+                  }

+                }

+              }

+            }

+LAB_4:

+            iVar25 = 0;

+            iVar16 = (int)local_138[0];

+            goto LAB_11;

+          }

+          uVar10 = HsmiBitmapNORMALPrepareMcbsForCommit((longlong)param_1,(char *)local_138);

+          iVar6 = (int)uVar10;

+          HsmDbgBreakOnStatus(iVar6);

+          if (iVar6 < 0) {

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              uVar14 = 0x82;

+              goto LAB_0;

+            }

+          }

+          else {

+            ppuVar20 = (ushort **)0x6d427348;

+            local_118 = (ulonglong *)ExAllocatePool2(0x100,0x1000);

+            local_f8 = local_118;

+            if (local_118 != (ulonglong *)0x0) {

+              puVar1 = param_1 + 4;

+              if ((*(longlong *)puVar1 < 1) || ((*(uint *)(param_1 + 8) & 0x10) != 0)) {

+                local_127[0] = '\x01';

+              }

+              else {

+                local_f0 = (ushort *)0x0;

+                ppuVar20 = &local_f0;

+                puVar13 = HsmIBitmapNORMALQueryRangeEx

+                                    ((undefined8 *)param_1,7,(longlong *)ppuVar20,

+                                     (undefined8 *)puVar1,local_127,&local_a0);

+                iVar6 = (int)puVar13;

+                HsmDbgBreakOnStatus(iVar6);

+                if (iVar6 < 0) {

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    uVar14 = 0x84;

+                    goto LAB_0;

+                  }

+                  goto LAB_2;

+                }

+              }

+              if ((local_127[0] == '\0') || (local_a0 != *(longlong *)puVar1)) {

+                uVar18 = 1 << ((byte)(*(uint *)(param_1 + 8) >> 6) & 0x1f);

+                uVar24 = *(uint *)(param_1 + 8) >> 0xc & 7;

+                local_124 = uVar24;

+                local_108 = uVar24;

+                local_104 = uVar18;

+                lVar9 = HsmiBitmapNORMALComputeMaxUserFileSize(uVar24,(ulonglong)uVar18);

+                ppuVar23 = local_res10;

+                uVar7 = local_124;

+                if (lVar9 < (longlong)local_res10) {

+                  do {

+                    uVar24 = uVar24 + 1;

+                    local_108 = uVar24;

+                    lVar9 = HsmiBitmapNORMALComputeMaxUserFileSize(uVar24,(ulonglong)uVar18);

+                    uVar7 = uVar24;

+                  } while (lVar9 < (longlong)ppuVar23);

+                }

+                local_124 = uVar7;

+                uVar7 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)param_1);

+                local_60[0] = 0;

+                local_60[1] = 0;

+                uStack_70 = CONCAT44(uVar7,uVar24);

+                local_78 = param_1;

+                local_68 = ppuVar23;

+                iVar6 = HsmExpandKernelStackAndCallout(HsmiBitmapNORMALOpenOnDiskCallout,local_60);

+                HsmDbgBreakOnStatus(iVar6);

+                if (iVar6 < 0) {

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    uVar14 = 0x86;

+                    goto LAB_0;

+                  }

+                  goto LAB_2;

+                }

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  ppuVar20 = local_res10;

+                  WPP_SF_qisdi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x87,local_res10,param_1,

+                               *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                }

+                uVar7 = uVar24;

+                if (uVar24 != 0xffffffff) {

+                  uVar18 = *(uint *)(param_1 + 8);

+                  puVar15 = local_58;

+                  puVar11 = puVar17;

+                  do {

+                    uVar12 = HsmiBitmapNORMALComputeGranularity

+                                       ((int)puVar11,

+                                        (ulonglong)(uint)(1 << ((byte)(uVar18 >> 6) & 0x1f)));

+                    *puVar15 = uVar12;

+                    uVar19 = (int)puVar11 + 1;

+                    puVar11 = (uint *)(ulonglong)uVar19;

+                    puVar15 = puVar15 + 1;

+                    param_4 = local_res20;

+                    uVar7 = local_124;

+                  } while (uVar19 < uVar24 + 1);

+                }

+                FltAcquirePushLockSharedEx(param_1 + 0x18);

+                local_res18 = '\x01';

+                if (*(longlong *)(param_1 + 0x1c) == 0) {

+LAB_12:

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    WPP_SF_qis(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8a,ppuVar20,param_1,

+                               *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                  }

+                  iVar6 = 0;

+LAB_13:

+                  memset(local_118,iVar6,0x1000);

+                }

+                else {

+                  if ((*(uint *)(param_1 + 8) >> 0xc & 7) != uVar7) {

+                    if (*(longlong *)(param_1 + 0x1c) == 0) goto LAB_12;

+                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                       (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+                      WPP_SF_qis(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x89,ppuVar20,param_1,

+                                 *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                    }

+                    iVar6 = 0xff;

+                    goto LAB_13;

+                  }

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    WPP_SF_qis(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x88,ppuVar20,param_1,

+                               *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                  }

+                  memmove(local_118,*(void **)(param_1 + 0x1c),0x1000);

+                }

+                if ((*(longlong *)(param_1 + 0x1c) != 0) &&

+                   (uVar18 = *(uint *)(param_1 + 8) >> 0xc & 7, uVar12 = (ulonglong)uVar18,

+                   uVar18 < uVar7)) {

+                  if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                     (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 &&

+                      (3 < (byte)WPP_GLOBAL_Control[0x29])))) {

+                    WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8b,uVar12,param_1,

+                                 *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                  }

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    WPP_SF_qis(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8c,uVar12,param_1,

+                               *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                  }

+                  HsmiBitmapNORMALSetNextLevelBlockState('\0',(longlong)local_118,0,1);

+                  uVar8 = RtlComputeCrc32(0,local_118);

+                  *(undefined4 *)((longlong)local_118 + 0xffc) = uVar8;

+                  uVar18 = *(uint *)(param_1 + 8) >> 0xc & 7;

+                  while( true ) {

+                    local_110 = CONCAT44(local_110._4_4_,uVar18);

+                    if (uVar7 <= uVar18) break;

+                    if (uVar18 == (*(uint *)(param_1 + 8) >> 0xc & 7)) {

+                      local_138[0] = *(ulonglong **)(param_1 + 0x1c);

+                    }

+                    else {

+                      local_138[0] = local_118;

+                    }

+                    uVar12 = HsmiBitmapNORMALPrepareBlockForWrite

+                                       ((undefined8 *)param_1,uVar18,(undefined *)0x0,0,4,&local_100

+                                        ,&local_e8);

+                    iVar6 = (int)uVar12;

+                    local_d0[2] = iVar6;

+                    HsmDbgBreakOnStatus(iVar6);

+                    if (iVar6 < 0) {

+                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                        uVar14 = 0x8d;

+LAB_14:

+                        WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar14,

+                                     local_110 & 0xffffffff,param_1,*(undefined8 *)param_1,

+                                     (char *)(param_1 + 0x10));

+                      }

+LAB_15:

+                      iVar25 = (int)local_e8;

+                      uVar26 = local_e8._4_4_;

+                      uVar27 = (undefined4)uStack_e0;

+                      uVar28 = uStack_e0._4_4_;

+                      iVar16 = (int)local_e8;

+                      goto LAB_11;

+                    }

+                    uVar10 = 0x1000;

+                    puVar15 = local_138[0];

+                    memmove(local_100,local_138[0],0x1000);

+                    uVar12 = local_110 & 0xffffffff;

+                    if (iVar6 < 0) {

+                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                        uVar12 = *(ulonglong *)(WPP_GLOBAL_Control + 0x18);

+                        WPP_SF_qisdil(uVar12,0x8e,WPP_GLOBAL_Control,param_1,*(undefined8 *)param_1,

+                                      (char *)(param_1 + 0x10));

+                      }

+                      iVar6 = HsmiBitmapTranslateIOStatus(uVar12,iVar6);

+                      HsmDbgBreakOnStatus(iVar6);

+                      goto LAB_15;

+                    }

+                    uVar10 = HsmpFileCacheSetAddressRangeModified(local_100,puVar15,uVar10);

+                    iVar6 = (int)uVar10;

+                    HsmDbgBreakOnStatus(iVar6);

+                    if (iVar6 < 0) {

+                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                        uVar14 = 0x8f;

+                        goto LAB_14;

+                      }

+                      goto LAB_15;

+                    }

+                    local_78 = local_e8;

+                    uStack_70 = uStack_e0;

+                    HsmIBitmapNORMALUnpinBlock((int *)&local_78);

+                    uVar26 = (undefined4)((ulonglong)local_e8 >> 0x20);

+                    local_e8 = (ushort *)((ulonglong)local_e8 & 0xffffffff00000000);

+                    local_100 = (void *)0x0;

+                    uVar18 = (int)local_110 + 1;

+                    uVar27 = (undefined4)uStack_e0;

+                    uVar28 = uStack_e0._4_4_;

+                  }

+                }

+                local_138[0] = (ulonglong *)((ulonglong)local_138[0] & 0xffffffff00000000);

+                FltReleasePushLockEx(param_1 + 0x18,0);

+                local_res18 = '\0';

+                local_90[1] = 0xffffffffffffffff;

+                local_120[0] = 0xff;

+                for (local_f0 = *(ushort **)(param_1 + 0x44); local_f0 != param_1 + 0x40;

+                    local_f0 = *(ushort **)(local_f0 + 4)) {

+                  local_f8 = (ulonglong *)(local_f0 + 8);

+                  local_110 = 0;

+                  while ((longlong)local_110 < 3) {

+                    local_100 = (void *)0x0;

+                    local_b8 = (uint *)0x0;

+                    local_98 = 0;

+                    local_e8 = (ushort *)*local_f8;

+                    puVar11 = puVar17;

+                    uVar12 = local_110;

+                    while ((local_108 = (uint)puVar11, local_e8 != (ushort *)0x0 &&

+                           (cVar4 = FsRtlGetNextBaseMcbEntry

+                                              (local_e8,puVar11,&local_100,&local_b8,&local_98),

+                           cVar4 != '\0'))) {

+                      local_78 = (ushort *)0x0;

+                      if (local_b8 != (uint *)0xffffffffffffffff) {

+                        uVar21 = (ulonglong)local_104;

+                        local_a8 = uVar21 * (longlong)local_100;

+                        local_90[0] = (ulonglong)local_104 * local_98 + local_a8;

+                        ppuVar20 = local_res10;

+                        if ((longlong)local_res10 < (longlong)*(ushort ***)(param_1 + 4)) {

+                          ppuVar20 = *(ushort ***)(param_1 + 4);

+                        }

+                        if ((longlong)((ulonglong)((uVar21 - 1) + (longlong)ppuVar20) & -uVar21) <

+                            (longlong)local_90[0]) goto LAB_16;

+                        local_res8 = (ushort *)CONCAT71(local_res8._1_7_,uVar12 != 2);

+                        iVar6 = HsmiBitmapNORMALMarkBitmapOnDisk

+                                          ((undefined8 *)param_1,(longlong)local_58,

+                                           (undefined *)(local_90 + 1),(longlong)local_120,local_124

+                                           ,(longlong *)&local_78,(longlong)local_118,&local_a8,

+                                           local_90,uVar12 != 2);

+                        HsmDbgBreakOnStatus(iVar6);

+                        if (iVar6 < 0) {

+                          if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                             ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) goto LAB_4;

+                          if ((byte)WPP_GLOBAL_Control[0x29] < 2) goto LAB_10;

+                          uVar14 = 0x90;

+                          goto LAB_17;

+                        }

+                        uVar12 = local_110;

+                        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                           (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                          WPP_SF_qisdiic(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x91,

+                                         param_1 + 0x10,param_1,*(undefined8 *)param_1,

+                                         (char *)(param_1 + 0x10));

+                          uVar12 = local_110;

+                        }

+                      }

+                      puVar11 = (uint *)(ulonglong)(local_108 + 1);

+                    }

+                    local_f8 = local_f8 + 1;

+                    local_110 = uVar12 + 1;

+                  }

+                }

+                puVar15 = *(ulonglong **)(param_1 + 4);

+                if ((longlong)local_res10 <= (longlong)puVar15) goto LAB_18;

+                local_a8 = 0;

+                local_e8 = (ushort *)~((ulonglong)local_104 - 1);

+                local_f8 = (ulonglong *)((ulonglong)puVar15 & (ulonglong)local_e8);

+                if (local_f8 == puVar15) {

+LAB_19:

+                  local_78 = (ushort *)

+                             ((ulonglong)((longlong)local_res10 + ((ulonglong)local_104 - 1)) &

+                             (ulonglong)local_e8);

+                  puVar15 = local_90 + 1;

+                  iVar6 = HsmiBitmapNORMALMarkBitmapOnDisk

+                                    ((undefined8 *)param_1,(longlong)local_58,(undefined *)puVar15,

+                                     (longlong)local_120,local_124,(longlong *)&local_a8,

+                                     (longlong)local_118,(ulonglong *)&local_f8,

+                                     (ulonglong *)&local_78,'\x01');

+                  HsmDbgBreakOnStatus(iVar6);

+                  if (-1 < iVar6) {

+                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                       (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                      WPP_SF_qisdiic(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x94,puVar15,param_1

+                                     ,*(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                    }

+                    goto LAB_18;

+                  }

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    uVar14 = 0x93;

+LAB_17:

+                    WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar14,

+                                 WPP_GLOBAL_Control,param_1,*(undefined8 *)param_1,

+                                 (char *)(param_1 + 0x10));

+                  }

+                  goto LAB_4;

+                }

+                local_res8 = (ushort *)((ulonglong)local_res8 & 0xffffffffffffff00);

+                local_f0 = (ushort *)0x0;

+                ppuVar22 = &local_f8;

+                puVar13 = HsmIBitmapNORMALQueryRangeEx

+                                    ((undefined8 *)param_1,7,(longlong *)ppuVar22,

+                                     (undefined8 *)(param_1 + 4),(undefined1 *)&local_res8,

+                                     (longlong *)&local_f0);

+                iVar6 = (int)puVar13;

+                HsmDbgBreakOnStatus(iVar6);

+                if (-1 < iVar6) {

+                  if (((char)local_res8 != '\0') &&

+                     (*(longlong *)(param_1 + 4) <= (longlong)local_f0)) goto LAB_19;

+LAB_16:

+                  iVar6 = -0x3fffff1b;

+                  HsmDbgBreakOnStatus(-0x3fffff1b);

+                  goto LAB_4;

+                }

+                if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_4;

+                uVar14 = 0x92;

+                goto LAB_5;

+              }

+              local_148[6] = local_148[6] | 8;

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                WPP_SF_qis(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x85,ppuVar20,param_1,

+                           *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+              }

+              memset(local_118,0xff,0x1000);

+              local_138[0] = (ulonglong *)((ulonglong)local_138[0] & 0xffffffff00000000);

+LAB_18:

+              uVar8 = RtlComputeCrc32(0,local_118,0xffc);

+              *(undefined4 *)((longlong)local_118 + 0xffc) = uVar8;

+              puVar11 = local_b0 + 2;

+              if (local_124 == 0) {

+                puVar11[0] = 0;

+                puVar11[1] = 0;

+LAB_20:

+                *(ulonglong **)(local_148 + 4) = local_118;

+                local_118 = (ulonglong *)0x0;

+                local_148[6] = (local_124 ^ local_148[6]) & 0xfffffff8 ^ local_124;

+                *(ushort ***)local_148 = local_res10;

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  WPP_SF_qisddi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

+                                (ulonglong)(*(uint *)(param_1 + 8) >> 6 & 0x3f),

+                                (ulonglong)(uint)((int)(local_124 << 0x1d) >> 0x1d),param_1,

+                                *(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                }

+                goto LAB_3;

+              }

+              local_d0[0] = 0;

+              local_d0[1] = 0;

+              uStack_e0 = (ulonglong)local_124;

+              local_e8 = param_1;

+              local_d8 = puVar11;

+              iVar6 = HsmExpandKernelStackAndCallout

+                                (HsmiBitmapNORMALFlushBitmapOnDiskCallout,local_d0);

+              HsmDbgBreakOnStatus(iVar6);

+              if (-1 < iVar6) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  WPP_SF_qisdi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x96,param_1 + 0x10,

+                               param_1,*(undefined8 *)param_1,(char *)(param_1 + 0x10));

+                }

+                goto LAB_20;

+              }

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x95,

+                         &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,iVar6);

+              }

+              goto LAB_4;

+            }

+            iVar6 = -0x3fffff66;

+            HsmDbgBreakOnStatus(-0x3fffff66);

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              uVar14 = 0x83;

+              goto LAB_1;

+            }

+          }

+        }

+      }

+LAB_2:

+      iVar16 = 0;

+      goto LAB_11;

+    }

+    iVar6 = -0x3fffff1b;

   }

-  return unaff_EBX;

+  HsmDbgBreakOnStatus(iVar6);

+  iVar16 = 0;

+LAB_11:

+  if (local_res18 != '\0') {

+    FltReleasePushLockEx(param_1 + 0x18,0);

+  }

+  if (local_118 != (ulonglong *)0x0) {

+    ExFreePoolWithTag(local_118,0x6d427348);

+  }

+  if (local_148 != (uint *)0x0) {

+    if (*(longlong *)(local_148 + 4) != 0) {

+      ExFreePoolWithTag(*(longlong *)(local_148 + 4),0x6d427348);

+    }

+    ExFreePoolWithTag(local_148,0x63427348);

+  }

+  if (iVar16 != 0) {

+    local_e8 = (ushort *)CONCAT44(uVar26,iVar25);

+    uStack_e0 = CONCAT44(uVar28,uVar27);

+    HsmIBitmapNORMALUnpinBlock((int *)&local_e8);

+  }

+  return iVar6;

 }
```

## `CldSyncAccessCheck`  (modified)

```diff
--- CldSyncAccessCheck
+++ CldSyncAccessCheck
@@ -1,277 +1,34 @@
-

-/* WARNING: Instruction at (ram,0x00014004b018) overlaps instruction at (ram,0x00014004b016)

-    */

-/* WARNING: Control flow encountered bad instruction data */

-/* WARNING: Removing unreachable block (ram,0x00014004afdc) */

-/* WARNING: Removing unreachable block (ram,0x00014004afe9) */

-/* WARNING: Removing unreachable block (ram,0x00014004b007) */

-/* WARNING: Removing unreachable block (ram,0x00014004b00a) */

 

 int CldSyncAccessCheck(longlong param_1,undefined8 param_2)

 

 {

-  ushort uVar1;

-  uint uVar2;

-  uint uVar3;

-  char *in_RAX;

-  ulonglong uVar4;

-  undefined2 uVar5;

-  int iVar6;

-  byte bVar7;

-  ushort uVar8;

-  int unaff_EBP;

-  int iVar9;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  uint uVar10;

-  ulonglong in_R9;

-  ulonglong in_R10;

-  byte unaff_R12B;

-  byte unaff_R13B;

-  byte bVar11;

-  ushort unaff_R14W;

-  int unaff_R15D;

-  bool in_ZF;

-  bool in_OF;

-  undefined4 uStack0000000000000028;

-  byte in_stack_00000070;

-  byte in_stack_00000080;

-  byte in_stack_00000088;

+  int iVar1;

+  longlong lVar2;

+  ulonglong uVar3;

   

-  bVar11 = (byte)unaff_R14W;

-  bVar7 = (byte)unaff_EBP;

-  if (in_ZF) {

-    *in_RAX = *in_RAX + (char)in_RAX;

-    *(char *)(unaff_RSI + 0x45) = *(char *)(unaff_RSI + 0x45) + (char)((ulonglong)in_RAX >> 8);

-    uVar8 = *(ushort *)(unaff_RDI + 0xe);

-    unaff_R15D = 4;

-    if (uVar8 != 0) {

-      unaff_R15D = 5;

-      if ((ulonglong)uVar8 * 8 + 0x10 < in_R9) {

-        unaff_R15D = 0x10000;

-        uVar4 = in_R10 & 0xffffffff;

-        iVar6 = 0;

-        while( true ) {

-          uVar2 = (uint)uVar8;

-          if (4 < uVar8) {

-            uVar2 = 5;

-          }

-          if (uVar2 <= (uint)uVar4) break;

-          if (0x11 < *(ushort *)(unaff_RDI + 0x10 + uVar4 * 8)) goto LAB_0;

-          uVar2 = *(uint *)(unaff_RDI + 0x14 + uVar4 * 8);

-          if ((((uVar2 != 0) && ((ulonglong)uVar2 < (ulonglong)uVar8 * 8 + 0x10)) ||

-              (uVar10 = (uint)in_R9, uVar10 < uVar2)) ||

-             (((uVar1 = *(ushort *)(unaff_RDI + 0x12 + uVar4 * 8), uVar10 < uVar1 ||

-               (uVar3 = uVar1 + uVar2, uVar3 < uVar2)) || (uVar10 < uVar3)))) goto LAB_0;

-          unaff_R15D = unaff_R15D + unaff_EBP;

-          uVar4 = (ulonglong)((uint)uVar4 + unaff_EBP);

-        }

-        uVar2 = *(uint *)(unaff_RDI + 8);

-        unaff_R15D = 0x20000;

-        if ((((0x17 < uVar2) && (*(ushort *)(unaff_RDI + 0xe) != 0)) &&

-            (*(ushort *)(unaff_RDI + 0x10) < 0x12)) &&

-           ((((uVar10 = *(uint *)(unaff_RDI + 0x14), uVar10 == 0 ||

-              (((uint)*(ushort *)(unaff_RDI + 0xe) * 8 + 0x10 <= uVar10 && (uVar10 <= uVar2)))) &&

-             (*(ushort *)(unaff_RDI + 0x12) <= uVar2)) &&

-            (((uVar3 = *(ushort *)(unaff_RDI + 0x12) + uVar10, uVar10 <= uVar3 && (uVar3 <= uVar2))

-             && (*(ushort *)(unaff_RDI + 0x10) == 7)))))) {

-          uVar8 = (ushort)unaff_EBP;

-          if (*(ushort *)(unaff_RDI + 0x12) == uVar8) {

-            memmove(&stack0x00000070,(void *)((ulonglong)*(uint *)(unaff_RDI + 0x14) + unaff_RDI),

-                    (ulonglong)*(ushort *)(unaff_RDI + 0x12));

-            unaff_R15D = 0x20001;

-            if (in_stack_00000070 <= bVar7) {

-              uVar2 = *(uint *)(unaff_RDI + 8);

-              iVar9 = -0x3ffffddb;

-              if (((((((uVar2 < 0x18) || (*(ushort *)(unaff_RDI + 0xe) <= unaff_R14W)) ||

-                     (uVar2 < 0x28)) || (0x11 < *(ushort *)(unaff_RDI + 0x20))) ||

-                   ((uVar10 = *(uint *)(unaff_RDI + 0x24), uVar10 != 0 &&

-                    ((uVar10 < (uint)*(ushort *)(unaff_RDI + 0xe) * 8 + 0x10 || (uVar2 < uVar10)))))

-                   ) || ((uVar2 < *(ushort *)(unaff_RDI + 0x22) ||

-                         ((uVar3 = *(ushort *)(unaff_RDI + 0x22) + uVar10, uVar3 < uVar10 ||

-                          (uVar2 < uVar3)))))) ||

-                 ((*(ushort *)(unaff_RDI + 0x20) != 7 || (*(ushort *)(unaff_RDI + 0x22) != uVar8))))

-              {

-                iVar6 = -0x3ffffddb;

-              }

-              else {

-                memmove(&stack0x00000080,

-                        (void *)((ulonglong)*(uint *)(unaff_RDI + 0x24) + unaff_RDI),

-                        (ulonglong)*(ushort *)(unaff_RDI + 0x22));

-                unaff_R12B = in_stack_00000080;

-              }

-              HsmDbgBreakOnStatus(iVar6);

-              if (iVar6 < 0) {

-                HsmDbgBreakOnCorruption();

-                HsmDbgBreakOnStatus(-0x3fff30fe);

-                if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-                  return -0x3fff30fe;

-                }

-                if ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) {

-                  return -0x3fff30fe;

-                }

-                if ((byte)WPP_GLOBAL_Control[0x29] < bVar11) {

-                  return -0x3fff30fe;

-                }

-                uVar5 = 0xa2;

-                goto LAB_1;

-              }

-              if (unaff_R12B != 0) {

-                uVar4 = Feature_720257338__private_IsEnabledDeviceUsageNoInline();

-                if ((int)uVar4 == 0) {

-                  if (*(ushort *)(unaff_RDI + 0xe) < 4) {

-                    HsmDbgBreakOnCorruption();

-                    HsmDbgBreakOnStatus(-0x3fff30fe);

-                    if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-                      return -0x3fff30fe;

-                    }

-                    if ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) {

-                      return -0x3fff30fe;

-                    }

-                    if ((byte)WPP_GLOBAL_Control[0x29] < bVar11) {

-                      return -0x3fff30fe;

-                    }

-                    uVar5 = 0xa4;

-                    goto LAB_1;

-                  }

-                }

-                else if (*(ushort *)(unaff_RDI + 0xe) < 5) {

-                  HsmDbgBreakOnCorruption();

-                  HsmDbgBreakOnStatus(-0x3fff30fe);

-                  if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-                    return -0x3fff30fe;

-                  }

-                  if ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) {

-                    return -0x3fff30fe;

-                  }

-                  if ((byte)WPP_GLOBAL_Control[0x29] < bVar11) {

-                    return -0x3fff30fe;

-                  }

-                  uVar5 = 0xa3;

-                  goto LAB_1;

-                }

-                if (*(int *)(unaff_RDI + 0x34) == 0) {

-                  HsmDbgBreakOnCorruption();

-                  HsmDbgBreakOnStatus(-0x3fff30fe);

-                  if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-                    return -0x3fff30fe;

-                  }

-                  if ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) {

-                    return -0x3fff30fe;

-                  }

-                  if ((byte)WPP_GLOBAL_Control[0x29] < bVar11) {

-                    return -0x3fff30fe;

-                  }

-                  uVar5 = 0xa5;

-                  goto LAB_1;

-                }

-                if (0x1000 < *(ushort *)(unaff_RDI + 0x32)) {

-                  HsmDbgBreakOnCorruption();

-                  HsmDbgBreakOnStatus(-0x3fff30fe);

-                  if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-                    return -0x3fff30fe;

-                  }

-                  if ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) {

-                    return -0x3fff30fe;

-                  }

-                  if ((byte)WPP_GLOBAL_Control[0x29] < bVar11) {

-                    return -0x3fff30fe;

-                  }

-                  uStack0000000000000028 = 0xc000cf02;

-                  WPP_SF_ddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xa6,

-                             &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,

-                             (uint)*(ushort *)(unaff_RDI + 0x32));

-                  return -0x3fff30fe;

-                }

-              }

-              if (bVar7 < unaff_R12B) {

-                HsmDbgBreakOnCorruption();

-                HsmDbgBreakOnStatus(-0x3fff30fe);

-                if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-                  return -0x3fff30fe;

-                }

-                if ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) {

-                  return -0x3fff30fe;

-                }

-                if ((byte)WPP_GLOBAL_Control[0x29] < bVar11) {

-                  return -0x3fff30fe;

-                }

-                uStack0000000000000028 = 0xc000cf02;

-                WPP_SF_ddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xa7,

-                           &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,(uint)unaff_R12B);

-                return -0x3fff30fe;

-              }

-              uVar2 = *(uint *)(unaff_RDI + 8);

-              if (((((((0x17 < uVar2) && (uVar8 < *(ushort *)(unaff_RDI + 0xe))) && (0x1f < uVar2))

-                    && (*(ushort *)(unaff_RDI + 0x18) < 0x12)) &&

-                   (((uVar10 = *(uint *)(unaff_RDI + 0x1c), uVar10 == 0 ||

-                     (((uint)*(ushort *)(unaff_RDI + 0xe) * 8 + 0x10 <= uVar10 && (uVar10 <= uVar2))

-                     )) && (*(ushort *)(unaff_RDI + 0x1a) <= uVar2)))) &&

-                  ((uVar3 = *(ushort *)(unaff_RDI + 0x1a) + uVar10, uVar10 <= uVar3 &&

-                   (uVar3 <= uVar2)))) &&

-                 ((*(ushort *)(unaff_RDI + 0x18) == 7 && (*(ushort *)(unaff_RDI + 0x1a) == uVar8))))

-              {

-                memmove(&stack0x00000088,

-                        (void *)((ulonglong)*(uint *)(unaff_RDI + 0x1c) + unaff_RDI),

-                        (ulonglong)*(ushort *)(unaff_RDI + 0x1a));

-                iVar9 = 0;

-                unaff_R13B = in_stack_00000088;

-              }

-              HsmDbgBreakOnStatus(iVar9);

-              if (-1 < iVar9) {

-                if ((byte)(unaff_R13B - bVar7) < 0x14) {

-                  return iVar9;

-                }

-                HsmDbgBreakOnCorruption();

-                HsmDbgBreakOnStatus(-0x3fff30fe);

-                if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-                  return -0x3fff30fe;

-                }

-                if ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) {

-                  return -0x3fff30fe;

-                }

-                if ((byte)WPP_GLOBAL_Control[0x29] < bVar11) {

-                  return -0x3fff30fe;

-                }

-                WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xa9,

-                          &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,(uint)unaff_R13B);

-                return -0x3fff30fe;

-              }

-              HsmDbgBreakOnCorruption();

-              HsmDbgBreakOnStatus(-0x3fff30fe);

-              if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

-                return -0x3fff30fe;

-              }

-              if ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0) {

-                return -0x3fff30fe;

-              }

-              if ((byte)WPP_GLOBAL_Control[0x29] < bVar11) {

-                return -0x3fff30fe;

-              }

-              uVar5 = 0xa8;

-LAB_1:

-              WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar5,

-                       &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,0xc000cf02);

-              return -0x3fff30fe;

-            }

-          }

-        }

+  iVar1 = 0;

+  lVar2 = CldSyncReferenceStream(param_1,param_2,0);

+  if (lVar2 == 0) {

+    uVar3 = Feature_3375760696__private_IsEnabledDeviceUsageNoInline();

+    if ((int)uVar3 != 0) {

+      iVar1 = -0x3fff30e5;

+      HsmDbgBreakOnStatus(-0x3fff30e5);

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+        WPP_SF_iDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x33,

+                   &WPP_028866cd16db3b910821a8d7e4c3d7b2_Traceguids,param_2);

       }

     }

   }

-  else if (in_OF) {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-    halt_baddata();

+  else {

+    iVar1 = HsmpAccessCheckByFileId

+                      (*(longlong *)((longlong *)**(longlong **)(lVar2 + 8))[1],

+                       *(undefined8 *)

+                        (*(longlong *)(*(longlong *)**(longlong **)(lVar2 + 8) + 0x10) + 0x20));

+    HsmDbgBreakOnStatus(iVar1);

+    CldiSyncReleaseRundown(lVar2);

   }

-LAB_0:

-  HsmDbgBreakOnCorruption();

-  HsmDbgBreakOnStatus(-0x3fff30fe);

-  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-      ((bVar7 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-     (bVar11 <= (byte)WPP_GLOBAL_Control[0x29])) {

-    WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xa1,

-              &WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,unaff_R15D);

-  }

-  return -0x3fff30fe;

+  return iVar1;

 }
```

## `HsmiCldGetSyncRootInfo`  (modified)

```diff
--- HsmiCldGetSyncRootInfo
+++ HsmiCldGetSyncRootInfo
@@ -1,108 +1,37 @@
+

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 uint HsmiCldGetSyncRootInfo(longlong param_1,longlong param_2,undefined8 param_3,longlong *param_4)

 

 {

-  longlong lVar1;

-  char cVar2;

-  ulonglong in_RAX;

-  char *pcVar3;

-  longlong lVar4;

-  longlong lVar5;

-  ulonglong uVar6;

-  undefined2 uVar7;

-  uint uVar8;

-  longlong unaff_RBP;

-  uint unaff_ESI;

-  longlong unaff_RDI;

-  longlong unaff_R12;

-  char unaff_R14B;

-  longlong unaff_R15;

-  undefined8 in_stack_00000030;

-  char cStack0000000000000090;

-  longlong *in_stack_000000a8;

+  uint uVar1;

+  longlong lVar2;

+  longlong local_res10;

   

-  pcVar3 = (char *)(unaff_RBP + -0x74 + param_1 * 4);

-  *pcVar3 = *pcVar3 + (char)param_1;

-  pcVar3 = (char *)(in_RAX & 0xffffffffffffff90);

-  *pcVar3 = *pcVar3 + (char)pcVar3;

-  pcVar3[-0x77] = pcVar3[-0x77] + (char)param_1;

-  cStack0000000000000090 = unaff_R14B;

-  lVar4 = RtlInsertElementGenericTableAvl();

-  uVar8 = (uint)unaff_RBP;

-  if (lVar4 == 0) {

-    HsmDbgBreakOnStatus(uVar8);

-    unaff_ESI = uVar8;

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-      uVar7 = 0x1e;

-LAB_0:

-      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar7,

-                &WPP_028866cd16db3b910821a8d7e4c3d7b2_Traceguids,unaff_R15);

-      unaff_ESI = uVar8;

-    }

-LAB_1:

-    if ((unaff_RDI != 0) && (unaff_RDI != unaff_R12)) {

-      uVar6 = Feature_4003697978__private_IsEnabledDeviceUsageNoInline();

-      if (((int)uVar6 != 0) && ((lVar4 != 0 && (*(longlong *)(lVar4 + 8) == unaff_RDI)))) {

-        RtlDeleteElementGenericTableAvl(in_stack_00000030,lVar4);

+  uVar1 = 0;

+  local_res10 = 0;

+  *param_4 = 0;

+  if ((param_2 == 0) || (local_res10 = (*DAT_0)(), local_res10 == 0)) {

+    uVar1 = HsmiCldGetSyncRootInfoByFileObject(param_1,param_3,&local_res10);

+    HsmDbgBreakOnStatus(uVar1);

+    if ((int)uVar1 < 0) {

+      lVar2 = local_res10;

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x23,

+                    &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+        lVar2 = local_res10;

       }

-      if (*(longlong *)(unaff_RDI + 0x20) != 0) {

-        ExFreePoolWithTag(*(longlong *)(unaff_RDI + 0x20),0x69537348);

-      }

-      if (*(longlong *)(unaff_RDI + 0x10) != 0) {

-        ExFreePoolWithTag(*(longlong *)(unaff_RDI + 0x10),0x73557348);

-      }

-      if (*(longlong *)(unaff_RDI + 0x50) != 0) {

-        ExFreePoolWithTag(*(longlong *)(unaff_RDI + 0x50),0x72736c43);

-      }

-      ExFreePoolWithTag();

+      goto LAB_1;

     }

   }

-  else {

-    if (cStack0000000000000090 == '\0') {

-      HsmDbgBreakOnStatus(-0x3fffff1b);

-      unaff_ESI = 0xc00000e5;

-      goto LAB_1;

-    }

-    lVar1 = unaff_R15 + 0x78;

-    lVar5 = RtlFindUnicodePrefix(lVar1,unaff_RDI + 8,0);

-    if (lVar5 == 0) {

-LAB_2:

-      lVar5 = ExAllocatePool2(0x100,0x40,0x65707343);

-      if (lVar5 == 0) {

-        HsmDbgBreakOnStatus(uVar8);

-        unaff_ESI = uVar8;

-        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-          uVar7 = 0x1f;

-          goto LAB_0;

-        }

-        goto LAB_1;

-      }

-      *(longlong *)(lVar5 + 0x38) = unaff_RDI;

-      RtlInsertUnicodePrefix(lVar1,unaff_RDI + 8,lVar5);

-    }

-    else {

-      cVar2 = RtlEqualUnicodeString(*(undefined8 *)(lVar5 + 0x30),unaff_RDI + 8,1);

-      if (cVar2 == '\0') {

-        RtlRemoveUnicodePrefix(lVar1,lVar5);

-        ExFreePoolWithTag(lVar5,0x65707343);

-        goto LAB_2;

-      }

-      if (*(longlong *)(lVar5 + 0x38) != unaff_RDI) {

-        *(longlong *)(lVar5 + 0x38) = unaff_RDI;

-      }

-    }

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-       (3 < (byte)WPP_GLOBAL_Control[0x29])) {

-      WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x20,

-                 &WPP_028866cd16db3b910821a8d7e4c3d7b2_Traceguids,unaff_R15);

-    }

-    *in_stack_000000a8 = unaff_RDI;

+  *param_4 = local_res10;

+  lVar2 = 0;

+LAB_1:

+  if (lVar2 != 0) {

+    ExFreePoolWithTag(lVar2,0);

   }

-  return unaff_ESI;

+  return uVar1;

 }
```

## `HsmpRecallInitiateHydrationEx`  (modified)

```diff
--- HsmpRecallInitiateHydrationEx
+++ HsmpRecallInitiateHydrationEx
@@ -1,55 +1,656 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-/* WARNING: Removing unreachable block (ram,0x000140004bd8) */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

 

 int HsmpRecallInitiateHydrationEx

               (uint *param_1,uint *param_2,ulonglong param_3,byte *param_4,uint *param_5,

               uint *param_6,longlong param_7,undefined8 param_8,undefined *param_9)

 

 {

-  int *in_RAX;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  undefined8 uVar1;

-  int iVar2;

-  longlong unaff_R15;

-  bool in_OF;

-  int in_stack_000000c8;

+  longlong *plVar1;

+  longlong lVar2;

+  code *pcVar3;

+  uint *puVar4;

+  char cVar5;

+  uint uVar6;

+  uint uVar7;

+  undefined4 uVar8;

+  ulonglong uVar9;

+  longlong lVar10;

+  undefined8 uVar11;

+  uint *puVar12;

+  ulonglong uVar13;

+  longlong lVar14;

+  undefined8 uVar15;

+  undefined8 uVar16;

+  uint *puVar17;

+  undefined2 uVar18;

+  uint *puVar19;

+  undefined1 *puVar20;

+  undefined *puVar21;

+  int iVar22;

+  char local_res10 [8];

+  ulonglong local_res18;

+  char local_res20 [8];

+  undefined1 auStackY_118 [8];

+  undefined1 auStackY_110 [24];

+  undefined4 in_stack_ffffffffffffff40;

+  undefined4 in_stack_ffffffffffffff44;

+  uint local_a0;

+  uint local_9c;

+  undefined8 local_98;

+  uint *local_90;

+  longlong local_88;

+  uint local_80;

+  ulonglong local_78;

+  longlong local_70;

+  longlong local_68;

+  longlong local_60;

+  code *local_58;

+  longlong local_50;

+  longlong local_48;

+  uint *local_40;

   

-  if (!in_OF) {

-    *in_RAX = *in_RAX + (int)in_RAX;

-    MicrosoftTelemetryAssertTriggeredMsgKM((char *)param_1);

-    iVar2 = 1;

-    if (in_stack_000000c8 < 0) {

-      iVar2 = 4;

-      *(int *)(unaff_RBP + 0x18) = in_stack_000000c8;

-      *(undefined8 *)(unaff_RBP + 0x20) = 0;

-    }

-    if (unaff_RBX != 0) {

-      if ((((in_stack_000000c8 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+  puVar4 = param_5;

+  puVar20 = auStackY_118;

+  local_48 = param_7;

+  cVar5 = '\0';

+  local_40 = param_6;

+  lVar2 = *(longlong *)(*(longlong *)(param_2 + 4) + 0x10);

+  local_98 = *(undefined8 *)(*(longlong *)(param_2 + 4) + 0x20);

+  local_80 = (uint)param_4 & 0x10000;

+  local_9c = (uint)param_4 & 0xffff;

+  local_a0 = 0;

+  local_60 = 0;

+  local_88 = 0;

+  local_50 = 0;

+  local_70 = 0;

+  param_8._0_1_ = '\0';

+  local_res10[0] = '\0';

+  local_90 = (uint *)0x0;

+  lVar14 = param_7;

+  local_res18 = param_3;

+  while( true ) {

+    if ((*(char *)(*(longlong *)(puVar4 + 4) + 4) != '\r') ||

+       (iVar22 = 4, *(int *)(*(longlong *)(puVar4 + 4) + 0x28) != 0x903bc)) {

+      iVar22 = 0;

+    }

+    HsmpAcquireReparseUpdateLock((longlong)param_2,cVar5);

+    uVar6 = HsmpRpCheckState((longlong)param_2);

+    HsmDbgBreakOnStatus(uVar6);

+    local_58 = (code *)param_9;

+    if ((int)uVar6 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

           ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

          ) {

-        FltIsOperationSynchronous();

-        WPP_SF_qiDcccqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xf,

-                         &WPP_2f77a96d61d535b9e067d50c2392dcbb_Traceguids,unaff_RBP);

-      }

-      uVar1 = 0;

-      if (iVar2 != 2) {

-        uVar1 = *(undefined8 *)(unaff_RBP + 0x20);

-      }

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        WPP_SF_qiiqqLid(*(undefined8 *)(puVar21 + 0x18),0x2a,(longlong)param_6 + lVar14,puVar4);

+      }

+      uVar9 = local_res18;

+      TlmWriteFoundCorruptReparsePoint(local_res18,uVar6);

+      goto LAB_0;

+    }

+    puVar19 = param_2;

+    uVar9 = HsmpIsPlaceholder((longlong)param_2);

+    uVar6 = 0;

+    if (((char)uVar9 == '\0') || (uVar7 = HsmpIsDirectory((longlong)puVar19), (char)uVar7 != '\0'))

+    {

+      uVar9 = local_res18;

+      if ((*(char *)(*(longlong *)(puVar4 + 4) + 4) == '\r') &&

+         (*(int *)(*(longlong *)(puVar4 + 4) + 0x28) == 0x903bc)) {

+        iVar22 = 4;

+      }

+      else {

+        iVar22 = 0;

+      }

+      goto LAB_0;

+    }

+    lVar10 = HsmpGetStreamSize((longlong)puVar19);

+    uVar6 = (uint)param_4;

+    if ((lVar10 != 0) || (cVar5 != '\0')) break;

+LAB_1:

+    HsmpReleaseReparseUpdateLock((longlong)puVar19);

+    cVar5 = '\x01';

+  }

+  if ((char)param_2[8] != '\0') {

+    if ((param_1 == (uint *)0x0) || (*(char *)((longlong)param_1 + 0x2d) == '\0')) {

+      uVar6 = 0xc000cf18;

+      HsmDbgBreakOnStatus(-0x3fff30e8);

+      uVar9 = local_res18;

+      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (1 < (byte)WPP_GLOBAL_Control[0x29])))

+         ) {

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        uVar9 = local_res18;

+        WPP_SF_qqLiqiqd(*(undefined8 *)(puVar21 + 0x18),0x2b,

+                        &WPP_7b493afee855349cd64b6fd5ca5bddac_Traceguids,lVar2);

+        uVar6 = 0xc000cf18;

+      }

+    }

+    else {

+      iVar22 = 1;

+      uVar9 = local_res18;

+      uVar6 = 0;

+    }

+    goto LAB_0;

+  }

+  HsmpAcquireBitmapLock((longlong)puVar19,cVar5);

+  if ((param_2[7] >> 8 & 1) != 0) {

+    uVar9 = local_res18;

+    if ((1 < local_9c - 9) || ((param_2[7] >> 10 & 1) != 0)) goto LAB_2;

+    param_5 = (uint *)0x0;

+    local_78 = 0;

+    local_68 = 0;

+    param_7._0_1_ = '\0';

+    if (local_9c == 9) {

+      lVar10 = *(longlong *)(puVar4 + 4);

+      if (*(char *)(lVar10 + 4) == '\x04') {

+        puVar19 = *(uint **)(lVar10 + 0x28);

+        param_5 = puVar19;

+        if (puVar19 == (uint *)0xffffffffffffffff) goto LAB_2;

+        lVar10 = (ulonglong)*(uint *)(lVar10 + 0x18) + (longlong)puVar19;

+      }

+      else {

+        param_5 = param_6;

+        puVar19 = param_6;

+        if (lVar14 == -1) {

+          lVar14 = HsmpGetStreamSize((longlong)param_2);

+          lVar14 = lVar14 - (longlong)puVar19;

+        }

+        lVar10 = (longlong)puVar19 + lVar14;

+      }

+      uVar6 = HsmpGetRecallAlignment((longlong)param_2);

+      param_5 = (uint *)(-(ulonglong)uVar6 & (ulonglong)puVar19);

+      uVar6 = HsmpGetRecallAlignment((longlong)param_2);

+      local_78 = ((ulonglong)uVar6 - 1) + lVar10 & -(ulonglong)uVar6;

+    }

+    else {

+      local_78 = HsmpGetStreamSize((longlong)param_2);

+    }

+    param_4 = (byte *)&param_7;

+    uVar6 = HsmpQueryModifiedRangeNoLock((longlong)param_2,&param_5,&local_78,param_4,&local_68);

+    HsmDbgBreakOnStatus(uVar6);

+    uVar9 = local_res18;

+    if ((int)uVar6 < 0) {

       if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 4) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        WPP_SF_qldPq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x26,uVar1,unaff_RBP);

-      }

-      FltReleaseContext();

-    }

-    if (unaff_R15 != 0) {

-      FltReleaseContext();

-    }

-    return iVar2;

-  }

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        uVar18 = 0x2c;

+LAB_3:

+        uVar9 = local_res18;

+        WPP_SF_qqLiqiqd(*(undefined8 *)(puVar21 + 0x18),uVar18,

+                        &WPP_7b493afee855349cd64b6fd5ca5bddac_Traceguids,lVar2);

+      }

+      goto LAB_4;

+    }

+    if (((char)param_7 != '\0') && ((longlong)local_78 <= local_68)) goto LAB_2;

+    if (cVar5 == '\0') {

+      param_3 = local_78;

+      HsmpReleaseBitmapLock((longlong)param_2);

+      puVar19 = param_2;

+      goto LAB_1;

+    }

+    uVar6 = HsmpMarkModificationBitmapNoLock((longlong)param_2,(ulonglong)param_5,local_78,1);

+    HsmDbgBreakOnStatus(uVar6);

+    uVar9 = local_res18;

+    if ((int)uVar6 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        uVar18 = 0x2d;

+        uVar9 = local_res18;

+LAB_5:

+        WPP_SF_qqLiqiqd(*(undefined8 *)(puVar21 + 0x18),uVar18,

+                        &WPP_7b493afee855349cd64b6fd5ca5bddac_Traceguids,lVar2);

+      }

+    }

+    else {

+      uVar6 = HsmpRpCommitNoLock(lVar2,(longlong)param_2,local_res18,'\0','\x01');

+      HsmDbgBreakOnStatus(uVar6);

+      if ((int)uVar6 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          puVar21 = WPP_GLOBAL_Control;

+          HsmpGetStreamSize((longlong)param_2);

+          uVar18 = 0x2e;

+          goto LAB_6;

+        }

+      }

+      else {

+LAB_2:

+        uVar6 = 0;

+        if ((*(char *)(*(longlong *)(puVar4 + 4) + 4) == '\r') &&

+           (*(int *)(*(longlong *)(puVar4 + 4) + 0x28) == 0x903bc)) {

+          iVar22 = 4;

+        }

+        else {

+          iVar22 = 0;

+        }

+      }

+    }

+    goto LAB_4;

+  }

+  uVar6 = HsmpToggleFileAttributesNoNotify(lVar2,local_res18,param_3,uVar6);

+  HsmDbgBreakOnStatus(uVar6);

+  if ((int)uVar6 < 0) {

+    uVar9 = local_res18;

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_4;

+    puVar21 = WPP_GLOBAL_Control;

+    HsmpGetStreamSize((longlong)param_2);

+    uVar18 = 0x2f;

+    uVar9 = local_res18;

+LAB_6:

+    WPP_SF_qqLiqiqd(*(undefined8 *)(puVar21 + 0x18),uVar18,

+                    &WPP_7b493afee855349cd64b6fd5ca5bddac_Traceguids,lVar2);

+LAB_4:

+    HsmpReleaseBitmapLock((longlong)param_2);

+LAB_0:

+    HsmpReleaseReparseUpdateLock((longlong)param_2);

+    puVar20 = auStackY_118;

+  }

+  else {

+    if ((*(char *)(*(longlong *)(puVar4 + 4) + 4) == '\x03') &&

+       (lVar10 = IoGetTopLevelIrp(), lVar10 == 2)) {

+      uVar6 = 0xc000cf0a;

+      HsmDbgBreakOnStatus(-0x3fff30f6);

+      uVar9 = local_res18;

+      goto LAB_4;

+    }

+    uVar11 = HsmpGetAttributionInformation

+                       ((longlong)param_1,(longlong)param_2,(longlong)puVar4,&local_90);

+    uVar6 = (uint)uVar11;

+    HsmDbgBreakOnStatus(uVar6);

+    if ((int)uVar6 < 0) {

+      uVar9 = local_res18;

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        uVar18 = 0x30;

+        uVar9 = local_res18;

+        goto LAB_6;

+      }

+      goto LAB_4;

+    }

+    uVar9 = (ulonglong)local_9c;

+    uVar6 = HsmpCldGetSyncPolicy(lVar2,(longlong)param_2,local_res18,local_9c,&local_a0);

+    HsmDbgBreakOnStatus(uVar6);

+    if ((int)uVar6 < 0) {

+      uVar9 = local_res18;

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        uVar18 = 0x31;

+        uVar9 = local_res18;

+        goto LAB_6;

+      }

+      goto LAB_4;

+    }

+    puVar19 = (uint *)0x1;

+    puVar12 = HsmOsCheckAppCompatPolicy((undefined8 *)local_90,1,local_res10);

+    if (((int)puVar12 < 0) || (local_res10[0] != '\0')) {

+      local_a0 = local_a0 & 0xfffffff3 | 3;

+    }

+    if (local_9c == 2) {

+      local_a0 = local_a0 & 0xfffffff3 | 3;

+    }

+    if ((local_a0 & 0xf) == 0) {

+      if ((local_9c != 2) || (*(char *)(lVar2 + 0x18) == '\0')) goto LAB_7;

+      uVar6 = 0xc000cf0c;

+      HsmDbgBreakOnStatus(-0x3fff30f4);

+      uVar9 = local_res18;

+      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (1 < (byte)WPP_GLOBAL_Control[0x29])))

+         ) {

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        uVar18 = 0x32;

+        goto LAB_8;

+      }

+      goto LAB_4;

+    }

+    if ((*(char *)(lVar2 + 0x18) != '\0') && ((local_a0 & 0x200) == 0)) {

+      uVar6 = 0xc000cf0c;

+      HsmDbgBreakOnStatus(-0x3fff30f4);

+      uVar9 = local_res18;

+      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (1 < (byte)WPP_GLOBAL_Control[0x29])))

+         ) {

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        uVar18 = 0x33;

+LAB_8:

+        uVar6 = 0xc000cf0c;

+        goto LAB_3;

+      }

+      goto LAB_4;

+    }

+    uVar7 = local_9c;

+    if (lVar14 == -1) {

+      lVar14 = HsmpGetStreamSize((longlong)param_2);

+      lVar14 = lVar14 - (longlong)param_6;

+    }

+    puVar12 = param_6;

+    if (((byte)local_a0 & 0xf) < 3) {

+      puVar19 = puVar4;

+      uVar13 = HsmiRecallCbdMayCausePagingIo(lVar2,(longlong)puVar4);

+      uVar7 = local_9c;

+      if (((char)uVar13 != '\0') && ((local_a0 & 0x100) != 0)) {

+        lVar14 = lVar14 + 0x10000;

+      }

+    }

+    else {

+      puVar12 = (uint *)0x0;

+      lVar14 = HsmpGetStreamSize((longlong)param_2);

+    }

+    puVar17 = param_2;

+    lVar10 = HsmpGetStreamSize((longlong)param_2);

+    if (lVar10 <= (longlong)puVar12) {

+      lVar14 = HsmpGetStreamSize((longlong)puVar17);

+      if ((lVar14 == 0) && ((param_2[7] >> 8 & 1) == 0)) {

+        param_2[7] = param_2[7] | 0x3c0;

+        uVar6 = HsmpOpenFileById(lVar2,local_98,0x100100,uVar9,0x200028,'\0',&local_50,&local_70);

+        HsmDbgBreakOnStatus(uVar6);

+        if ((int)uVar6 < 0) {

+          uVar9 = local_res18;

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            puVar21 = WPP_GLOBAL_Control;

+            HsmpGetStreamSize((longlong)param_2);

+            uVar18 = 0x34;

+            uVar9 = local_res18;

+            goto LAB_6;

+          }

+        }

+        else {

+          uVar6 = HsmpRpCommitNoLock(lVar2,(longlong)param_2,local_70,'\0','\x01');

+          HsmDbgBreakOnStatus(uVar6);

+          if (-1 < (int)uVar6) goto LAB_7;

+          uVar9 = local_res18;

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            puVar21 = WPP_GLOBAL_Control;

+            HsmpGetStreamSize((longlong)param_2);

+            uVar18 = 0x35;

+            uVar9 = local_res18;

+            goto LAB_6;

+          }

+        }

+      }

+      else {

+LAB_7:

+        uVar6 = 0;

+        uVar9 = local_res18;

+        if ((*(char *)(*(longlong *)(puVar4 + 4) + 4) == '\r') &&

+           (*(int *)(*(longlong *)(puVar4 + 4) + 0x28) == 0x903bc)) {

+          iVar22 = 4;

+        }

+        else {

+          iVar22 = 0;

+        }

+      }

+      goto LAB_4;

+    }

+    lVar10 = HsmpGetStreamSize((longlong)puVar17);

+    if (lVar10 < (longlong)puVar12 + lVar14) {

+      lVar14 = HsmpGetStreamSize((longlong)param_2);

+      lVar14 = lVar14 - (longlong)puVar12;

+    }

+    if ((uVar7 - 4 & 0xfffffffd) != 0) {

+      if ((param_1 == (uint *)0x0) || ((char)param_1[0xb] == '\0')) {

+        local_res20[0] = '\0';

+        cVar5 = HsmOsIsSyncProviderProcessFromAttributionInfo((longlong)local_90);

+        if ((cVar5 == '\0') || ((local_a0 & 0x1000000) == 0)) {

+          puVar19 = param_2;

+          uVar9 = HsmpCldIsHydrationDisallowed

+                            ((undefined8 *)local_90,(longlong)param_2,(longlong)param_1,local_res20)

+          ;

+          uVar6 = (uint)uVar9;

+          HsmDbgBreakOnStatus(uVar6);

+          uVar7 = local_9c;

+          if ((int)uVar6 < 0) {

+            uVar9 = local_res18;

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              puVar21 = WPP_GLOBAL_Control;

+              HsmpGetStreamSize((longlong)param_2);

+              uVar9 = local_res18;

+              WPP_SF_qqLliqiqd(*(undefined8 *)(puVar21 + 0x18),puVar19,puVar21,lVar2);

+            }

+            goto LAB_4;

+          }

+        }

+        else {

+          local_res20[0] = '\x01';

+          uVar7 = local_9c;

+        }

+      }

+      else {

+        local_res20[0] = '\x01';

+      }

+      if (local_res20[0] != '\0') {

+        uVar6 = 0xc000cf18;

+        HsmDbgBreakOnStatus(-0x3fff30e8);

+        uVar9 = local_res18;

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          puVar21 = WPP_GLOBAL_Control;

+          HsmpGetStreamSize((longlong)param_2);

+          uVar9 = local_res18;

+          WPP_SF_qqLliqiqDd(*(undefined8 *)(puVar21 + 0x18),puVar19,puVar21,lVar2);

+          uVar6 = 0xc000cf18;

+        }

+        goto LAB_4;

+      }

+    }

+    HsmpDbgBreakOnHydration(param_1,(longlong)puVar4,uVar7);

+    HsmpSetLastHydrationTimeNoLock((longlong)param_2,_DAT_9);

+    uVar9 = local_res18;

+    puVar19 = param_1;

+    uVar6 = HsmiRecallAllocateHydrationContext

+                      (local_90,(longlong)param_1,(longlong)param_2,local_res18,local_9c,local_a0,

+                       (longlong)puVar4,local_40,local_48,(longlong)puVar12,lVar14,

+                       CONCAT44(in_stack_ffffffffffffff44,in_stack_ffffffffffffff40),&local_88);

+    HsmDbgBreakOnStatus(uVar6);

+    if ((int)uVar6 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        puVar21 = WPP_GLOBAL_Control;

+        HsmpGetStreamSize((longlong)param_2);

+        uVar18 = 0x39;

+        goto LAB_5;

+      }

+      goto LAB_4;

+    }

+    local_90 = (uint *)0x0;

+    *(undefined **)(local_88 + 0x90) = param_9;

+    if ((local_80 != 0) || (cVar5 = FltIsOperationSynchronous(puVar4), cVar5 != '\0')) {

+      lVar14 = ExAllocatePool2(0x42,0x18,0x63527348);

+      local_60 = lVar14;

+      if (lVar14 == 0) {

+        uVar6 = 0xc000009a;

+        HsmDbgBreakOnStatus(-0x3fffff66);

+        goto LAB_4;

+      }

+      puVar19 = (uint *)0x0;

+      KeInitializeEvent(lVar14,0,0);

+      *(longlong *)(local_88 + 0x88) = lVar14;

+    }

+    if ((param_1 != (uint *)0x0) && ((local_a0 & 0x800000) != 0)) {

+      puVar19 = puVar4;

+      HsmpCaptureProcessInfo((longlong)param_1,(longlong)puVar4);

+    }

+    HsmpReleaseBitmapLock((longlong)param_2);

+    HsmpReleaseReparseUpdateLock((longlong)param_2);

+    puVar12 = param_2;

+    uVar11 = HsmpGetLastDehydrationTime((longlong)param_2);

+    *(undefined8 *)(local_88 + 0xa0) = uVar11;

+    lVar10 = local_88;

+    uVar8 = HsmpGetLastDehydrationReason((longlong)puVar12);

+    *(undefined4 *)(lVar10 + 0xa8) = uVar8;

+    LOCK();

+    plVar1 = (longlong *)(lVar10 + 8);

+    lVar14 = *plVar1;

+    *plVar1 = *plVar1 + 1;

+    UNLOCK();

+    if (lVar14 + 1 < 2) {

+      pcVar3 = (code *)swi(0x29);

+      (*pcVar3)(0xe);

+      puVar20 = auStackY_110;

+    }

+    *(undefined8 *)(puVar20 + -8) = 0x140005447;

+    param_8._0_1_ = HsmiRecallInitiateHydration(local_88,puVar19,lVar10);

+    local_58 = (code *)0x0;

+    iVar22 = 2;

+  }

+  if (local_60 == 0) {

+    if ((int)uVar6 < 0) {

+      iVar22 = 4;

+    }

+    else if (iVar22 != 4) goto LAB_10;

+  }

+  else {

+    iVar22 = 4;

+    *(undefined8 *)(puVar20 + -8) = 0x140005183;

+    uVar6 = FltCancellableWaitForSingleObject(local_60,0,puVar4);

+    *(undefined8 *)(puVar20 + -8) = 0x140005191;

+    HsmDbgBreakOnStatus(uVar6);

+    if (-1 < (int)uVar6) {

+      uVar6 = puVar4[6];

+      *(undefined8 *)(puVar20 + -8) = 0x1400051a5;

+      HsmDbgBreakOnStatus(uVar6);

+      if (((int)uVar6 < 0) || ((*puVar4 & 0x80000) != 0)) goto LAB_10;

+      if (((char)param_8 == '\0') ||

+         (((puVar19 = *(uint **)(puVar4 + 4), (char)puVar19[1] != '\x03' ||

+           (2 < ((byte)local_a0 & 0xf))) || ((local_a0 & 0x100) != 0)))) {

+        puVar19 = *(uint **)(puVar4 + 4);

+        if (((char)puVar19[1] == '\r') && (puVar19[10] == 0x903bc)) {

+          iVar22 = 4;

+          goto LAB_10;

+        }

+        iVar22 = 0;

+        if ((char)puVar19[1] != '\x03') goto LAB_10;

+      }

+      if ((((*puVar19 & 2) == 0) && (iVar22 == 4)) &&

+         ((*(uint *)(*(longlong *)(puVar19 + 2) + 0x50) & 2) != 0)) {

+        *(longlong *)(*(longlong *)(puVar19 + 2) + 0x68) =

+             *(longlong *)(puVar19 + 10) + *(longlong *)(puVar4 + 8);

+      }

+      goto LAB_10;

+    }

+    uVar11 = local_98;

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      *(undefined8 *)(puVar20 + -8) = 0x140005c25;

+      puVar21 = WPP_GLOBAL_Control;

+      uVar16 = HsmpGetStreamSize((longlong)param_2);

+      uVar11 = local_98;

+      uVar15 = *(undefined8 *)(puVar21 + 0x18);

+      *(uint *)(puVar20 + 0x50) = uVar6;

+      *(uint **)(puVar20 + 0x48) = puVar4;

+      *(undefined8 *)(puVar20 + 0x40) = local_98;

+      *(ulonglong *)(puVar20 + 0x38) = uVar9;

+      *(undefined8 *)(puVar20 + 0x30) = uVar16;

+      *(uint *)(puVar20 + 0x28) = param_2[7];

+      *(uint **)(puVar20 + 0x20) = param_2;

+      *(undefined8 *)(puVar20 + -8) = 0x140005c65;

+      WPP_SF_qqLiqiqd(uVar15,0x3a,&WPP_7b493afee855349cd64b6fd5ca5bddac_Traceguids,lVar2);

+    }

+    *(undefined8 *)(puVar20 + -8) = 0x140005c73;

+    uVar15 = HsmpCldCancelIo(puVar4);

+    if ((char)uVar15 == '\0') {

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        *(undefined8 *)(puVar20 + -8) = 0x140005ca4;

+        puVar21 = WPP_GLOBAL_Control;

+        uVar16 = HsmpGetStreamSize((longlong)param_2);

+        uVar15 = *(undefined8 *)(puVar21 + 0x18);

+        *(uint *)(puVar20 + 0x50) = uVar6;

+        *(uint **)(puVar20 + 0x48) = puVar4;

+        *(undefined8 *)(puVar20 + 0x40) = uVar11;

+        *(ulonglong *)(puVar20 + 0x38) = uVar9;

+        *(undefined8 *)(puVar20 + 0x30) = uVar16;

+        *(uint *)(puVar20 + 0x28) = param_2[7];

+        *(uint **)(puVar20 + 0x20) = param_2;

+        *(undefined8 *)(puVar20 + -8) = 0x140005ce0;

+        WPP_SF_qqLiqiqd(uVar15,0x3b,&WPP_7b493afee855349cd64b6fd5ca5bddac_Traceguids,lVar2);

+      }

+      iVar22 = 2;

+      goto LAB_10;

+    }

+  }

+  puVar4[8] = 0;

+  puVar4[9] = 0;

+  puVar4[6] = uVar6;

+LAB_10:

+  if (local_88 != 0) {

+    *(undefined8 *)(puVar20 + -8) = 0x140004e7b;

+    HsmiRecallFreeHydrationContext(local_88);

+  }

+  uVar11 = local_98;

+  if (local_58 != (code *)0x0) {

+    *(uint *)(puVar20 + 0x28) = uVar6;

+    *(uint **)(puVar20 + 0x20) = puVar4;

+    *(undefined8 *)(puVar20 + -8) = 0x140005d58;

+    puVar19 = param_2;

+    uVar7 = (*local_58)(lVar2,param_2,uVar9,local_98);

+    if ((-1 < (int)uVar6) && ((int)uVar7 < 0)) {

+      puVar4[8] = 0;

+      puVar4[9] = 0;

+      iVar22 = 4;

+      puVar4[6] = uVar7;

+      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (1 < (byte)WPP_GLOBAL_Control[0x29])))

+         ) {

+        *(undefined8 *)(puVar20 + -8) = 0x140005daf;

+        puVar21 = WPP_GLOBAL_Control;

+        uVar16 = HsmpGetStreamSize((longlong)param_2);

+        *(uint *)(puVar20 + 0x60) = uVar7;

+        *(uint *)(puVar20 + 0x58) = uVar6;

+        *(uint *)(puVar20 + 0x50) = local_9c;

+        uVar15 = *(undefined8 *)(puVar21 + 0x18);

+        *(uint **)(puVar20 + 0x48) = puVar4;

+        *(undefined8 *)(puVar20 + 0x40) = uVar11;

+        *(ulonglong *)(puVar20 + 0x38) = uVar9;

+        *(undefined8 *)(puVar20 + 0x30) = uVar16;

+        *(uint *)(puVar20 + 0x28) = param_2[7];

+        *(uint **)(puVar20 + 0x20) = param_2;

+        *(undefined8 *)(puVar20 + -8) = 0x140005deb;

+        WPP_SF_qqLiqiqldd(uVar15,puVar19,puVar21,lVar2);

+      }

+    }

+  }

+  if (local_50 != 0) {

+    *(undefined8 *)(puVar20 + -8) = 0x1400052bc;

+    FltClose();

+  }

+  if (local_70 != 0) {

+    *(undefined8 *)(puVar20 + -8) = 0x140005df7;

+    ObfDereferenceObject();

+  }

+  if (local_90 != (uint *)0x0) {

+    *(undefined8 *)(puVar20 + -8) = 0x140004e54;

+    HsmpCleanupAttributionInformation(local_90);

+  }

+  return iVar22;

 }
```

## `CldiIsStreamListEmpty`  (modified)

```diff
--- CldiIsStreamListEmpty
+++ CldiIsStreamListEmpty
@@ -1,24 +1,19 @@
-

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 undefined1 CldiIsStreamListEmpty(longlong param_1)

 

 {

-  byte *pbVar1;

-  undefined1 uVar2;

-  undefined2 in_DX;

-  longlong unaff_RBP;

-  undefined8 in_R8;

-  undefined8 in_R9;

-  int in_R10D;

-  longlong in_R11;

+  longlong *plVar1;

+  longlong *plVar2;

   

-  pbVar1 = (byte *)(unaff_RBP + -0x77);

-  *pbVar1 = *pbVar1 >> 3 | *pbVar1 << 5;

-  *(undefined8 *)(in_R11 + -0x50) = in_R9;

-  *(undefined8 *)(in_R11 + -0x58) = in_R8;

-  uVar2 = (*(code *)0x20438d4d)

-                    (param_1,in_R10D + 0x27,&WPP_028866cd16db3b910821a8d7e4c3d7b2_Traceguids,in_DX);

-  return uVar2;

+  plVar1 = (longlong *)(param_1 + 0x10);

+  plVar2 = (longlong *)*plVar1;

+  if (plVar2 != plVar1) {

+    for (; plVar2 != plVar1; plVar2 = (longlong *)*plVar2) {

+      if ((short)plVar2[-1] != 0) {

+        return 0;

+      }

+    }

+  }

+  return 1;

 }
```

## `HsmFltPreSetBasicInformation`  (modified)

```diff
--- HsmFltPreSetBasicInformation
+++ HsmpOpCreatePlaceholders
@@ -1,249 +1,644 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* WARNING: Type propagation algorithm not settling */

+/* WARNING: Removing unreachable block (ram,0x00014008863a) */

+/* WARNING: Removing unreachable block (ram,0x00014008863e) */

+/* WARNING: Removing unreachable block (ram,0x000140088652) */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

 

-undefined8

-HsmFltPreSetBasicInformation

-          (longlong param_1,longlong param_2,longlong param_3,longlong param_4,longlong param_5,

-          longlong *param_6)

+uint HsmpOpCreatePlaceholders

+               (longlong param_1,undefined8 param_2,uint param_3,void *param_4,uint param_5,

+               int *param_6)

 

 {

-  longlong *plVar1;

-  bool bVar2;

-  bool bVar3;

-  bool bVar4;

-  bool bVar5;

-  bool bVar6;

-  char cVar7;

-  uint uVar8;

-  uint uVar9;

-  longlong lVar10;

-  longlong lVar11;

+  undefined1 (*pauVar1) [16];

+  ushort uVar2;

+  undefined1 (*pauVar3) [16];

+  ushort uVar4;

+  ushort uVar5;

+  ulonglong uVar6;

+  bool bVar7;

+  bool bVar8;

+  ulonglong uVar9;

+  uint uVar10;

+  uint uVar11;

+  void *_Dst;

   ulonglong uVar12;

-  undefined2 uVar13;

-  uint uVar14;

-  undefined8 uVar15;

-  undefined *puVar16;

-  undefined1 auStackY_108 [32];

-  char local_a8 [8];

-  longlong local_a0;

-  longlong local_98;

-  undefined8 local_90;

-  uint local_88 [2];

-  longlong *local_80;

+  ushort uVar13;

+  ushort uVar14;

+  uint uVar15;

+  ulonglong uVar16;

+  undefined8 uVar17;

+  undefined2 uVar18;

+  undefined1 (*pauVar19) [16];

+  uint uVar20;

+  longlong ****pppplVar21;

+  undefined1 auStackY_288 [32];

+  undefined1 (*local_200) [16];

+  uint local_1e8;

+  int local_1e4;

+  uint local_1d8;

+  uint local_1b4;

+  undefined1 (*local_1a8) [16];

+  uint *local_1a0;

+  longlong **local_198;

+  longlong local_190;

+  undefined1 (*local_188) [16];

+  longlong **local_180;

+  uint local_178;

+  undefined8 local_170;

+  undefined8 local_168;

+  longlong local_160;

+  undefined8 local_158;

+  undefined1 *puStack_150;

+  undefined8 local_148;

+  longlong lStack_140;

+  undefined8 local_138;

+  undefined8 uStack_130;

+  ulonglong local_128;

+  undefined8 local_120;

+  undefined8 uStack_118;

+  undefined8 *local_110;

+  undefined8 uStack_108;

+  undefined8 local_100;

+  ulonglong uStack_f8;

+  int *local_f0;

+  ulonglong local_e8;

+  undefined8 local_e0;

+  undefined8 uStack_d8;

+  undefined8 local_d0;

+  undefined8 uStack_c8;

+  undefined1 local_b8 [16];

+  longlong **local_a8;

+  undefined8 uStack_a0;

+  undefined8 local_98;

+  undefined8 uStack_90;

+  ulonglong local_88;

+  longlong ***ppplStack_80;

   undefined8 local_78;

   undefined8 uStack_70;

-  undefined8 local_68;

+  longlong **local_68;

   undefined8 uStack_60;

-  ulonglong local_58;

-  ulonglong local_50;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  undefined8 local_48;

+  ulonglong local_40;

   

-  local_50 = __security_cookie ^ (ulonglong)auStackY_108;

-  lVar10 = 0;

-  local_80 = param_6;

-  local_a0 = *(longlong *)(param_5 + 0x20);

-  if (param_2 != 0) {

-    lVar10 = *(longlong *)(param_2 + 0x10);

-  }

-  uVar15 = 1;

-  local_88[0] = 0;

-  plVar1 = *(longlong **)(*(longlong *)(param_4 + 0x10) + 0x38);

-  local_58 = 0;

-  local_78 = 0;

-  uStack_70 = 0;

-  local_68 = 0;

-  uStack_60 = 0;

-  if (lVar10 == 0) {

-    local_90 = 0;

+  local_40 = __security_cookie ^ (ulonglong)auStackY_288;

+  local_e8 = (ulonglong)param_5;

+  local_178 = param_5;

+  local_f0 = param_6;

+  pauVar3 = *(undefined1 (**) [16])(param_1 + 0x20);

+  local_170 = 0;

+  local_1e4 = 0;

+  local_198 = (longlong **)0x0;

+  local_1d8 = 0;

+  local_188 = (undefined1 (*) [16])0x0;

+  local_148 = 0;

+  lStack_140 = 0;

+  local_138 = 0;

+  uStack_130 = 0;

+  local_128 = local_128 & 0xffffffffffff0000;

+  local_1a0 = (uint *)0x0;

+  local_190 = 0;

+  local_168 = param_2;

+  local_160 = param_1;

+  _Dst = (void *)ExAllocatePool2(0x102,param_5,0x70537348);

+  if (_Dst == (void *)0x0) {

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    uVar10 = 0xc000009a;

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        (uVar10 = 0xc000009a, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+    uVar18 = 0x61;

   }

   else {

-    local_90 = *(undefined8 *)(lVar10 + 0x20);

-  }

-  bVar4 = false;

-  bVar6 = false;

-  local_98 = param_1;

-  uVar8 = FltQueryInformationFile(*(undefined8 *)(param_5 + 0x18),local_a0,&local_78);

-  HsmDbgBreakOnStatus(uVar8);

-  bVar5 = true;

-  bVar2 = bVar4;

-  if ((int)uVar8 < 0) {

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      uVar13 = 0x1f;

-LAB_0:

-      WPP_SF_qqqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar13,

-                    &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

-      bVar2 = bVar4;

-    }

-LAB_1:

-    *(uint *)(param_4 + 0x18) = uVar8;

-    uVar15 = 4;

-    *(undefined8 *)(param_4 + 0x20) = 0;

-    bVar5 = bVar6;

-LAB_2:

-    if (!bVar2) goto LAB_3;

-  }

-  else {

-    uVar9 = *(uint *)(plVar1 + 4);

-    if (uVar9 != 0) {

-      if ((uVar9 >> 0x13 & 1) == 0) {

-        uVar14 = -(uint)((uVar9 & 0x100000) != 0) & 2;

+    ProbeForWrite(param_4,(ulonglong)param_5,4);

+    memmove(_Dst,param_4,(ulonglong)param_5);

+    local_1a0 = (uint *)ExAllocatePool2(0x100,0x4000,0x70527348);

+    if (local_1a0 != (uint *)0x0) {

+      uVar10 = FltAllocateExtraCreateParameterList(DAT_1,0,&local_190);

+      HsmDbgBreakOnStatus(uVar10);

+      if ((int)uVar10 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+        uVar18 = 100;

+        uVar17 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

       }

       else {

-        uVar14 = 3;

-        if ((uVar9 & 0x100000) == 0) {

-          uVar14 = 1;

+        uVar10 = FltAllocateExtraCreateParameterFromLookasideList

+                           (DAT_1,&GUID_ECP_ATOMIC_CREATE,0x58);

+        HsmDbgBreakOnStatus(uVar10);

+        if ((int)uVar10 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+          uVar18 = 0x65;

         }

-      }

-      if (((uint)local_58 >> 0x13 & 1) == 0) {

-        uVar9 = (uint)(local_58 >> 0x13) & 2;

-      }

-      else {

-        uVar9 = ((uint)local_58 & 0x100000 | 0x80000) >> 0x13;

-      }

-      if ((uVar14 != uVar9) && ((uVar14 == 3 || (uVar9 == 3)))) {

-        local_a8[0] = '\0';

-        lVar10 = FltGetRequestorProcess(param_4);

-        uVar8 = HsmpCldCheckSyncProviderAccess(local_98,param_2,local_a0,lVar10,local_a8);

-        HsmDbgBreakOnStatus(uVar8);

-        if ((int)uVar8 < 0) {

-          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            uVar13 = 0x20;

+        else {

+          FltInsertExtraCreateParameter(DAT_1,local_190,0);

+          uVar10 = ObReferenceObjectByHandle(param_2,0,*(undefined8 *)IoFileObjectType_exref,0);

+          HsmDbgBreakOnStatus(uVar10);

+          if (-1 < (int)uVar10) {

+            uVar20 = 0;

+            do {

+              local_200 = (undefined1 (*) [16])0x0;

+              pppplVar21 = (longlong ****)0x50;

+              memset(local_b8,0,0x50);

+              pauVar1 = (undefined1 (*) [16])((longlong)_Dst + (ulonglong)local_1d8);

+              local_158 = 0;

+              puStack_150 = (undefined1 *)0x0;

+              local_120 = 0;

+              uStack_118 = 0;

+              local_110 = (undefined8 *)0x0;

+              uStack_108 = 0;

+              local_100 = 0;

+              uStack_f8 = uStack_f8 & 0xffffffff00000000;

+              local_e0 = 0;

+              uStack_d8 = 0;

+              local_68 = (longlong **)0x0;

+              uStack_60 = 0;

+              local_58 = 0;

+              uStack_50 = 0;

+              local_48 = 0;

+              bVar8 = true;

+              uVar10 = local_178 - local_1d8;

+              pauVar19 = (undefined1 (*) [16])(ulonglong)uVar10;

+              if (uVar10 < 0x50) {

+                uVar10 = 0xc000cf0b;

+                HsmDbgBreakOnStatus(-0x3fff30f5);

+                uVar15 = ~-(uint)(local_1e4 != 0) & 0xc000cf0b;

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  pauVar19 = (undefined1 (*) [16])0x67;

+LAB_2:

+                  uVar17 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+LAB_3:

+                  uVar10 = 0xc000cf0b;

+                  pppplVar21 = (longlong ****)&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids;

+                  WPP_SF_qiD(uVar17,(short)pauVar19,&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids

+                             ,param_1);

+                }

+                break;

+              }

+              local_b8 = *pauVar1;

+              local_a8 = *(longlong ***)pauVar1[1];

+              uStack_a0 = *(undefined8 *)(pauVar1[1] + 8);

+              local_98 = *(undefined8 *)pauVar1[2];

+              uStack_90 = *(undefined8 *)(pauVar1[2] + 8);

+              local_88 = *(ulonglong *)pauVar1[3];

+              ppplStack_80 = *(longlong ****)(pauVar1[3] + 8);

+              local_78 = *(undefined8 *)pauVar1[4];

+              uStack_70 = *(undefined8 *)(pauVar1[4] + 8);

+              pppplVar21 = (longlong ****)(local_b8._8_8_ >> 0x20 & 0xffff);

+              uVar15 = (uint)pppplVar21;

+              uVar5 = local_b8._14_2_;

+              uVar13 = local_b8._10_2_;

+              uVar4 = local_b8._8_2_;

+              uVar11 = uVar15 + uVar5;

+              if (uVar15 + uVar5 < (uint)uVar4 + (uint)uVar13) {

+                uVar11 = (uint)uVar4 + (uint)uVar13;

+              }

+              if (((uVar10 < uVar4) || (uVar10 - uVar4 < (uint)uVar13)) ||

+                 ((uVar10 < uVar15 || ((uVar10 - uVar15 < (uint)uVar5 || (0x1000 < uVar5)))))) {

+LAB_4:

+                uVar10 = 0xc000cf0b;

+                HsmDbgBreakOnStatus(-0x3fff30f5);

+                uVar15 = ~-(uint)(local_1e4 != 0) & 0xc000cf0b;

+                if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                   (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 &&

+                    (1 < (byte)WPP_GLOBAL_Control[0x29])))) {

+                  pauVar19 = (undefined1 (*) [16])0x68;

+                  uVar17 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+                  goto LAB_3;

+                }

+                break;

+              }

+              pppplVar21 = (longlong ****)(ulonglong)(uint)local_b8._0_4_;

+              if ((local_b8._0_4_ != 0) &&

+                 (((uint)local_b8._0_4_ < uVar11 || (uVar10 < (uint)local_b8._0_4_))))

+              goto LAB_4;

+              for (uVar14 = 0; uVar15 = uVar20, uVar14 < uVar13 >> 1; uVar14 = uVar14 + 1) {

+                uVar2 = *(ushort *)(*pauVar1 + (ulonglong)uVar14 * 2 + (ulonglong)uVar4);

+                pauVar19 = (undefined1 (*) [16])(ulonglong)uVar2;

+                if ((uVar2 == 0x5c) || (uVar2 == 0x3a)) {

+                  HsmDbgBreakOnStatus(-0x3fff30f5);

+                  local_200 = pauVar19;

+                  uVar10 = 0xc000cf0b;

+                  if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                     ((uVar10 = 0xc000cf0b, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0 ||

+                      ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_5;

+                  local_200 = (undefined1 (*) [16])0x69;

+                  goto LAB_6;

+                }

+              }

+              if ((local_b8._0_4_ & 3) != 0) {

+                HsmDbgBreakOnStatus(-0x3fff30f5);

+                uVar10 = 0xc000cf0b;

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    (uVar10 = 0xc000cf0b, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  pauVar19 = (undefined1 (*) [16])0x6a;

+                  uVar15 = 0;

+                  goto LAB_2;

+                }

+                break;

+              }

+              uVar12 = local_88 & 0x10;

+              uVar6 = local_88 & 0x10;

+              uVar9 = local_88 & 0x10;

+              if (((((local_88 & 0x10) == 0) && ((param_3 & 2) == 0)) &&

+                  ((longlong ****)ppplStack_80 != (longlong ****)0x0)) ||

+                 ((((local_88 & 0x10) != 0 && ((param_3 & 4) == 0)) && ((local_b8[4] & 0x40) == 0)))

+                 ) {

+                uVar10 = 0xc000cf0b;

+                HsmDbgBreakOnStatus(-0x3fff30f5);

+                local_200 = pauVar19;

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  local_200 = (undefined1 (*) [16])0x6b;

+LAB_6:

+                  uVar10 = 0xc000cf0b;

+LAB_7:

+                  pppplVar21 = (longlong ****)&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids;

+                  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(short)local_200,

+                             &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,param_1);

+                }

+              }

+              else if (uVar5 == 0) {

+                uVar10 = 0xc000cf0b;

+                HsmDbgBreakOnStatus(-0x3fff30f5);

+                local_200 = pauVar19;

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  local_200 = (undefined1 (*) [16])0x6c;

+                  goto LAB_6;

+                }

+              }

+              else {

+                local_1e4 = local_1e4 + 1;

+                uVar16 = (ulonglong)local_78 >> 0x20;

+                local_78 = CONCAT44((int)uVar16,0xc000cf07);

+                uStack_70 = 0;

+                if ((local_88 & 0x10) != 0) {

+                  pppplVar21 = (longlong ****)0x4;

+                  pauVar19 = local_188;

+                  uVar10 = HsmpAccessCheck(param_1,(ulonglong)local_188,4);

+                  uVar16 = (ulonglong)uVar10;

+                  HsmDbgBreakOnStatus(uVar10);

+                  if ((int)uVar10 < 0) {

+                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                        (uVar16 = (ulonglong)*(uint *)(WPP_GLOBAL_Control + 0x2c),

+                        (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                      pauVar19 = (undefined1 (*) [16])0x6d;

+                      pppplVar21 = (longlong ****)&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids;

+                      uVar16 = *(ulonglong *)(WPP_GLOBAL_Control + 0x18);

+                      WPP_SF_qiD(uVar16,0x6d,&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,

+                                 param_1);

+                    }

+                    TlmWriteAccessDeniedForAddSubDirectory(uVar16,pauVar19,pppplVar21);

+                    local_200 = pauVar19;

+                    goto LAB_5;

+                  }

+                }

+                local_1b4 = (uint)local_88 | 0x401000;

+                if (uVar12 == 0) {

+                  local_1e8 = (uint)local_88 >> 9 & 1;

+                }

+                else {

+                  local_1e8 = 0x10;

+                  if ((local_b8[4] & 0x40) != 0) {

+                    local_1e8 = 0x16;

+                    local_1b4 = (uint)local_88 & 0xffbfefff;

+                  }

+                }

+                if ((local_b8[4] & 1) != 0) {

+                  local_1e8 = local_1e8 | 0x40;

+                }

+                if ((local_b8._4_4_ & 0x400) != 0) {

+                  local_1e8 = local_1e8 | 0x100;

+                }

+                pppplVar21 = (longlong ****)(*pauVar1 + (ushort)local_b8._12_2_);

+                pauVar19 = (undefined1 (*) [16])(ulonglong)local_1e8;

+                uVar10 = HsmpRpBuildBuffer(ppplStack_80,local_1e8,pppplVar21,local_b8._14_2_,

+                                           local_1a0);

+                HsmDbgBreakOnStatus(uVar10);

+                if ((int)uVar10 < 0) {

+                  local_200 = pauVar19;

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    local_200 = (undefined1 (*) [16])0x6e;

+                    goto LAB_7;

+                  }

+                }

+                else {

+                  uRam0000000000000000 = 0x58;

+                  uRam0000000000000002 = 0x1e32;

+                  uRam0000000000000004 = 0;

+                  sRam0000000000000006 = (short)local_1a0[1] + 8;

+                  _DAT_8 = &local_a8;

+                  uRam0000000000000028 = local_1b4;

+                  if (uVar6 == 0) {

+                    if (0 < (longlong)ppplStack_80) {

+                      uRam0000000000000002 = 0x1e33;

+                    }

+                    pppplRam0000000000000010 = (longlong ****)ppplStack_80;

+                    pppplRam0000000000000018 = (longlong ****)ppplStack_80;

+                    uRam0000000000000002 = uRam0000000000000002 | 0xc;

+                  }

+                  uRam000000000000002c = 8;

+                  local_138 = 0;

+                  uStack_130 = 0;

+                  local_148 = 0x28;

+                  local_128 = 1;

+                  lStack_140 = local_190;

+                  puStack_150 = *pauVar1 + (ushort)local_b8._8_2_;

+                  local_158._0_4_ = CONCAT22(local_b8._10_2_,local_b8._10_2_);

+                  local_120 = CONCAT44(local_120._4_4_,0x30);

+                  uStack_108 = CONCAT44(uStack_108._4_4_,0x240);

+                  local_110 = &local_158;

+                  local_100 = 0;

+                  uStack_f8 = 0;

+                  pppplVar21 = (longlong ****)&local_198;

+                  pauVar19 = pauVar3;

+                  uStack_118 = param_2;

+                  puRam0000000000000008 = local_1a0;

+                  uVar10 = FltCreateFileEx2(DAT_1);

+                  HsmDbgBreakOnStatus(uVar10);

+                  if (((uVar10 == 0xc0000035) || (uVar10 == 0xc0000279)) &&

+                     ((local_b8._4_4_ & 0x4000) != 0)) {

+                    uVar12 = Feature_1245077819__private_IsEnabledDeviceUsageNoInline();

+                    if ((int)uVar12 != 0) {

+                      local_180 = (longlong **)0x0;

+                      local_1a8 = (undefined1 (*) [16])0x0;

+                      local_d0 = 0;

+                      uStack_c8 = 0;

+                      pppplVar21 = (longlong ****)0x40;

+                      pauVar19 = local_188;

+                      uVar10 = HsmpAccessCheck(param_1,(ulonglong)local_188,0x40);

+                      HsmDbgBreakOnStatus(uVar10);

+                      if ((int)uVar10 < 0) {

+                        pppplVar21 = (longlong ****)&local_180;

+                        pauVar19 = pauVar3;

+                        uVar10 = FltCreateFileEx(DAT_1);

+                        if (-1 < (int)uVar10) {

+                          pppplVar21 = (longlong ****)0x10000;

+                          uVar10 = HsmpAccessCheck(param_1,0,0x10000);

+                          ObfDereferenceObject(0);

+                          FltClose(local_180);

+                          pauVar19 = local_1a8;

+                        }

+                        if ((int)uVar10 < 0) {

+                          local_200 = pauVar19;

+                          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                            local_200 = (undefined1 (*) [16])0x6f;

+                            goto LAB_7;

+                          }

+                          goto LAB_5;

+                        }

+                      }

+                    }

+                    bVar7 = false;

+                    bVar8 = false;

+                  }

+                  else {

+                    bVar7 = true;

+                  }

+                  if (!bVar7) {

+                    pppplVar21 = (longlong ****)&local_198;

+                    pauVar19 = pauVar3;

+                    uVar10 = FltCreateFileEx(DAT_1);

+                    HsmDbgBreakOnStatus(uVar10);

+                    bVar7 = bVar8;

+                  }

+                  if ((int)uVar10 < 0) {

+                    local_200 = pauVar19;

+                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                      local_200 = (undefined1 (*) [16])0x70;

+                      goto LAB_7;

+                    }

+                  }

+                  else if (bVar7) {

+                    *(longlong ***)pauVar1[1] = local_a8;

+                    *(undefined8 *)(pauVar1[1] + 8) = uStack_a0;

+                    *(undefined8 *)pauVar1[2] = local_98;

+                    *(undefined8 *)(pauVar1[2] + 8) = uStack_90;

+                    *(uint *)pauVar1[3] = uRam0000000000000028;

+                    *(undefined8 *)(pauVar1[4] + 8) = uRam0000000000000030;

+                    local_200 = pauVar1;

+LAB_9:

+                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                       (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                      local_200 = (undefined1 (*) [16])0x79;

+                      pppplVar21 = (longlong ****)&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids;

+                      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x79,

+                                &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,param_1);

+                    }

+                  }

+                  else {

+                    pppplVar21 = (longlong ****)0x8;

+                    pauVar19 = local_200;

+                    uVar10 = HsmpMarkHandleUsnSourceInfo(param_1,0,8,0);

+                    HsmDbgBreakOnStatus(uVar10);

+                    if ((int)uVar10 < 0) {

+                      local_200 = pauVar19;

+                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                        local_200 = (undefined1 (*) [16])0x71;

+                        goto LAB_7;

+                      }

+                    }

+                    else {

+                      pauVar19 = local_200;

+                      pppplVar21 = (longlong ****)ppplStack_80;

+                      uVar10 = HsmpRpCreate(param_1,0,(longlong)ppplStack_80,local_1e8,

+                                            *pauVar1 + (ushort)local_b8._12_2_,local_b8._14_2_,'\0')

+                      ;

+                      HsmDbgBreakOnStatus(uVar10);

+                      if ((int)uVar10 < 0) {

+                        local_200 = pauVar19;

+                        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                          local_200 = (undefined1 (*) [16])0x72;

+                          goto LAB_7;

+                        }

+                      }

+                      else if ((uVar9 == 0) && ((longlong ****)ppplStack_80 != (longlong ****)0x0))

+                      {

+                        pppplVar21 = (longlong ****)CONCAT71((int7)((ulonglong)pppplVar21 >> 8),1);

+                        pauVar19 = local_200;

+                        uVar10 = HsmpToggleFileSparseAttribute(param_1,0,'\x01');

+                        HsmDbgBreakOnStatus(uVar10);

+                        if ((int)uVar10 < 0) {

+                          local_200 = pauVar19;

+                          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                            local_200 = (undefined1 (*) [16])0x73;

+                            goto LAB_7;

+                          }

+                        }

+                        else {

+                          pppplVar21 = &ppplStack_80;

+                          pauVar19 = local_200;

+                          uVar10 = FltSetInformationFile(pauVar3,0,pppplVar21,8);

+                          HsmDbgBreakOnStatus(uVar10);

+                          if ((int)uVar10 < 0) {

+                            local_200 = pauVar19;

+                            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                              local_200 = (undefined1 (*) [16])0x74;

+                              goto LAB_7;

+                            }

+                          }

+                          else {

+                            pauVar19 = local_200;

+                            pppplVar21 = (longlong ****)ppplStack_80;

+                            uVar10 = HsmpSetFileVDL(pauVar3,0,ppplStack_80);

+                            HsmDbgBreakOnStatus(uVar10);

+                            if (-1 < (int)uVar10) goto LAB_10;

+                            local_200 = pauVar19;

+                            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                              local_200 = (undefined1 (*) [16])0x75;

+                              goto LAB_7;

+                            }

+                          }

+                        }

+                      }

+                      else {

+LAB_10:

+                        local_68 = local_a8;

+                        uStack_60 = uStack_a0;

+                        local_58 = local_98;

+                        uStack_50 = uStack_90;

+                        local_48 = CONCAT44((int)(local_88 >> 0x20),local_1b4);

+                        pppplVar21 = (longlong ****)&local_68;

+                        pauVar19 = local_200;

+                        uVar10 = FltSetInformationFile(pauVar3,0,pppplVar21,0x28);

+                        HsmDbgBreakOnStatus(uVar10);

+                        if ((int)uVar10 < 0) {

+                          local_200 = pauVar19;

+                          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                            local_200 = (undefined1 (*) [16])0x76;

+                            goto LAB_7;

+                          }

+                        }

+                        else {

+                          pppplVar21 = (longlong ****)(pauVar1[4] + 8);

+                          pauVar19 = local_200;

+                          uVar10 = HsmpQueryLastEffectiveUsn(pauVar3,0,(longlong *)pppplVar21);

+                          HsmDbgBreakOnStatus(uVar10);

+                          if ((int)uVar10 < 0) {

+                            local_200 = pauVar19;

+                            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+                               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                              local_200 = (undefined1 (*) [16])0x77;

+                              goto LAB_7;

+                            }

+                          }

+                          else {

+                            pppplVar21 = (longlong ****)&local_68;

+                            uVar10 = FltQueryInformationFile(pauVar3,0,pppplVar21,0x28);

+                            HsmDbgBreakOnStatus(uVar10);

+                            if (-1 < (int)uVar10) {

+                              *(longlong ***)pauVar1[1] = local_68;

+                              *(undefined8 *)(pauVar1[1] + 8) = uStack_60;

+                              *(undefined8 *)pauVar1[2] = local_58;

+                              *(undefined8 *)(pauVar1[2] + 8) = uStack_50;

+                              *(undefined8 *)pauVar1[3] = local_48;

+                              goto LAB_9;

+                            }

+                            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+                               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                              local_200 = (undefined1 (*) [16])0x78;

+                              goto LAB_7;

+                            }

+                          }

+                        }

+                      }

+                    }

+                  }

+                }

+              }

+LAB_5:

+              *(uint *)pauVar1[4] = uVar10;

+              if ((longlong ***)local_198 != (longlong ***)0x0) {

+                FltClose();

+                local_198 = (longlong **)0x0;

+              }

+              pauVar19 = local_200;

+              if (((int)uVar10 < 0) && (uVar15 = 0, (param_3 & 1) != 0)) break;

+              uVar11 = 0;

+              if (local_b8._0_4_ != 0) {

+                uVar11 = local_1d8 + local_b8._0_4_;

+              }

+              uVar15 = uVar20;

+              local_1d8 = uVar11;

+            } while (uVar11 != 0);

+            if ((((local_1e4 != 0) &&

+                 (uVar10 = uVar15, (undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+              WPP_SF_qqdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),pauVar19,pppplVar21,param_1);

+            }

+            *local_f0 = local_1e4;

             goto LAB_0;

           }

-          goto LAB_1;

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+          uVar18 = 0x66;

         }

-        if (local_a8[0] == '\0') {

-          *(uint *)(plVar1 + 4) = *(uint *)(plVar1 + 4) & 0xffe7ffff;

-          *(uint *)(plVar1 + 4) = *(uint *)(plVar1 + 4) | (uint)local_58 & 0x180000;

-        }

+        uVar17 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

       }

+      WPP_SF_qiD(uVar17,uVar18,&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,param_1);

+      goto LAB_0;

     }

-    if (param_3 == 0) {

-      if (-1 < (int)uVar8) {

-        return 1;

-      }

-      goto LAB_1;

+    uVar10 = 0xc000009a;

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_0;

+    uVar18 = 99;

+  }

+  uVar10 = 0xc000009a;

+  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar18,

+             &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,param_1);

+LAB_0:

+  if (local_1a0 != (uint *)0x0) {

+    ExFreePoolWithTag(local_1a0,0x70527348);

+  }

+  if (local_190 != 0) {

+    FltFreeExtraCreateParameterList(DAT_1);

+  }

+  if (_Dst != (void *)0x0) {

+    if (-1 < (int)uVar10) {

+      memmove(param_4,_Dst,local_e8);

     }

-    uVar8 = HsmpAcquireUserRequestRundownProtection(param_2,param_4);

-    HsmDbgBreakOnStatus(uVar8);

-    if ((int)uVar8 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        puVar16 = WPP_GLOBAL_Control;

-        HsmpGetStreamSize(param_2);

-        WPP_SF_qqLiqiqd(*(undefined8 *)(puVar16 + 0x18),0x21,

-                        &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,local_98);

-      }

-      goto LAB_1;

-    }

-    FltAcquirePushLockSharedEx(*(longlong *)(param_2 + 0x10) + 0x18,0);

-    uVar8 = *(uint *)(plVar1 + 4);

-    bVar4 = true;

-    bVar3 = true;

-    if (uVar8 != 0) {

-      if ((*(uint *)(param_2 + 0x1c) & 0x100) == 0) {

-        uVar8 = uVar8 | 0x401000;

-      }

-      else {

-        uVar8 = uVar8 & 0xffbfefff;

-      }

-      *(uint *)(plVar1 + 4) = uVar8;

-    }

-    if (plVar1[1] == -1) {

-      *(uint *)(param_3 + 0x28) = *(uint *)(param_3 + 0x28) | 8;

-    }

-    else if (plVar1[1] == -2) {

-      *(uint *)(param_3 + 0x28) = *(uint *)(param_3 + 0x28) & 0xfffffff7;

-    }

-    uVar8 = *(uint *)(plVar1 + 4);

-    if (((uVar8 != 0) && (uVar12 = HsmpIsPlaceholderHandle(param_3), (char)uVar12 != '\0')) &&

-       (((uVar8 >> 0x13 & 1) != 0 && ((uVar8 & 0x100000) != 0)))) {

-      HsmpAcquireBitmapLock(param_2,'\0');

-      if ((*(uint *)(param_2 + 0x1c) & 0x100) == 0) {

-        *(uint *)(plVar1 + 4) = *(uint *)(plVar1 + 4) & 0xffe7ffff;

-        *(uint *)(plVar1 + 4) = *(uint *)(plVar1 + 4) | (uint)local_58 & 0x180000;

-        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (2 < (byte)WPP_GLOBAL_Control[0x29])) {

-          WPP_SF_qqqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x22,

-                        &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

-        }

-      }

-      HsmpReleaseBitmapLock(param_2);

-    }

-    lVar10 = local_a0;

-    uVar8 = HsmpCldGetSyncPolicy(local_98,param_2,local_a0,0,local_88);

-    HsmDbgBreakOnStatus(uVar8);

-    uVar9 = local_88[0];

-    bVar2 = bVar4;

-    if ((int)uVar8 < 0) {

-      bVar6 = bVar5;

-      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          (bVar2 = bVar3, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-         (bVar6 = true, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

-        uVar13 = 0x23;

-        bVar6 = bVar5;

-        goto LAB_0;

-      }

-      goto LAB_1;

-    }

-    if ((local_88[0] >> 10 & 1) == 0) {

-LAB_4:

-      if ((*(uint *)(param_2 + 0x1c) >> 0xd & 1) == 0) goto LAB_5;

-      uVar8 = (uint)local_58;

-      if ((*(uint *)(param_2 + 0x1c) & 2) == 0) {

-        if ((((uVar9 >> 0xb & 1) == 0) || (*plVar1 < 1)) &&

-           (((uVar9 >> 0xf & 1) == 0 || (plVar1[2] < 1)))) {

-          uVar14 = *(uint *)(plVar1 + 4);

-          bVar2 = bVar3;

-          if (uVar14 == 0) goto LAB_5;

-          if ((((uVar9 >> 0xc & 1) == 0) || ((((byte)uVar14 ^ (byte)local_58) & 1) == 0)) &&

-             (((uVar9 >> 0xd & 1) == 0 || (((uVar14 ^ uVar8) & 2) == 0)))) {

-            uVar9 = uVar9 >> 0xe;

-            goto joined_r0x00014006219a;

-          }

-        }

-LAB_6:

-        FltReleasePushLockEx(*(longlong *)(param_2 + 0x10) + 0x18,0);

-        HsmpPersistInSync(param_2,local_a0,lVar10);

-        bVar2 = false;

-      }

-      else {

-        if ((((uVar9 >> 0x10 & 1) != 0) && (0 < *plVar1)) ||

-           (((uVar9 >> 0x14 & 1) != 0 && (0 < plVar1[2])))) goto LAB_6;

-        uVar14 = *(uint *)(plVar1 + 4);

-        bVar2 = bVar3;

-        if (uVar14 != 0) {

-          if ((((uVar9 >> 0x11 & 1) == 0) || ((((byte)uVar14 ^ (byte)local_58) & 1) == 0)) &&

-             (((uVar9 >> 0x12 & 1) == 0 || (((uVar14 ^ uVar8) & 2) == 0)))) {

-            uVar9 = uVar9 >> 0x13;

-joined_r0x00014006219a:

-            bVar2 = bVar3;

-            if (((uVar9 & 1) == 0) || (((uVar14 ^ uVar8) & 4) == 0)) goto LAB_5;

-          }

-          goto LAB_6;

-        }

-      }

-LAB_5:

-      bVar5 = false;

-      uVar15 = 0;

-      *local_80 = param_2;

-      goto LAB_2;

-    }

-    lVar11 = FltGetRequestorProcess(param_4);

-    cVar7 = HsmOsIsSyncProviderProcess(lVar11);

-    if (cVar7 == '\0') goto LAB_4;

+    ExFreePoolWithTag(_Dst,0x70537348);

   }

-  FltReleasePushLockEx(*(longlong *)(param_2 + 0x10) + 0x18,0);

-LAB_3:

-  if (bVar5) {

-    HsmpReleaseUserRequestRundownProtection(param_2);

+  if (local_188 != (undefined1 (*) [16])0x0) {

+    ObfDereferenceObject();

   }

-  return uVar15;

+  return uVar10;

 }
```

## `CldHsmCreateStreamHandleContext`  (modified)

```diff
--- CldHsmCreateStreamHandleContext
+++ CldHsmCreateStreamHandleContext
@@ -1,201 +1,212 @@
 

 ulonglong CldHsmCreateStreamHandleContext(longlong param_1,longlong *param_2,longlong *param_3)

 

 {

-  uint uVar1;

-  char in_AL;

-  uint extraout_EAX;

-  uint uVar2;

-  ulonglong uVar3;

-  void *pvVar4;

-  uint uVar5;

-  undefined2 uVar6;

-  undefined8 uVar7;

+  longlong lVar1;

+  undefined8 uVar2;

+  char cVar3;

+  uint uVar4;

+  int iVar5;

+  longlong *plVar6;

+  longlong lVar7;

   ulonglong uVar8;

-  uint unaff_EBX;

-  longlong unaff_RSI;

-  ushort unaff_DI;

-  ulonglong uVar9;

-  short in_R9W;

-  short in_R10W;

-  char in_R11B;

-  short unaff_R12W;

-  longlong unaff_R13;

-  char cVar10;

-  uint uVar11;

-  ulonglong unaff_R14;

-  uint unaff_R15D;

-  bool in_CF;

-  bool in_ZF;

-  uint uStack0000000000000080;

-  uint in_stack_00000090;

-  uint in_stack_00000094;

-  ulonglong *in_stack_00000098;

-  ulonglong in_stack_000000b0;

-  ulonglong in_stack_000000b8;

-  uint *in_stack_000000c8;

-  void *in_stack_00000128;

+  undefined2 uVar9;

+  uint uVar10;

+  ulonglong uVar11;

+  ulonglong uVar12;

+  short *psVar13;

+  longlong lVar14;

+  uint uVar15;

+  uint uVar16;

+  longlong *plVar17;

+  ulonglong uVar18;

+  ulonglong uVar19;

+  undefined4 local_res8 [2];

+  longlong local_res10;

+  longlong *local_res18;

+  undefined8 local_res20;

   

-  cVar10 = (char)unaff_R14;

-  if (!in_CF && !in_ZF) {

-    in_AL = cVar10;

-  }

-  uVar11 = (uint)unaff_R14;

-  uVar2 = unaff_EBX;

-  if ((in_AL != '\0') && (in_R9W == 0x11)) {

-    unaff_R15D = (uint)*(ushort *)(unaff_RSI + 0x52);

-    uVar2 = uVar11;

-  }

-  uVar7 = 4;

-  if ((-1 < (int)uVar2) && (unaff_R15D != 0x82)) {

-    uVar3 = 0xc000cf0b;

-    uStack0000000000000080 = 0xc000cf0b;

-    HsmDbgBreakOnStatus(-0x3fff30f5);

-    if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0 && (1 < (byte)WPP_GLOBAL_Control[0x29])

-        ))) {

-      WPP_SF_qqDqDDDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar7,param_3,unaff_R13);

-    }

-    goto LAB_0;

-  }

-  if (in_stack_00000090 < 0x18) {

-    uVar3 = (ulonglong)unaff_EBX;

-    uStack0000000000000080 = unaff_EBX;

-  }

-  else {

-    if (*(ushort *)(unaff_RSI + 0xe) < 5) {

-LAB_1:

-      uVar3 = (ulonglong)unaff_EBX;

-    }

-    else {

-      uVar2 = *(uint *)(unaff_RSI + 8);

-      param_3 = (longlong *)(ulonglong)uVar2;

-      if (uVar2 < 0x38) goto LAB_1;

-      if (((0x11 < *(ushort *)(unaff_RSI + 0x30)) ||

-          (((uVar1 = *(uint *)(unaff_RSI + 0x34), uVar1 != 0 &&

-            (uVar1 < (uint)*(ushort *)(unaff_RSI + 0xe) * 8 + 0x10)) || (uVar2 < uVar1)))) ||

-         (((uVar2 < *(ushort *)(unaff_RSI + 0x32) ||

-           (uVar5 = *(ushort *)(unaff_RSI + 0x32) + uVar1, uVar5 < uVar1)) || (uVar2 < uVar5)))) {

-        in_R11B = cVar10;

-      }

-      if (((in_R11B == '\0') || (*(ushort *)(unaff_RSI + 0x30) != unaff_DI)) ||

-         (*(short *)(unaff_RSI + 0x32) != in_R10W)) goto LAB_1;

-      in_stack_000000b0 = *(ulonglong *)((ulonglong)*(uint *)(unaff_RSI + 0x34) + unaff_RSI);

-      uVar3 = unaff_R14 & 0xffffffff;

-    }

-    uStack0000000000000080 = (uint)uVar3;

-  }

-  HsmDbgBreakOnStatus((int)uVar3);

-  if ((int)uVar3 < 0) {

+  lVar1 = param_2[2];

+  uVar8 = 0;

+  uVar11 = 0;

+  uVar18 = 0;

+  uVar2 = *(undefined8 *)(param_1 + 0x30);

+  local_res8[0] = 0;

+  local_res10 = 0;

+  local_res18 = param_3;

+  plVar6 = (longlong *)ExAllocateFromPagedLookasideList(&DAT_0);

+  if (plVar6 == (longlong *)0x0) {

+    uVar19 = 0xc000009a;

+    HsmDbgBreakOnStatus(-0x3fffff66);

     if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

         ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-    uVar6 = 0x92;

-  }

-  else {

-    if (in_stack_00000090 < 0x18) {

-      uVar3 = (ulonglong)unaff_EBX;

-      uStack0000000000000080 = unaff_EBX;

+       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+    uVar9 = 0xd;

+    plVar17 = (longlong *)0x0;

+    uVar19 = 0xc000009a;

+LAB_2:

+    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,

+               &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,plVar17);

+    goto LAB_1;

+  }

+  *plVar6 = param_1;

+  plVar6[1] = (longlong)param_2;

+  if ((*(longlong *)(lVar1 + 0x20) == 0) && (*(longlong *)(lVar1 + 0x10) != 0)) {

+    FltAcquirePushLockExclusiveEx(lVar1 + 0x18,0);

+    if (*(longlong *)(lVar1 + 0x20) == 0) {

+      lVar14 = *(longlong *)(lVar1 + 8);

+      local_res20 = *(undefined8 *)(lVar1 + 0x10);

+      FltAcquirePushLockSharedEx(lVar14 + 8,0);

+      lVar7 = RtlLookupElementGenericTableAvl(lVar14 + 0x10,&local_res20);

+      if (lVar7 == 0) {

+        HsmDbgBreakOnStatus(-0x3fff30ff);

+      }

+      else {

+        *(undefined8 *)(lVar1 + 0x20) = *(undefined8 *)(lVar7 + 8);

+      }

+      FltReleasePushLockEx(lVar14 + 8,0);

+    }

+    FltReleasePushLockEx(lVar1 + 0x18,0);

+  }

+  lVar14 = *(longlong *)(lVar1 + 0x20);

+  uVar19 = uVar8;

+  if (lVar14 != 0) {

+    uVar4 = CldStreamOpen(param_2);

+    uVar19 = (ulonglong)uVar4;

+    HsmDbgBreakOnStatus(uVar4);

+    if ((int)uVar4 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+      uVar9 = 0xe;

+      plVar17 = plVar6;

+      goto LAB_2;

+    }

+  }

+  lVar7 = IoGetCurrentProcess();

+  uVar12 = uVar8;

+  if (lVar7 != *(longlong *)PsInitialSystemProcess_exref) {

+    if ((lVar14 == 0) || (*(longlong *)(lVar14 + 0x60) == 0)) {

+      lVar14 = 0;

     }

     else {

-      if (*(ushort *)(unaff_RSI + 0xe) < 8) {

-LAB_2:

-        uVar3 = (ulonglong)unaff_EBX;

+      lVar14 = *(longlong *)(*(longlong *)(lVar14 + 0x60) + 0x68);

+    }

+    lVar7 = IoGetCurrentProcess();

+    uVar12 = uVar11;

+    psVar13 = DAT_3;

+    uVar11 = uVar8;

+    uVar8 = uVar18;

+    if (lVar7 != lVar14) {

+      for (; (uVar18 = uVar11, *(short **)(psVar13 + 4) != (short *)0x0 &&

+             ((**(short **)(psVar13 + 4) != 0x2a || (*psVar13 != 2)))); psVar13 = psVar13 + 0x14) {

+        if (uVar18 == 0) {

+          uVar4 = ZwQueryInformationProcess(0xffffffffffffffff,0x1b,0,0,local_res8);

+          uVar19 = (ulonglong)uVar4;

+          HsmDbgBreakOnStatus(uVar4);

+          if (((uVar4 + 0x80000000 & 0x80000000) == 0) && (uVar4 != 0xc0000004)) {

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+            uVar9 = 0xf;

+          }

+          else {

+            uVar18 = ExAllocatePool2(0x100,local_res8[0],0x6e706c43);

+            if (uVar18 == 0) {

+              uVar19 = 0xc000009a;

+              HsmDbgBreakOnStatus(-0x3fffff66);

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+              uVar9 = 0x10;

+              uVar19 = 0xc000009a;

+            }

+            else {

+              uVar4 = ZwQueryInformationProcess

+                                (0xffffffffffffffff,0x1b,uVar18,local_res8[0],local_res8);

+              uVar19 = (ulonglong)uVar4;

+              HsmDbgBreakOnStatus(uVar4);

+              if (-1 < (int)uVar4) goto LAB_4;

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+              uVar9 = 0x11;

+            }

+          }

+          WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,

+                    &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,param_1);

+          goto LAB_1;

+        }

+LAB_4:

+        cVar3 = FsRtlDoesNameContainWildCards(psVar13);

+        if (cVar3 == '\0') {

+          iVar5 = RtlCompareUnicodeString(psVar13,uVar18);

+          if (iVar5 == 0) break;

+        }

+        else {

+          cVar3 = FsRtlIsNameInExpression();

+          if (cVar3 != '\0') break;

+        }

+        uVar11 = uVar18;

+      }

+      uVar8 = uVar18;

+      if ((*(short **)(psVar13 + 0xc) == (short *)0x0) ||

+         ((**(short **)(psVar13 + 0xc) == 0x2a && (psVar13[8] == 2)))) {

+LAB_5:

+        uVar12 = (ulonglong)*(uint *)(psVar13 + 0x10);

       }

       else {

-        uVar2 = *(uint *)(unaff_RSI + 8);

-        param_3 = (longlong *)(ulonglong)uVar2;

-        if (uVar2 < 0x50) goto LAB_2;

-        if ((((*(ushort *)(unaff_RSI + 0x48) < 0x12) &&

-             ((uVar1 = *(uint *)(unaff_RSI + 0x4c), uVar1 == 0 ||

-              ((uint)*(ushort *)(unaff_RSI + 0xe) * 8 + 0x10 <= uVar1)))) &&

-            ((uVar1 <= uVar2 &&

-             ((*(ushort *)(unaff_RSI + 0x4a) <= uVar2 &&

-              (uVar5 = *(ushort *)(unaff_RSI + 0x4a) + uVar1, uVar5 <= uVar2)))))) &&

-           (uVar1 <= uVar5)) {

-          cVar10 = '\x01';

-        }

-        if (((cVar10 == '\0') || (*(ushort *)(unaff_RSI + 0x48) != 6)) ||

-           (*(short *)(unaff_RSI + 0x4a) != 8)) goto LAB_2;

-        in_stack_000000b8 = *(ulonglong *)((ulonglong)*(uint *)(unaff_RSI + 0x4c) + unaff_RSI);

-        uVar3 = unaff_R14 & 0xffffffff;

-      }

-      uStack0000000000000080 = (uint)uVar3;

-    }

-    HsmDbgBreakOnStatus((int)uVar3);

-    if (-1 < (int)uVar3) {

-      if (unaff_R12W != 0x201) {

-        uVar8 = in_stack_000000b0;

-        uVar9 = in_stack_000000b8;

-        uVar3 = CldiPortAccessCheck(unaff_R13,in_stack_000000b0,in_stack_000000b8);

-        uVar2 = (uint)uVar3;

-        uVar3 = uVar3 & 0xffffffff;

-        uStack0000000000000080 = uVar2;

-        HsmDbgBreakOnStatus(uVar2);

-        if ((int)uVar2 < 0) {

+        uVar4 = FltGetFileNameInformationUnsafe(uVar2,0,0x102,&local_res10);

+        uVar19 = (ulonglong)uVar4;

+        HsmDbgBreakOnStatus(uVar4);

+        if ((int)uVar4 < 0) {

           if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

               ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

              (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            WPP_SF_qiild(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar8,uVar9,unaff_R13);

-          }

-          goto LAB_0;

-        }

-      }

-      if (unaff_R12W == -0x2fff) {

-        if ((in_stack_00000098 != (ulonglong *)0x0) && (in_stack_00000094 == 8)) {

-          *in_stack_00000098 = unaff_R14;

-        }

-        CldiPortProcessGetRangeInfo

-                  (unaff_R13,in_stack_000000b0,in_stack_000000b8,unaff_RSI,in_stack_00000090,

-                   in_stack_00000098,in_stack_00000094);

-        uVar3 = (ulonglong)extraout_EAX;

-        HsmDbgBreakOnStatus(extraout_EAX);

-        uStack0000000000000080 = extraout_EAX;

-      }

-      else {

-        CldiPortSetSyncStatus

-                  (unaff_R13,in_stack_000000b0,in_stack_000000b8,unaff_RSI,in_stack_00000090);

-        if ((ushort)(unaff_R12W - 0x101U) < 6) {

-          uStack0000000000000080 =

-               CldiPortProcessTransfer

-                         (unaff_R13,in_stack_000000b0,in_stack_000000b8,unaff_R12W,unaff_RSI,

-                          in_stack_00000090,in_stack_00000098,in_stack_00000094);

-        }

-        else {

-          if (unaff_R12W != 0x201) {

-            uVar3 = 0xc000cf0b;

-            uStack0000000000000080 = 0xc000cf0b;

-            goto LAB_3;

-          }

-          pvVar4 = CldiPortProcessAckNotification

-                             (unaff_R13,in_stack_000000b0,in_stack_000000b8,unaff_RSI,

-                              in_stack_00000090);

-          uStack0000000000000080 = (uint)pvVar4;

-        }

-        uVar3 = (ulonglong)uStack0000000000000080;

-      }

-LAB_3:

-      HsmDbgBreakOnStatus(uStack0000000000000080);

-      goto LAB_0;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-    uVar6 = 0x93;

-  }

-  WPP_SF_qqDqDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar6,param_3,unaff_R13);

-LAB_0:

-  if (in_stack_00000128 != (void *)0x0) {

-    memmove(in_stack_00000128,in_stack_00000098,(ulonglong)in_stack_00000094);

-    uVar11 = in_stack_00000094;

-  }

-  *in_stack_000000c8 = uVar11;

-  if (in_stack_00000098 != (ulonglong *)0x0) {

-    ExFreePoolWithTag(in_stack_00000098,0x424f6c43);

-  }

-  if (unaff_RSI != 0) {

-    ExFreePoolWithTag();

-  }

-  return uVar3;

+            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x12,

+                       &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,param_1);

+          }

+          goto LAB_1;

+        }

+        if ((*(longlong *)(local_res10 + 0x50) == 0) && (*(longlong *)(local_res10 + 0x40) != 0)) {

+          cVar3 = FsRtlDoesNameContainWildCards(psVar13 + 8);

+          if (cVar3 != '\0') {

+            cVar3 = FsRtlIsNameInExpression(psVar13 + 8,local_res10 + 0x38,1,0);

+            if (cVar3 != '\0') goto LAB_5;

+          }

+          iVar5 = RtlCompareUnicodeString(psVar13 + 8,local_res10 + 0x38,1);

+          if (iVar5 == 0) goto LAB_5;

+        }

+      }

+    }

+  }

+  uVar18 = uVar8;

+  FltAcquirePushLockExclusiveEx(lVar1 + 0x18,0);

+  uVar4 = *(uint *)(lVar1 + 0x28);

+  uVar15 = uVar4;

+  if (((byte)uVar4 & 0xf) <= ((byte)uVar12 & 0xf)) {

+    uVar15 = (uint)uVar12;

+  }

+  uVar10 = (uint)uVar12 >> 4;

+  uVar16 = (uVar15 ^ uVar4) & 0xf ^ uVar4;

+  uVar15 = uVar4 >> 4;

+  if (((byte)(uVar4 >> 4) & 0xf) <= ((byte)uVar10 & 0xf)) {

+    uVar15 = uVar10;

+  }

+  *(uint *)(lVar1 + 0x28) = (uVar15 << 4 ^ uVar16) & 0xf0 ^ uVar16;

+  FltReleasePushLockEx(lVar1 + 0x18,0);

+  *local_res18 = (longlong)plVar6;

+  plVar6 = (longlong *)0x0;

+LAB_1:

+  if (local_res10 != 0) {

+    FltReleaseFileNameInformation();

+  }

+  if (uVar18 != 0) {

+    ExFreePoolWithTag(uVar18,0x6e706c43);

+  }

+  if (plVar6 != (longlong *)0x0) {

+    ExFreeToPagedLookasideList(&DAT_0,plVar6);

+  }

+  return uVar19;

 }
```

## `HsmpCldNotifyPostOperation`  (modified)

```diff
--- HsmpCldNotifyPostOperation
+++ HsmpRpiDecompressBuffer
@@ -1,21 +1,103 @@
 

-undefined4

-HsmpCldNotifyPostOperation

-          (int param_1,longlong param_2,undefined4 param_3,undefined8 param_4,undefined8 param_5)

+int HsmpRpiDecompressBuffer(undefined8 *param_1,int param_2,undefined8 *param_3,ulonglong param_4)

 

 {

+  int *piVar1;

+  uint uVar2;

+  int iVar3;

+  undefined8 uVar4;

+  longlong lVar5;

+  undefined2 uVar6;

+  longlong unaff_RBX;

   longlong unaff_RBP;

+  longlong unaff_RSI;

   undefined4 unaff_EDI;

+  undefined4 uVar7;

+  undefined *puVar8;

+  undefined8 unaff_R12;

+  int unaff_R13D;

+  longlong unaff_R14;

+  undefined4 uStack0000000000000030;

+  undefined8 uStack0000000000000038;

+  longlong lStack0000000000000040;

+  undefined4 uStack0000000000000048;

+  undefined8 uStack0000000000000050;

+  undefined8 uStack0000000000000058;

+  int iStack0000000000000068;

   

-  if (*(longlong *)(unaff_RBP + -0x20) != 0) {

-    FltClose();

+  uVar4 = HsmFltProcessQueryStreamKey();

+  iVar3 = (int)uVar4;

+  HsmDbgBreakOnStatus(iVar3);

+  lVar5 = *(longlong *)(unaff_RBP + -0x51);

+  uVar2 = *(uint *)(unaff_RBP + -0x59);

+  *(longlong *)(unaff_RBP + 0x67) = lVar5;

+  if ((uVar2 & 1) != 0) {

+    FltAcquirePushLockExclusiveEx(unaff_R14 + 0x70,0);

+    piVar1 = (int *)(unaff_R14 + 0xac);

+    *piVar1 = *piVar1 + -1;

+    if (*piVar1 == 0) {

+      KeSetEvent(unaff_R14 + 0x90,0,0);

+    }

+    FltReleasePushLockEx(unaff_R14 + 0x70,0);

+    uVar2 = *(uint *)(unaff_RBP + -0x59);

+    lVar5 = *(longlong *)(unaff_RBP + 0x67);

   }

-  if (*(longlong *)(unaff_RBP + -0x70) != 0) {

-    FltReleaseFileNameInformation();

+  if ((uVar2 & 2) != 0) {

+    KeSetEvent(lVar5 + 0x60,0,0);

+    uVar2 = *(uint *)(unaff_RBP + -0x59);

   }

-  if (*(longlong *)(unaff_RBP + -0x78) != 0) {

-    ExFreePoolWithTag(*(longlong *)(unaff_RBP + -0x78),0x73557348);

+  if ((uVar2 & 4) != 0) {

+    FltReleaseContext(*(undefined8 *)(unaff_RBP + 0x67));

   }

-  return unaff_EDI;

+  FltReleaseContext();

+  if (iVar3 < 0) {

+    uStack0000000000000030 = (undefined4)unaff_R12;

+    puVar8 = WPP_GLOBAL_Control;

+    uVar7 = uStack0000000000000030;

+    if (((iVar3 == -0x7ffffffb) || (iVar3 == -0x3fffffdd)) ||

+       ((iVar3 == -0x3fff30ed && (*(char *)(unaff_RBP + 0x7f) == '\0')))) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3)

+         ) goto LAB_0;

+      lVar5 = *(longlong *)(unaff_RBP + 0x6f);

+      if (lVar5 != 0) {

+        uVar7 = *(undefined4 *)(lVar5 + 0x28);

+      }

+      if (unaff_RBX != 0) {

+        unaff_R12 = HsmpGetStreamSize(unaff_RBX);

+        uStack0000000000000030 = *(undefined4 *)(unaff_RBX + 0x1c);

+      }

+      uVar6 = 0xf2;

+    }

+    else {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

+         ) goto LAB_0;

+      lVar5 = *(longlong *)(unaff_RBP + 0x6f);

+      if (lVar5 != 0) {

+        uVar7 = *(undefined4 *)(lVar5 + 0x28);

+      }

+      if (unaff_RBX != 0) {

+        unaff_R12 = HsmpGetStreamSize(unaff_RBX);

+        uStack0000000000000030 = *(undefined4 *)(unaff_RBX + 0x1c);

+      }

+      uVar6 = 0xf1;

+    }

+    uStack0000000000000058 = *(undefined8 *)(unaff_RBP + -0x39);

+    uStack0000000000000050 = *(undefined8 *)(unaff_RBP + -0x31);

+    uStack0000000000000038 = unaff_R12;

+    lStack0000000000000040 = lVar5;

+    uStack0000000000000048 = uVar7;

+    iStack0000000000000068 = iVar3;

+    WPP_SF_lqqLiqLiqqd(*(undefined8 *)(puVar8 + 0x18),uVar6,lVar5,unaff_EDI);

+  }

+  else if (iVar3 == 0x103) {

+    return 2;

+  }

+LAB_0:

+  if (unaff_R13D == 4) {

+    *(int *)(unaff_RSI + 0x18) = iVar3;

+  }

+  return unaff_R13D;

 }
```

## `HsmiMungeQueryDirectory`  (modified)

```diff
--- HsmiMungeQueryDirectory
+++ HsmiMungeQueryDirectory
@@ -1,13 +1,302 @@
-

-/* WARNING: Control flow encountered bad instruction data */

 

 int HsmiMungeQueryDirectory(longlong param_1,longlong param_2)

 

 {

-  int *unaff_RDI;

+  int iVar1;

+  uint uVar2;

+  char cVar3;

+  int iVar4;

+  uint *puVar5;

+  undefined8 uVar6;

+  longlong lVar7;

+  uint uVar8;

+  undefined2 uVar9;

+  int iVar10;

+  int iVar11;

+  ulonglong in_stack_ffffffffffffff38;

+  undefined8 in_stack_ffffffffffffff40;

+  undefined4 uVar12;

+  longlong local_98;

+  uint local_90 [2];

+  undefined8 local_88;

+  undefined8 local_80;

+  uint *local_78;

+  int local_70;

+  uint local_6c;

+  uint local_68;

+  undefined8 local_60;

+  undefined8 local_58;

+  uint *local_50;

+  longlong local_48;

+  longlong local_40;

   

-  *unaff_RDI = *unaff_RDI + -1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  uVar12 = (undefined4)((ulonglong)in_stack_ffffffffffffff40 >> 0x20);

+  uVar6 = *(undefined8 *)(param_2 + 0x20);

+  local_60 = 0;

+  local_88 = 0;

+  local_78 = (uint *)0x0;

+  local_98 = 0;

+  local_90[0] = 0;

+  iVar4 = 0;

+  iVar10 = 0;

+  local_80 = uVar6;

+  local_58 = uVar6;

+  local_40 = HsmpGetStreamHandleContext(param_1,*(longlong *)(param_2 + 0x18),uVar6);

+  if (local_40 != 0) {

+    lVar7 = *(longlong *)(*(longlong *)(local_40 + 0x10) + 0x10);

+    local_60 = *(undefined8 *)(lVar7 + 0x10);

+    local_88 = *(undefined8 *)(lVar7 + 0x20);

+  }

+  iVar1 = *(int *)(*(longlong *)(param_1 + 0x10) + 0x28);

+  iVar11 = 0;

+  if (iVar1 < 0x3d) {

+    if (iVar1 == 0x3c) {

+      iVar4 = 0x58;

+      iVar10 = 0x3c;

+      iVar11 = iVar4;

+    }

+    else {

+      if (iVar1 == 1) {

+        iVar4 = 0x40;

+      }

+      else {

+        if (iVar1 != 2) {

+          if (iVar1 == 3) {

+            iVar4 = 0x5e;

+          }

+          else {

+            if (iVar1 != 0x25) {

+              iVar10 = 0;

+              if (iVar1 == 0x26) goto LAB_0;

+              goto LAB_1;

+            }

+            iVar4 = 0x68;

+          }

+          iVar10 = 0x4f;

+          iVar11 = 0x6a;

+          goto LAB_1;

+        }

+        iVar4 = 0x44;

+      }

+      iVar10 = 0x4e;

+      iVar11 = 0x50;

+    }

+  }

+  else if (iVar1 == 0x3f) {

+    iVar4 = 0x72;

+    iVar10 = 0x3f;

+    iVar11 = iVar4;

+  }

+  else if (iVar1 == 0x4e) {

+LAB_0:

+    iVar4 = 0x50;

+    iVar10 = 0x4e;

+    iVar11 = 0x50;

+  }

+  else if (iVar1 == 0x4f) {

+    iVar4 = 0x6a;

+    iVar10 = 0x4f;

+    iVar11 = 0x6a;

+  }

+  else if (iVar1 == 0x50) {

+    iVar4 = 0x60;

+    iVar10 = 0x50;

+    iVar11 = iVar4;

+  }

+  else if (iVar1 == 0x51) {

+    iVar4 = 0x7a;

+    iVar10 = 0x51;

+    iVar11 = iVar4;

+  }

+LAB_1:

+  uVar2 = *(uint *)(*(longlong *)(param_1 + 0x10) + 0x18);

+  uVar8 = (iVar11 - iVar4) + uVar2;

+  local_70 = iVar1;

+  if (uVar8 < uVar2) {

+    iVar4 = -0x3ffffff3;

+    HsmDbgBreakOnStatus(-0x3ffffff3);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_qqqiDDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),WPP_GLOBAL_Control,uVar6,param_1);

+    }

+    goto LAB_2;

+  }

+  if (0x100000 < uVar8) {

+    uVar8 = 0x100000;

+  }

+  puVar5 = (uint *)ExAllocatePool2(0x100,uVar8,0x64517348);

+  local_78 = puVar5;

+  local_50 = puVar5;

+  if (puVar5 == (uint *)0x0) {

+    iVar4 = -0x3fffff66;

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_2;

+    uVar9 = 0xb;

+    iVar4 = -0x3fffff66;

+  }

+  else {

+    iVar4 = FltAllocateCallbackDataEx

+                      (*(undefined8 *)(param_2 + 0x18),*(undefined8 *)(param_2 + 0x20),1,&local_98);

+    HsmDbgBreakOnStatus(iVar4);

+    if (iVar4 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

+         ) goto LAB_2;

+      uVar9 = 0xc;

+    }

+    else {

+      iVar4 = FltPropagateIrpExtension(param_1,local_98,0);

+      HsmDbgBreakOnStatus(iVar4);

+      if (iVar4 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+        uVar9 = 0xd;

+      }

+      else {

+        *(undefined1 *)(*(longlong *)(local_98 + 0x10) + 4) = 0xc;

+        *(undefined1 *)(*(longlong *)(local_98 + 0x10) + 5) = 1;

+        *(uint *)(*(longlong *)(local_98 + 0x10) + 0x18) = uVar8;

+        *(undefined8 *)(*(longlong *)(local_98 + 0x10) + 0x20) =

+             *(undefined8 *)(*(longlong *)(param_1 + 0x10) + 0x20);

+        *(int *)(*(longlong *)(local_98 + 0x10) + 0x28) = iVar10;

+        *(undefined4 *)(*(longlong *)(local_98 + 0x10) + 0x30) =

+             *(undefined4 *)(*(longlong *)(param_1 + 0x10) + 0x30);

+        *(uint **)(*(longlong *)(local_98 + 0x10) + 0x38) = puVar5;

+        *(undefined8 *)(*(longlong *)(local_98 + 0x10) + 0x40) = 0;

+        *(undefined1 *)(*(longlong *)(local_98 + 0x10) + 6) =

+             *(undefined1 *)(*(longlong *)(param_1 + 0x10) + 6);

+        FltPerformSynchronousIo(local_98);

+        iVar4 = *(int *)(local_98 + 0x18);

+        HsmDbgBreakOnStatus(iVar4);

+        uVar8 = *(uint *)(local_98 + 0x20);

+        local_6c = uVar8;

+        FltFreeCallbackData();

+        local_98 = 0;

+        *(int *)(param_1 + 0x18) = iVar4;

+        if (iVar4 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 4)) goto LAB_2;

+          uVar9 = 0x12;

+        }

+        else {

+          lVar7 = *(longlong *)(param_1 + 0x10);

+          uVar2 = *(uint *)(lVar7 + 0x18);

+          local_68 = uVar2;

+          if (*(longlong *)(lVar7 + 0x40) == 0) {

+            lVar7 = *(longlong *)(lVar7 + 0x38);

+            local_48 = lVar7;

+            if ((*(char *)(param_1 + 0x50) == '\0') || (ProbeForWrite(lVar7,uVar2,1), -1 < iVar4)) {

+LAB_3:

+              cVar3 = HsmOsGetPlaceholderCompatMode(param_1);

+              if (iVar10 == 0x3c) {

+                uVar6 = HsmiMungeQueryDirectoryBufferForFileIdExtdDirectoryInformation

+                                  (cVar3,iVar1,local_78,(ulonglong)uVar8,lVar7,uVar2,local_90);

+                iVar4 = (int)uVar6;

+LAB_4:

+                HsmDbgBreakOnStatus(iVar4);

+              }

+              else {

+                if (iVar10 == 0x3f) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdExtdBothDirectoryInformation

+                                    (cVar3,iVar1,local_78,(ulonglong)uVar8,lVar7,uVar2,local_90);

+                  iVar4 = (int)uVar6;

+                  goto LAB_4;

+                }

+                if (iVar10 == 0x4e) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferWithoutShortnameFileId64

+                                    (cVar3,iVar1,local_78,(ulonglong)uVar8,lVar7,uVar2,local_90);

+                  iVar4 = (int)uVar6;

+                  goto LAB_4;

+                }

+                if (iVar10 == 0x4f) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferWithShortnameFileId64

+                                    (cVar3,iVar1,local_78,(ulonglong)uVar8,lVar7,uVar2,local_90);

+                  iVar4 = (int)uVar6;

+                  goto LAB_4;

+                }

+                if (iVar10 == 0x50) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdAllExtdDirectoryInformation

+                                    (cVar3,iVar1,local_78,(ulonglong)uVar8,lVar7,uVar2,local_90);

+                  iVar4 = (int)uVar6;

+                  goto LAB_4;

+                }

+                if (iVar10 == 0x51) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdAllExtdBothDirectoryInformation

+                                    (cVar3,iVar1,local_78,(ulonglong)uVar8,lVar7,uVar2,local_90);

+                  iVar4 = (int)uVar6;

+                  goto LAB_4;

+                }

+              }

+              if (-1 < iVar4) {

+                *(ulonglong *)(param_1 + 0x20) = (ulonglong)local_90[0];

+                goto LAB_2;

+              }

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+              uVar9 = 0x11;

+            }

+            else {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+              uVar9 = 0x10;

+            }

+          }

+          else {

+            iVar4 = FltLockUserBuffer(param_1);

+            HsmDbgBreakOnStatus(iVar4);

+            if (iVar4 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+              uVar9 = 0xe;

+            }

+            else {

+              lVar7 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x40);

+              if ((*(byte *)(lVar7 + 10) & 5) == 0) {

+                lVar7 = MmMapLockedPagesSpecifyCache

+                                  (lVar7,0,1,0,in_stack_ffffffffffffff38 & 0xffffffff00000000,

+                                   CONCAT44(uVar12,0x40000010));

+              }

+              else {

+                lVar7 = *(longlong *)(lVar7 + 0x18);

+              }

+              if (lVar7 != 0) goto LAB_3;

+              iVar4 = -0x3fffffe9;

+              HsmDbgBreakOnStatus(-0x3fffffe9);

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+              uVar9 = 0xf;

+              iVar4 = -0x3fffffe9;

+            }

+          }

+        }

+      }

+    }

+  }

+  WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,

+               &WPP_23c031617105374e664d37900f58dae3_Traceguids,param_1);

+LAB_2:

+  if (iVar4 < 0) {

+    *(int *)(param_1 + 0x18) = iVar4;

+    *(undefined8 *)(param_1 + 0x20) = 0;

+  }

+  if (local_98 != 0) {

+    FltFreeCallbackData();

+  }

+  if (local_78 != (uint *)0x0) {

+    ExFreePoolWithTag(local_78,0x64517348);

+  }

+  if (local_40 != 0) {

+    FltReleaseContext();

+  }

+  return iVar4;

 }
```

## `TlmCldPortSendUpstreamMessageTimeout`  (modified)

```diff
--- TlmCldPortSendUpstreamMessageTimeout
+++ TlmCldPortSendUpstreamMessageTimeout
@@ -1,33 +1,80 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-int TlmCldPortSendUpstreamMessageTimeout

-              (undefined8 param_1,undefined8 param_2,ushort *param_3,ushort *param_4)

+void TlmCldPortSendUpstreamMessageTimeout

+               (undefined8 param_1,undefined8 param_2,ushort *param_3,ushort *param_4)

 

 {

-  int in_EAX;

-  int iVar1;

-  longlong unaff_RBP;

-  undefined1 *unaff_RDI;

-  byte in_CF;

-  longlong in_stack_00000038;

+  bool bVar1;

+  undefined1 auStackY_138 [32];

+  undefined8 local_108;

+  undefined8 local_100;

+  undefined8 local_f8;

+  undefined8 local_f0;

+  undefined8 local_e8;

+  undefined8 local_e0;

+  undefined8 local_d8 [4];

+  undefined8 *local_b8;

+  undefined8 local_b0;

+  undefined8 *local_a8;

+  undefined8 local_a0;

+  undefined8 *local_98;

+  undefined8 local_90;

+  undefined8 *local_88;

+  undefined8 local_80;

+  undefined8 *local_78;

+  undefined8 local_70;

+  uint *local_68;

+  undefined8 local_60;

+  undefined8 local_58;

+  uint local_50 [2];

+  uint *local_48;

+  undefined8 local_40;

+  undefined8 local_38;

+  uint local_30 [2];

+  undefined8 *local_28;

+  undefined8 local_20;

+  ulonglong local_18;

   

-  iVar1 = in_EAX + 0x1a65b + (uint)in_CF;

-  if (iVar1 == -0x3fffffcc) {

-    *unaff_RDI = 1;

-    iVar1 = 0;

-  }

-  else if (-1 < iVar1) {

-    if (*(int *)(unaff_RBP + -0x6c) == 4) {

-      *unaff_RDI = *(int *)(unaff_RBP + -100) == 0;

+  local_18 = __security_cookie ^ (ulonglong)auStackY_138;

+  local_100 = KeQueryUnbiasedInterruptTime();

+  if (5 < *DAT_0) {

+    if (((*(ulonglong *)(DAT_0 + 4) & 0x400000000000) == 0) ||

+       (bVar1 = true,

+       (*(ulonglong *)(DAT_0 + 6) & 0x400000000000) != *(ulonglong *)(DAT_0 + 6))) {

+      bVar1 = false;

     }

-    else {

-      iVar1 = -0x3fffffdc;

+    if (bVar1) {

+      local_b8 = &local_108;

+      local_50[1] = 0;

+      local_a8 = &local_100;

+      local_30[1] = 0;

+      local_98 = &local_f8;

+      local_108 = 1;

+      local_88 = &local_f0;

+      local_b0 = 8;

+      local_78 = &local_e8;

+      local_68 = local_50;

+      local_58 = *(undefined8 *)(param_3 + 4);

+      local_50[0] = (uint)*param_3;

+      local_48 = local_30;

+      local_38 = *(undefined8 *)(param_4 + 4);

+      local_30[0] = (uint)*param_4;

+      local_28 = &local_e0;

+      local_a0 = 8;

+      local_90 = 8;

+      local_80 = 8;

+      local_70 = 8;

+      local_60 = 2;

+      local_40 = 2;

+      local_e0 = 0x1000000;

+      local_20 = 8;

+      local_f8 = local_100;

+      local_f0 = param_1;

+      local_e8 = param_2;

+      _tlgWriteAgg((longlong)DAT_0,&DAT_1400234cc,local_100,0xc,local_d8);

     }

   }

-  if (in_stack_00000038 != 0) {

-    ZwClose();

-  }

-  return iVar1;

+  return;

 }
```

## `HsmiQueryFileRangesTotalNoLock`  (modified)

```diff
--- HsmiQueryFileRangesTotalNoLock
+++ HsmiQueryFileRangesTotalNoLock
@@ -1,13 +1,81 @@
-

-/* WARNING: Control flow encountered bad instruction data */

 

 int HsmiQueryFileRangesTotalNoLock(longlong param_1,int param_2,longlong param_3,longlong *param_4)

 

 {

-  undefined4 in_EAX;

+  longlong lVar1;

+  int iVar2;

+  byte bVar3;

+  longlong lVar4;

+  longlong lVar5;

+  longlong local_res18;

+  byte local_res20 [8];

+  longlong local_78;

+  longlong local_70;

+  longlong local_68;

+  undefined4 local_60;

+  undefined4 local_5c;

+  longlong *local_58;

+  longlong *local_50;

+  byte *local_48;

+  longlong *local_40;

+  int local_38 [4];

   

-  uRam26840fc83b48fffb = in_EAX;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  iVar2 = 0;

+  lVar5 = 0;

+  local_70 = 0;

+  local_res18 = param_3;

+  if (0 < param_3) {

+    do {

+      local_78 = 0;

+      iVar2 = 0;

+      local_res20[0] = 0;

+      if (param_2 == 0x4244) {

+        bVar3 = *(byte *)(param_1 + 0x1c) >> 6;

+        lVar4 = *(longlong *)(*(longlong *)(param_1 + 0xa0) + 0x38);

+LAB_0:

+        bVar3 = bVar3 & 1;

+        lVar1 = local_res18;

+        if (lVar4 != 0) {

+          local_5c = 0;

+          local_58 = &local_70;

+          local_38[0] = 0;

+          local_38[1] = 0;

+          local_50 = &local_res18;

+          local_48 = local_res20;

+          local_40 = &local_78;

+          local_60 = 7;

+          local_68 = lVar4;

+          iVar2 = HsmExpandKernelStackAndCallout(HsmpBitmapQueryRangeExCallout,local_38);

+          HsmDbgBreakOnStatus(iVar2);

+          HsmDbgBreakOnStatus(iVar2);

+          bVar3 = local_res20[0];

+          lVar1 = local_78;

+        }

+      }

+      else {

+        if (param_2 == 0x424d) {

+          bVar3 = (byte)(*(uint *)(param_1 + 0x1c) >> 10);

+          lVar4 = *(longlong *)(*(longlong *)(param_1 + 0xa0) + 0x48);

+          goto LAB_0;

+        }

+        bVar3 = 0;

+        lVar1 = local_res18;

+        if (param_2 == 0x4256) {

+          bVar3 = (byte)((uint)*(undefined4 *)(param_1 + 0x1c) >> 8);

+          lVar4 = *(longlong *)(*(longlong *)(param_1 + 0xa0) + 0x40);

+          goto LAB_0;

+        }

+      }

+      local_78 = lVar1;

+      local_res20[0] = bVar3;

+      HsmDbgBreakOnStatus(iVar2);

+      if (local_res20[0] != 0) {

+        lVar5 = lVar5 + (local_78 - local_70);

+      }

+      local_70 = local_78;

+    } while (local_78 < local_res18);

+  }

+  *param_4 = lVar5;

+  return iVar2;

 }
```

## `HsmiRecallPostProcessHydration`  (modified)

```diff
--- HsmiRecallPostProcessHydration
+++ HsmiRecallPostProcessHydration
@@ -1,15 +1,137 @@
-

-/* WARNING: Control flow encountered bad instruction data */

 

 void HsmiRecallPostProcessHydration(longlong param_1,int param_2)

 

 {

-  undefined1 *unaff_RSI;

-  undefined1 *unaff_RDI;

+  longlong lVar1;

+  undefined8 uVar2;

+  longlong lVar3;

+  longlong lVar4;

+  longlong lVar5;

+  undefined *puVar6;

+  longlong lVar7;

+  undefined *puVar8;

+  undefined4 in_register_00000014;

+  longlong *plVar9;

+  uint uVar10;

+  uint uVar11;

+  ulonglong uVar12;

+  longlong lVar13;

+  longlong *plVar14;

+  bool bVar15;

   

-  *unaff_RDI = *unaff_RSI;

-  *(int *)(unaff_RDI + 1) = *(int *)(unaff_RDI + 1) + -1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  plVar9 = (longlong *)CONCAT44(in_register_00000014,param_2);

+  if ((*(uint *)(param_1 + 0x30) >> 9 & 1) == 0) {

+    lVar3 = *(longlong *)(param_1 + 0x18);

+  }

+  else {

+    lVar3 = 0;

+  }

+  lVar5 = *(longlong *)(param_1 + 0x70);

+  lVar1 = *(longlong *)(param_1 + 0x78);

+  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+    lVar13 = *(longlong *)(lVar1 + 0x10);

+    puVar6 = WPP_GLOBAL_Control;

+    HsmpGetStreamSize(lVar1);

+    plVar9 = (longlong *)&DAT_0;

+    WPP_SF_qliiqqLiid(*(undefined8 *)(puVar6 + 0x18),0x20,*(undefined8 *)(lVar13 + 0x20),param_1);

+  }

+  uVar11 = 0x1c0;

+  if (param_2 == -0x3ffffdd3) {

+    uVar10 = *(uint *)(param_1 + 0x30) & 0xfffffe7f | 0x40;

+    param_2 = 0;

+    *(uint *)(param_1 + 0x30) = uVar10;

+    if (2 < ((byte)*(undefined4 *)(param_1 + 0x28) & 0xf)) {

+      *(undefined8 *)(param_1 + 0x48) = 0;

+      uVar11 = 0x1c0;

+      uVar2 = HsmpGetStreamSize(lVar1);

+      *(undefined8 *)(param_1 + 0x50) = uVar2;

+    }

+LAB_1:

+    uVar12 = (ulonglong)(uVar10 & uVar11);

+    if (0xbf < (uVar10 & uVar11)) goto LAB_2;

+LAB_3:

+    HsmiRecallInitiateHydration(param_1,plVar9,uVar12);

+  }

+  else {

+    if ((param_2 == -0x3fff30ea) && (lVar5 != 0)) {

+      *(undefined1 *)(lVar5 + 0x2c) = 1;

+      *(uint *)(param_1 + 0x30) = *(uint *)(param_1 + 0x30) & 0xfffffeff | 0xc0;

+    }

+    else {

+      uVar10 = *(uint *)(param_1 + 0x30);

+      uVar10 = (uVar10 + 0x40 ^ uVar10) & 0x1c0 ^ uVar10;

+      uVar10 = ((~(*(uint *)(param_1 + 0x28) >> 2) & 0x40) + uVar10 ^ uVar10) & 0x1c0 ^ uVar10;

+      *(uint *)(param_1 + 0x30) = uVar10;

+      if (-1 < param_2) goto LAB_1;

+    }

+LAB_2:

+    if (lVar3 != 0) {

+      HsmiRecallPostProcessUserHydrationRequest(param_1,lVar3,param_2);

+    }

+    if (((-1 < param_2) && ((*(uint *)(lVar1 + 0x1c) & 0x100) == 0)) &&

+       ((((byte)*(undefined4 *)(param_1 + 0x28) & 0xf) == 2 && (*(longlong *)(param_1 + 0x70) != 0))

+       )) {

+      LOCK();

+      lVar3 = *(longlong *)(lVar5 + 0x38);

+      bVar15 = lVar3 == 0;

+      if (bVar15) {

+        *(longlong *)(lVar5 + 0x38) = param_1;

+        lVar3 = 0;

+      }

+      UNLOCK();

+      if ((bVar15) || (lVar3 == param_1)) {

+        uVar11 = *(uint *)(param_1 + 0x30);

+        plVar9 = (longlong *)(param_1 + 0x48);

+        lVar3 = *(longlong *)(param_1 + 0x50);

+        lVar13 = lVar3;

+        if ((uVar11 >> 9 & 1) == 0) {

+          *(undefined8 *)(param_1 + 0x50) = 0x1000;

+          uVar11 = uVar11 | 0x200;

+          lVar13 = 0x1000;

+        }

+        lVar3 = lVar3 + *plVar9;

+        *plVar9 = lVar3;

+        uVar11 = uVar11 & 0xfffffe7f | 0x40;

+        *(uint *)(param_1 + 0x30) = uVar11;

+        lVar7 = lVar1;

+        plVar14 = plVar9;

+        lVar4 = HsmpGetStreamSize(lVar1);

+        if ((lVar4 <= lVar3) && ((uVar11 & 0x400) == 0)) {

+          *plVar14 = 0;

+          *(uint *)(param_1 + 0x30) = uVar11 | 0x400;

+          lVar3 = 0;

+          *(undefined8 *)(param_1 + 0x50) = 0x1000;

+          lVar13 = 0x1000;

+        }

+        lVar4 = HsmpGetStreamSize(lVar7);

+        if (lVar3 < lVar4) {

+          lVar13 = lVar13 + lVar3;

+          lVar5 = HsmpGetStreamSize(lVar7);

+          if (lVar5 <= lVar13) {

+            lVar13 = HsmpGetStreamSize(lVar7);

+          }

+          uVar12 = lVar13 - lVar3;

+          *(ulonglong *)(param_1 + 0x50) = uVar12;

+          goto LAB_3;

+        }

+      }

+    }

+    if (lVar5 == 0) {

+      puVar6 = *(undefined **)(lVar1 + 0x68);

+    }

+    else {

+      puVar6 = *(undefined **)(lVar5 + 0x60);

+    }

+    puVar8 = &DAT_4;

+    if (puVar6 != (undefined *)0x0) {

+      puVar8 = puVar6;

+    }

+    TlmWriteHydrationCompletion

+              ((longlong)puVar8,*(longlong *)(param_1 + 0x98),(ushort *)(param_1 + 0x58),

+               *(ulonglong *)(param_1 + 0x50),param_2);

+    HsmiRecallFreeHydrationContext(param_1);

+  }

+  return;

 }
```

## `HsmpCreateProcessInfo`  (modified)

```diff
--- HsmpCreateProcessInfo
+++ HsmpCreateProcessInfo
@@ -1,69 +1,299 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 ulonglong * HsmpCreateProcessInfo(longlong param_1)

 

 {

-  undefined1 uVar1;

-  int iVar2;

+  undefined8 uVar1;

+  ulonglong uVar2;

   ulonglong *puVar3;

-  undefined2 in_DX;

-  undefined8 uVar4;

-  longlong unaff_RBX;

-  ulonglong uVar5;

-  ulonglong unaff_RSI;

-  undefined1 *unaff_RDI;

-  undefined1 *puVar6;

-  undefined *puVar7;

-  longlong *unaff_R14;

-  longlong *plVar8;

-  longlong unaff_R15;

-  bool in_OF;

-  undefined8 in_stack_00000090;

+  int iVar4;

+  uint uVar5;

+  longlong lVar6;

+  ulonglong uVar7;

+  undefined8 uVar8;

+  ulonglong *puVar9;

+  ushort uVar10;

+  longlong lVar11;

+  uint uVar12;

+  void *pvVar13;

+  wchar_t *_Src;

+  wchar_t *_Src_00;

+  uint uVar14;

+  uint uVar15;

+  undefined1 auStackY_298 [32];

+  uint local_268;

+  undefined4 local_264;

+  ulonglong local_258;

+  wchar_t *pwStack_250;

+  uint *local_248 [2];

+  wchar_t *local_238;

+  wchar_t *pwStack_230;

+  uint local_228;

+  uint local_224;

+  ulonglong *local_220;

+  undefined8 local_218;

+  wchar_t *pwStack_210;

+  ulonglong local_208;

+  ulonglong local_200;

+  ulonglong local_1f8;

+  undefined8 *local_1f0;

+  undefined8 local_1e8;

+  undefined8 uStack_1e0;

+  ulonglong local_1d8;

+  wchar_t *pwStack_1d0;

+  wchar_t local_1c8 [72];

+  wchar_t local_138 [128];

+  ulonglong local_38;

   

-  puVar6 = unaff_RDI + 1;

-  uVar1 = in(in_DX);

-  *unaff_RDI = uVar1;

-  if (in_OF) {

-    uVar5 = (ulonglong)((int)&stack0x00000000 - 0x30);

-    *(undefined8 *)(uVar5 + 0x20) = 0;

-    puVar7 = (undefined *)0x0;

-    uVar4 = 0;

-    *(undefined8 *)(uVar5 - 8) = 0x140076ba6;

-    iVar2 = KeWaitForSingleObject(&DAT_0,0,0,0);

-    *(undefined8 *)(uVar5 - 8) = 0x140076bb4;

-    HsmDbgBreakOnStatus(iVar2);

-    if ((-1 < iVar2) && (DAT_1 = DAT_1 + -1, DAT_1 < 1)) {

-      *(undefined8 *)(uVar5 - 8) = 0x140076bde;

-      ExReInitializeRundownProtection();

-      *(undefined8 *)(uVar5 - 8) = 0x140076bea;

-      CldiStreamStartCountdownTimer('\0',uVar4,puVar7);

-    }

-    *(undefined8 *)(uVar5 - 8) = 0x140076bfd;

-    puVar3 = (ulonglong *)KeSetEvent(&DAT_0,0,0);

-    return puVar3;

-  }

-  do {

-    ExFreePoolWithTag(puVar6);

-    plVar8 = unaff_R14;

-    do {

-      unaff_R14 = plVar8 + 2;

-      unaff_R15 = unaff_R15 + -1;

-      if (unaff_R15 == 0) {

-        ExFreePoolWithTag(in_stack_00000090,0x67706c43);

-        KeLeaveCriticalRegion();

-        return (ulonglong *)(unaff_RSI & 0xffffffff);

-      }

-      if ((undefined8 *)*unaff_R14 != (undefined8 *)0x0) {

-        FltReleaseContext(**(undefined8 **)*unaff_R14);

-      }

-      puVar6 = (undefined1 *)plVar8[3];

-      plVar8 = unaff_R14;

-    } while (puVar6 == (undefined1 *)0x0);

-    if (*(longlong *)(puVar6 + 0x10) != unaff_RBX) {

-      FsRtlUninitializeBaseMcb(puVar6);

-    }

-    if (*(longlong *)(puVar6 + 0x28) != unaff_RBX) {

-      FsRtlUninitializeBaseMcb(puVar6 + 0x18);

-    }

-  } while( true );

+  local_38 = __security_cookie ^ (ulonglong)auStackY_298;

+  puVar9 = (ulonglong *)0x0;

+  local_200 = 0x84;

+  local_248[0] = (uint *)0x0;

+  _Src = L"UNKNOWN";

+  local_208 = 0x100;

+  uVar15 = 0xe;

+  local_220 = (ulonglong *)0x0;

+  local_268 = 0;

+  local_1f0 = (undefined8 *)0x0;

+  local_218 = 0;

+  pwStack_210 = (wchar_t *)0x0;

+  local_238 = (wchar_t *)0x10000e;

+  pwStack_230 = L"UNKNOWN";

+  local_1d8 = 0x10000e;

+  pwStack_1d0 = L"UNKNOWN";

+  local_258 = 0x10000e;

+  pwStack_250 = L"UNKNOWN";

+  if (param_1 == 0) goto LAB_0;

+  lVar11 = param_1;

+  lVar6 = HsmOsGetEcpFromAttributionInfo(param_1);

+  if (lVar6 == 0) {

+    local_1f8 = HsmOsGetProcessId(lVar11);

+    uVar7 = HsmOsGetProcessSessionId(param_1);

+    local_264 = (undefined4)uVar7;

+  }

+  else {

+    local_1f8 = HsmOsGetProcessId(lVar11);

+    uVar7 = HsmOsGetProcessSessionId(param_1);

+    local_264 = (undefined4)uVar7;

+    local_1f0 = (undefined8 *)HsmOsGetVmGuid(param_1);

+  }

+  uVar8 = HsmOsLocateProcessImageName(param_1,(longlong *)local_248);

+  uVar7 = Feature_CloudFilesCrashReadingProcessImageName__private_IsEnabledDeviceUsageNoInline();

+  if ((int)uVar7 == 0) {

+    if (-1 < (int)uVar8) {

+LAB_1:

+      if (*(longlong *)(local_248[0] + 2) == 0) {

+        local_1e8 = 0;

+        uStack_1e0 = 0;

+        uVar8 = HsmOsGetProcessImageFileName(param_1);

+        RtlInitAnsiString(&local_1e8,uVar8);

+        iVar4 = RtlAnsiStringToUnicodeString(&local_218);

+        if (-1 < iVar4) {

+          uVar15 = (uint)local_218;

+          _Src = pwStack_210;

+        }

+        goto LAB_2;

+      }

+    }

+    uVar15 = *local_248[0];

+    _Src = *(wchar_t **)(local_248[0] + 2);

+  }

+  else if (-1 < (int)uVar8) goto LAB_1;

+LAB_2:

+  iVar4 = HsmOsGetProcessCommandLineByAttributionInfo(param_1,(undefined2 *)0x0,0,(int *)&local_268)

+  ;

+  if (iVar4 == -0x3ffffffc) {

+    puVar9 = (ulonglong *)ExAllocatePool2(0x100,local_268,0x73557348);

+    local_220 = puVar9;

+    if (puVar9 != (ulonglong *)0x0) {

+      iVar4 = HsmOsGetProcessCommandLineByAttributionInfo

+                        (param_1,(undefined2 *)puVar9,local_268,(int *)&local_268);

+      goto LAB_3;

+    }

+  }

+  else {

+LAB_3:

+    if (-1 < iVar4) {

+      local_258 = *puVar9;

+      pwStack_250 = (wchar_t *)puVar9[1];

+    }

+  }

+  iVar4 = HsmOsQueryPackageIdentity(param_1,local_138,&local_208,local_1c8,&local_200);

+  _Src_00 = pwStack_230;

+  uVar10 = (ushort)local_238;

+  if (iVar4 < 0) {

+LAB_4:

+    local_238 = pwStack_1d0;

+    uVar7 = local_1d8 & 0xffff;

+  }

+  else {

+    if (local_208 < 0x10000) {

+      uVar7 = local_208;

+      _Src_00 = local_138;

+    }

+    else {

+      uVar7 = (ulonglong)local_238 & 0xffff;

+    }

+    uVar10 = (ushort)uVar7;

+    if (0xffff < local_200) goto LAB_4;

+    local_238 = local_1c8;

+    uVar7 = local_200;

+  }

+  local_224 = (uint)uVar7 & 0xffff;

+  local_228 = (uint)uVar10;

+  uVar14 = ((ushort)local_258 + 5 +

+            (local_224 + (((uVar15 & 0xffff) + 0x51 & 0xfffffffc) + local_228 + 3 & 0xfffffffc) + 7

+            & 0xfffffffc) & 0xfffffffc) + 0x10;

+  puVar9 = (ulonglong *)ExAllocatePool2(0x100,uVar14,0x69507348);

+  pvVar13 = (void *)0x0;

+  if (puVar9 != (ulonglong *)0x0) {

+    *puVar9 = 0x69706c43;

+    *(undefined4 *)(puVar9 + 1) = 0x48;

+    *(undefined4 *)((longlong)puVar9 + 0xc) = 0x70000;

+    puVar9[2] = 0;

+    puVar9[3] = 0;

+    puVar9[4] = 0;

+    puVar9[5] = 0;

+    puVar9[6] = 0;

+    puVar9[7] = 0;

+    puVar9[8] = 0;

+    if (((uVar14 < 0x18) || (*(short *)((longlong)puVar9 + 0xe) == 0)) ||

+       ((ulonglong)uVar14 < ((ulonglong)(uint)puVar9[1] + 3 & 0xfffffffffffffffc) + 4)) {

+      if (0x17 < uVar14) goto LAB_5;

+    }

+    else {

+      uVar5 = (uint)puVar9[1] + 3 & 0xfffffffc;

+      *(uint *)(puVar9 + 1) = uVar5;

+      if ((short)puVar9[2] != 0) {

+        *(ushort *)((longlong)puVar9 + 0xc) = *(ushort *)((longlong)puVar9 + 0xc) | 1;

+      }

+      *(undefined4 *)(puVar9 + 2) = 0x4000a;

+      *(uint *)((longlong)puVar9 + 0x14) = uVar5;

+      *(int *)((ulonglong)uVar5 + (longlong)puVar9) = (int)local_1f8;

+      *(int *)(puVar9 + 1) = (int)puVar9[1] + 4;

+LAB_5:

+      uVar5 = (uVar15 & 0xffff) + 2;

+      if (((uVar5 < 0x10001) && (0x1f < uVar14)) &&

+         ((1 < *(ushort *)((longlong)puVar9 + 0xe) &&

+          (((ulonglong)(uint)puVar9[1] + 3 & 0xfffffffffffffffc) + (ulonglong)uVar5 <=

+           (ulonglong)uVar14)))) {

+        uVar12 = (uint)puVar9[1] + 3 & 0xfffffffc;

+        *(short *)((longlong)puVar9 + 0x1a) = (short)uVar5;

+        *(uint *)((longlong)puVar9 + 0x1c) = uVar12;

+        *(undefined2 *)(puVar9 + 3) = 0x11;

+        pvVar13 = (void *)((ulonglong)uVar12 + (longlong)puVar9);

+        *(uint *)(puVar9 + 1) = (uVar5 & 0xffff) + uVar12;

+      }

+    }

+    memmove(pvVar13,_Src,(ulonglong)(uVar15 & 0xffff));

+    uVar7 = (ulonglong)uVar14;

+    *(undefined2 *)((longlong)pvVar13 + (ulonglong)((uVar15 & 0xffff) >> 1) * 2) = 0;

+    if (uVar14 < 0x18) {

+LAB_6:

+      if (0x17 < uVar14) goto LAB_7;

+LAB_8:

+      pvVar13 = (void *)0x0;

+    }

+    else {

+      uVar10 = *(ushort *)((longlong)puVar9 + 0xe);

+      if ((0x27 < uVar14) && (2 < uVar10)) {

+        if (((ulonglong)(uint)puVar9[1] + 3 & 0xfffffffffffffffc) + (ulonglong)(ushort)local_228 <=

+            uVar7) {

+          if ((short)puVar9[4] != 0) {

+            *(ushort *)((longlong)puVar9 + 0xc) = *(ushort *)((longlong)puVar9 + 0xc) | 1;

+          }

+          uVar15 = (uint)puVar9[1] + 3 & 0xfffffffc;

+          *(uint *)(puVar9 + 1) = uVar15;

+          *(undefined2 *)(puVar9 + 4) = 0x11;

+          *(ushort *)((longlong)puVar9 + 0x22) = (ushort)local_228;

+          *(uint *)((longlong)puVar9 + 0x24) = uVar15;

+          if ((_Src_00 != (wchar_t *)0x0) &&

+             ((wchar_t *)((ulonglong)uVar15 + (longlong)puVar9) != _Src_00)) {

+            memmove((wchar_t *)((ulonglong)uVar15 + (longlong)puVar9),_Src_00,

+                    (ulonglong)(ushort)local_228);

+            uVar10 = *(ushort *)((longlong)puVar9 + 0xe);

+          }

+          *(uint *)(puVar9 + 1) = (int)puVar9[1] + (uint)*(ushort *)((longlong)puVar9 + 0x22);

+        }

+      }

+      if ((0x2f < uVar14) && (3 < uVar10)) {

+        if (((ulonglong)(uint)puVar9[1] + 3 & 0xfffffffffffffffc) + (ulonglong)(ushort)local_224 <=

+            uVar7) {

+          if ((short)puVar9[5] != 0) {

+            *(ushort *)((longlong)puVar9 + 0xc) = *(ushort *)((longlong)puVar9 + 0xc) | 1;

+          }

+          uVar15 = (uint)puVar9[1] + 3 & 0xfffffffc;

+          *(uint *)(puVar9 + 1) = uVar15;

+          *(undefined2 *)(puVar9 + 5) = 0x11;

+          *(ushort *)((longlong)puVar9 + 0x2a) = (ushort)local_224;

+          *(uint *)((longlong)puVar9 + 0x2c) = uVar15;

+          if ((local_238 != (wchar_t *)0x0) &&

+             ((wchar_t *)((ulonglong)uVar15 + (longlong)puVar9) != local_238)) {

+            memmove((wchar_t *)((ulonglong)uVar15 + (longlong)puVar9),local_238,

+                    (ulonglong)(ushort)local_224);

+            uVar10 = *(ushort *)((longlong)puVar9 + 0xe);

+          }

+          *(uint *)(puVar9 + 1) = (int)puVar9[1] + (uint)*(ushort *)((longlong)puVar9 + 0x2a);

+        }

+      }

+      if (((uVar10 < 5) || (uVar14 < 0x38)) ||

+         (uVar7 < ((ulonglong)(uint)puVar9[1] + 3 & 0xfffffffffffffffc) + 4)) goto LAB_6;

+      uVar15 = (uint)puVar9[1] + 3 & 0xfffffffc;

+      *(uint *)(puVar9 + 1) = uVar15;

+      if ((short)puVar9[6] != 0) {

+        *(ushort *)((longlong)puVar9 + 0xc) = *(ushort *)((longlong)puVar9 + 0xc) | 1;

+      }

+      *(undefined4 *)(puVar9 + 6) = 0x4000a;

+      *(uint *)((longlong)puVar9 + 0x34) = uVar15;

+      *(undefined4 *)((ulonglong)uVar15 + (longlong)puVar9) = local_264;

+      *(int *)(puVar9 + 1) = (int)puVar9[1] + 4;

+LAB_7:

+      uVar15 = (ushort)local_258 + 2;

+      if (((0x10000 < uVar15) || (uVar14 < 0x40)) ||

+         ((*(ushort *)((longlong)puVar9 + 0xe) < 6 ||

+          (uVar7 < ((ulonglong)(uint)puVar9[1] + 3 & 0xfffffffffffffffc) + (ulonglong)uVar15))))

+      goto LAB_8;

+      uVar5 = (uint)puVar9[1] + 3 & 0xfffffffc;

+      *(short *)((longlong)puVar9 + 0x3a) = (short)uVar15;

+      *(uint *)((longlong)puVar9 + 0x3c) = uVar5;

+      *(undefined2 *)(puVar9 + 7) = 0x11;

+      pvVar13 = (void *)((ulonglong)uVar5 + (longlong)puVar9);

+      *(uint *)(puVar9 + 1) = (uVar15 & 0xffff) + uVar5;

+    }

+    uVar2 = local_258;

+    memmove(pvVar13,pwStack_250,local_258 & 0xffff);

+    *(undefined2 *)((longlong)pvVar13 + (uVar2 >> 1 & 0x7fff) * 2) = 0;

+    if (local_1f0 != (undefined8 *)0x0) {

+      uVar8 = *local_1f0;

+      uVar1 = local_1f0[1];

+      if (((0x17 < uVar14) && (6 < *(ushort *)((longlong)puVar9 + 0xe))) &&

+         ((0x47 < uVar14 && (((ulonglong)(uint)puVar9[1] + 3 & 0xfffffffffffffffc) + 0x10 <= uVar7))

+         )) {

+        uVar15 = (uint)puVar9[1] + 3 & 0xfffffffc;

+        *(uint *)(puVar9 + 1) = uVar15;

+        if ((short)puVar9[8] != 0) {

+          *(ushort *)((longlong)puVar9 + 0xc) = *(ushort *)((longlong)puVar9 + 0xc) | 1;

+        }

+        *(undefined4 *)(puVar9 + 8) = 0x100010;

+        *(uint *)((longlong)puVar9 + 0x44) = uVar15;

+        *(undefined8 *)((ulonglong)uVar15 + (longlong)puVar9) = uVar8;

+        ((undefined8 *)((ulonglong)uVar15 + (longlong)puVar9))[1] = uVar1;

+        *(int *)(puVar9 + 1) = (int)puVar9[1] + 0x10;

+      }

+    }

+  }

+  if (local_248[0] != (uint *)0x0) {

+    ExFreePoolWithTag(local_248[0],0);

+  }

+LAB_0:

+  puVar3 = local_220;

+  if (pwStack_210 != (wchar_t *)0x0) {

+    RtlFreeUnicodeString(&local_218);

+  }

+  if (puVar3 != (ulonglong *)0x0) {

+    ExFreePoolWithTag(puVar3,0x73557348);

+  }

+  return puVar9;

 }
```

## `HsmiDecompressBuffer`  (modified)

```diff
--- HsmiDecompressBuffer
+++ HsmpCldNotifyPostOperation
@@ -1,46 +1,21 @@
 

-/* WARNING: Type propagation algorithm not settling */

-

-int HsmiDecompressBuffer

-              (ushort param_1,byte param_2,undefined8 param_3,uint param_4,undefined8 param_5,

-              undefined4 param_6,undefined8 param_7)

+undefined4

+HsmpCldNotifyPostOperation

+          (int param_1,longlong param_2,undefined4 param_3,undefined8 param_4,undefined8 param_5)

 

 {

-  ushort uVar1;

-  int iVar2;

-  ushort *puVar3;

-  longlong lVar4;

-  int local_18 [4];

+  longlong unaff_RBP;

+  undefined4 unaff_EDI;

   

-  local_18[1] = 0;

-  local_18[0] = 0;

-  lVar4 = 0;

-  puVar3 = HsmiFindSupportedCompressionType(param_1,param_2,param_4);

-  if (puVar3 == (ushort *)0x0) {

-    iVar2 = -0x3ffffda1;

-LAB_0:

-    HsmDbgBreakOnStatus(iVar2);

+  if (*(longlong *)(unaff_RBP + -0x20) != 0) {

+    FltClose();

   }

-  else {

-    uVar1 = *puVar3;

-    if (*(char *)((longlong)puVar3 + 3) != '\0') {

-      iVar2 = RtlGetCompressionWorkSpaceSize(uVar1,local_18 + 1,local_18);

-      HsmDbgBreakOnStatus(iVar2);

-      if (iVar2 < 0) {

-        return iVar2;

-      }

-      if ((local_18[0] != 0) && (lVar4 = ExAllocatePool2(0x100,local_18[0],0x72507348), lVar4 == 0))

-      {

-        iVar2 = -0x3fffff66;

-        goto LAB_0;

-      }

-    }

-    iVar2 = RtlDecompressBufferEx(uVar1,param_3,param_4,param_5,param_6,param_7,lVar4);

-    HsmDbgBreakOnStatus(iVar2);

-    if (lVar4 != 0) {

-      ExFreePoolWithTag(lVar4,0x72507348);

-    }

+  if (*(longlong *)(unaff_RBP + -0x70) != 0) {

+    FltReleaseFileNameInformation();

   }

-  return iVar2;

+  if (*(longlong *)(unaff_RBP + -0x78) != 0) {

+    ExFreePoolWithTag(*(longlong *)(unaff_RBP + -0x78),0x73557348);

+  }

+  return unaff_EDI;

 }
```

## `CldStreamOpen`  (modified)

```diff
--- CldStreamOpen
+++ CldStreamOpen
@@ -1,39 +1,107 @@
 

 int CldStreamOpen(longlong *param_1)

 

 {

-  byte bVar1;

-  int *in_RAX;

-  longlong unaff_RSI;

-  char *unaff_RDI;

-  undefined8 in_R8;

-  undefined8 unaff_R13;

-  uint unaff_R14D;

-  uint in_stack_00000094;

-  void *in_stack_00000098;

-  uint *in_stack_000000c8;

-  void *in_stack_00000128;

-  char *pcVar2;

+  longlong lVar1;

+  int iVar2;

+  undefined8 *puVar3;

+  undefined8 *puVar4;

+  ulonglong uVar5;

+  longlong lVar6;

+  int iVar7;

+  undefined8 uVar8;

   

-  *in_RAX = *in_RAX + (int)in_RAX;

-  *unaff_RDI = *unaff_RDI + (char)param_1;

-  bVar1 = (char)in_RAX + (char)*in_RAX;

-  pcVar2 = (char *)CONCAT71((int7)((ulonglong)in_RAX >> 8),bVar1);

-  *pcVar2 = *pcVar2 + bVar1;

-  if (bVar1 <= *(byte *)((longlong)param_1 + 0x29)) {

-    WPP_SF_qqDqDd(param_1[3],0x92,in_R8,unaff_R13);

+  lVar1 = param_1[2];

+  iVar2 = 0;

+  FltAcquirePushLockExclusiveEx(param_1 + 3,0);

+  if (param_1[4] != 0) goto LAB_0;

+  if (*(longlong *)(lVar1 + 0x20) == 0) {

+    iVar2 = -0x3fff30ff;

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+      WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x22,

+                 &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_1);

+    }

+    goto LAB_0;

   }

-  if (in_stack_00000128 != (void *)0x0) {

-    memmove(in_stack_00000128,in_stack_00000098,(ulonglong)in_stack_00000094);

-    unaff_R14D = in_stack_00000094;

+  puVar3 = (undefined8 *)ExAllocatePool2(0x100,0x80,0x74736c43);

+  if (puVar3 == (undefined8 *)0x0) {

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    iVar2 = -0x3fffff66;

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+       (iVar2 = -0x3fffff66, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+      WPP_SF_qi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x23,

+                &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,param_1);

+    }

+    goto LAB_0;

   }

-  *in_stack_000000c8 = unaff_R14D;

-  if (in_stack_00000098 != (void *)0x0) {

-    ExFreePoolWithTag(in_stack_00000098,0x424f6c43);

+  puVar3[1] = 0;

+  *puVar3 = param_1;

+  puVar4 = puVar3 + 2;

+  puVar3[3] = puVar4;

+  *puVar4 = puVar4;

+  FltInitializePushLock(puVar3 + 4);

+  uVar5 = Feature_1683904827__private_IsEnabledDeviceUsageNoInline();

+  if ((int)uVar5 != 0) {

+    ExInitializeRundownProtection(puVar3 + 9);

   }

-  if (unaff_RSI != 0) {

-    ExFreePoolWithTag();

+  if ((*(uint *)(*(longlong *)*puVar3 + 0x1c) & 2) == 0) {

+    puVar4 = puVar3 + 10;

+    puVar3[0xb] = puVar4;

+    *puVar4 = puVar4;

+    FltInitializePushLock(puVar3 + 0xc);

+    puVar4 = puVar3 + 0xd;

+    puVar3[0xe] = puVar4;

+    *puVar4 = puVar4;

   }

-  return (int)unaff_RDI;

+  uVar5 = Feature_4003697978__private_IsEnabledDeviceUsageNoInline();

+  if ((int)uVar5 == 0) {

+    iVar2 = CldSyncRegisterStream

+                      (*(longlong *)(lVar1 + 0x20),*(undefined8 *)(*param_1 + 0x28),puVar3);

+    HsmDbgBreakOnStatus(iVar2);

+    if (-1 < iVar2) goto LAB_1;

+  }

+  else {

+LAB_1:

+    uVar8 = 0x68727343;

+    lVar6 = ExAllocatePool2(0x40);

+    puVar3[8] = lVar6;

+    if (lVar6 != 0) {

+      KeInitializeEvent(lVar6,0,1);

+      uVar5 = Feature_4003697978__private_IsEnabledDeviceUsageNoInline();

+      if ((int)uVar5 != 0) {

+        iVar2 = CldSyncRegisterStream

+                          (*(longlong *)(lVar1 + 0x20),*(undefined8 *)(*param_1 + 0x28),puVar3);

+        HsmDbgBreakOnStatus(iVar2);

+        if (iVar2 < 0) goto LAB_2;

+      }

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+         (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+        WPP_SF_qqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x25,

+                   &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,puVar3);

+      }

+      param_1[4] = (longlong)puVar3;

+      goto LAB_0;

+    }

+    iVar7 = -0x3fffff66;

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    iVar2 = -0x3fffff66;

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        (iVar2 = iVar7, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+      WPP_SF_iqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x24,uVar8,puVar3);

+    }

+  }

+LAB_2:

+  if (puVar3[8] != 0) {

+    ExFreePoolWithTag(puVar3[8],0x68727343);

+  }

+  ExFreePoolWithTag(puVar3,0x74736c43);

+LAB_0:

+  FltReleasePushLockEx(param_1 + 3,0);

+  return iVar2;

 }
```

## `HsmpRpValidateBuffer`  (modified)

```diff
--- HsmpRpValidateBuffer
+++ HsmpRpValidateBuffer
@@ -1,26 +1,341 @@
-

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 int * HsmpRpValidateBuffer(uint *param_1,uint param_2)

 

 {

-  longlong unaff_RBP;

-  byte unaff_SIL;

-  uint unaff_EDI;

-  undefined8 unaff_R12;

-  byte unaff_R14B;

-  undefined *unaff_R15;

-  undefined8 uStack0000000000000028;

-  undefined8 uStack0000000000000030;

+  uint *puVar1;

+  ushort uVar2;

+  ushort uVar3;

+  uint uVar4;

+  uint uVar5;

+  undefined2 uVar6;

+  uint uVar7;

+  int iVar8;

+  int *piVar9;

+  int *piVar10;

+  int *piVar11;

+  uint uVar12;

+  uint uVar13;

+  byte local_res10 [8];

   

-  if (((WPP_GLOBAL_Control != unaff_R15) &&

-      ((unaff_SIL & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-     (unaff_R14B <= (byte)WPP_GLOBAL_Control[0x29])) {

-    uStack0000000000000030 = *(undefined8 *)(unaff_RBP + 0x77);

-    uStack0000000000000028 = *(undefined8 *)(unaff_RBP + -0x69);

-    WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x95,

-                 &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,unaff_R12);

+  piVar9 = (int *)0x0;

+  uVar13 = 0;

+  uVar12 = 0;

+  puVar1 = param_1 + 1;

+  uVar5 = param_2 - 4;

+  if (param_2 < 5) {

+    uVar5 = 0;

   }

-  return (int *)(ulonglong)unaff_EDI;

+  if ((*param_1 & 0xf) == 0) {

+    HsmDbgBreakOnCorruption();

+    piVar9 = (int *)0xc0000058;

+    HsmDbgBreakOnStatus(-0x3fffffa8);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x15,

+                &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,*param_1 & 0xf);

+    }

+  }

+  else if ((*param_1 & 0xf) < 2) {

+    iVar8 = 0;

+    local_res10[0] = 0;

+    if ((0x17 < uVar5) && (iVar8 = 1, *puVar1 == 0x70526546)) {

+      iVar8 = 2;

+      if (((param_1[4] & 2) == 0) ||

+         (uVar4 = RtlComputeCrc32(0,param_1 + 3,uVar5 - 8), param_1[2] == uVar4)) {

+        uVar4 = param_1[3];

+        iVar8 = 3;

+        if (uVar4 <= uVar5) {

+          uVar2 = *(ushort *)((longlong)param_1 + 0x12);

+          iVar8 = 4;

+          if ((uVar2 != 0) && (iVar8 = 5, (uint)uVar2 * 8 + 0x10 < uVar4)) {

+            iVar8 = 0x10000;

+            piVar10 = piVar9;

+            while( true ) {

+              uVar5 = (uint)uVar2;

+              if (9 < uVar2) {

+                uVar5 = 10;

+              }

+              if (uVar5 <= (uint)piVar10) break;

+              if (0x11 < (ushort)param_1[(longlong)piVar10 * 2 + 5]) goto LAB_0;

+              uVar5 = param_1[(longlong)piVar10 * 2 + 6];

+              if (((((uVar5 != 0) && (uVar5 < (uint)uVar2 * 8 + 0x10)) || (uVar4 < uVar5)) ||

+                  ((uVar3 = *(ushort *)((longlong)puVar1 + (longlong)piVar10 * 8 + 0x12),

+                   uVar4 < uVar3 || (uVar7 = uVar3 + uVar5, uVar4 < uVar7)))) || (uVar7 < uVar5))

+              goto LAB_0;

+              iVar8 = iVar8 + 1;

+              piVar10 = (int *)(ulonglong)((uint)piVar10 + 1);

+            }

+            uVar5 = param_1[3];

+            iVar8 = 0x20000;

+            if ((((0x17 < uVar5) && (*(ushort *)((longlong)param_1 + 0x12) != 0)) &&

+                ((ushort)param_1[5] < 0x12)) &&

+               ((((uVar4 = param_1[6], uVar4 == 0 ||

+                  (((uint)*(ushort *)((longlong)param_1 + 0x12) * 8 + 0x10 <= uVar4 &&

+                   (uVar4 <= uVar5)))) && (*(ushort *)((longlong)param_1 + 0x16) <= uVar5)) &&

+                (((uVar7 = *(ushort *)((longlong)param_1 + 0x16) + uVar4, uVar7 <= uVar5 &&

+                  (uVar4 <= uVar7)) &&

+                 (((ushort)param_1[5] == 7 && (*(short *)((longlong)param_1 + 0x16) == 1)))))))) {

+              memmove(local_res10,(void *)((ulonglong)param_1[6] + (longlong)puVar1),1);

+              iVar8 = 0x20001;

+              if (local_res10[0] < 2) {

+                uVar5 = param_1[3];

+                if (uVar5 < 0x18) {

+                  HsmDbgBreakOnStatus(-0x3ffffddb);

+                  piVar10 = (int *)0xc0000225;

+                }

+                else {

+                  if ((((((*(ushort *)((longlong)param_1 + 0x12) < 2) || (uVar5 < 0x20)) ||

+                        (0x11 < (ushort)param_1[7])) ||

+                       ((uVar4 = param_1[8], uVar4 != 0 &&

+                        ((uVar4 < (uint)*(ushort *)((longlong)param_1 + 0x12) * 8 + 0x10 ||

+                         (uVar5 < uVar4)))))) || (uVar5 < *(ushort *)((longlong)param_1 + 0x1e))) ||

+                     (((uVar7 = *(ushort *)((longlong)param_1 + 0x1e) + uVar4, uVar5 < uVar7 ||

+                       (uVar7 < uVar4)) ||

+                      (((ushort)param_1[7] != 10 || (*(short *)((longlong)param_1 + 0x1e) != 4))))))

+                  {

+                    piVar10 = (int *)0xc0000225;

+                    piVar11 = piVar9;

+                  }

+                  else {

+                    piVar11 = (int *)(ulonglong)*(uint *)((ulonglong)param_1[8] + (longlong)puVar1);

+                    piVar10 = piVar9;

+                  }

+                  HsmDbgBreakOnStatus((int)piVar10);

+                  if (-1 < (int)piVar10) {

+                    if (((ulonglong)piVar11 & 0x10) != 0) {

+                      return piVar10;

+                    }

+                    uVar5 = param_1[3];

+                    if (uVar5 < 0x18) {

+                      HsmDbgBreakOnStatus(-0x3ffffddb);

+                      piVar10 = (int *)0xc0000225;

+                    }

+                    else {

+                      if ((((*(ushort *)((longlong)param_1 + 0x12) < 3) || (uVar5 < 0x28)) ||

+                          (0x11 < (ushort)param_1[9])) ||

+                         (((uVar4 = param_1[10], uVar4 != 0 &&

+                           ((uVar4 < (uint)*(ushort *)((longlong)param_1 + 0x12) * 8 + 0x10 ||

+                            (uVar5 < uVar4)))) ||

+                          ((uVar5 < *(ushort *)((longlong)param_1 + 0x26) ||

+                           (((uVar7 = *(ushort *)((longlong)param_1 + 0x26) + uVar4, uVar5 < uVar7

+                             || (uVar7 < uVar4)) ||

+                            (((ushort)param_1[9] != 6 ||

+                             (piVar10 = piVar9, *(short *)((longlong)param_1 + 0x26) != 8))))))))))

+                      {

+                        piVar10 = (int *)0xc0000225;

+                      }

+                      HsmDbgBreakOnStatus((int)piVar10);

+                      if (-1 < (int)piVar10) {

+                        uVar5 = param_1[3];

+                        piVar10 = piVar9;

+                        if (0x17 < uVar5) {

+                          if ((((((*(ushort *)((longlong)param_1 + 0x12) < 5) || (uVar5 < 0x38)) ||

+                                (0x11 < (ushort)param_1[0xd])) ||

+                               ((uVar12 = param_1[0xe], uVar12 != 0 &&

+                                ((uVar12 < (uint)*(ushort *)((longlong)param_1 + 0x12) * 8 + 0x10 ||

+                                 (uVar5 < uVar12)))))) ||

+                              ((uVar5 < *(ushort *)((longlong)param_1 + 0x36) ||

+                               ((uVar4 = *(ushort *)((longlong)param_1 + 0x36) + uVar12,

+                                uVar5 < uVar4 || ((ushort)param_1[0xd] != 0x11)))))) ||

+                             (uVar4 < uVar12)) {

+                            piVar11 = (int *)0xc0000225;

+                          }

+                          else {

+                            if ((param_1[0xe] != 0) &&

+                               (piVar10 = (int *)0x0, *(short *)((longlong)param_1 + 0x36) != 0)) {

+                              piVar10 = (int *)((longlong)puVar1 + (ulonglong)param_1[0xe]);

+                            }

+                            uVar13 = (uint)*(ushort *)((longlong)param_1 + 0x36);

+                            piVar11 = piVar9;

+                          }

+                          iVar8 = (int)piVar11;

+                          uVar12 = uVar13;

+                          if (iVar8 < 0) {

+                            uVar12 = 0;

+                          }

+                          HsmDbgBreakOnStatus(iVar8);

+                          if (iVar8 < 0) {

+                            if (iVar8 == -0x3ffffddb) goto LAB_1;

+                          }

+                          else {

+                            uVar5 = HsmpBitmapIsReparseBufferSupported(piVar10,uVar12);

+                            HsmDbgBreakOnStatus(uVar5);

+                            piVar11 = (int *)(ulonglong)uVar5;

+                            if (-1 < (int)uVar5) goto LAB_1;

+                          }

+                          piVar9 = piVar11;

+                          if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+                            return piVar9;

+                          }

+                          if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                            return piVar9;

+                          }

+                          if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+                            return piVar9;

+                          }

+                          uVar6 = 0x1a;

+                          goto LAB_2;

+                        }

+                        HsmDbgBreakOnStatus(-0x3ffffddb);

+LAB_1:

+                        uVar5 = param_1[3];

+                        if (uVar5 < 0x18) {

+                          HsmDbgBreakOnStatus(-0x3ffffddb);

+                        }

+                        else {

+                          if (((((*(ushort *)((longlong)param_1 + 0x12) < 6) || (uVar5 < 0x40)) ||

+                               (0x11 < (ushort)param_1[0xf])) ||

+                              (((uVar13 = param_1[0x10], uVar13 != 0 &&

+                                ((uVar13 < (uint)*(ushort *)((longlong)param_1 + 0x12) * 8 + 0x10 ||

+                                 (uVar5 < uVar13)))) ||

+                               (uVar5 < *(ushort *)((longlong)param_1 + 0x3e))))) ||

+                             (((uVar4 = *(ushort *)((longlong)param_1 + 0x3e) + uVar13,

+                               uVar5 < uVar4 || ((ushort)param_1[0xf] != 0x11)) || (uVar4 < uVar13))

+                             )) {

+                            piVar11 = (int *)0xc0000225;

+                          }

+                          else {

+                            piVar10 = piVar9;

+                            if ((param_1[0x10] != 0) && (*(short *)((longlong)param_1 + 0x3e) != 0))

+                            {

+                              piVar10 = (int *)((longlong)puVar1 + (ulonglong)param_1[0x10]);

+                            }

+                            uVar12 = (uint)*(ushort *)((longlong)param_1 + 0x3e);

+                            piVar11 = piVar9;

+                          }

+                          iVar8 = (int)piVar11;

+                          HsmDbgBreakOnStatus(iVar8);

+                          if (iVar8 < 0) {

+                            if (iVar8 != -0x3ffffddb) {

+LAB_3:

+                              piVar9 = piVar11;

+                              if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+                                return piVar9;

+                              }

+                              if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                                return piVar9;

+                              }

+                              if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+                                return piVar9;

+                              }

+                              uVar6 = 0x1b;

+                              goto LAB_2;

+                            }

+                          }

+                          else {

+                            uVar5 = HsmpBitmapIsReparseBufferSupported(piVar10,uVar12);

+                            HsmDbgBreakOnStatus(uVar5);

+                            piVar11 = (int *)(ulonglong)uVar5;

+                            if ((int)uVar5 < 0) goto LAB_3;

+                          }

+                        }

+                        uVar5 = param_1[3];

+                        if (uVar5 < 0x18) {

+                          HsmDbgBreakOnStatus(-0x3ffffddb);

+                          return (int *)0x0;

+                        }

+                        if ((((((*(ushort *)((longlong)param_1 + 0x12) < 7) || (uVar5 < 0x48)) ||

+                              (0x11 < (ushort)param_1[0x11])) ||

+                             ((uVar13 = param_1[0x12], uVar13 != 0 &&

+                              ((uVar13 < (uint)*(ushort *)((longlong)param_1 + 0x12) * 8 + 0x10 ||

+                               (uVar5 < uVar13)))))) ||

+                            ((uVar5 < *(ushort *)((longlong)param_1 + 0x46) ||

+                             ((uVar4 = *(ushort *)((longlong)param_1 + 0x46) + uVar13, uVar5 < uVar4

+                              || ((ushort)param_1[0x11] != 0x11)))))) || (uVar4 < uVar13)) {

+                          piVar9 = (int *)0xc0000225;

+                        }

+                        else {

+                          piVar10 = piVar9;

+                          if ((param_1[0x12] != 0) && (*(short *)((longlong)param_1 + 0x46) != 0)) {

+                            piVar10 = (int *)((longlong)puVar1 + (ulonglong)param_1[0x12]);

+                          }

+                          uVar12 = (uint)*(ushort *)((longlong)param_1 + 0x46);

+                        }

+                        iVar8 = (int)piVar9;

+                        HsmDbgBreakOnStatus(iVar8);

+                        if (iVar8 < 0) {

+                          if (iVar8 == -0x3ffffddb) {

+                            return (int *)0x0;

+                          }

+                        }

+                        else {

+                          uVar5 = HsmpBitmapIsReparseBufferSupported(piVar10,uVar12);

+                          piVar9 = (int *)(ulonglong)uVar5;

+                          HsmDbgBreakOnStatus(uVar5);

+                          if (-1 < (int)uVar5) {

+                            return piVar9;

+                          }

+                        }

+                        if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+                          return piVar9;

+                        }

+                        if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                          return piVar9;

+                        }

+                        if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+                          return piVar9;

+                        }

+                        uVar6 = 0x1c;

+                        goto LAB_2;

+                      }

+                    }

+                    piVar9 = piVar10;

+                    if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+                      return piVar9;

+                    }

+                    if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                      return piVar9;

+                    }

+                    if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+                      return piVar9;

+                    }

+                    uVar6 = 0x19;

+                    goto LAB_2;

+                  }

+                }

+                piVar9 = piVar10;

+                if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+                  return piVar9;

+                }

+                if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) {

+                  return piVar9;

+                }

+                if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+                  return piVar9;

+                }

+                uVar6 = 0x18;

+LAB_2:

+                WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar6,

+                         &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,(int)piVar9);

+                return piVar9;

+              }

+            }

+          }

+        }

+      }

+    }

+LAB_0:

+    HsmDbgBreakOnCorruption();

+    piVar9 = (int *)0xc000cf02;

+    HsmDbgBreakOnStatus(-0x3fff30fe);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x17,

+                &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,iVar8);

+    }

+  }

+  else {

+    piVar9 = (int *)0xc0000059;

+    HsmDbgBreakOnStatus(-0x3fffffa7);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x16,

+                &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,*param_1 & 0xf);

+    }

+  }

+  return piVar9;

 }
```

## `HsmiBitmapNORMALLookupMcbGroupMapping`  (modified)

```diff
--- HsmiBitmapNORMALLookupMcbGroupMapping
+++ HsmiBitmapNORMALLookupMcbGroupMapping
@@ -1,26 +1,100 @@
 

 undefined8

 HsmiBitmapNORMALLookupMcbGroupMapping

           (undefined8 *param_1,longlong param_2,longlong param_3,longlong *param_4,

           undefined1 *param_5)

 

 {

-  char cVar1;

-  ulonglong uVar2;

-  undefined8 uVar3;

-  longlong *unaff_RDI;

-  bool bVar4;

+  bool bVar1;

+  bool bVar2;

+  int iVar3;

+  char cVar4;

+  longlong lVar5;

+  longlong lVar6;

+  longlong lVar7;

+  int iVar8;

+  longlong *plVar9;

+  longlong local_res18;

+  longlong *local_res20;

+  longlong local_58 [3];

   

-  CldiStreamCdqACQUIRE((ulonglong)((int)param_1 + 0x90));

-  uVar2 = Feature_544180536__private_IsEnabledDeviceUsageNoInline();

-  if ((int)uVar2 == 0) {

-    bVar4 = (longlong *)unaff_RDI[2] != unaff_RDI + 2;

+  bVar1 = false;

+  iVar8 = 3;

+  lVar7 = *param_4;

+  *param_5 = 0;

+  lVar6 = param_3;

+  iVar3 = 3;

+  local_res20 = param_4;

+  if (param_3 < lVar7 + param_3) {

+    do {

+      iVar8 = iVar3;

+      param_4 = local_res20;

+      if (bVar1) break;

+      plVar9 = (longlong *)*param_1;

+      lVar7 = (lVar7 - lVar6) + param_3;

+      lVar5 = 0;

+      if (-1 < lVar7) {

+        lVar5 = lVar7;

+      }

+      for (; plVar9 != param_1; plVar9 = (longlong *)*plVar9) {

+        for (lVar7 = 0; lVar7 < 3; lVar7 = lVar7 + 1) {

+          local_58[0] = -1;

+          local_res18 = 0x7fffffffffffffff;

+          if (param_2 != 0) {

+            FltAcquirePushLockExclusiveEx(param_2,0);

+          }

+          if (((plVar9[lVar7 + 2] == 0) ||

+              (cVar4 = FsRtlLookupBaseMcbEntry(plVar9[lVar7 + 2],lVar6,local_58,&local_res18,0,0,0),

+              cVar4 == '\0')) || (local_58[0] == -1)) {

+            bVar2 = false;

+          }

+          else {

+            bVar2 = true;

+          }

+          if (param_2 != 0) {

+            FltReleasePushLockEx(param_2,0);

+          }

+          if (bVar2) {

+            if (iVar8 == 3) {

+              if (lVar7 != 2) {

+                iVar8 = 1;

+                goto LAB_0;

+              }

+              iVar8 = 0;

+            }

+            else {

+LAB_0:

+              if ((lVar7 != 2) != (iVar8 == 1)) goto LAB_1;

+            }

+            lVar6 = lVar6 + local_res18;

+          }

+          else {

+            if (local_res18 <= lVar5) {

+              lVar5 = local_res18;

+            }

+            if ((lVar7 == 2) && ((undefined8 *)*plVar9 == param_1)) {

+              if (iVar8 == 3) {

+                lVar6 = lVar6 + lVar5;

+              }

+LAB_1:

+              bVar1 = true;

+              goto LAB_2;

+            }

+          }

+        }

+      }

+LAB_2:

+      lVar7 = *local_res20;

+      param_4 = local_res20;

+      iVar3 = iVar8;

+    } while (lVar6 < lVar7 + param_3);

   }

-  else {

-    cVar1 = CldiIsStreamListEmpty((longlong)unaff_RDI);

-    bVar4 = cVar1 == '\0';

+  *param_5 = iVar8 == 1;

+  lVar5 = lVar7 + param_3;

+  if (lVar6 < lVar7 + param_3) {

+    lVar5 = lVar6;

   }

-  uVar3 = CldiStreamCdqRELEASE(*(longlong *)(*unaff_RDI + 8) + 0x90);

-  return CONCAT71((int7)((ulonglong)uVar3 >> 8),bVar4);

+  *param_4 = lVar5 - param_3;

+  return CONCAT71((int7)((ulonglong)(lVar5 - param_3) >> 8),iVar8 != 3);

 }
```

## `CldiStreamStartCountdownTimer`  (modified)

```diff
--- CldiStreamStartCountdownTimer
+++ CldiStreamStartCountdownTimer
@@ -1,176 +1,138 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* WARNING: Type propagation algorithm not settling */

+/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

 

-int CldiStreamStartCountdownTimer(char param_1,ulonglong param_2,undefined *param_3)

+void CldiStreamStartCountdownTimer(char param_1,longlong param_2,undefined *param_3)

 

 {

-  int iVar1;

-  longlong *plVar2;

+  longlong *plVar1;

+  undefined8 *puVar2;

   longlong lVar3;

-  undefined7 in_register_00000009;

-  undefined8 uVar4;

-  undefined2 uVar5;

-  uint uVar6;

-  undefined1 auStack_80 [32];

-  ulonglong uStack_60;

-  longlong *plStack_58;

-  undefined4 uStack_50;

-  undefined8 uStack_48;

-  longlong lStack_40;

-  longlong local_38 [5];

+  char cVar4;

+  bool bVar5;

+  ulonglong uVar6;

+  undefined8 uVar7;

+  longlong lVar8;

+  uint *puVar9;

+  longlong lVar10;

   

-  uVar4 = CONCAT71(in_register_00000009,param_1);

-  local_38[4] = __security_cookie ^ (ulonglong)auStack_80;

-  *(undefined8 *)param_3 = 0xffffffffffffffff;

-  uVar6 = 0;

-  local_38[0] = 0;

-  lStack_40 = 0;

-  local_38[1] = 0;

-  iVar1 = 0;

-  plVar2 = (longlong *)ExAllocatePool2(0x100,0x10040,0x72557348);

-  if (plVar2 != (longlong *)0x0) goto LAB_0;

-  iVar1 = -0x3fffff66;

-  HsmDbgBreakOnStatus(-0x3fffff66);

-LAB_1:

-  if (((iVar1 != -0x3ffffd49) && (iVar1 != -0x3ffffd48)) || (2 < uVar6)) goto LAB_2;

-  uVar6 = uVar6 + 1;

-LAB_0:

-  if (iVar1 == -0x3ffffd49) {

-    local_38[2] = 0;

-    local_38[3] = 2;

-    if (lStack_40 != 0) {

-LAB_3:

-      uStack_48 = 0;

-      uStack_50 = 0;

-      plStack_58 = (longlong *)0x0;

-      uStack_60 = CONCAT44(uStack_60._4_4_,0x10);

-      iVar1 = FltFsControlFile(uVar4,lStack_40,0x900f8,local_38 + 2);

-      HsmDbgBreakOnStatus(iVar1);

-      if (-1 < iVar1) goto LAB_4;

-      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        uVar5 = 0x23;

-        goto LAB_5;

+  cVar4 = ExAcquireRundownProtection(&DAT_0);

+  lVar3 = _DAT_1;

+  if (cVar4 == '\0') {

+    return;

+  }

+  uVar6 = Feature_3750208824__private_IsEnabledDeviceUsageNoInline();

+  if ((int)uVar6 == 0) {

+    do {

+      while( true ) {

+        puVar9 = (uint *)0x0;

+        KeEnterCriticalRegion();

+        ExAcquireResourceExclusiveLite(&DAT_2,1);

+        puVar2 = DAT_3;

+        if ((undefined8 **)DAT_3 != &DAT_3) break;

+LAB_4:

+        ExReleaseResourceLite(&DAT_2);

+        KeLeaveCriticalRegion();

+        if (puVar9 == (uint *)0x0) goto LAB_5;

+        HsmDbgBreakOnTimeOut();

+        TlmWriteFltTimeout((longlong)(int)*puVar9,*(undefined1 *)((longlong)puVar9 + 0x69),param_3);

+        puVar9[0x24] = 0;

+        puVar9[0x25] = 0;

+        if (*(undefined8 **)(puVar9 + 0x18) == (undefined8 *)0x0) {

+          CldiStreamCancelSynchronousRequest(puVar9);

+        }

+        else {

+          FltCancelIo(**(undefined8 **)(puVar9 + 0x18));

+        }

       }

-      goto LAB_1;

-    }

-    iVar1 = FltOpenVolume(uVar4,local_38,&lStack_40);

-    HsmDbgBreakOnStatus(iVar1);

-    if (-1 < iVar1) goto LAB_3;

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

-    goto LAB_1;

-    uVar5 = 0x22;

+      puVar9 = (uint *)(DAT_3 + -5);

+      if ((param_1 == '\0') && (lVar10 = DAT_3[0xd], lVar3 < lVar10)) goto LAB_1400671f6;

+      CldiStreamRemoveFromGlobalRequestListNoLock(puVar9);

+      if ((param_1 != '\0') || (bVar5 = CldiStreamIsRequestExpired((longlong)puVar9,lVar3), bVar5))

+      {

+        *(undefined1 *)(puVar2 + 8) = 1;

+        goto LAB_4;

+      }

+      CldiStreamInsertIntoGlobalRequestListNoLock(puVar9);

+      ExReleaseResourceLite(&DAT_2);

+      KeLeaveCriticalRegion();

+    } while (puVar9 != (uint *)0x0);

   }

   else {

-    if (iVar1 == -0x3ffffd48) {

-LAB_4:

-      local_38[2] = 0;

-      local_38[3] = 0;

-      if (lStack_40 == 0) {

-        iVar1 = FltOpenVolume(uVar4,local_38,&lStack_40);

-        HsmDbgBreakOnStatus(iVar1);

-        if (iVar1 < 0) {

+    while( true ) {

+      KeEnterCriticalRegion();

+      ExAcquireResourceExclusiveLite(&DAT_2,1);

+      puVar2 = DAT_3;

+      if ((undefined8 **)DAT_3 == &DAT_3) break;

+      puVar9 = (uint *)(DAT_3 + -5);

+      plVar1 = DAT_3 + 0xd;

+      if (param_1 == '\0') {

+        lVar10 = *plVar1;

+        if (lVar3 < lVar10) goto LAB_6;

+        bVar5 = CldiStreamIsRequestExpired((longlong)puVar9,lVar3);

+        if (bVar5) goto LAB_7;

+LAB_8:

+        CldiStreamRemoveFromGlobalRequestListNoLock(puVar9);

+        CldiStreamInsertIntoGlobalRequestListNoLock(puVar9);

+        ExReleaseResourceLite(&DAT_2);

+        KeLeaveCriticalRegion();

+      }

+      else {

+LAB_7:

+        lVar10 = *(longlong *)(*(longlong *)puVar2[10] + 8) + 0x90;

+        bVar5 = CldiStreamCdqTRYACQUIRE(lVar10);

+        if (!bVar5) goto LAB_8;

+        CldiStreamRemoveFromGlobalRequestListNoLock(puVar9);

+        *(undefined1 *)(puVar2 + 8) = 1;

+        ExReleaseResourceLite(&DAT_2);

+        KeLeaveCriticalRegion();

+        *plVar1 = 0;

+        HsmDbgBreakOnTimeOut();

+        TlmWriteFltTimeout((longlong)(int)*puVar9,*(undefined1 *)((longlong)puVar2 + 0x41),param_3);

+        lVar8 = 0;

+        if ((longlong *)puVar2[7] != (longlong *)0x0) {

+          lVar8 = *(longlong *)puVar2[7];

+        }

+        cVar4 = CldiStreamPrepareRequestForNonCdqCompletion(puVar9);

+        if ((cVar4 == '\0') ||

+           (uVar7 = CldiCanDoNonCdqCompletion((longlong)puVar9), (char)uVar7 == '\0')) {

+          CldiStreamCdqRELEASE(lVar10);

+        }

+        else {

+          CldiStreamCdqRELEASE(lVar10);

+          if (lVar8 != 0) {

+            FltCancelIo(lVar8);

+          }

           if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            uVar5 = 0x24;

-            goto LAB_5;

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+             (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+            param_3 = &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids;

+            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x12,

+                       &WPP_9165f93611ec341ade6e5a50db07a61b_Traceguids,puVar9);

           }

-          goto LAB_1;

+          CldiStreamCompleteCanceledRequest(puVar9,0xc0000120);

         }

       }

-      uStack_48 = 0;

-      uStack_50 = 0;

-      plStack_58 = (longlong *)0x0;

-      uStack_60 = CONCAT44(uStack_60._4_4_,0x10);

-      iVar1 = FltFsControlFile(uVar4,lStack_40,0x900e7,local_38 + 2);

-      HsmDbgBreakOnStatus(iVar1);

-      if (iVar1 < 0) {

-        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-          uVar5 = 0x25;

-          goto LAB_5;

-        }

-        goto LAB_1;

-      }

     }

-    uStack_48 = 0;

-    uStack_50 = 0x10040;

-    uStack_60 = uStack_60 & 0xffffffff00000000;

-    plStack_58 = plVar2;

-    iVar1 = FltFsControlFile(uVar4,param_2,0x900eb,0);

-    HsmDbgBreakOnStatus(iVar1);

-    if (iVar1 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        uVar5 = 0x26;

-        goto LAB_5;

-      }

-      goto LAB_1;

+    ExReleaseResourceLite(&DAT_2);

+    KeLeaveCriticalRegion();

+  }

+LAB_5:

+  ExReleaseRundownProtection(&DAT_0);

+  return;

+LAB_6:

+  ExReleaseResourceLite(&DAT_2);

+  KeLeaveCriticalRegion();

+  if (lVar3 - lVar10 != 0) {

+    LOCK();

+    bVar5 = DAT_9 == 0;

+    if (bVar5) {

+      DAT_9 = 1;

     }

-    uStack_48 = 0;

-    plStack_58 = local_38 + 1;

-    lVar3 = plVar2[3];

-    uStack_50 = 8;

-    uStack_60 = uStack_60 & 0xffffffff00000000;

-    iVar1 = FltFsControlFile(uVar4,param_2,0x900ef);

-    HsmDbgBreakOnStatus(iVar1);

-    if (iVar1 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_1;

-      uVar5 = 0x27;

-    }

-    else {

-      uStack_48 = 0;

-      uStack_50 = 0x10040;

-      uStack_60 = uStack_60 & 0xffffffff00000000;

-      plStack_58 = plVar2;

-      iVar1 = FltFsControlFile(uVar4,param_2,0x900eb);

-      HsmDbgBreakOnStatus(iVar1);

-      if (-1 < iVar1) {

-        if ((int)plVar2[5] == -0x80000000) {

-          *(longlong *)param_3 = lVar3;

-        }

-        else {

-          lVar3 = -1;

-          if (plVar2[3] != 0) {

-            lVar3 = plVar2[3];

-          }

-          *(longlong *)param_3 = lVar3;

-        }

-LAB_2:

-        if (local_38[0] != 0) {

-          FltClose();

-        }

-        if (lStack_40 != 0) {

-          ObfDereferenceObject();

-        }

-        if (plVar2 != (longlong *)0x0) {

-          ExFreePoolWithTag(plVar2,0x72557348);

-        }

-        if (iVar1 + 0x3ffffd49U < 2) {

-          *(undefined8 *)param_3 = 0xffffffffffffffff;

-          iVar1 = 0;

-        }

-        return iVar1;

-      }

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_1;

-      uVar5 = 0x28;

+    UNLOCK();

+    if ((bVar5) && (cVar4 = ExAcquireRundownProtection(&DAT_0), cVar4 != '\0')) {

+      KeSetTimer(&DAT_10,lVar3 - lVar10,&DAT_14002a830);

     }

   }

-LAB_5:

-  plStack_58 = (longlong *)CONCAT44(plStack_58._4_4_,iVar1);

-  uStack_60 = param_2;

-  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar5,

-             &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,uVar4);

-  goto LAB_1;

+  goto LAB_5;

 }
```

## `HsmiOsIsSyncProviderProcess`  (modified)

```diff
--- HsmiOsIsSyncProviderProcess
+++ HsmiOsGetProcessFlags
@@ -1,19 +1,292 @@
 

-char HsmiOsIsSyncProviderProcess(longlong param_1)

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+

+uint * HsmiOsGetProcessFlags(longlong param_1)

 

 {

-  char *pcVar1;

-  char in_AL;

-  undefined7 in_register_00000001;

-  int *unaff_RDI;

+  char cVar1;

+  int iVar2;

+  longlong lVar3;

+  longlong lVar4;

+  longlong lVar5;

+  uint *puVar6;

+  ulonglong uVar7;

+  byte *pbVar8;

+  undefined8 uVar9;

+  ulonglong in_RAX;

+  uint uVar10;

+  byte bVar11;

+  byte unaff_BL;

+  uint *puVar12;

+  char unaff_DIL;

+  uint *unaff_R15;

+  byte bStackX_21;

+  char cStackX_22;

+  char cStackX_23;

+  undefined4 uVar13;

+  int iStack0000000000000030;

+  wchar_t *pwStack0000000000000040;

   

-  pcVar1 = (char *)(CONCAT71(in_register_00000001,in_AL) + -0x7b);

-  *pcVar1 = *pcVar1 + (char)param_1;

-  *unaff_RDI = *unaff_RDI + -1;

-  *(char *)CONCAT71(in_register_00000001,in_AL) =

-       *(char *)CONCAT71(in_register_00000001,in_AL) + in_AL;

-  pcVar1 = (char *)(CONCAT71(in_register_00000001,in_AL) + -0x75);

-  *pcVar1 = *pcVar1 + (char)param_1;

-  return in_AL;

+  pbVar8 = (byte *)(in_RAX & 0xffffffffffffff38);

+  *pbVar8 = *pbVar8 ^ (byte)pbVar8;

+  pwStack0000000000000040 = L"AlwaysExposePlaceholders";

+  bStackX_21 = unaff_BL;

+  iStack0000000000000030 = (int)unaff_R15;

+  iVar2 = HsmOsGetPolicyDWord(&stack0x00000038,&bStackX_21,&stack0x00000030);

+  if (iVar2 < 0) {

+    if (DAT_1 == unaff_BL) goto LAB_14000752f;

+  }

+  else {

+    DAT_2 = 1;

+    DAT_1 = unaff_BL;

+    if ((bStackX_21 == unaff_BL) || (iStack0000000000000030 == (int)unaff_R15)) {

+LAB_0:

+      if (unaff_DIL != '\0') {

+        lVar3 = PsGetThreadProcess();

+        lVar5 = lVar3;

+        if (lVar3 == 0) {

+          lVar5 = PsGetCurrentProcess();

+        }

+        lVar4 = PsGetCurrentProcess();

+        cStackX_23 = lVar5 != lVar4;

+        if ((bool)cStackX_23) {

+          KeStackAttachProcess(lVar5,&stack0x00000060);

+        }

+        cVar1 = func_0x000140007c60(lVar3);

+        if (cVar1 == '\0') {

+          lVar5 = PsGetThreadTeb();

+          if (lVar5 != 0) {

+            cVar1 = HsmpIs32bitProcess();

+            if (cVar1 == '\0') {

+              unaff_BL = *(byte *)(lVar5 + 0x280);

+            }

+            else {

+              unaff_BL = *(byte *)(lVar5 + 0x2174);

+            }

+          }

+          bVar11 = unaff_BL;

+          if (unaff_BL == 0) {

+            puVar12 = unaff_R15;

+            if (lVar3 == 0) {

+              uVar9 = PsGetCurrentProcess();

+              lVar5 = PsGetProcessWow64Process(uVar9);

+              if (lVar5 != 0) {

+                lVar5 = PsGetCurrentProcess();

+                goto LAB_3;

+              }

+              uVar9 = PsGetCurrentProcess();

+              lVar5 = PsGetProcessPeb(uVar9);

+              if (lVar5 != 0) {

+                lVar5 = PsGetCurrentProcess();

+                goto LAB_4;

+              }

+            }

+            else {

+              lVar4 = PsGetProcessWow64Process(lVar3);

+              lVar5 = lVar3;

+              if (lVar4 == 0) {

+                lVar4 = PsGetProcessPeb();

+                if (lVar4 != 0) {

+LAB_4:

+                  lVar5 = PsGetProcessPeb(lVar5);

+                  puVar12 = (uint *)(lVar5 + 0x2c8);

+                }

+              }

+              else {

+LAB_3:

+                lVar5 = PsGetProcessWow64Process(lVar5);

+                puVar12 = (uint *)(lVar5 + 0x1d8);

+              }

+            }

+            puVar6 = unaff_R15;

+            if (lVar3 == 0) {

+              uVar9 = PsGetCurrentProcess();

+              lVar5 = PsGetProcessWow64Process(uVar9);

+              if (lVar5 != 0) {

+                lVar5 = PsGetCurrentProcess();

+                goto LAB_5;

+              }

+              uVar9 = PsGetCurrentProcess();

+              lVar5 = PsGetProcessPeb(uVar9);

+              if (lVar5 != 0) {

+                lVar5 = PsGetCurrentProcess();

+                goto LAB_6;

+              }

+            }

+            else {

+              lVar4 = PsGetProcessWow64Process(lVar3);

+              lVar5 = lVar3;

+              if (lVar4 == 0) {

+                lVar4 = PsGetProcessPeb();

+                if (lVar4 != 0) {

+LAB_6:

+                  lVar5 = PsGetProcessPeb(lVar5);

+                  puVar6 = (uint *)(lVar5 + 0x7b0);

+                }

+              }

+              else {

+LAB_5:

+                lVar5 = PsGetProcessWow64Process(lVar5);

+                puVar6 = (uint *)(lVar5 + 0x468);

+              }

+            }

+            bVar11 = (byte)*puVar6;

+            if (bVar11 == 0) {

+              if ((puVar12 == (uint *)0x0) || ((*puVar12 & 0x20000000) == 0)) {

+                puVar6 = unaff_R15;

+                if (lVar3 == 0) {

+                  uVar9 = PsGetCurrentProcess();

+                  lVar5 = PsGetProcessWow64Process(uVar9);

+                  if (lVar5 != 0) {

+                    lVar5 = PsGetCurrentProcess();

+                    goto LAB_7;

+                  }

+                  uVar9 = PsGetCurrentProcess();

+                  lVar5 = PsGetProcessPeb(uVar9);

+                  if (lVar5 != 0) {

+                    lVar5 = PsGetCurrentProcess();

+                    goto LAB_8;

+                  }

+                }

+                else {

+                  lVar4 = PsGetProcessWow64Process(lVar3);

+                  lVar5 = lVar3;

+                  if (lVar4 == 0) {

+                    lVar4 = PsGetProcessPeb();

+                    if (lVar4 != 0) {

+LAB_8:

+                      lVar5 = PsGetProcessPeb(lVar5);

+                      puVar6 = (uint *)(lVar5 + 0x7a8);

+                    }

+                  }

+                  else {

+LAB_7:

+                    lVar5 = PsGetProcessWow64Process(lVar5);

+                    puVar6 = (uint *)(lVar5 + 0x460);

+                  }

+                }

+                HsmiOsIsForegroundHydrator(lVar3,puVar12,puVar6,&cStackX_22);

+                bVar11 = unaff_BL;

+              }

+              else {

+                bVar11 = 1;

+              }

+            }

+          }

+          if (bVar11 != 0) goto LAB_9;

+          uVar13 = (undefined4)((ulonglong)unaff_R15 >> 0x20);

+          if ((Feature_CloudFileDisguisePlaceholders__private_featureState & 0x10) == 0) {

+            uVar10 = Feature_CloudFileDisguisePlaceholders__private_featureState | 1;

+            wil_details_FeatureReporting_ReportUsageToService

+                      (0x140028f70,

+                       CONCAT44(uVar13,Feature_CloudFileDisguisePlaceholders__private_featureState)

+                       | 1,3);

+            wil_details_FeatureStateCache_TryEnableDeviceUsageFastPath

+                      (uVar10,3,&Feature_CloudFileDisguisePlaceholders__private_descriptor);

+          }

+          uVar7 = func_0x000140007e40(&stack0x00000048);

+          if ((uVar7 & 1) == 0) {

+            if (((cStackX_22 != '\0') && ((uVar7 & 2) != 0)) &&

+               ((Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState & 0x10) == 0)

+               ) {

+              uVar10 = Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState | 1;

+              wil_details_FeatureReporting_ReportUsageToService

+                        (0x140029018,

+                         CONCAT44(uVar13,

+                                  Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState

+                                 ) | 1,3);

+              wil_details_FeatureStateCache_TryEnableDeviceUsageFastPath

+                        (uVar10,3,&

+                                  Feature_CloudFileDisguisePlaceholdersForGUIApps__private_descriptor

+                        );

+            }

+            bVar11 = 1;

+          }

+          else {

+            bVar11 = 2;

+          }

+          if (lVar3 == 0) {

+            uVar9 = PsGetCurrentProcess();

+            lVar5 = PsGetProcessWow64Process(uVar9);

+            if (lVar5 != 0) {

+              lVar5 = PsGetCurrentProcess();

+              goto LAB_10;

+            }

+            uVar9 = PsGetCurrentProcess();

+            lVar5 = PsGetProcessPeb(uVar9);

+            if (lVar5 != 0) {

+              lVar5 = PsGetCurrentProcess();

+              goto LAB_11;

+            }

+          }

+          else {

+            lVar4 = PsGetProcessWow64Process(lVar3);

+            lVar5 = lVar3;

+            if (lVar4 == 0) {

+              lVar4 = PsGetProcessPeb();

+              if (lVar4 != 0) {

+LAB_11:

+                lVar5 = PsGetProcessPeb(lVar5);

+                unaff_R15 = (uint *)(lVar5 + 0x7a8);

+              }

+            }

+            else {

+LAB_10:

+              lVar5 = PsGetProcessWow64Process(lVar5);

+              unaff_R15 = (uint *)(lVar5 + 0x460);

+            }

+          }

+          if (lVar3 == 0) {

+            uVar9 = PsGetCurrentProcess();

+            lVar5 = PsGetProcessWow64Process(uVar9);

+            if (lVar5 != 0) {

+              lVar3 = PsGetCurrentProcess();

+              goto LAB_12;

+            }

+            uVar9 = PsGetCurrentProcess();

+            lVar5 = PsGetProcessPeb(uVar9);

+            if (lVar5 != 0) {

+              lVar3 = PsGetCurrentProcess();

+              goto LAB_13;

+            }

+          }

+          else {

+            lVar5 = PsGetProcessWow64Process(lVar3);

+            if (lVar5 == 0) {

+              lVar5 = PsGetProcessPeb();

+              if (lVar5 == 0) goto LAB_14;

+LAB_13:

+              lVar5 = PsGetProcessPeb(lVar3);

+              pbVar8 = (byte *)(lVar5 + 0x7b0);

+            }

+            else {

+LAB_12:

+              lVar5 = PsGetProcessWow64Process(lVar3);

+              pbVar8 = (byte *)(lVar5 + 0x468);

+            }

+            if (pbVar8 != (byte *)0x0) {

+              *pbVar8 = bVar11;

+            }

+          }

+LAB_14:

+          if (unaff_R15 != (uint *)0x0) {

+            LOCK();

+            *unaff_R15 = *unaff_R15 | 0x20;

+            UNLOCK();

+          }

+          goto LAB_9;

+        }

+      }

+    }

+    else {

+      DAT_1 = 1;

+    }

+  }

+  bVar11 = 2;

+LAB_9:

+  if (cStackX_23 != '\0') {

+    KeUnstackDetachProcess(&stack0x00000060);

+  }

+  return (uint *)(ulonglong)bVar11;

 }
```

## `HsmpToggleFileAttributesNoNotify`  (modified)

```diff
--- HsmpToggleFileAttributesNoNotify
+++ HsmpToggleFileAttributesNoNotify
@@ -1,57 +1,86 @@
-

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 int HsmpToggleFileAttributesNoNotify

               (longlong param_1,undefined8 param_2,undefined8 param_3,uint param_4)

 

 {

   longlong lVar1;

-  char in_AL;

-  longlong unaff_RBP;

-  undefined4 unaff_EDI;

-  longlong unaff_R15;

+  int iVar2;

+  undefined2 uVar3;

+  undefined8 local_res8 [2];

+  uint local_res18 [2];

+  uint local_res20 [2];

+  uint *puVar4;

+  undefined8 uVar5;

+  longlong local_38;

+  longlong local_30;

+  undefined4 uVar6;

   

-  if (((byte)((byte)((ulonglong)param_2 >> 8) & in_AL - 0x40U) != 0) &&

-     (1 < *(byte *)(param_1 + 0x29))) {

-    WPP_SF_qqqiqd(*(undefined8 *)(param_1 + 0x18),0x2e,

-                  &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,unaff_R15);

+  local_30 = 0;

+  local_38 = 0;

+  local_res18[0] = 0;

+  local_res8[0] = 0;

+  puVar4 = local_res18;

+  local_res20[0] = param_4 & 0xffffff00;

+  iVar2 = HsmiIsFileAttributeChangeRequired

+                    (*(undefined8 *)(param_1 + 0x20),param_2,0,0x100000,puVar4,

+                     (undefined1 *)local_res20);

+  uVar6 = (undefined4)((ulonglong)puVar4 >> 0x20);

+  HsmDbgBreakOnStatus(iVar2);

+  if (iVar2 < 0) {

+    return iVar2;

   }

-  lVar1 = *(longlong *)(unaff_RBP + -0x50);

-  *(undefined4 *)(unaff_R15 + 0x18) = unaff_EDI;

-  *(undefined8 *)(unaff_R15 + 0x20) = 0;

-  if (*(longlong *)(unaff_RBP + 0xa8) != 0) {

-    ExFreePoolWithTag(*(longlong *)(unaff_RBP + 0xa8),0x73557348);

+  if ((char)local_res20[0] == '\0') {

+    return iVar2;

   }

-  if (*(longlong *)(unaff_RBP + -0x10) != 0) {

-    FltReleaseFileNameInformation();

+  uVar5 = CONCAT44(uVar6,6);

+  iVar2 = FltQueryInformationFile(*(undefined8 *)(param_1 + 0x20),param_2,local_res8,8,uVar5,0);

+  HsmDbgBreakOnStatus(iVar2);

+  if (iVar2 < 0) {

+    if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+      return iVar2;

+    }

+    if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0) {

+      return iVar2;

+    }

+    if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+      return iVar2;

+    }

+    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2f,

+               &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,param_1);

+    return iVar2;

   }

-  if (*(longlong *)(unaff_RBP + -8) != 0) {

+  iVar2 = HsmpOpenFileByIdEx(param_1,*(undefined8 *)(param_1 + 0x20),local_res8[0],0x100180,uVar5,

+                             0x200028,'\x01',&local_30,&local_38);

+  HsmDbgBreakOnStatus(iVar2);

+  lVar1 = local_38;

+  if (iVar2 < 0) {

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_0;

+    uVar3 = 0x30;

+  }

+  else {

+    iVar2 = HsmpPrepareForMgmtOperation(param_1,local_38,0,'\0');

+    HsmDbgBreakOnStatus(iVar2);

+    if (-1 < iVar2) {

+      iVar2 = HsmiUpdateFileAttributes(*(undefined8 *)(param_1 + 0x20),lVar1,local_res18[0]);

+      HsmDbgBreakOnStatus(iVar2);

+      goto LAB_0;

+    }

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_0;

+    uVar3 = 0x31;

+  }

+  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar3,

+             &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,param_1);

+LAB_0:

+  if (lVar1 != 0) {

+    ObfDereferenceObject(lVar1);

+  }

+  if (local_30 != 0) {

     FltClose();

   }

-  if (*(longlong *)(unaff_RBP + -0x40) != 0) {

-    ObfDereferenceObject();

-  }

-  if (*(longlong *)(unaff_RBP + -0x68) != 0) {

-    ExFreePoolWithTag(*(longlong *)(unaff_RBP + -0x68),0x62547348);

-  }

-  if (lVar1 != 0) {

-    ExFreePoolWithTag(lVar1,0x634e7348);

-  }

-  if (*(char *)(unaff_RBP + -0x7f) != '\0') {

-    FltReleaseContext();

-  }

-  if (*(longlong *)(unaff_RBP + 0x60) != 0) {

-    FltReleaseContext();

-  }

-  if (*(longlong *)(unaff_RBP + 0x68) != 0) {

-    FltReleaseContext();

-  }

-  if (*(int **)(unaff_RBP + 0x70) != (int *)0x0) {

-    HsmpReleaseFileNameLock(*(int **)(unaff_RBP + 0x70));

-  }

-  if (*(int **)(unaff_RBP + 0x28) != (int *)0x0) {

-    HsmpReleaseFileNameLock(*(int **)(unaff_RBP + 0x28));

-  }

-  return 4;

+  return iVar2;

 }
```

## `HsmiRecallFreeHydrationContext`  (modified)

```diff
--- HsmiRecallFreeHydrationContext
+++ HsmiRecallFreeHydrationContext
@@ -1,76 +1,53 @@
 

-int HsmiRecallFreeHydrationContext(longlong param_1)

+void HsmiRecallFreeHydrationContext(longlong param_1)

 

 {

-  uint uVar1;

-  undefined8 uVar2;

-  longlong *plVar3;

-  longlong lVar4;

-  int in_EAX;

-  int iVar5;

-  longlong lVar6;

-  ulonglong uVar7;

-  undefined8 in_R8;

-  undefined8 uVar8;

-  longlong lVar9;

-  undefined8 in_R9;

-  undefined8 uVar10;

-  undefined8 in_stack_ffffffffffffff00;

-  undefined8 in_stack_ffffffffffffff08;

-  undefined4 uVar12;

-  undefined8 uVar11;

-  longlong alStack_b0 [22];

+  longlong *plVar1;

+  longlong lVar2;

+  code *pcVar3;

   

-  uVar12 = (undefined4)((ulonglong)in_stack_ffffffffffffff08 >> 0x20);

-  uVar7 = (ulonglong)(in_EAX - 0x48);

-  lVar9 = *(longlong *)(param_1 + 0x10);

-  *(undefined8 *)(uVar7 + 0x50) = 0;

-  alStack_b0[0] = 0;

-  lVar6 = *(longlong *)(lVar9 + 0x10);

-  uVar2 = *(undefined8 *)(lVar9 + 0x20);

-  memset((void *)(uVar7 - 0x80),0,0x98);

-  uVar10 = 0x100080;

-  uVar11 = CONCAT44(uVar12,0x200000);

-  uVar8 = uVar2;

-  iVar5 = HsmpOpenFileByIdEx(lVar6,*(undefined8 *)(lVar6 + 0x20),uVar2,0x100080,

-                             in_stack_ffffffffffffff00,0x200000,'\0',alStack_b0,

-                             (longlong *)(uVar7 + 0x50));

-  HsmDbgBreakOnStatus(iVar5);

-  if (iVar5 < 0) {

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      WPP_SF_iqqLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

-                   (ulonglong)*(uint *)(WPP_GLOBAL_Control + 0x2c),uVar8,uVar2);

+  LOCK();

+  plVar1 = (longlong *)(param_1 + 8);

+  lVar2 = *plVar1;

+  *plVar1 = *plVar1 + -1;

+  UNLOCK();

+  if (lVar2 < 2) {

+    if (lVar2 == 1) {

+      if (*(uint **)(param_1 + 0x68) != (uint *)0x0) {

+        HsmpCleanupAttributionInformation(*(uint **)(param_1 + 0x68));

+      }

+      if (*(longlong *)(param_1 + 0x10) != 0) {

+        ObfDereferenceObject();

+      }

+      if (*(longlong *)(param_1 + 0x80) != 0) {

+        HsmpBitmapRelease(*(longlong *)(param_1 + 0x80));

+      }

+      if (*(longlong *)(param_1 + 0x78) != 0) {

+        HsmpReleaseSyncOpRundownProtection(*(longlong *)(param_1 + 0x78));

+        FltReleaseContext(*(undefined8 *)(param_1 + 0x78));

+      }

+      if (*(longlong *)(param_1 + 0x70) != 0) {

+        plVar1 = (longlong *)(*(longlong *)(param_1 + 0x70) + 0x38);

+        LOCK();

+        if (param_1 == *plVar1) {

+          *plVar1 = 0;

+        }

+        UNLOCK();

+        FltReleaseContext(*(undefined8 *)(param_1 + 0x70));

+      }

+      if (*(longlong *)(param_1 + 0x60) != 0) {

+        ExFreePoolWithTag(*(longlong *)(param_1 + 0x60),0x73557348);

+      }

+      if (*(longlong *)(param_1 + 0x88) != 0) {

+        ExFreePoolWithTag(*(longlong *)(param_1 + 0x88),0x63527348);

+      }

+      ExFreeToPagedLookasideList(&DAT_0,param_1);

+    }

+    else {

+      pcVar3 = (code *)swi(0x29);

+      (*pcVar3)(0xe);

     }

   }

-  else {

-    lVar9 = *(longlong *)(uVar7 + 0x50);

-    *(undefined4 *)(uVar7 - 0x78) = *(undefined4 *)(uVar7 + 0x58);

-    plVar3 = *(longlong **)(uVar7 + 0x80);

-    uVar1 = *(uint *)(uVar7 + 0x78);

-    lVar4 = *(longlong *)(uVar7 + 0x70);

-    *(undefined4 *)(uVar7 - 0x80) = 0x9000001a;

-    *(undefined4 *)(uVar7 - 0x7c) = 0xc0000011;

-    *(undefined8 *)(uVar7 - 0x70) = in_R8;

-    *(undefined8 *)(uVar7 - 0x68) = in_R9;

-    iVar5 = HsmpProcessQueryRangeStateHelper

-                      (0,lVar6,lVar9,uVar10,param_1,uVar11,uVar2,0,uVar7 - 0x80,0x98,lVar4,uVar1,

-                       plVar3);

-    HsmDbgBreakOnStatus(iVar5);

-    if (((iVar5 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

-       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0 && (1 < (byte)WPP_GLOBAL_Control[0x29]))))

-    {

-      WPP_SF_qiqqLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),lVar6,lVar9,

-                    *(undefined8 *)(uVar7 + 0x50));

-    }

-  }

-  if (alStack_b0[0] != 0) {

-    FltClose();

-  }

-  if (*(longlong *)(uVar7 + 0x50) != 0) {

-    ObfDereferenceObject(*(undefined8 *)(uVar7 + 0x50));

-  }

-  return iVar5;

+  return;

 }
```

## `HsmiOsGetProcessFlags`  (modified)

```diff
--- HsmiOsGetProcessFlags
+++ HsmOsCheckAppCompatPolicy
@@ -1,292 +1,130 @@
 

+/* WARNING: Instruction at (ram,0x000140008021) overlaps instruction at (ram,0x000140008020)

+    */

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-uint * HsmiOsGetProcessFlags(longlong param_1)

+uint * HsmOsCheckAppCompatPolicy(undefined8 *param_1,int param_2,char *param_3)

 

 {

-  char cVar1;

-  int iVar2;

-  longlong lVar3;

+  byte *pbVar1;

+  byte bVar2;

+  int iVar3;

   longlong lVar4;

-  longlong lVar5;

-  uint *puVar6;

-  ulonglong uVar7;

-  byte *pbVar8;

-  undefined8 uVar9;

-  ulonglong in_RAX;

-  uint uVar10;

-  byte bVar11;

-  byte unaff_BL;

-  uint *puVar12;

-  char unaff_DIL;

-  uint *unaff_R15;

-  byte bStackX_21;

-  char cStackX_22;

-  char cStackX_23;

-  undefined4 uVar13;

-  int iStack0000000000000030;

-  wchar_t *pwStack0000000000000040;

+  uint *puVar5;

+  uint *in_RAX;

+  undefined8 uVar6;

+  undefined4 in_register_00000014;

+  longlong unaff_RBX;

+  uint *puVar7;

+  uint unaff_EDI;

+  char unaff_R12B;

+  uint uVar8;

+  uint *unaff_R14;

+  uint uStackX_24;

+  uint *puStack0000000000000028;

+  longlong in_stack_00000030;

   

-  pbVar8 = (byte *)(in_RAX & 0xffffffffffffff38);

-  *pbVar8 = *pbVar8 ^ (byte)pbVar8;

-  pwStack0000000000000040 = L"AlwaysExposePlaceholders";

-  bStackX_21 = unaff_BL;

-  iStack0000000000000030 = (int)unaff_R15;

-  iVar2 = HsmOsGetPolicyDWord(&stack0x00000038,&bStackX_21,&stack0x00000030);

-  if (iVar2 < 0) {

-    if (DAT_1 == unaff_BL) goto LAB_14000752f;

+  pbVar1 = (byte *)((longlong)param_1 + -0x75);

+  bVar2 = *pbVar1;

+  *pbVar1 = *pbVar1 - (byte)param_1;

+  if (bVar2 < (byte)param_1) {

+    return in_RAX;

+  }

+  KeStackAttachProcess(param_1,CONCAT44(in_register_00000014,param_2),(char)param_3);

+  puVar7 = unaff_R14;

+  if (*(longlong *)(unaff_RBX + 0x10) == 0) {

+    uVar6 = PsGetCurrentProcess();

+    lVar4 = PsGetProcessWow64Process(uVar6);

+    if (lVar4 != 0) {

+      uVar6 = PsGetCurrentProcess();

+      goto LAB_0;

+    }

+    uVar6 = PsGetCurrentProcess();

+    lVar4 = PsGetProcessPeb(uVar6);

+    if (lVar4 != 0) {

+      uVar6 = PsGetCurrentProcess();

+      goto LAB_1;

+    }

   }

   else {

-    DAT_2 = 1;

-    DAT_1 = unaff_BL;

-    if ((bStackX_21 == unaff_BL) || (iStack0000000000000030 == (int)unaff_R15)) {

-LAB_0:

-      if (unaff_DIL != '\0') {

-        lVar3 = PsGetThreadProcess();

-        lVar5 = lVar3;

-        if (lVar3 == 0) {

-          lVar5 = PsGetCurrentProcess();

-        }

-        lVar4 = PsGetCurrentProcess();

-        cStackX_23 = lVar5 != lVar4;

-        if ((bool)cStackX_23) {

-          KeStackAttachProcess(lVar5,&stack0x00000060);

-        }

-        cVar1 = func_0x000140007c60(lVar3);

-        if (cVar1 == '\0') {

-          lVar5 = PsGetThreadTeb();

-          if (lVar5 != 0) {

-            cVar1 = HsmpIs32bitProcess();

-            if (cVar1 == '\0') {

-              unaff_BL = *(byte *)(lVar5 + 0x280);

-            }

-            else {

-              unaff_BL = *(byte *)(lVar5 + 0x2174);

-            }

-          }

-          bVar11 = unaff_BL;

-          if (unaff_BL == 0) {

-            puVar12 = unaff_R15;

-            if (lVar3 == 0) {

-              uVar9 = PsGetCurrentProcess();

-              lVar5 = PsGetProcessWow64Process(uVar9);

-              if (lVar5 != 0) {

-                lVar5 = PsGetCurrentProcess();

-                goto LAB_3;

-              }

-              uVar9 = PsGetCurrentProcess();

-              lVar5 = PsGetProcessPeb(uVar9);

-              if (lVar5 != 0) {

-                lVar5 = PsGetCurrentProcess();

-                goto LAB_4;

-              }

-            }

-            else {

-              lVar4 = PsGetProcessWow64Process(lVar3);

-              lVar5 = lVar3;

-              if (lVar4 == 0) {

-                lVar4 = PsGetProcessPeb();

-                if (lVar4 != 0) {

-LAB_4:

-                  lVar5 = PsGetProcessPeb(lVar5);

-                  puVar12 = (uint *)(lVar5 + 0x2c8);

-                }

-              }

-              else {

-LAB_3:

-                lVar5 = PsGetProcessWow64Process(lVar5);

-                puVar12 = (uint *)(lVar5 + 0x1d8);

-              }

-            }

-            puVar6 = unaff_R15;

-            if (lVar3 == 0) {

-              uVar9 = PsGetCurrentProcess();

-              lVar5 = PsGetProcessWow64Process(uVar9);

-              if (lVar5 != 0) {

-                lVar5 = PsGetCurrentProcess();

-                goto LAB_5;

-              }

-              uVar9 = PsGetCurrentProcess();

-              lVar5 = PsGetProcessPeb(uVar9);

-              if (lVar5 != 0) {

-                lVar5 = PsGetCurrentProcess();

-                goto LAB_6;

-              }

-            }

-            else {

-              lVar4 = PsGetProcessWow64Process(lVar3);

-              lVar5 = lVar3;

-              if (lVar4 == 0) {

-                lVar4 = PsGetProcessPeb();

-                if (lVar4 != 0) {

-LAB_6:

-                  lVar5 = PsGetProcessPeb(lVar5);

-                  puVar6 = (uint *)(lVar5 + 0x7b0);

-                }

-              }

-              else {

-LAB_5:

-                lVar5 = PsGetProcessWow64Process(lVar5);

-                puVar6 = (uint *)(lVar5 + 0x468);

-              }

-            }

-            bVar11 = (byte)*puVar6;

-            if (bVar11 == 0) {

-              if ((puVar12 == (uint *)0x0) || ((*puVar12 & 0x20000000) == 0)) {

-                puVar6 = unaff_R15;

-                if (lVar3 == 0) {

-                  uVar9 = PsGetCurrentProcess();

-                  lVar5 = PsGetProcessWow64Process(uVar9);

-                  if (lVar5 != 0) {

-                    lVar5 = PsGetCurrentProcess();

-                    goto LAB_7;

-                  }

-                  uVar9 = PsGetCurrentProcess();

-                  lVar5 = PsGetProcessPeb(uVar9);

-                  if (lVar5 != 0) {

-                    lVar5 = PsGetCurrentProcess();

-                    goto LAB_8;

-                  }

-                }

-                else {

-                  lVar4 = PsGetProcessWow64Process(lVar3);

-                  lVar5 = lVar3;

-                  if (lVar4 == 0) {

-                    lVar4 = PsGetProcessPeb();

-                    if (lVar4 != 0) {

-LAB_8:

-                      lVar5 = PsGetProcessPeb(lVar5);

-                      puVar6 = (uint *)(lVar5 + 0x7a8);

-                    }

-                  }

-                  else {

-LAB_7:

-                    lVar5 = PsGetProcessWow64Process(lVar5);

-                    puVar6 = (uint *)(lVar5 + 0x460);

-                  }

-                }

-                HsmiOsIsForegroundHydrator(lVar3,puVar12,puVar6,&cStackX_22);

-                bVar11 = unaff_BL;

-              }

-              else {

-                bVar11 = 1;

-              }

-            }

-          }

-          if (bVar11 != 0) goto LAB_9;

-          uVar13 = (undefined4)((ulonglong)unaff_R15 >> 0x20);

-          if ((Feature_CloudFileDisguisePlaceholders__private_featureState & 0x10) == 0) {

-            uVar10 = Feature_CloudFileDisguisePlaceholders__private_featureState | 1;

-            wil_details_FeatureReporting_ReportUsageToService

-                      (0x140028f70,

-                       CONCAT44(uVar13,Feature_CloudFileDisguisePlaceholders__private_featureState)

-                       | 1,3);

-            wil_details_FeatureStateCache_TryEnableDeviceUsageFastPath

-                      (uVar10,3,&Feature_CloudFileDisguisePlaceholders__private_descriptor);

-          }

-          uVar7 = func_0x000140007e40(&stack0x00000048);

-          if ((uVar7 & 1) == 0) {

-            if (((cStackX_22 != '\0') && ((uVar7 & 2) != 0)) &&

-               ((Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState & 0x10) == 0)

-               ) {

-              uVar10 = Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState | 1;

-              wil_details_FeatureReporting_ReportUsageToService

-                        (0x140029018,

-                         CONCAT44(uVar13,

-                                  Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState

-                                 ) | 1,3);

-              wil_details_FeatureStateCache_TryEnableDeviceUsageFastPath

-                        (uVar10,3,&

-                                  Feature_CloudFileDisguisePlaceholdersForGUIApps__private_descriptor

-                        );

-            }

-            bVar11 = 1;

-          }

-          else {

-            bVar11 = 2;

-          }

-          if (lVar3 == 0) {

-            uVar9 = PsGetCurrentProcess();

-            lVar5 = PsGetProcessWow64Process(uVar9);

-            if (lVar5 != 0) {

-              lVar5 = PsGetCurrentProcess();

-              goto LAB_10;

-            }

-            uVar9 = PsGetCurrentProcess();

-            lVar5 = PsGetProcessPeb(uVar9);

-            if (lVar5 != 0) {

-              lVar5 = PsGetCurrentProcess();

-              goto LAB_11;

-            }

-          }

-          else {

-            lVar4 = PsGetProcessWow64Process(lVar3);

-            lVar5 = lVar3;

-            if (lVar4 == 0) {

-              lVar4 = PsGetProcessPeb();

-              if (lVar4 != 0) {

-LAB_11:

-                lVar5 = PsGetProcessPeb(lVar5);

-                unaff_R15 = (uint *)(lVar5 + 0x7a8);

-              }

-            }

-            else {

-LAB_10:

-              lVar5 = PsGetProcessWow64Process(lVar5);

-              unaff_R15 = (uint *)(lVar5 + 0x460);

-            }

-          }

-          if (lVar3 == 0) {

-            uVar9 = PsGetCurrentProcess();

-            lVar5 = PsGetProcessWow64Process(uVar9);

-            if (lVar5 != 0) {

-              lVar3 = PsGetCurrentProcess();

-              goto LAB_12;

-            }

-            uVar9 = PsGetCurrentProcess();

-            lVar5 = PsGetProcessPeb(uVar9);

-            if (lVar5 != 0) {

-              lVar3 = PsGetCurrentProcess();

-              goto LAB_13;

-            }

-          }

-          else {

-            lVar5 = PsGetProcessWow64Process(lVar3);

-            if (lVar5 == 0) {

-              lVar5 = PsGetProcessPeb();

-              if (lVar5 == 0) goto LAB_14;

-LAB_13:

-              lVar5 = PsGetProcessPeb(lVar3);

-              pbVar8 = (byte *)(lVar5 + 0x7b0);

-            }

-            else {

-LAB_12:

-              lVar5 = PsGetProcessWow64Process(lVar3);

-              pbVar8 = (byte *)(lVar5 + 0x468);

-            }

-            if (pbVar8 != (byte *)0x0) {

-              *pbVar8 = bVar11;

-            }

-          }

-LAB_14:

-          if (unaff_R15 != (uint *)0x0) {

-            LOCK();

-            *unaff_R15 = *unaff_R15 | 0x20;

-            UNLOCK();

-          }

-          goto LAB_9;

-        }

+    lVar4 = PsGetProcessWow64Process();

+    uVar6 = *(undefined8 *)(unaff_RBX + 0x10);

+    if (lVar4 == 0) {

+      lVar4 = PsGetProcessPeb();

+      if (lVar4 != 0) {

+        uVar6 = *(undefined8 *)(unaff_RBX + 0x10);

+LAB_1:

+        lVar4 = PsGetProcessPeb(uVar6);

+        puVar7 = (uint *)(lVar4 + 0x7a8);

       }

     }

     else {

-      DAT_1 = 1;

+LAB_0:

+      lVar4 = PsGetProcessWow64Process(uVar6);

+      puVar7 = (uint *)(lVar4 + 0x460);

     }

   }

-  bVar11 = 2;

-LAB_9:

-  if (cStackX_23 != '\0') {

-    KeUnstackDetachProcess(&stack0x00000060);

+  puVar5 = unaff_R14;

+  puStack0000000000000028 = puVar7;

+  if (*(longlong *)(unaff_RBX + 0x10) == 0) {

+    uVar6 = PsGetCurrentProcess();

+    lVar4 = PsGetProcessWow64Process(uVar6);

+    if (lVar4 != 0) {

+      uVar6 = PsGetCurrentProcess();

+      goto LAB_2;

+    }

+    uVar6 = PsGetCurrentProcess();

+    lVar4 = PsGetProcessPeb(uVar6);

+    if (lVar4 == 0) goto LAB_3;

+    uVar6 = PsGetCurrentProcess();

   }

-  return (uint *)(ulonglong)bVar11;

+  else {

+    lVar4 = PsGetProcessWow64Process();

+    uVar6 = *(undefined8 *)(unaff_RBX + 0x10);

+    if (lVar4 != 0) {

+LAB_2:

+      lVar4 = PsGetProcessWow64Process(uVar6);

+      puVar5 = (uint *)(lVar4 + 0xb4);

+      goto LAB_3;

+    }

+    lVar4 = PsGetProcessPeb();

+    if (lVar4 == 0) goto LAB_3;

+    uVar6 = *(undefined8 *)(unaff_RBX + 0x10);

+  }

+  lVar4 = PsGetProcessPeb(uVar6);

+  puVar5 = (uint *)(lVar4 + 0x128);

+LAB_3:

+  if ((puVar7 != (uint *)0x0) && ((*puVar7 & 0x40) != 0)) {

+    unaff_R12B = '\x01';

+    unaff_EDI = *puVar7 >> 7 & 1;

+    uStackX_24 = unaff_EDI;

+  }

+  if (puVar5 != (uint *)0x0) {

+    uVar8 = (uint)unaff_R14;

+    if (*puVar5 == 2) {

+      uVar8 = 2;

+    }

+    unaff_EDI = uVar8 | unaff_EDI & 0xfffffffd;

+    uStackX_24 = unaff_EDI;

+  }

+  if (unaff_R12B == '\0') {

+    iVar3 = func_0x000140008214();

+    if (((-1 < iVar3) && (in_stack_00000030 != 0)) && (*(longlong *)(in_stack_00000030 + 8) != 0)) {

+      bVar2 = RtlPrefixUnicodeString(&DAT_4,in_stack_00000030,1);

+      unaff_EDI = bVar2 & 1 | unaff_EDI & 0xfffffffe;

+      uStackX_24 = unaff_EDI;

+    }

+    if (puVar7 != (uint *)0x0) {

+      LOCK();

+      *puVar7 = *puVar7 | (unaff_EDI & 1) << 7 | 0x40;

+      UNLOCK();

+      unaff_EDI = uStackX_24;

+    }

+  }

+  if (in_stack_00000030 != 0) {

+    ExFreePoolWithTag(in_stack_00000030,0);

+  }

+  KeUnstackDetachProcess(&stack0x00000040);

+  return (uint *)(ulonglong)unaff_EDI;

 }
```

## `HsmiCtxCreateFileContext`  (modified)

```diff
--- HsmiCtxCreateFileContext
+++ HsmiCtxCreateFileContext
@@ -1,118 +1,86 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 int HsmiCtxCreateFileContext

               (longlong param_1,longlong param_2,undefined8 param_3,undefined8 *param_4)

 

 {

-  byte *pbVar1;

-  byte bVar2;

-  ushort uVar3;

-  ushort uVar4;

-  uint uVar5;

-  int iVar6;

-  int iVar7;

-  uint uVar8;

-  uint uVar9;

-  char *in_RAX;

-  int *unaff_RBX;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  ulonglong uVar10;

-  undefined8 unaff_R12;

-  char unaff_R14B;

-  byte unaff_R15B;

+  undefined4 *puVar1;

+  int iVar2;

+  undefined2 uVar3;

+  undefined4 *local_res20;

+  undefined4 **ppuVar4;

+  undefined4 uVar5;

+  undefined8 local_28 [2];

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  pbVar1 = (byte *)(in_RAX + -1);

-  bVar2 = *pbVar1;

-  *pbVar1 = *pbVar1 + (byte)param_1;

-  iVar6 = (int)in_RAX + -0x2d412 + (uint)CARRY1(bVar2,(byte)param_1);

-  HsmDbgBreakOnStatus(iVar6);

-  if (iVar6 < 0) {

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((unaff_R15B & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x10,

-                &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R12);

-    }

+  *param_4 = 0;

+  ppuVar4 = &local_res20;

+  local_res20 = (undefined4 *)0x0;

+  iVar2 = FltAllocateContext(DAT_0,4,0xf0,0x200,ppuVar4);

+  uVar5 = (undefined4)((ulonglong)ppuVar4 >> 0x20);

+  HsmDbgBreakOnStatus(iVar2);

+  if (iVar2 < 0) {

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_1;

+    uVar3 = 0xe;

+LAB_2:

+    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar3,

+               &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

   }

   else {

-    uVar10 = *(ulonglong *)(unaff_RBP + 7);

-    if ((uVar10 == 0) || (0x10000 < (longlong)uVar10)) {

-      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-         (((unaff_R15B & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

-          (1 < (byte)WPP_GLOBAL_Control[0x29])))) {

-        WPP_SF_qi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x11,

-                  &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R12);

+    memset(local_res20,0,0xf0);

+    *local_res20 = 0x63467348;

+    *(longlong *)(local_res20 + 4) = param_1;

+    FltReferenceContext(param_1);

+    FltInitializePushLock(local_res20 + 6);

+    KeInitializeEvent(local_res20 + 0x18,1,1);

+    ExInitializeResourceLite(local_res20 + 0x1e);

+    FltInitializePushLock(local_res20 + 0xc);

+    ExInitializeRundownProtection(local_res20 + 0xe);

+    KeInitializeEvent(local_res20 + 0x10,0,1);

+    if ((*(uint *)(param_2 + 0x50) & 0x400000) == 0) {

+      local_28[0] = 0;

+      iVar2 = FltQueryInformationFile

+                        (*(undefined8 *)(param_1 + 0x20),param_2,local_28,8,CONCAT44(uVar5,6),0);

+      HsmDbgBreakOnStatus(iVar2);

+      if (iVar2 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+        uVar3 = 0xf;

+        goto LAB_2;

+      }

+      *(undefined8 *)(local_res20 + 8) = local_28[0];

+    }

+    if (DAT_3 != (code *)0x0) {

+      if (DAT_3 == CldHsmCreateFileContext) {

+        iVar2 = CldHsmCreateFileContext

+                          (local_res20,*(undefined8 *)(param_1 + 0x10),param_3,

+                           (undefined8 *)(local_res20 + 2));

+      }

+      else {

+        iVar2 = (*DAT_3)();

+      }

+      HsmDbgBreakOnStatus(iVar2);

+      if (iVar2 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x10,

+                      &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+        }

+        goto LAB_1;

       }

     }

-    else {

-      unaff_RBX = (int *)ExAllocatePool2(0x100,uVar10 & 0xffffffff,0x69537348);

-      if (unaff_RBX == (int *)0x0) {

-        iVar6 = -0x3fffff66;

-        HsmDbgBreakOnStatus(-0x3fffff66);

-      }

-      else {

-        iVar6 = FltReadFile(*(undefined8 *)(unaff_RSI + 0x20),*(undefined8 *)(unaff_RBP + -0x39),

-                            unaff_RBP + -0x11,*(undefined4 *)(unaff_RBP + 7),unaff_RBX);

-        HsmDbgBreakOnStatus(iVar6);

-        if (iVar6 < 0) {

-          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((unaff_R15B & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x12,

-                       &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R12);

-          }

-        }

-        else {

-          uVar8 = *(uint *)(unaff_RBP + 7);

-          if ((((0x17 < uVar8) && (*unaff_RBX == 0x6e497253)) &&

-              (((*(byte *)(unaff_RBX + 3) & unaff_R14B + 2U) == 0 ||

-               (iVar7 = RtlComputeCrc32(0,unaff_RBX + 2,uVar8 - 8), unaff_RBX[1] == iVar7)))) &&

-             (uVar5 = unaff_RBX[2], uVar5 <= uVar8)) {

-            uVar3 = *(ushort *)((longlong)unaff_RBX + 0xe);

-            if ((uVar3 != 0) && ((uint)uVar3 * 8 + 0x10 < uVar5)) {

-              uVar10 = 0;

-              while( true ) {

-                uVar8 = (uint)uVar3;

-                if (8 < uVar3) {

-                  uVar8 = 9;

-                }

-                if (uVar8 <= (uint)uVar10) {

-                  **(undefined8 **)(unaff_RBP + -9) = unaff_RBX;

-                  unaff_RBX = (int *)0x0;

-                  goto LAB_0;

-                }

-                if (((0x11 < *(ushort *)(unaff_RBX + uVar10 * 2 + 4)) ||

-                    ((((uVar8 = unaff_RBX[uVar10 * 2 + 5], uVar8 != 0 &&

-                       (uVar8 < (uint)uVar3 * 8 + 0x10)) || (uVar5 < uVar8)) ||

-                     ((uVar4 = *(ushort *)((longlong)unaff_RBX + uVar10 * 8 + 0x12), uVar5 < uVar4

-                      || (uVar9 = uVar4 + uVar8, uVar5 < uVar9)))))) || (uVar9 < uVar8)) break;

-                uVar10 = (ulonglong)((uint)uVar10 + 1);

-              }

-            }

-          }

-          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x13,

-                       &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R12);

-          }

-        }

-      }

-    }

+    puVar1 = local_res20;

+    local_res20 = (undefined4 *)0x0;

+    *param_4 = puVar1;

   }

-LAB_0:

-  if (*(longlong *)(unaff_RBP + -0x39) != 0) {

-    ObfDereferenceObject(*(undefined8 *)(unaff_RBP + -0x39));

+LAB_1:

+  if (local_res20 != (undefined4 *)0x0) {

+    FltReleaseContext();

   }

-  if (*(longlong *)(unaff_RBP + -0x29) != 0) {

-    FltClose();

-  }

-  if (unaff_RBX != (int *)0x0) {

-    ExFreePoolWithTag(unaff_RBX,0x69537348);

-  }

-  return iVar6;

+  return iVar2;

 }
```

## `HsmFltPreFAST_IO_CHECK_IF_POSSIBLE`  (modified)

```diff
--- HsmFltPreFAST_IO_CHECK_IF_POSSIBLE
+++ HsmFltPreFAST_IO_CHECK_IF_POSSIBLE
@@ -1,33 +1,17 @@
-

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 undefined8 HsmFltPreFAST_IO_CHECK_IF_POSSIBLE(longlong param_1,longlong param_2)

 

 {

-  undefined8 uVar1;

-  int in_EAX;

-  undefined4 in_register_00000004;

-  undefined8 in_R8;

-  longlong in_R11;

+  longlong lVar1;

+  undefined8 uVar2;

   

-  *(int *)CONCAT44(in_register_00000004,in_EAX) =

-       *(int *)CONCAT44(in_register_00000004,in_EAX) + in_EAX;

-  *(undefined8 *)(in_R11 + -0x20) = 4;

-  *(undefined8 *)(in_R11 + -0x28) = in_R8;

-  *(undefined8 *)(in_R11 + -0x30) = 8;

-  *(longlong *)(in_R11 + -0x38) = in_R11 + 0x48;

-  *(undefined8 *)(in_R11 + -0x40) = 8;

-  *(longlong *)(in_R11 + -0x48) = in_R11 + 0x40;

-  *(undefined8 *)(in_R11 + -0x50) = 4;

-  *(longlong *)(in_R11 + -0x58) = in_R11 + 0x38;

-  *(undefined8 *)(in_R11 + -0x60) = 8;

-  *(longlong *)(in_R11 + -0x68) = in_R11 + 0x30;

-  *(undefined8 *)(in_R11 + -0x70) = 8;

-  *(longlong *)(in_R11 + -0x78) = in_R11 + 0x28;

-  *(undefined8 *)(in_R11 + -0x80) = 8;

-  uVar1 = (*(code *)CONCAT44(in_register_00000004,in_EAX))

-                    (param_1,0x2b,&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,param_2 & 0xffff,

-                     in_R11 + 0x20);

-  return uVar1;

+  uVar2 = 1;

+  lVar1 = HsmpGetStreamHandleContext

+                    (param_1,*(longlong *)(param_2 + 0x18),*(undefined8 *)(param_2 + 0x20));

+  if (lVar1 != 0) {

+    uVar2 = 3;

+    FltReleaseContext(lVar1);

+  }

+  return uVar2;

 }
```

## `HsmpSetupContexts`  (modified)

```diff
--- HsmpSetupContexts
+++ HsmpSetupContexts
@@ -1,54 +1,587 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Type propagation algorithm not settling */

 

-ulonglong HsmpSetupContexts(ulonglong param_1,uint **param_2,uint param_3,uint *param_4)

+ulonglong HsmpSetupContexts(ulonglong param_1,undefined4 **param_2,uint param_3,uint *param_4)

 

 {

-  byte *pbVar1;

-  longlong lVar2;

-  longlong lVar3;

-  int iVar4;

-  longlong in_RAX;

-  undefined4 uVar5;

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  undefined4 in_register_00000084;

-  undefined8 unaff_R13;

-  char unaff_R14B;

-  longlong unaff_R15;

-  longlong *in_stack_00000038;

+  bool bVar1;

+  undefined8 uVar2;

+  char cVar3;

+  uint uVar4;

+  int iVar5;

+  ulonglong uVar6;

+  longlong lVar7;

+  uint *puVar8;

+  uint *puVar9;

+  longlong lVar10;

+  ulonglong uVar11;

+  undefined2 uVar12;

+  ulonglong uVar13;

+  uint *puVar14;

+  undefined *puVar15;

+  uint *puVar16;

+  undefined1 auStackY_158 [32];

+  uint *local_f8;

+  uint *local_f0;

+  undefined8 local_e8;

+  undefined8 local_e0;

+  uint *local_d8;

+  uint *local_d0;

+  ulonglong local_c8;

+  undefined8 local_c0;

+  uint uStack_b8;

+  uint uStack_b4;

+  uint local_b0;

+  longlong local_a8;

+  longlong local_a0 [3];

+  char cStack_82;

+  longlong local_88;

+  char cStack_81;

+  undefined8 local_80;

+  longlong lStack_78;

+  undefined8 local_70;

+  undefined8 uStack_68;

+  undefined8 local_60;

+  longlong lStack_58;

+  undefined8 local_50;

+  ulonglong local_48;

   

-  *(char *)(in_RAX + -0x75) = *(char *)(in_RAX + -0x75) + (byte)param_1;

-  *(byte *)(in_RAX + -0x73) = *(byte *)(in_RAX + -0x73) & (byte)param_1;

-  pbVar1 = (byte *)(CONCAT44(in_register_00000084,param_3) + -0x77);

-  *pbVar1 = *pbVar1 >> 1 | *pbVar1 << 7;

-  iVar4 = HsmpRelativeStreamOpenById

-                    (unaff_R15,param_2,0x14002a398,0x100080,1,0x200020,unaff_R13,

-                     (longlong *)(unaff_RBP + -0x28),in_stack_00000038);

-  lVar2 = *(longlong *)(unaff_RBP + -0x30);

-  if (iVar4 < 0) {

-    *(int *)(unaff_RBX + 0xec) = (int)unaff_R13;

+  local_48 = __security_cookie ^ (ulonglong)auStackY_158;

+  local_e0 = *(undefined8 *)(param_1 + 0x20);

+  uVar13 = 0;

+  local_f8 = (uint *)0x0;

+  local_f0 = (uint *)0x0;

+  local_d8 = (uint *)0x0;

+  local_a0[0] = 0;

+  puVar16 = (uint *)0x0;

+  local_a8 = 0;

+  local_b0 = 0;

+  uVar6 = uVar13;

+  local_c8 = param_1;

+  if (param_4 != (uint *)0x0) {

+    uVar6 = FltGetRequestorProcess(param_4);

+  }

+  cVar3 = HsmOsIsPassThroughModeEnabled(uVar6);

+  uVar6 = uVar13;

+  if (cVar3 != '\0') goto LAB_0;

+  if (param_3 == 0) {

+    local_e8 = (uint *)0x0;

+    uVar4 = FltQueryInformationFile(local_e0,param_2,&local_e8);

+    uVar11 = (ulonglong)uVar4;

+    uVar6 = (ulonglong)uVar4;

+    HsmDbgBreakOnStatus(uVar4);

+    if (-1 < (int)uVar4) {

+      if (((ulonglong)local_e8 & 0x400) != 0) {

+        param_3 = local_e8._4_4_;

+      }

+      goto LAB_1;

+    }

+    if (uVar4 == 0xc000000d) {

+      MicrosoftTelemetryAssertTriggeredArgsKM(uVar11,0);

+    }

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_0;

+    uVar12 = 0x1b;

   }

   else {

-    iVar4 = FltQueryInformationFile();

-    uVar5 = *(undefined4 *)(unaff_RBP + -0x18);

-    if (iVar4 < 0) {

-      uVar5 = (int)unaff_R13;

-    }

-    *(undefined4 *)(unaff_RBX + 0xec) = uVar5;

+LAB_1:

+    if (((param_3 & 0xffff0fff) != DAT_2) ||

+       ((param_4 != (uint *)0x0 &&

+        ((*(longlong *)(param_4 + 8) == 3 || (*(longlong *)(param_4 + 8) == 0)))))) {

+      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (3 < (byte)WPP_GLOBAL_Control[0x29])))

+         ) {

+        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x1c,

+                    &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,local_e0);

+      }

+      FltGetStreamContext(local_e0,param_2,&local_f8);

+      if (local_f8 != (uint *)0x0) {

+        FltAcquirePushLockExclusiveEx(*(longlong *)(local_f8 + 4) + 0x18,0);

+        local_f8[7] = local_f8[7] & 0xfffffffe;

+        FltReleasePushLockEx(*(longlong *)(local_f8 + 4) + 0x18,0);

+        HsmpCldNullifyStreamContext((longlong)local_f8);

+      }

+      FltGetStreamHandleContext(local_e0,param_2);

+      if (local_f0 != (uint *)0x0) {

+        FltDeleteContext();

+      }

+      uVar6 = uVar13;

+      if ((param_4 != (uint *)0x0) && (*(longlong *)(param_4 + 8) == 3)) {

+        HsmpToggleFileSparseAttribute(param_1,(longlong)param_2,'\0');

+        HsmpToggleFileAttributes

+                  (param_1,(longlong)param_2,*(ushort *)(*(longlong *)(param_4 + 4) + 0x28) & 0x1000

+                   ,0x401000);

+      }

+      goto LAB_0;

+    }

+    lVar7 = IoGetTransactionParameterBlock(param_2);

+    if (lVar7 != 0) {

+      uVar6 = 0xc019005a;

+      HsmDbgBreakOnStatus(-0x3fe6ffa6);

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

+         ) goto LAB_0;

+      uVar12 = 0x1d;

+      goto LAB_3;

+    }

+    if (param_4 != (uint *)0x0) {

+      local_a0[1] = 0;

+      local_a0[2] = 0;

+      local_e8 = (uint *)0x0;

+      local_d0 = (uint *)((ulonglong)local_d0 & 0xffffffff00000000);

+      local_88 = lVar7;

+      uVar4 = FltQueryInformationFile

+                        (*(undefined8 *)(*(longlong *)(param_4 + 4) + 0x10),

+                         *(undefined8 *)(*(longlong *)(param_4 + 4) + 8),local_a0 + 1);

+      uVar6 = (ulonglong)uVar4;

+      HsmDbgBreakOnStatus(uVar4);

+      if (((int)uVar4 < 0) || ((int)local_d0 != 0x18)) {

+        local_c0 = *(uint **)(param_4 + 6);

+        uStack_b8 = param_4[8];

+        uStack_b4 = param_4[9];

+        uVar4 = FltGetFileNameInformation(param_4,0x102,&local_e8);

+        uVar6 = (ulonglong)uVar4;

+        HsmDbgBreakOnStatus(uVar4);

+        param_4[6] = (uint)local_c0;

+        param_4[7] = local_c0._4_4_;

+        param_4[8] = uStack_b8;

+        param_4[9] = uStack_b4;

+        if (-1 < (int)uVar4) {

+          uVar4 = FltParseFileNameInformation(local_e8);

+          uVar6 = (ulonglong)uVar4;

+          HsmDbgBreakOnStatus(uVar4);

+          if (-1 < (int)uVar4) {

+            bVar1 = (short)local_e8[0x12] != 0;

+            goto LAB_4;

+          }

+        }

+LAB_5:

+        bVar1 = false;

+      }

+      else {

+        if ((cStack_81 == '\0') && (cStack_82 == '\0')) goto LAB_5;

+        bVar1 = true;

+      }

+LAB_4:

+      if (local_e8 != (uint *)0x0) {

+        FltReleaseFileNameInformation();

+      }

+      HsmDbgBreakOnStatus((int)uVar6);

+      if ((int)uVar6 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+        uVar12 = 0x1e;

+        goto LAB_3;

+      }

+      if (bVar1) goto LAB_0;

+    }

+    uVar4 = FltGetStreamContext(local_e0,param_2,&local_f8);

+    HsmDbgBreakOnStatus(uVar4);

+    uVar2 = local_e0;

+    uVar6 = uVar13;

+    if (uVar4 != 0xc0000225) {

+      uVar6 = (ulonglong)uVar4;

+    }

+    if (-1 < (int)uVar6) {

+      if (local_f8 != (uint *)0x0) {

+        if ((local_f8[7] & 1) == 0) goto LAB_0;

+        goto LAB_6;

+      }

+      local_c0 = (uint *)0x0;

+      uVar4 = HsmpRpReadBuffer(local_e0,param_2,&local_d8);

+      uVar6 = (ulonglong)uVar4;

+      HsmDbgBreakOnStatus(uVar4);

+      puVar16 = local_d8;

+      if (((uVar4 == 0xc0000275) || (uVar4 == 0xc000029c)) ||

+         ((uVar4 == 0x80000005 || (uVar4 == 0xc0000010)))) {

+        uVar6 = 0;

+      }

+      else if ((int)uVar4 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x20,

+                      &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,uVar2);

+          puVar16 = local_d8;

+        }

+      }

+      else if ((*local_d8 & 0xffff0fff) == DAT_2) {

+        local_d0 = (uint *)CONCAT62(local_d0._2_6_,(short)local_d8[1]);

+        uVar4 = HsmiCldGetSyncRootFileIdByFileObject

+                          (param_1,(ulonglong)param_2,&local_c0,(int *)0x0,(undefined4 *)0x0);

+        HsmDbgBreakOnStatus(uVar4);

+        if (((((int)uVar4 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (2 < (byte)WPP_GLOBAL_Control[0x29])) {

+          WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x34,

+                      &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+          HsmDbgBreakOnStatus(uVar4);

+LAB_7:

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (2 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x21,

+                        &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+          }

+        }

+        else {

+          HsmDbgBreakOnStatus(uVar4);

+          if ((int)uVar4 < 0) goto LAB_7;

+        }

+        uVar4 = HsmpCtxCreateStreamContext

+                          (param_1,param_2,local_c0,puVar16 + 2,(uint)(ushort)local_d0,&local_f8);

+        uVar6 = (ulonglong)uVar4;

+        HsmDbgBreakOnStatus(uVar4);

+        if ((int)uVar4 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            uVar12 = 0x22;

+LAB_8:

+            WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                        &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+          }

+        }

+        else {

+          local_f8[6] = *puVar16;

+          FltAcquirePushLockExclusiveEx(*(longlong *)(local_f8 + 4) + 0x18,0);

+          local_d0 = local_f8;

+          local_e8 = (uint *)0x0;

+          local_c0 = (uint *)0x0;

+          local_d8 = *(uint **)(local_f8 + 4);

+          uVar4 = FltSetStreamContext(*(undefined8 *)(param_1 + 0x20),param_2,1,local_f8);

+          uVar11 = (ulonglong)uVar4;

+          HsmDbgBreakOnStatus(uVar4);

+          uVar6 = uVar13;

+          puVar9 = local_e8;

+          if (uVar4 != 0xc01c0002) {

+            if ((int)uVar4 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x56,

+                            &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+              }

+              HsmDbgBreakOnStatus(-0x3fffffbd);

+              uVar6 = 0xc0000043;

+              puVar9 = local_c0;

+            }

+            else {

+              if (local_e8 != (uint *)0x0) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  puVar9 = local_e8;

+                  puVar15 = WPP_GLOBAL_Control;

+                  HsmpGetStreamSize((longlong)local_e8);

+                  WPP_SF_qqLii(*(undefined8 *)(puVar15 + 0x18),0x57,puVar9,param_1);

+                }

+                FltReleaseContext(local_e8);

+              }

+              uVar6 = uVar11;

+              puVar9 = local_d0;

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  (puVar9 = local_d0, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (puVar9 = local_d0, 4 < (byte)WPP_GLOBAL_Control[0x29])) {

+                puVar15 = WPP_GLOBAL_Control;

+                HsmpGetStreamSize((longlong)local_d0);

+                WPP_SF_qqLii(*(undefined8 *)(puVar15 + 0x18),0x58,puVar15,param_1);

+                puVar9 = local_d0;

+              }

+            }

+          }

+          local_c0 = puVar9;

+          HsmDbgBreakOnStatus((int)uVar6);

+          FltReleasePushLockEx(*(longlong *)(local_f8 + 4) + 0x18,0);

+          if ((int)uVar6 < 0) {

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              uVar12 = 0x23;

+              goto LAB_8;

+            }

+          }

+          else {

+            puVar9 = local_c0;

+            if (local_f8 != local_c0) {

+              FltReleaseContext(local_f8);

+              local_f8 = puVar9;

+            }

+            puVar9 = local_f8;

+            iVar5 = HsmpRpCheckState((longlong)local_f8);

+            if ((-1 < iVar5) && ((puVar9[7] & 2) == 0)) {

+              local_50 = 0;

+              local_80 = 0;

+              lStack_78 = 0;

+              local_70 = 0;

+              uStack_68 = 0;

+              local_60 = 0;

+              lStack_58 = 0;

+              uVar4 = FltQueryInformationFile(local_e0,param_2,&local_80,0x38);

+              uVar6 = (ulonglong)uVar4;

+              HsmDbgBreakOnStatus(uVar4);

+              if ((int)uVar4 < 0) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  uVar12 = 0x24;

+                  goto LAB_8;

+                }

+                goto LAB_9;

+              }

+              FltAcquirePushLockExclusiveEx(*(longlong *)(local_f8 + 4) + 0x18,0);

+              if (*(longlong *)(local_f8 + 0x28) != 0) {

+                FltAcquirePushLockExclusiveEx(*(longlong *)(local_f8 + 0x28) + 0x28,0);

+              }

+              lVar7 = *(longlong *)(*(longlong *)(local_f8 + 4) + 0x28);

+              lVar10 = lStack_78;

+              if (lStack_78 < lVar7) {

+                lVar10 = lVar7;

+              }

+              *(longlong *)(*(longlong *)(local_f8 + 4) + 0x28) = lVar10;

+              lVar7 = **(longlong **)(local_f8 + 0x28);

+              if (lStack_58 <= lVar7) {

+                lVar7 = lStack_58;

+              }

+              **(longlong **)(local_f8 + 0x28) = lVar7;

+              HsmpReleaseBitmapLock((longlong)local_f8);

+              FltReleasePushLockEx(*(longlong *)(local_f8 + 4) + 0x18,0);

+            }

+LAB_6:

+            uVar4 = HsmpCtxCreateStreamHandleContext

+                              (param_1,(longlong)param_2,(longlong)param_4,(longlong)local_f8,

+                               &local_f0);

+            uVar6 = (ulonglong)uVar4;

+            HsmDbgBreakOnStatus(uVar4);

+            if ((int)uVar4 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                uVar12 = 0x25;

+                goto LAB_8;

+              }

+            }

+            else {

+              local_c0 = local_f0;

+              local_e8 = (uint *)0x0;

+              local_d8 = (uint *)0x0;

+              uVar4 = FltSetStreamHandleContext(*(undefined8 *)(param_1 + 0x20),param_2,1,local_f0);

+              uVar6 = (ulonglong)uVar4;

+              HsmDbgBreakOnStatus(uVar4);

+              if (uVar4 == 0xc01c0002) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  WPP_SF_qqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x5f,

+                             &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+                }

+                local_d8 = local_e8;

+                HsmDbgBreakOnStatus(0);

+                uVar6 = uVar13;

+              }

+              else {

+                if ((int)uVar4 < 0) {

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x60,

+                               &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

+                  }

+                  uVar6 = 0xc0000043;

+                  HsmDbgBreakOnStatus(-0x3fffffbd);

+                }

+                else {

+                  local_d8 = local_c0;

+                }

+                if (local_e8 != (uint *)0x0) {

+                  FltReleaseContext();

+                }

+                HsmDbgBreakOnStatus((int)uVar6);

+                if ((int)uVar6 < 0) {

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    puVar9 = local_f8;

+                    puVar15 = WPP_GLOBAL_Control;

+                    HsmpGetStreamSize((longlong)local_f8);

+                    WPP_SF_qqiqLiq(*(undefined8 *)(puVar15 + 0x18),*(undefined8 *)(puVar9 + 4),

+                                   puVar9,param_1);

+                  }

+                  goto LAB_9;

+                }

+              }

+              if (local_f0 != local_d8) {

+                FltReleaseContext();

+                local_f0 = local_d8;

+              }

+              if (param_4 != (uint *)0x0) {

+                HsmpDbgBreakOnOpen((longlong)local_f0,(longlong)param_2,(longlong)param_4);

+                puVar9 = local_f8;

+                local_c0 = local_f0;

+                puVar8 = (uint *)ExAllocatePool2(0x100,0x18,0x69437348);

+                if (puVar8 == (uint *)0x0) {

+                  uVar6 = 0xc000009a;

+                  HsmDbgBreakOnStatus(-0x3fffff66);

+                  HsmDbgBreakOnStatus(-0x3fffff66);

+                  param_1 = local_c8;

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x27,

+                                 &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,local_c8);

+                  }

+                }

+                else {

+                  *puVar8 = *puVar8 | 2;

+                  HsmpFillOutAttributionInformation

+                            ((longlong)local_c0,(longlong)puVar9,(longlong)param_4,puVar8);

+                  HsmDbgBreakOnStatus(0);

+                  cVar3 = HsmOsIsSyncProviderProcessFromAttributionInfo((longlong)puVar8);

+                  uVar11 = local_c8;

+                  if ((cVar3 == '\0') && (uVar6 = uVar13, (local_f0[10] & 0x40) != 0)) {

+LAB_10:

+                    if (((local_f8[7] & 2) == 0) &&

+                       ((local_f8[7] >> 8 & 1) == 0 && (local_f0[10] & 0x20) != 0)) {

+                      local_d0 = (uint *)((ulonglong)local_d0 & 0xffffffffffffff00);

+                      puVar9 = local_f8;

+                      HsmpCldIsHydrationDisallowed

+                                ((undefined8 *)puVar8,(longlong)local_f8,(longlong)local_f0,

+                                 (char *)&local_d0);

+                      if ((char)local_d0 == '\0') goto LAB_11;

+                      uVar6 = 0xc000cf18;

+                      HsmDbgBreakOnStatus(-0x3fff30e8);

+                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                        puVar14 = local_f8;

+                        puVar15 = WPP_GLOBAL_Control;

+                        HsmpGetStreamSize((longlong)local_f8);

+                        WPP_SF_qqiqLiqD(*(undefined8 *)(puVar15 + 0x18),puVar9,puVar14,uVar11);

+                      }

+                    }

+                    else {

+LAB_11:

+                      lVar7 = HsmOsGetProcessFromAttributionInfo((longlong)puVar8);

+                      HsmOsSetPebCloudFileOpened(lVar7);

+                      if (((local_f8[7] & 2) == 0) && ((local_f0[10] & 0x20) != 0)) {

+                        local_d0 = (uint *)((ulonglong)local_d0 & 0xffffffffffffff00);

+                        puVar9 = HsmOsCheckAppCompatPolicy((undefined8 *)puVar8,2,(char *)&local_d0)

+                        ;

+                        cVar3 = (char)local_d0;

+                        if ((int)puVar9 < 0) {

+                          cVar3 = '\x01';

+                        }

+                        uVar4 = HsmpDbgFullyHydrateOnUserModeOpen();

+                        if (((char)uVar4 == '\0') || ((char)param_4[0x14] != '\x01')) {

+                          bVar1 = false;

+                        }

+                        else {

+                          bVar1 = true;

+                        }

+                        if (cVar3 != '\0' || bVar1) {

+                          HsmpRecallInitiateHydration

+                                    (local_f0,local_f8,(ulonglong)param_2,(byte *)0x10008,param_4,

+                                     (uint *)0x0,-1);

+                          uVar4 = param_4[6];

+                          uVar6 = (ulonglong)uVar4;

+                          HsmDbgBreakOnStatus(uVar4);

+                          if ((int)uVar4 < 0) {

+                            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                              puVar15 = WPP_GLOBAL_Control;

+                              HsmpGetStreamSize((longlong)local_f8);

+                              uVar12 = 0x2a;

+                              goto LAB_12;

+                            }

+                            goto LAB_13;

+                          }

+                        }

+                      }

+                      iVar5 = FltGetEcpListFromCallbackData(DAT_14,param_4,local_a0);

+                      HsmDbgBreakOnStatus(iVar5);

+                      if ((-1 < iVar5) && (local_a0[0] != 0)) {

+                        iVar5 = FltFindExtraCreateParameter

+                                          (DAT_14,local_a0[0],&GUID_ECP_CREATE_REDIRECTION);

+                        HsmDbgBreakOnStatus(iVar5);

+                        if ((-1 < iVar5) && ((3 < local_b0 && ((local_f8[7] & 0x100) == 0)))) {

+                          *(ushort *)(local_a8 + 2) = *(ushort *)(local_a8 + 2) | 0x10;

+                          FltAcknowledgeEcp(DAT_14,local_a8);

+                        }

+                      }

+                      if ((*(uint *)(*(longlong *)(param_4 + 4) + 0x20) & 0x1000) != 0) {

+                        local_f0[10] = local_f0[10] | 0x1000;

+                      }

+                      uVar4 = 1;

+                      if ((local_f8[7] & 8) == 0) {

+                        uVar4 = (local_f8[7] & 0xff) >> 3 & 2;

+                      }

+                      HsmpCldNotifyPostOperation(1,(longlong)param_4,uVar4,0,0);

+                    }

+                  }

+                  else {

+                    uVar4 = HsmpPrepareForMgmtOperation(local_c8,param_2,0xfffffffe,'\0');

+                    uVar6 = (ulonglong)uVar4;

+                    HsmDbgBreakOnStatus(uVar4);

+                    if (-1 < (int)uVar4) {

+                      local_f0[10] = local_f0[10] | 8;

+                      goto LAB_10;

+                    }

+                    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_13;

+                    puVar15 = WPP_GLOBAL_Control;

+                    HsmpGetStreamSize((longlong)local_f8);

+                    uVar12 = 0x28;

+LAB_12:

+                    WPP_SF_qqiqLiqd(*(undefined8 *)(puVar15 + 0x18),uVar12,

+                                    &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,uVar11);

+                  }

+LAB_13:

+                  if (*(longlong *)(puVar8 + 4) != 0) {

+                    ObfDereferenceObject();

+                  }

+                  if ((*puVar8 & 1) != 0) {

+                    ExFreePoolWithTag(*(undefined8 *)(puVar8 + 2),0x69417348);

+                  }

+                  param_1 = local_c8;

+                  if ((*puVar8 & 2) != 0) {

+                    ExFreePoolWithTag(puVar8,0x69437348);

+                    param_1 = local_c8;

+                  }

+                }

+              }

+            }

+          }

+        }

+      }

+LAB_9:

+      if (puVar16 != (uint *)0x0) {

+        ExFreePoolWithTag(puVar16,0x70527348);

+      }

+      goto LAB_0;

+    }

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_0;

+    uVar12 = 0x1f;

   }

-  lVar3 = *(longlong *)(unaff_RBP + -0x28);

-  *(undefined1 *)(unaff_RBX + 0xe8) = 1;

-  if (lVar3 != 0) {

-    FltClose(lVar3);

+LAB_3:

+  WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+              &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,local_e0);

+LAB_0:

+  if (local_f8 != (uint *)0x0) {

+    if ((local_f8[7] & 4) != 0) {

+      HsmpReportCorruption(param_1,*(undefined8 *)(*(longlong *)(local_f8 + 4) + 0x20),0xc000cf02);

+    }

+    FltReleaseContext(local_f8);

   }

-  if (lVar2 != 0) {

-    ObfDereferenceObject(lVar2);

+  if (local_f0 != (uint *)0x0) {

+    FltReleaseContext();

   }

-  if (unaff_R14B != '\0') {

-    ExReleaseResourceLite(unaff_RBX + 0x78);

-    KeLeaveCriticalRegion();

-  }

-  return (ulonglong)*(uint *)(unaff_RBX + 0xec);

+  return uVar6;

 }
```

## `CldHsmPurgeCache`  (modified)

```diff
--- CldHsmPurgeCache
+++ CldHsmPurgeCache
@@ -1,97 +1,10 @@
 

-uint CldHsmPurgeCache(longlong param_1)

+void CldHsmPurgeCache(longlong param_1)

 

 {

-  longlong *plVar1;

-  char *pcVar2;

-  uint uVar3;

-  undefined4 uVar4;

-  longlong lVar5;

-  undefined8 uVar6;

-  undefined *puVar7;

-  undefined2 uVar8;

-  undefined8 uVar9;

-  longlong *unaff_RBX;

-  longlong unaff_RBP;

-  longlong unaff_R12;

-  longlong unaff_R13;

-  byte unaff_R14B;

-  ulonglong unaff_R15;

-  

-  pcVar2 = (char *)((longlong)unaff_RBX + param_1 * 4 + 0x7d);

-  *pcVar2 = *pcVar2 + (char)param_1;

-  FltAcquirePushLockExclusiveEx(&DAT_0,0);

-  uVar3 = CldSyncConnectRoot(unaff_RBX,unaff_R13,unaff_R15,(undefined2 *)(unaff_RBP + 7),

-                             *(uint *)(unaff_RBP + -0x2d),*(undefined4 *)(unaff_RBP + -0x31),

-                             *(longlong *)(unaff_RBP + -0x61),(longlong *)(unaff_RBP + -0x39));

-  HsmDbgBreakOnStatus(uVar3);

-  if ((int)uVar3 < 0) {

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < unaff_R14B)) goto LAB_1;

-    uVar8 = 0x2a;

+  if (*(undefined8 **)(param_1 + 0x20) != (undefined8 *)0x0) {

+    CldStreamPurgeCache(*(undefined8 **)(param_1 + 0x20));

   }

-  else {

-    FltAcquirePushLockExclusiveEx(unaff_R13 + 0x90,0);

-    uVar6 = *(undefined8 *)(unaff_RBP + -0x61);

-    uVar3 = CldiPortInsertSyncRootNoLock

-                      (unaff_R13,*(undefined8 *)(unaff_RBP + -0x39),uVar6,unaff_R15);

-    uVar9 = 0;

-    FltReleasePushLockEx(unaff_R13 + 0x90);

-    if (-1 < (int)uVar3) {

-      plVar1 = (longlong *)(unaff_R13 + 0x68);

-      if (*plVar1 != unaff_R12) {

-        lVar5 = IoGetCurrentProcess();

-        if (*plVar1 != lVar5) {

-          uVar3 = 0xc000cf18;

-          HsmDbgBreakOnStatus(-0x3fff30e8);

-          puVar7 = WPP_GLOBAL_Control;

-          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-             (unaff_R14B <= (byte)WPP_GLOBAL_Control[0x29])) {

-            puVar7 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-            WPP_SF_qiqDZd(puVar7,uVar9,uVar6,unaff_R13);

-          }

-          uVar4 = PsGetCurrentProcessId();

-          MicrosoftTelemetryAssertTriggeredArgsMsgKM

-                    (puVar7,*(undefined4 *)(unaff_R13 + 0x80),uVar4,

-                     "ConnectingPortContext\'s SyncProvider is already set");

-          goto LAB_1;

-        }

-      }

-      uVar6 = IoGetCurrentProcess();

-      CldCaptureProcessInfo(uVar6,plVar1);

-      lVar5 = IoGetCurrentProcess();

-      HsmOsSetProcessAsSyncProvider(lVar5);

-      *(int *)(unaff_R13 + 0x8c) = *(int *)(unaff_R13 + 0x8c) + 1;

-      *(undefined4 *)(unaff_R13 + 0x104) = *(undefined4 *)(unaff_RBP + -0x11);

-      goto LAB_1;

-    }

-    CldSyncDisconnectRootByObject(*(undefined8 **)(unaff_RBP + -0x39),0xc0000002);

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < unaff_R14B)) goto LAB_1;

-    uVar8 = 0x2b;

-  }

-  WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar8,

-            &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,*(undefined8 *)(unaff_RBP + -0x69));

-LAB_1:

-  FltReleasePushLockEx(&DAT_0,0);

-  if (*(longlong *)(unaff_RBP + 0xf) != 0) {

-    ExFreePoolWithTag(*(longlong *)(unaff_RBP + 0xf),0x73557348);

-  }

-  if (*(longlong *)(unaff_RBP + -0x51) != 0) {

-    FltReleaseContext();

-  }

-  if (*(longlong *)(unaff_RBP + -0x21) != 0) {

-    FltObjectDereference();

-  }

-  if (*(longlong *)(unaff_RBP + -0x29) != 0) {

-    FltObjectDereference();

-  }

-  if (*(longlong *)(unaff_RBP + -0x49) != 0) {

-    ObfDereferenceObject();

-  }

-  return uVar3;

+  return;

 }
```

## `wil_InitializeFeatureStaging`  (modified)

```diff
--- wil_InitializeFeatureStaging
+++ wil_InitializeFeatureStaging
@@ -1,264 +1,46 @@
 

 int wil_InitializeFeatureStaging(void)

 

 {

-  code *pcVar1;

-  char cVar2;

-  undefined4 in_EAX;

-  int iVar3;

-  undefined4 in_register_00000004;

+  bool bVar1;

+  int iVar2;

+  longlong *plVar3;

+  undefined **ppuVar4;

+  undefined8 local_res8;

   

-  cVar2 = (char)in_EAX;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + cVar2;

-  pcVar1 = (code *)swi(3);

-  iVar3 = (*pcVar1)();

-  return iVar3;

+  bVar1 = false;

+  if (g_wil_details_isFeatureStagingInitialized == 0) {

+    g_wil_details_isFeatureStagingInitialized = 1;

+    local_res8 = RtlQueryFeatureConfigurationChangeStamp();

+    wil_details_PopulateInitialConfiguredFeatureStates();

+    wil_details_EvaluateFeatureDependencies();

+    ppuVar4 = &wil_details_featureDescriptors_a;

+    while (plVar3 = wil_details_FeatureDescriptors_SkipPadding((longlong *)ppuVar4),

+          plVar3 != (longlong *)0x0) {

+      if (((*(char *)((longlong)plVar3 + 0x1d) == '\0') &&

+          (*(char *)((longlong)plVar3 + 0x1e) == '\0')) &&

+         (*(char *)((longlong)plVar3 + 0x1c) == '\0')) {

+        iVar2 = RtlRegisterFeatureConfigurationChangeNotification

+                          (wil_details_ReevaluateOnFeatureConfigurationChange,0,&local_res8,

+                           &g_wil_details_featureChangeNotification);

+        if (iVar2 == 0) {

+          bVar1 = true;

+        }

+        else {

+          g_wil_details_featureChangeNotification = 0;

+        }

+        break;

+      }

+      ppuVar4 = (undefined **)(plVar3 + 7);

+    }

+    iVar2 = wil_details_RegisterFeatureUsageProvider();

+    if (iVar2 != 0) {

+      if (!bVar1) {

+        return iVar2;

+      }

+      return 0;

+    }

+  }

+  return 0;

 }
```

## `HsmiBitmapNORMALOpenOnDisk`  (modified)

```diff
--- HsmiBitmapNORMALOpenOnDisk
+++ HsmiBitmapNORMALOpenOnDisk
@@ -1,54 +1,591 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 uint HsmiBitmapNORMALOpenOnDisk

-               (ulonglong *******param_1,uint param_2,ulonglong *******param_3,

-               ulonglong *******param_4)

+               (ulonglong *param_1,uint param_2,ulonglong *param_3,ulonglong param_4)

 

 {

-  uint uVar1;

-  void *in_RAX;

-  uint unaff_EBX;

-  longlong unaff_RBP;

-  undefined8 *unaff_RSI;

-  undefined8 *unaff_RDI;

-  undefined8 unaff_R12;

-  undefined8 unaff_R13;

-  ulonglong unaff_R14;

-  void *unaff_R15;

-  undefined8 uStack0000000000000038;

-  undefined4 uStack0000000000000040;

+  longlong *plVar1;

+  byte bVar2;

+  uint uVar3;

+  int iVar4;

+  ulonglong uVar5;

+  longlong lVar6;

+  ulonglong uVar7;

+  undefined *puVar8;

+  undefined2 uVar9;

+  ulonglong uVar10;

+  int *piVar11;

+  ulonglong uVar12;

+  char cVar13;

+  longlong lVar14;

+  char *pcVar15;

+  ulonglong uVar16;

+  uint uVar17;

+  uint uVar18;

+  uint uVar19;

+  undefined1 auStackY_168 [32];

+  ulonglong *in_stack_fffffffffffffeb8;

+  undefined4 uVar20;

+  ulonglong *in_stack_fffffffffffffec8;

+  ulonglong *puVar21;

+  uint local_108;

+  undefined1 local_104;

+  char local_103;

+  int *local_100;

+  uint local_f8;

+  uint local_f4;

+  ulonglong local_f0;

+  undefined8 local_e8;

+  uint local_e0;

+  uint local_dc;

+  longlong local_d8 [2];

+  ulonglong local_c8;

+  undefined8 uStack_c0;

+  ulonglong *local_b8;

+  ulonglong *local_b0;

+  ulonglong local_a8;

+  undefined8 uStack_a0;

+  ulonglong local_98;

+  undefined8 uStack_90;

+  undefined8 local_88;

+  undefined8 uStack_80;

+  undefined8 local_78;

+  ulonglong local_68;

+  undefined8 uStack_60;

+  ulonglong local_58;

+  ulonglong uStack_50;

+  undefined8 local_48;

+  ulonglong local_40;

   

-  *(int *)(unaff_RDI + 7) = (int)in_RAX;

-  if (in_RAX == (void *)0x0) {

-    unaff_EBX = 0xc000009a;

-    HsmDbgBreakOnStatus(-0x3fffff66);

+  local_40 = __security_cookie ^ (ulonglong)auStackY_168;

+  uVar19 = (uint)param_3;

+  uVar12 = 0;

+  uVar18 = 0;

+  local_f8 = 0;

+  local_d8[0] = 0;

+  local_100 = (int *)0x0;

+  local_c8 = 0;

+  uStack_c0 = 0;

+  local_103 = '\0';

+  local_e0 = uVar19;

+  local_b0 = param_1;

+  local_a8 = param_4;

+  FltAcquirePushLockExclusiveEx(param_1 + 6,0);

+  if (param_2 != 0) {

+    uVar5 = Feature_3051065658__private_IsEnabledDeviceUsageNoInline();

+    if (((int)uVar5 == 0) || ((uVar19 < 4 && (param_2 < 2)))) {

+      if (param_1[0x14] == 0) {

+        param_3 = (ulonglong *)0x65427348;

+        uVar5 = ExAllocatePool2(0x100,0x28);

+        param_1[0x14] = uVar5;

+        if (uVar5 == 0) {

+          uVar18 = 0xc000009a;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (uVar18 = 0xc000009a, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_iisd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x3f,param_3,param_1,*param_1,

+                        (char *)(param_1 + 4));

+          }

+          goto LAB_0;

+        }

+      }

+      uVar5 = param_1[5];

+      local_b8 = param_1 + 2;

+      uVar19 = (uint)*local_b8;

+      local_f4 = 1 << ((byte)(uVar19 >> 6) & 0x1f);

+      uVar7 = uVar12;

+      local_e8 = uVar5;

+      if ((uVar19 & 8) == 0) {

+        local_dc = 0;

+        local_103 = '\x01';

+        uVar19 = local_dc;

+        local_f8 = local_dc;

+      }

+      else {

+        local_f8 = uVar19 >> 0xc & 7;

+        uVar19 = local_f8;

+        local_dc = local_f8;

+        if (local_f8 == param_2) goto LAB_0;

+      }

+      for (; uVar10 = (ulonglong)local_f4, uVar16 = uVar12, uVar19 < param_2; uVar19 = uVar19 + 1) {

+        uVar18 = (uint)*local_b8 >> 0xc & 7;

+        local_104 = uVar18 <= uVar19;

+        param_3 = (ulonglong *)CONCAT71((int7)((ulonglong)param_3 >> 8),local_104);

+        plVar1 = (longlong *)(param_1[0x14] + (ulonglong)uVar19 * 8);

+        if (*plVar1 == 0) {

+          lVar6 = (longlong)((local_a8 - 1) + uVar10) / (longlong)uVar10;

+          uVar5 = uVar12;

+          if (param_2 != 0) {

+            do {

+              uVar3 = (uint)uVar5;

+              if (uVar19 <= uVar3) break;

+              lVar14 = (-(ulonglong)(uVar3 != 0) & 0xffffffffffffc010) + 0x7fe0;

+              lVar6 = (lVar6 + -1 + lVar14) / lVar14;

+              uVar5 = (ulonglong)(uVar3 + 1);

+            } while (uVar3 + 1 < param_2);

+            param_3 = (ulonglong *)(ulonglong)(byte)local_104;

+          }

+          lVar14 = (-(ulonglong)(uVar19 != 0) & 0xffffffffffffc010) + 0x7fe0;

+          local_98 = ((lVar6 + -1 + lVar14) / lVar14 + 1) * 0x2000;

+          puVar21 = param_1 + 4;

+          in_stack_fffffffffffffec8 = &local_98;

+          cVar13 = (char)param_3;

+          in_stack_fffffffffffffeb8 =

+               (ulonglong *)CONCAT71((int7)((ulonglong)in_stack_fffffffffffffeb8 >> 8),cVar13);

+          param_3 = (ulonglong *)(ulonglong)(uint)*puVar21;

+          uVar7 = HsmiBitmapNormalOpenStream

+                            (local_e8,*param_1,(char)(uint)*puVar21,uVar19,cVar13,'\0',

+                             in_stack_fffffffffffffec8,local_d8,plVar1);

+          local_108 = (uint)uVar7;

+          uVar7 = uVar7 & 0xffffffff;

+          HsmDbgBreakOnStatus(local_108);

+          if ((int)local_108 < 0) {

+            puVar8 = WPP_GLOBAL_Control;

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              pcVar15 = "create";

+              if (uVar19 < uVar18) {

+                pcVar15 = "open";

+              }

+              puVar8 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

+              WPP_SF_sqisdd(puVar8,0x40,param_3,pcVar15,param_1,*param_1,(char *)(param_1 + 4));

+            }

+            goto LAB_1;

+          }

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+            pcVar15 = "Created";

+            if (uVar19 < uVar18) {

+              pcVar15 = "Opened";

+            }

+            in_stack_fffffffffffffeb8 = param_1;

+            WPP_SF_sqisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x41,param_3,pcVar15,param_1,

+                          *param_1,(char *)puVar21);

+            in_stack_fffffffffffffec8 = puVar21;

+          }

+          uVar5 = local_e8;

+          if (local_d8[0] != 0) {

+            FltClose();

+            local_d8[0] = 0;

+            uVar5 = local_e8;

+          }

+        }

+        while( true ) {

+          uVar3 = (uint)uVar16;

+          if (local_e0 <= uVar3) break;

+          local_88 = 0;

+          uStack_80 = 0;

+          local_78 = 0;

+          local_f0 = (ulonglong)uVar19 * 3 + uVar16;

+          plVar1 = (longlong *)(param_1[0x14] + 0x10 + local_f0 * 8);

+          if (*plVar1 == 0) {

+            uVar18 = 0;

+            uVar20 = (undefined4)((ulonglong)in_stack_fffffffffffffeb8 >> 0x20);

+            param_3 = (ulonglong *)(ulonglong)(uint)param_1[4];

+            uVar5 = HsmiBitmapNormalOpenStream

+                              (uVar5,*param_1,(char)(uint)param_1[4],uVar19,'\0','\x01',0,local_d8,

+                               plVar1);

+            local_108 = (uint)uVar5;

+            HsmDbgBreakOnStatus(local_108);

+            if ((int)local_108 < 0) {

+              puVar8 = WPP_GLOBAL_Control;

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+              uVar9 = 0x42;

+              goto LAB_2;

+            }

+            local_78 = CONCAT44(local_78._4_4_,0x80);

+            local_88 = CONCAT44(local_88._4_4_,uVar3);

+            in_stack_fffffffffffffec8 = (ulonglong *)((ulonglong)uVar18 << 0x20);

+            in_stack_fffffffffffffeb8 = (ulonglong *)CONCAT44(uVar20,0x18);

+            param_3 = (ulonglong *)0x900fc;

+            uVar18 = FltFsControlFile(*(undefined8 *)(local_e8 + 0x20),

+                                      *(undefined8 *)(param_1[0x14] + 0x10 + local_f0 * 8),0x900fc,

+                                      &local_88);

+            uVar7 = (ulonglong)uVar18;

+            HsmDbgBreakOnStatus(uVar18);

+            if ((int)uVar18 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+              uVar9 = 0x43;

+              goto LAB_3;

+            }

+            if (local_d8[0] != 0) {

+              FltClose();

+              local_d8[0] = 0;

+            }

+          }

+          uVar5 = local_e8;

+          uVar16 = (ulonglong)(uVar3 + 1);

+        }

+      }

+      while (uVar19 = (uint)uVar16, uVar5 = uVar12, uVar19 < param_2) {

+        local_58 = 0;

+        uStack_50 = 0;

+        local_48 = 0;

+        uVar5 = *local_b8;

+        lVar6 = (longlong)((local_a8 - 1) + uVar10) / (longlong)uVar10;

+        uVar7 = uVar12;

+        if (param_2 != 0) {

+          do {

+            uVar18 = (uint)uVar7;

+            if (uVar19 <= uVar18) break;

+            lVar14 = (-(ulonglong)(uVar18 != 0) & 0xffffffffffffc010) + 0x7fe0;

+            lVar6 = (lVar6 + -1 + lVar14) / lVar14;

+            uVar7 = (ulonglong)(uVar18 + 1);

+          } while (uVar18 + 1 < param_2);

+        }

+        lVar14 = (-(ulonglong)(uVar19 != 0) & 0xffffffffffffc010) + 0x7fe0;

+        local_f0 = ((lVar6 + -1 + lVar14) / lVar14 + 1) * 0x2000;

+        in_stack_fffffffffffffeb8 =

+             (ulonglong *)CONCAT44((int)((ulonglong)in_stack_fffffffffffffeb8 >> 0x20),5);

+        param_3 = &local_58;

+        local_108 = FltQueryInformationFile

+                              (*(undefined8 *)(local_e8 + 0x20),

+                               *(undefined8 *)(param_1[0x14] + uVar16 * 8),param_3,0x18);

+        HsmDbgBreakOnStatus(local_108);

+        if ((int)local_108 < 0) {

+          puVar8 = WPP_GLOBAL_Control;

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+          uVar9 = 0x44;

+          goto LAB_2;

+        }

+        if (uVar19 < ((uint)uVar5 >> 0xc & 7)) {

+          if ((longlong)uStack_50 < (longlong)local_f0) {

+            uVar18 = 0xc000cf02;

+            HsmDbgBreakOnStatus(-0x3fff30fe);

+            goto LAB_0;

+          }

+          if (uStack_50 != local_f0) {

+            uStack_50 = uVar12;

+          }

+        }

+        if ((longlong)uStack_50 < (longlong)local_f0) {

+          in_stack_fffffffffffffeb8 =

+               (ulonglong *)CONCAT44((int)((ulonglong)in_stack_fffffffffffffeb8 >> 0x20),0x14);

+          local_108 = FltSetInformationFile

+                                (*(undefined8 *)(local_e8 + 0x20),

+                                 *(undefined8 *)(param_1[0x14] + uVar16 * 8),&local_f0,8);

+          HsmDbgBreakOnStatus(local_108);

+          if ((int)local_108 < 0) {

+            puVar8 = WPP_GLOBAL_Control;

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+            uVar9 = 0x45;

+          }

+          else {

+            local_108 = HsmpSetFileVDL(*(undefined8 *)(local_e8 + 0x20),

+                                       *(undefined8 *)(param_1[0x14] + uVar16 * 8),local_f0);

+            HsmDbgBreakOnStatus(local_108);

+            if (-1 < (int)local_108) goto LAB_4;

+            puVar8 = WPP_GLOBAL_Control;

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+            uVar9 = 0x46;

+          }

+          puVar8 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

+          WPP_SF_qisdil(puVar8,uVar9,param_1 + 4,param_1,*param_1,(char *)(param_1 + 4));

+          goto LAB_1;

+        }

+        local_f0 = uStack_50;

+LAB_4:

+        uVar7 = (ulonglong)local_108;

+        param_3 = (ulonglong *)param_1[0x14];

+        puVar21 = param_3 + uVar16 + 1;

+        uVar5 = *puVar21;

+        if (uVar5 == 0) {

+          param_3 = (ulonglong *)param_3[uVar16];

+          uVar18 = HsmFileCacheCreateFileObject

+                             (*(undefined8 *)(local_e8 + 0x20),*(uint *)(local_e8 + 0x68),

+                              (undefined *)param_3,local_f0,in_stack_fffffffffffffeb8,param_1,

+                              in_stack_fffffffffffffec8,(longlong *)puVar21);

+          uVar7 = (ulonglong)uVar18;

+          HsmDbgBreakOnStatus(uVar18);

+          if ((int)uVar18 < 0) {

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              uVar9 = 0x47;

+LAB_3:

+              WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,param_3,param_1,*param_1

+                           ,(char *)(param_1 + 4));

+            }

+            goto LAB_0;

+          }

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+            uVar9 = 0x48;

+            goto LAB_5;

+          }

+        }

+        else {

+          HsmpFileCacheSetFileSize(uVar5,local_f0);

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+            uVar9 = 0x49;

+LAB_5:

+            in_stack_fffffffffffffec8 =

+                 (ulonglong *)CONCAT44((int)((ulonglong)in_stack_fffffffffffffec8 >> 0x20),uVar19);

+            param_3 = param_1 + 4;

+            in_stack_fffffffffffffeb8 = (ulonglong *)*param_1;

+            WPP_SF_qisdi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,param_3,param_1,

+                         in_stack_fffffffffffffeb8,(char *)param_3);

+          }

+        }

+        uVar10 = (ulonglong)local_f4;

+        uVar16 = (ulonglong)(uVar19 + 1);

+      }

+LAB_6:

+      uVar19 = (uint)uVar5;

+      local_f4 = uVar19;

+      if (param_2 <= uVar19) goto LAB_7;

+      uVar18 = (uint)*local_b8 >> 0xc;

+      local_e0 = uVar18 & 7;

+      local_e8 = CONCAT44(local_e8._4_4_,uVar18) & 0xffffffff00000007;

+      if (uVar19 < local_e0) {

+LAB_8:

+        uVar5 = (longlong)(param_1[0x12] + 1) % 2 << 0xc;

+        if ((int)local_c8 != 0) {

+          local_68 = local_c8;

+          uStack_60 = uStack_c0;

+          HsmIBitmapNORMALUnpinBlock((int *)&local_68);

+          local_c8 = local_c8 & 0xffffffff00000000;

+          local_100 = (int *)0x0;

+        }

+        in_stack_fffffffffffffeb8 = &local_c8;

+        uVar7 = HsmiBitmapNORMALLoadFromDisk

+                          (param_1,uVar19,uVar5,(ulonglong *)&local_100,in_stack_fffffffffffffeb8);

+        uVar18 = (uint)uVar7;

+        HsmDbgBreakOnStatus(uVar18);

+        if ((int)uVar18 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4d,uVar5,param_1,*param_1,

+                          (char *)(param_1 + 4));

+          }

+          goto LAB_0;

+        }

+        bVar2 = *(byte *)(local_100 + 1);

+        param_3 = (ulonglong *)(ulonglong)bVar2;

+        if (CONCAT11(bVar2,*(undefined1 *)((longlong)local_100 + 5)) ==

+            *(short *)((longlong)local_100 + 6)) {

+          if (*local_100 == 0x704d7442) {

+            local_108 = HsmiBitmapCheckVersion(bVar2,*(undefined1 *)((longlong)local_100 + 5));

+            HsmDbgBreakOnStatus(local_108);

+            if ((int)local_108 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                param_3 = param_1 + 4;

+                in_stack_fffffffffffffeb8 = (ulonglong *)*param_1;

+                WPP_SF_qisdddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

+                               (ulonglong)*(byte *)(local_100 + 1),param_3,param_1,

+                               in_stack_fffffffffffffeb8,(char *)param_3);

+              }

+            }

+            else if (local_100[2] == uVar19) {

+              if ((*(longlong *)(local_100 + 4) != 0) &&

+                 (*(longlong *)(local_100 + 4) < (longlong)param_1[0x12])) {

+                local_108 = 0xc000cf02;

+                HsmDbgBreakOnStatus(-0x3fff30fe);

+                if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                   (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 &&

+                    (1 < (byte)WPP_GLOBAL_Control[0x29])))) {

+                  in_stack_fffffffffffffeb8 = (ulonglong *)*param_1;

+                  WPP_SF_qisdiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),param_1 + 4,param_3,

+                                 param_1,in_stack_fffffffffffffeb8,(char *)(param_1 + 4));

+                }

+              }

+            }

+            else {

+              local_108 = 0xc000cf02;

+              HsmDbgBreakOnStatus(-0x3fff30fe);

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                param_3 = param_1 + 4;

+                in_stack_fffffffffffffeb8 = (ulonglong *)*param_1;

+                WPP_SF_qisddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x51,param_3,param_1,

+                              in_stack_fffffffffffffeb8,(char *)param_3);

+              }

+            }

+          }

+          else {

+            local_108 = 0xc000cf02;

+            HsmDbgBreakOnStatus(-0x3fff30fe);

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              in_stack_fffffffffffffeb8 = (ulonglong *)*param_1;

+              WPP_SF_qisdLLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),param_1 + 4,param_3,param_1,

+                             in_stack_fffffffffffffeb8,(char *)(param_1 + 4));

+            }

+          }

+        }

+        else {

+          local_108 = 0xc000003f;

+          HsmDbgBreakOnStatus(-0x3fffffc1);

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            param_3 = (ulonglong *)(ulonglong)*(byte *)(local_100 + 1);

+            in_stack_fffffffffffffeb8 = (ulonglong *)*param_1;

+            WPP_SF_qisdDDLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

+                            (ulonglong)*(byte *)((longlong)local_100 + 5),param_3,param_1,

+                            in_stack_fffffffffffffeb8,(char *)(param_1 + 4));

+          }

+        }

+        uVar7 = (ulonglong)local_108;

+        if ((int)local_108 < 0) {

+          puVar8 = WPP_GLOBAL_Control;

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+          uVar9 = 0x54;

+          goto LAB_2;

+        }

+      }

+      else {

+        local_104 = 0;

+        if ((int)local_c8 != 0) {

+          local_a8 = local_c8;

+          uStack_a0 = uStack_c0;

+          HsmIBitmapNORMALUnpinBlock((int *)&local_a8);

+          local_c8 = local_c8 & 0xffffffff00000000;

+          local_100 = (int *)0x0;

+        }

+        uVar5 = HsmpFileCachePreparePinWrite

+                          (*(longlong *)(param_1[0x14] + 8 + uVar5 * 8),0,(undefined *)param_3,1,

+                           in_stack_fffffffffffffeb8,&uStack_c0,&local_100,&local_104);

+        local_108 = (uint)uVar5;

+        HsmDbgBreakOnStatus(local_108);

+        if ((int)local_108 < 0) {

+          puVar8 = WPP_GLOBAL_Control;

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+          uVar9 = 0x4a;

+LAB_2:

+          puVar8 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

+          WPP_SF_qisdd(puVar8,uVar9,param_3,param_1,*param_1,(char *)(param_1 + 4));

+LAB_1:

+          uVar18 = HsmiBitmapTranslateIOStatus(puVar8,local_108);

+          HsmDbgBreakOnStatus(uVar18);

+          goto LAB_0;

+        }

+        local_c8 = CONCAT44(local_c8._4_4_,1);

+        *local_100 = 0x704d7442;

+        *(undefined1 *)(local_100 + 1) = 1;

+        *(undefined1 *)((longlong)local_100 + 5) = 3;

+        *(undefined2 *)((longlong)local_100 + 6) = 0x103;

+        local_100[2] = uVar19;

+        param_3 = (ulonglong *)0xffc;

+        piVar11 = local_100;

+        iVar4 = RtlComputeCrc32(0);

+        local_100[0x3ff] = iVar4;

+        if ((int)local_108 < 0) {

+          puVar8 = WPP_GLOBAL_Control;

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            puVar8 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

+            WPP_SF_dd(puVar8,0x4b,&WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,uVar19);

+          }

+          goto LAB_1;

+        }

+        uVar7 = HsmpFileCacheSetAddressRangeModified(local_100,piVar11,param_3);

+        local_108 = (uint)uVar7;

+        uVar7 = uVar7 & 0xffffffff;

+        HsmDbgBreakOnStatus(local_108);

+        if ((int)local_108 < 0) {

+          puVar8 = WPP_GLOBAL_Control;

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            puVar8 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

+            WPP_SF_d(puVar8,0x4c,&WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,local_108);

+          }

+          goto LAB_1;

+        }

+        if (uVar19 < local_e0) goto LAB_8;

+      }

+      uVar5 = (ulonglong)(uVar19 + 1);

+      goto LAB_6;

+    }

+    uVar18 = 0xc000cf02;

+    HsmDbgBreakOnStatus(-0x3fff30fe);

     if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      WPP_SF_iisd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x66,param_3,unaff_R13,unaff_R12,

-                  (char *)(unaff_RBP + 0x67));

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+       (uVar18 = 0xc000cf02, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+      WPP_SF_qisdDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(ulonglong)param_2,param_3,param_1,

+                    *param_1,(char *)(param_1 + 4));

+      uVar18 = 0xc000cf02;

     }

-    HsmpBitmapRelease((longlong)unaff_RDI);

   }

-  else {

-    memmove(in_RAX,unaff_R15,unaff_R14 & 0xffffffff);

-    uVar1 = *(uint *)(unaff_RDI + 2);

-    *(undefined8 *)(unaff_RBP + 7) = 0;

-    *(undefined8 **)(unaff_RBP + -0x11) = unaff_RDI;

-    *(uint *)(unaff_RBP + -9) = uVar1 >> 0xc & 7;

-    uVar1 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RDI);

-    *(uint *)(unaff_RBP + -5) = uVar1;

-    *(undefined8 *)(unaff_RBP + -1) = unaff_R12;

-    HsmExpandKernelStackAndCallout(HsmiBitmapNORMALOpenOnDiskCallout,(int *)(unaff_RBP + 7));

+  goto LAB_0;

+LAB_7:

+  uVar18 = (uint)uVar7;

+  if (local_103 != '\0') {

+    *(uint *)(param_1 + 2) = (uint)param_1[2] | 8;

+  }

+LAB_0:

+  if (local_d8[0] != 0) {

+    FltClose();

+  }

+  if ((int)local_c8 != 0) {

+    local_98 = local_c8;

+    uStack_90 = uStack_c0;

+    HsmIBitmapNORMALUnpinBlock((int *)&local_98);

+  }

+  if ((int)uVar18 < 0) {

+    uVar5 = param_1[0x14];

+    for (uVar19 = local_f8; (local_f8 = uVar19, uVar5 != 0 && (uVar19 == 0)); uVar19 = uVar19 + 1) {

+      if (*(longlong *)(uVar5 + 8) != 0) {

+        HsmFileCacheCloseFileObject(*(longlong *)(uVar5 + 8));

+        *(undefined8 *)(param_1[0x14] + 8) = 0;

+      }

+      if (*(longlong *)param_1[0x14] != 0) {

+        ObfDereferenceObject();

+        *(undefined8 *)param_1[0x14] = 0;

+      }

+      uVar3 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)param_1);

+      uVar5 = uVar12;

+      if (uVar3 != 0) {

+        do {

+          if (*(longlong *)(param_1[0x14] + 0x10 + uVar5 * 8) != 0) {

+            ObfDereferenceObject();

+            *(undefined8 *)(param_1[0x14] + 0x10 + uVar5 * 8) = 0;

+          }

+          uVar17 = (int)uVar5 + 1;

+          uVar3 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)param_1);

+          uVar5 = (ulonglong)uVar17;

+          uVar19 = local_f8;

+        } while (uVar17 < uVar3);

+      }

+      uVar5 = param_1[0x14];

+    }

     if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      uStack0000000000000038 = unaff_RDI[0x12];

-      uStack0000000000000040 = *(undefined4 *)(unaff_RDI + 3);

-      WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x67,*unaff_RDI,unaff_RDI,*unaff_RDI,

-                    (char *)(unaff_RDI + 4));

+        ((*(uint *)((longlong)WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+       (1 < *(byte *)((longlong)WPP_GLOBAL_Control + 0x29))) {

+      WPP_SF_qisdd(*(undefined **)((longlong)WPP_GLOBAL_Control + 0x18),0x55,(ulonglong)uVar19,

+                   param_1,*param_1,(char *)(param_1 + 4));

     }

-    *unaff_RSI = unaff_RDI;

   }

-  return unaff_EBX;

+  *(uint *)(param_1 + 3) = uVar18;

+  FltReleasePushLockEx(param_1 + 6,0);

+  return uVar18;

 }
```

## `HsmiCldGetSyncRootFileIdByFileObject`  (modified)

```diff
--- HsmiCldGetSyncRootFileIdByFileObject
+++ HsmiCldGetSyncRootFileIdByFileObject
@@ -1,203 +1,291 @@
 

-/* WARNING: Variable defined which should be unmapped: param_5 */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 uint HsmiCldGetSyncRootFileIdByFileObject

                (longlong param_1,ulonglong param_2,ulonglong *param_3,int *param_4,

                undefined4 *param_5)

 

 {

-  char cVar1;

-  bool bVar2;

-  uint uVar3;

-  int iVar4;

-  char *in_RAX;

-  ulonglong uVar5;

-  uint *puVar6;

-  uint uVar7;

-  uint *puVar8;

-  void *pvVar9;

-  uint uVar10;

-  uint *unaff_RDI;

-  uint *puVar11;

-  uint *in_R11;

-  longlong lVar12;

-  longlong unaff_R13;

-  uint uVar13;

-  ulonglong unaff_R14;

-  uint unaff_R15D;

-  uint *in_stack_00000068;

-  uint *in_stack_00000070;

-  uint *puStack0000000000000078;

-  longlong in_stack_00000090;

-  longlong in_stack_00000098;

-  undefined8 in_stack_000000a0;

-  uint uStack00000000000000e8;

-  undefined8 in_stack_000000f0;

-  longlong in_stack_00000120;

-  longlong in_stack_00000128;

-  uint in_stack_00000130;

-  int iStack0000000000000140;

-  undefined4 uStack0000000000000144;

+  undefined8 uVar1;

+  uint *puVar2;

+  ulonglong uVar3;

+  ushort uVar4;

+  uint uVar5;

+  uint uVar6;

+  undefined8 *puVar7;

+  ulonglong uVar8;

+  short sVar9;

+  undefined2 uVar10;

+  undefined8 *puVar11;

+  undefined8 *puVar12;

+  uint *puVar13;

+  undefined4 uVar14;

+  int iVar15;

+  undefined8 *puVar16;

+  undefined1 auStack_118 [32];

+  ulonglong local_f8;

+  undefined8 local_f0;

+  undefined4 local_e8;

+  ulonglong local_d8 [2];

+  undefined4 *local_c8;

+  undefined8 *puStack_c0;

+  ulonglong local_b8;

+  undefined4 *local_a8;

+  undefined8 *puStack_a0;

+  ulonglong local_98;

+  ulonglong *local_90;

+  undefined8 local_88;

+  uint *puStack_80;

+  int *local_78;

+  undefined8 local_70;

+  undefined8 uStack_68;

+  undefined8 local_60;

+  undefined8 uStack_58;

+  ulonglong local_50;

   

-  *in_RAX = *in_RAX + (char)in_RAX;

-  uVar10 = (uint)unaff_RDI;

-  uVar5 = (ulonglong)unaff_RDI & 0xffffffff;

-  lVar12 = (ulonglong)*(uint *)(in_stack_00000128 + 0x10) + in_stack_00000128;

-  uStack00000000000000e8 = *(uint *)(in_stack_00000128 + 0x14);

-  puVar6 = in_R11 + 0x14;

-  puStack0000000000000078 = in_R11;

-  _iStack0000000000000140 = puVar6;

-  while( true ) {

-    uVar13 = (uint)uVar5;

-    if (uStack00000000000000e8 <= (uint)unaff_R14) break;

-    in_stack_00000098 = unaff_R14 * 3;

-    uVar7 = *(uint *)(lVar12 + unaff_R14 * 0x18);

-    if (uVar7 != 0) {

-      for (puVar11 = *(uint **)puVar6; (puVar11 != puVar6 && (puVar11[4] <= uVar7));

-          puVar11 = *(uint **)puVar11) {

-        if ((puVar11[4] == uVar7) &&

-           ((puVar11[5] == uVar10 &&

-            (bVar2 = HsmiIsLockOwned((longlong)puVar11,(ulonglong *)&stack0x00000080),

-            puVar6 = _iStack0000000000000140, !bVar2)))) {

-          HsmDbgBreakOnStatus(-0x3fff30e6);

-          in_stack_00000070 = unaff_RDI;

-          in_stack_00000068 = unaff_RDI;

-          uVar10 = 0xc000cf1a;

-          goto LAB_0;

-        }

-      }

-      param_4 = (int *)(puStack0000000000000078 + 0x10);

-      puVar8 = unaff_RDI;

-      for (puVar11 = *(uint **)param_4;

-          (puVar11 != (uint *)param_4 && (puVar8 = puVar11, puVar11[4] != uVar7));

-          puVar11 = *(uint **)puVar11) {

-      }

-      if (puVar8 != (uint *)0x0) {

-        if (*(char *)((longlong)puVar8 + 0x1b) == '\0') {

-          uVar7 = puVar8[6];

-        }

-        else {

-          uVar7 = puVar8[7];

-        }

-        uVar7 = uVar7 & 0xffffff;

-        puVar6 = _iStack0000000000000140;

-        if (uVar7 <= *(uint *)(lVar12 + 4 + in_stack_00000098 * 8)) {

-          uVar3 = puVar8[6] & 0xffffff;

-          if (uVar3 <= uVar13) {

-            uVar3 = uVar13;

-          }

-          uVar5 = (ulonglong)uVar3;

-          if ((*(char *)((longlong)puVar8 + 0x1b) != '\0') && (unaff_R15D < uVar7 + 4)) {

-            unaff_R15D = uVar7 + 4;

-          }

-        }

-      }

-    }

-    unaff_R14 = (ulonglong)((uint)unaff_R14 + 1);

-  }

-  if ((uVar13 == 0) ||

-     (in_stack_00000068 = (uint *)ExAllocatePool2(0x100,uVar5,0x72507348,param_4),

-     in_stack_00000068 != (uint *)0x0)) {

-    if ((unaff_R15D == 0) ||

-       (in_stack_00000070 = (uint *)ExAllocatePool2(0x100,unaff_R15D,0x72507348),

-       in_stack_00000070 != (uint *)0x0)) {

-      uVar5 = (ulonglong)unaff_RDI & 0xffffffff;

-      while( true ) {

-        _iStack0000000000000140 = (uint *)CONCAT44(uStack0000000000000144,(uint)uVar5);

-        if (*(uint *)(in_stack_00000128 + 0x14) <= (uint)uVar5) break;

-        uVar13 = *(uint *)(lVar12 + uVar5 * 0x18);

-        if (uVar13 != 0) {

-          puVar6 = puStack0000000000000078 + 0x10;

-          puVar8 = unaff_RDI;

-          for (puVar11 = *(uint **)puVar6;

-              (puVar11 != puVar6 && (puVar8 = puVar11, puVar11[4] != uVar13));

-              puVar11 = *(uint **)puVar11) {

-          }

-          if ((puVar11 == puVar6) || (uVar13 = puVar8[6] & 0xffffff, uVar13 == 0)) {

-LAB_1:

-            *(uint **)(lVar12 + 0x10 + uVar5 * 0x18) = unaff_RDI;

-          }

-          else {

-            puVar6 = puVar8 + 7;

-            if (*(char *)((longlong)puVar8 + 0x1b) != (char)unaff_RDI) {

-              uVar13 = *puVar6 & 0xffffff;

-            }

-            *(uint *)(lVar12 + 0x10 + uVar5 * 0x18) = uVar13;

-            if (*(uint *)(lVar12 + 4 + uVar5 * 0x18) < uVar13) {

-              *(undefined4 *)(lVar12 + 0x14 + uVar5 * 0x18) = 0x80000005;

-            }

-            else {

-              in_stack_00000090 = (ulonglong)puVar8[5] + 8;

-              uVar7 = FltReadFile(in_stack_000000a0,*(undefined8 *)(puStack0000000000000078 + 6),

-                                  &stack0x00000090,puVar8[6] & 0xffffff);

-              HsmDbgBreakOnStatus(uVar7);

-              if ((int)uVar7 < 0) {

-                uVar10 = uVar7;

-                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                  WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x21,

-                              &WPP_763fdbe3267e397a59cf662dc14be4ed_Traceguids,in_stack_000000f0);

-                }

-                goto LAB_0;

-              }

-              puVar11 = in_stack_00000068;

-              if (*(char *)((longlong)puVar8 + 0x1b) != (char)unaff_RDI) {

-                uStack00000000000000e8 = uVar10;

-                iVar4 = HsmiDecompressBuffer

-                                  ((ushort)(byte)(puVar8[6] >> 0x18),

-                                   *(byte *)((longlong)puVar8 + 0x1f),in_stack_00000070,uVar13 + 4,

-                                   in_stack_00000068,puVar8[6] & 0xffffff,&stack0x000000e8);

-                HsmDbgBreakOnStatus(iVar4);

-                if ((iVar4 < 0) || (uStack00000000000000e8 != uVar13 + 4)) {

-                  HsmDbgBreakOnCorruption();

-                  goto LAB_1;

-                }

-                puVar11 = in_stack_00000070 + 1;

-                puVar6 = in_stack_00000070;

-              }

-              pvVar9 = *(void **)(lVar12 + 8 + uVar5 * 0x18);

-              cVar1 = FltIs32bitProcess(in_stack_00000120);

-              if (cVar1 != '\0') {

-                pvVar9 = (void *)((ulonglong)pvVar9 & 0xffffffff);

-              }

-              uStack00000000000000e8 = RtlCrc32(puVar11,(ulonglong)uVar13,0);

-              RtlCopyToUser(pvVar9,puVar11,(ulonglong)uVar13);

-              uVar13 = uVar10;

-              if (uStack00000000000000e8 != *puVar6) {

-                HsmDbgBreakOnCorruption();

-                uVar13 = 0x8000cf00;

-              }

-              *(uint *)(lVar12 + 0x14 + uVar5 * 0x18) = uVar13;

-            }

-          }

-        }

-        uVar5 = (ulonglong)(iStack0000000000000140 + 1);

-      }

-      *(ulonglong *)(in_stack_00000120 + 0x20) = (ulonglong)in_stack_00000130;

-    }

-    else {

-      HsmDbgBreakOnStatus(-0x3fffff66);

-      uVar10 = 0xc000009a;

+  local_50 = __security_cookie ^ (ulonglong)auStack_118;

+  puVar7 = &local_70;

+  puVar11 = (undefined8 *)0x0;

+  local_a8 = param_5;

+  local_b8 = 0;

+  local_d8[0] = local_d8[0] & 0xffffffff00000000;

+  local_c8 = (undefined4 *)0x0;

+  puStack_c0 = (undefined8 *)0x0;

+  local_70 = 0;

+  uStack_68 = 0;

+  local_60 = 0;

+  uStack_58 = 0;

+  local_90 = param_3;

+  local_78 = param_4;

+  if ((param_4 == (int *)0x0) && (param_5 == (undefined4 *)0x0)) {

+    uVar1 = *(undefined8 *)(param_1 + 0x20);

+    local_d8[0] = 0;

+    local_a8 = (undefined4 *)0x0;

+    puStack_a0 = (undefined8 *)0x0;

+    if (param_2 == 0) {

+      uVar5 = FltGetFileNameInformation(0,0x102,local_d8);

+    }

+    else {

+      uVar5 = FltGetFileNameInformationUnsafe(param_2,0,0x102,local_d8);

+    }

+    HsmDbgBreakOnStatus(uVar5);

+    if ((int)uVar5 < 0) {

+      puVar11 = puStack_a0;

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        local_f0 = CONCAT44(local_f0._4_4_,uVar5);

+        local_f8 = param_2;

+        WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xd,

+                   &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,uVar1);

+        puVar11 = puStack_a0;

+      }

+    }

+    else {

+      sVar9 = (*(short *)(local_d8[0] + 8) - *(short *)(local_d8[0] + 0x18)) + 2;

+      local_a8 = (undefined4 *)

+                 ((ulonglong)CONCAT42((int)((ulonglong)local_a8 >> 0x20),sVar9) << 0x10);

+      puVar7 = (undefined8 *)ExAllocatePool2(0x100,sVar9,0x73557348);

+      uVar5 = ~-(uint)(puVar7 != (undefined8 *)0x0) & 0xc000009a;

+      puStack_a0 = puVar7;

+      HsmDbgBreakOnStatus(uVar5);

+      if (puVar7 == (undefined8 *)0x0) {

+        puVar11 = (undefined8 *)0x0;

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          local_f0 = CONCAT44(local_f0._4_4_,0xffffffff) & 0xffffffffc000009a;

+          local_f8 = param_2;

+          WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xe,

+                     &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,uVar1);

+        }

+      }

+      else {

+        uVar4 = *(short *)(local_d8[0] + 8) - *(ushort *)(local_d8[0] + 0x18);

+        local_a8 = (undefined4 *)CONCAT62(local_a8._2_6_,uVar4);

+        memmove(puVar7,(void *)((ulonglong)*(ushort *)(local_d8[0] + 0x18) +

+                               *(longlong *)(local_d8[0] + 0x10)),(ulonglong)uVar4);

+        *(undefined2 *)((longlong)puVar7 + (ulonglong)(uVar4 >> 1) * 2) = 0;

+        local_c8 = local_a8;

+        puStack_c0 = puStack_a0;

+      }

+    }

+    if (local_d8[0] != 0) {

+      FltReleaseFileNameInformation();

+    }

+    if (puVar11 != (undefined8 *)0x0) {

+      ExFreePoolWithTag(puVar11,0x73557348);

+    }

+    HsmDbgBreakOnStatus(uVar5);

+    if ((int)uVar5 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        local_f0 = CONCAT44(local_f0._4_4_,uVar5);

+        local_f8 = param_2;

+        WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2d,

+                   &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+      }

+    }

+    else {

+      if (DAT_0 == CldHsmGetSyncRootFileIdByPath) {

+        uVar8 = CldHsmGetSyncRootFileIdByPath(*(longlong *)(param_1 + 0x10),&local_c8);

+      }

+      else {

+        uVar8 = (*DAT_0)();

+      }

+      *local_90 = uVar8;

+      if (uVar8 == 0) {

+        uVar5 = HsmiCldGetSyncRootFileIdByPath(param_1,(ushort *)&local_c8,local_90);

+        HsmDbgBreakOnStatus(uVar5);

+        if ((((int)uVar5 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+           (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (2 < (byte)WPP_GLOBAL_Control[0x29])

+            ))) {

+          local_f8 = CONCAT44(local_f8._4_4_,uVar5);

+          WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2e,

+                    &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+        }

+      }

     }

   }

   else {

-    HsmDbgBreakOnStatus(-0x3fffff66);

-    in_stack_00000070 = unaff_RDI;

-    uVar10 = 0xc000009a;

+    uVar14 = 0x20;

+    puVar12 = puVar11;

+    puVar16 = puVar11;

+    while( true ) {

+      local_f0 = 0;

+      local_f8 = CONCAT44(local_f8._4_4_,0x2e);

+      uVar5 = FltQueryInformationFile(*(undefined8 *)(param_1 + 0x20),param_2,puVar7,uVar14);

+      HsmDbgBreakOnStatus(uVar5);

+      if (uVar5 != 0x80000005) break;

+      if ((int)puVar12 != 0) goto LAB_1;

+      uVar14 = *(undefined4 *)puVar7;

+      puVar7 = (undefined8 *)ExAllocatePool2(0x100,uVar14,0x694c7348);

+      puVar16 = puVar7;

+      if (puVar7 == (undefined8 *)0x0) {

+        uVar5 = 0xc000009a;

+        HsmDbgBreakOnStatus(-0x3fffff66);

+        goto LAB_1;

+      }

+      puVar12 = (undefined8 *)0x1;

+    }

+    if ((int)uVar5 < 0) {

+LAB_1:

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        uVar10 = 0x2f;

+LAB_2:

+        local_f0 = CONCAT44(local_f0._4_4_,uVar5);

+        local_f8 = param_2;

+        WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar10,

+                   &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+      }

+    }

+    else {

+      puVar2 = (uint *)(puVar7 + 1);

+      while( true ) {

+        puVar13 = puVar2;

+        iVar15 = (int)puVar11;

+        if (puVar13 == (uint *)0x0) break;

+        puStack_80 = puVar13 + 5;

+        sVar9 = (short)puVar13[4] * 2;

+        local_88 = (ulonglong)CONCAT22(sVar9,sVar9);

+        uVar5 = HsmpBuildFullLinkPath

+                          (param_1,*(undefined8 *)(puVar13 + 2),(short *)&local_88,

+                           (undefined4 *)&local_c8);

+        HsmDbgBreakOnStatus(uVar5);

+        uVar6 = 0;

+        if ((uVar5 != 0xc0000034) && (uVar5 != 0xc000003a)) {

+          if ((int)uVar5 < 0) {

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_3;

+            uVar10 = 0x30;

+            goto LAB_2;

+          }

+          local_98 = (*DAT_0)(*(undefined8 *)(param_1 + 0x10),&local_c8);

+          if (local_98 == 0) {

+            uVar6 = HsmiCldGetSyncRootFileIdByPath(param_1,(ushort *)&local_c8,&local_98);

+            HsmDbgBreakOnStatus(uVar6);

+            uVar5 = 0;

+            if (uVar6 != 0xc000cf13) {

+              uVar5 = uVar6;

+            }

+            if ((int)uVar5 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                local_f8 = CONCAT44(local_f8._4_4_,uVar5);

+                WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x31,

+                          &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+              }

+              goto LAB_3;

+            }

+          }

+          uVar8 = local_98;

+          uVar6 = uVar5;

+          if (local_b8 == 0) {

+            uVar3 = local_98;

+            if (local_98 != 0) {

+LAB_4:

+              local_b8 = uVar3;

+              puVar11 = (undefined8 *)(ulonglong)(iVar15 + 1);

+              goto LAB_5;

+            }

+          }

+          else if (local_98 != 0) {

+            uVar3 = local_b8;

+            if (local_b8 == local_98) goto LAB_4;

+            uVar5 = 0xc000cf19;

+            HsmDbgBreakOnStatus(-0x3fff30e7);

+            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              local_e8 = 0xc000cf19;

+              local_f8 = local_b8;

+              local_f0 = uVar8;

+              WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x32,

+                          &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

+            }

+            goto LAB_3;

+          }

+          local_d8[0] = CONCAT44(local_d8[0]._4_4_,(int)local_d8[0] + 1);

+        }

+LAB_5:

+        uVar5 = uVar6;

+        if ((puVar16 != (undefined8 *)0x0) && (puStack_c0 != (undefined8 *)0x0)) {

+          ExFreePoolWithTag(puStack_c0,0x73557348);

+          puStack_c0 = (undefined8 *)0x0;

+        }

+        puVar2 = (uint *)0x0;

+        if (*puVar13 != 0) {

+          puVar2 = (uint *)((longlong)puVar13 + (ulonglong)*puVar13);

+        }

+      }

+      if (iVar15 == 0) {

+        uVar5 = 0xc000cf13;

+        HsmDbgBreakOnStatus(-0x3fff30ed);

+      }

+      else {

+        *local_90 = local_b8;

+        if (local_78 != (int *)0x0) {

+          *local_78 = iVar15;

+        }

+        if (local_a8 != (undefined4 *)0x0) {

+          *local_a8 = (int)local_d8[0];

+        }

+      }

+    }

+LAB_3:

+    if (puVar16 != (undefined8 *)0x0) {

+      ExFreePoolWithTag(puVar16,0x694c7348);

+    }

   }

-LAB_0:

-  if (puStack0000000000000078 != unaff_RDI) {

-    ExReleaseResourceLite(unaff_R13 + 0x78);

-    KeLeaveCriticalRegion();

+  if (puStack_c0 != (undefined8 *)0x0) {

+    ExFreePoolWithTag(puStack_c0,0x73557348);

   }

-  if (in_stack_00000068 != (uint *)0x0) {

-    ExFreePoolWithTag(in_stack_00000068,0x72507348);

-  }

-  if (in_stack_00000070 != (uint *)0x0) {

-    ExFreePoolWithTag(in_stack_00000070,0x72507348);

-  }

-  HsmpUnloadPropertyStream(unaff_R13);

-  return uVar10;

+  return uVar5;

 }
```

## `HsmpRpCommitNoLock`  (modified)

```diff
--- HsmpRpCommitNoLock
+++ HsmpRpCommitNoLock
@@ -1,18 +1,985 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 int HsmpRpCommitNoLock(longlong param_1,longlong param_2,longlong param_3,char param_4,char param_5)

 

 {

-  undefined8 in_RAX;

-  int unaff_EBX;

-  longlong unaff_RSI;

-  undefined7 in_register_00000089;

-  undefined8 in_stack_00000020;

+  void *_Src;

+  bool bVar1;

+  byte bVar2;

+  ushort uVar3;

+  int iVar4;

+  uint uVar5;

+  uint uVar6;

+  undefined8 uVar7;

+  longlong lVar8;

+  int *piVar9;

+  uint uVar10;

+  uint uVar11;

+  undefined2 uVar12;

+  uint *puVar13;

+  uint *puVar14;

+  longlong lVar15;

+  uint *puVar16;

+  ushort uVar17;

+  longlong lVar18;

+  ulonglong uVar19;

+  int iVar20;

+  uint *puVar21;

+  undefined *puVar22;

+  bool bVar23;

+  undefined1 auStackY_138 [32];

+  uint *local_e8;

+  bool local_e0;

+  bool local_df;

+  bool local_de;

+  int local_d8;

+  uint local_d4;

+  uint local_d0;

+  ushort local_cc;

+  uint local_c8 [2];

+  longlong local_c0;

+  uint local_b8;

+  uint local_b4;

+  longlong local_b0;

+  uint *local_a8;

+  uint local_a0;

+  uint local_9c;

+  longlong local_98;

+  uint *local_90;

+  uint *local_88;

+  uint *local_80;

+  uint *local_78;

+  uint *local_70;

+  uint *local_68;

+  undefined8 local_60;

+  longlong lStack_58;

+  undefined8 local_50;

+  ulonglong local_48;

   

-  HsmpCldNotifyPostOperation

-            ((int)CONCAT71((int7)((ulonglong)in_RAX >> 8),(char)in_RAX + 'A'),param_2,(int)param_3,

-             CONCAT71(in_register_00000089,param_4),in_stack_00000020);

-  func_0x000140063cf4();

-  HsmpTracePostCallbackExit(unaff_EBX,unaff_RSI,param_3,'\x01');

-  return unaff_EBX;

+  local_48 = __security_cookie ^ (ulonglong)auStackY_138;

+  puVar13 = (uint *)0x0;

+  bVar1 = false;

+  local_50 = 0;

+  local_cc = 10;

+  local_a8 = (uint *)0x0;

+  local_e8 = (uint *)0x0;

+  local_d0 = 0;

+  local_78 = (uint *)0x0;

+  local_90 = (uint *)0x0;

+  local_b8 = 0;

+  local_a0 = 0;

+  local_70 = (uint *)0x0;

+  local_88 = (uint *)0x0;

+  local_b4 = 0;

+  local_9c = 0;

+  local_68 = (uint *)0x0;

+  local_80 = (uint *)0x0;

+  local_d4 = 0;

+  local_c8[0] = 0;

+  local_de = false;

+  local_e0 = false;

+  local_df = false;

+  local_60 = 0;

+  lStack_58 = 0;

+  local_c0 = param_3;

+  local_b0 = param_1;

+  uVar7 = HsmpValidateStreamContextNoLock(param_2,param_3);

+  iVar4 = (int)uVar7;

+  HsmDbgBreakOnStatus(iVar4);

+  if (iVar4 < 0) {

+    puVar21 = (uint *)0x0;

+    goto LAB_0;

+  }

+  if ((*(uint *)(param_2 + 0x1c) & 2) == 0) {

+    lVar15 = local_c0;

+    iVar4 = FltQueryInformationFile(*(undefined8 *)(local_b0 + 0x20),local_c0,&local_60,0x18);

+    HsmDbgBreakOnStatus(iVar4);

+    if (iVar4 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

+         ) {

+        puVar21 = (uint *)0x0;

+        goto LAB_0;

+      }

+      uVar12 = 0x20;

+    }

+    else {

+      lVar18 = lStack_58;

+      iVar4 = 0;

+      if (((*(uint *)(param_2 + 0x1c) & 4) != 0) ||

+         (iVar4 = 0, lVar8 = HsmpGetStreamSize(param_2), lVar18 < lVar8)) {

+        if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+           (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (3 < (byte)WPP_GLOBAL_Control[0x29])

+            ))) {

+          puVar22 = WPP_GLOBAL_Control;

+          HsmpGetStreamSize(param_2);

+          WPP_SF_qiqii(*(undefined8 *)(puVar22 + 0x18),lVar15,lVar18,param_2);

+          iVar4 = 0;

+          lVar18 = lStack_58;

+        }

+        lVar8 = **(longlong **)(param_2 + 0xa0);

+        if (lVar18 <= lVar8) {

+          lVar8 = lVar18;

+        }

+        **(longlong **)(param_2 + 0xa0) = lVar8;

+      }

+      iVar20 = iVar4;

+      local_98 = HsmpGetStreamSize(param_2);

+      lVar18 = *(longlong *)(*(longlong *)(param_2 + 0xa0) + 0x38);

+      if (lVar18 != 0) {

+        uVar5 = *(uint *)(param_2 + 0x1c) >> 6 & 1;

+        if (0 < local_98) {

+          local_d8 = iVar20;

+          iVar4 = HsmpBitmapGetRangeState(lVar18,lVar15,&local_98,&local_d8);

+          HsmDbgBreakOnStatus(iVar4);

+          if ((iVar4 < 0) || (local_d8 == 2)) goto LAB_1;

+          uVar5 = (uint)(local_d8 == 1);

+        }

+        uVar6 = *(uint *)(param_2 + 0x1c);

+        uVar10 = uVar6 >> 6 & 1;

+        local_de = uVar10 != uVar5;

+        uVar6 = (uVar5 << 6 ^ uVar6) & 0x40 ^ uVar6;

+        *(uint *)(param_2 + 0x1c) = uVar6;

+        if (uVar10 != uVar5) {

+          *(uint *)(param_2 + 0x1c) = uVar6 | 0x80;

+        }

+        HsmiDeleteExternalBitmap(param_2,0x4244);

+        lVar15 = 0x4244;

+        HsmiReleaseBitmap(param_2,0x4244);

+      }

+LAB_1:

+      HsmDbgBreakOnStatus(iVar4);

+      iVar20 = 0;

+      puVar21 = (uint *)0x0;

+      if (iVar4 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+        uVar12 = 0x22;

+      }

+      else {

+        local_98 = HsmpGetStreamSize(param_2);

+        lVar18 = *(longlong *)(*(longlong *)(param_2 + 0xa0) + 0x40);

+        iVar4 = 0;

+        if (lVar18 != 0) {

+          uVar5 = *(uint *)(param_2 + 0x1c) >> 8 & 1;

+          if (0 < local_98) {

+            local_d8 = iVar20;

+            iVar4 = HsmpBitmapGetRangeState(lVar18,lVar15,&local_98,&local_d8);

+            HsmDbgBreakOnStatus(iVar4);

+            if ((iVar4 < 0) || (local_d8 == 2)) goto LAB_2;

+            uVar5 = (uint)(local_d8 == 1);

+          }

+          uVar6 = *(uint *)(param_2 + 0x1c);

+          uVar10 = uVar6 >> 8 & 1;

+          local_e0 = uVar10 != uVar5;

+          uVar6 = (uVar5 << 8 ^ uVar6) & 0x100 ^ uVar6;

+          *(uint *)(param_2 + 0x1c) = uVar6;

+          if (uVar10 != uVar5) {

+            *(uint *)(param_2 + 0x1c) = uVar6 | 0x200;

+          }

+          HsmiDeleteExternalBitmap(param_2,0x4256);

+          lVar15 = 0x4256;

+          HsmiReleaseBitmap(param_2,0x4256);

+        }

+LAB_2:

+        HsmDbgBreakOnStatus(iVar4);

+        iVar20 = 0;

+        puVar21 = (uint *)0x0;

+        if (-1 < iVar4) {

+          local_98 = HsmpGetStreamSize(param_2);

+          lVar18 = *(longlong *)(*(longlong *)(param_2 + 0xa0) + 0x48);

+          iVar4 = 0;

+          if (lVar18 != 0) {

+            uVar5 = *(uint *)(param_2 + 0x1c) >> 10 & 1;

+            if (0 < local_98) {

+              local_d8 = iVar20;

+              iVar4 = HsmpBitmapGetRangeState(lVar18,lVar15,&local_98,&local_d8);

+              HsmDbgBreakOnStatus(iVar4);

+              if ((iVar4 < 0) || (local_d8 == 2)) goto LAB_3;

+              uVar5 = (uint)(local_d8 == 1);

+            }

+            uVar6 = *(uint *)(param_2 + 0x1c);

+            uVar10 = uVar6 >> 10 & 1;

+            local_df = uVar10 != uVar5;

+            uVar6 = (uVar5 << 10 ^ uVar6) & 0x400 ^ uVar6;

+            *(uint *)(param_2 + 0x1c) = uVar6;

+            if (uVar10 != uVar5) {

+              *(uint *)(param_2 + 0x1c) = uVar6 | 0x800;

+            }

+            HsmiDeleteExternalBitmap(param_2,0x424d);

+            HsmiReleaseBitmap(param_2,0x424d);

+          }

+LAB_3:

+          HsmDbgBreakOnStatus(iVar4);

+          if (iVar4 < 0) {

+            if ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) {

+              if (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_4;

+              uVar12 = 0x24;

+              goto LAB_5;

+            }

+          }

+          else {

+            uVar5 = *(uint *)(param_2 + 0x1c);

+            bVar2 = HsmiIsBitmapCommitPending(param_2,0x4244);

+            local_de = (bool)(local_de | (byte)(uVar5 >> 7) & 1 | bVar2);

+            uVar5 = *(uint *)(param_2 + 0x1c);

+            bVar2 = HsmiIsBitmapCommitPending(param_2,0x4256);

+            local_e0 = (bool)(local_e0 | (byte)(uVar5 >> 9) & 1 | bVar2);

+            uVar5 = *(uint *)(param_2 + 0x1c);

+            bVar2 = HsmiIsBitmapCommitPending(param_2,0x424d);

+            local_df = (bool)(local_df | (byte)(uVar5 >> 0xb) & 1 | bVar2);

+            if ((((param_5 == '\0') || (local_de != false)) || (local_e0 != false)) ||

+               (local_df != false)) goto LAB_6;

+          }

+LAB_7:

+          puVar21 = (uint *)0x0;

+          goto LAB_0;

+        }

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+        uVar12 = 0x23;

+      }

+    }

+LAB_5:

+    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+               &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_2);

+    goto LAB_4;

+  }

+LAB_6:

+  lVar15 = local_c0;

+  iVar4 = HsmpRpReadBuffer(*(undefined8 *)(local_b0 + 0x20),local_c0,&local_a8);

+  HsmDbgBreakOnStatus(iVar4);

+  uVar7 = 0xc0000275;

+  if (iVar4 == -0x3ffffd8b) {

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x25,

+                  &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_2);

+    }

+    iVar4 = 0;

+    goto LAB_7;

+  }

+  if (iVar4 < 0) {

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      uVar12 = 0x26;

+LAB_8:

+      WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                  &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_2);

+    }

+  }

+  else {

+    if ((*local_a8 & 0xffff0fff) == DAT_9) {

+      uVar3 = (ushort)local_a8[1];

+      piVar9 = HsmpRpValidateBuffer(local_a8 + 2,(uint)uVar3);

+      iVar4 = (int)piVar9;

+      HsmDbgBreakOnStatus(iVar4);

+      puVar21 = (uint *)0x0;

+      if (iVar4 < 0) {

+        HsmDbgBreakOnCorruption();

+        if (param_4 == (char)puVar21) {

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+          uVar12 = 0x28;

+          goto LAB_8;

+        }

+        uVar5 = (uint)puVar21;

+        uVar17 = (short)puVar21 + 4;

+      }

+      else {

+        uVar17 = 4;

+        puVar13 = local_a8 + 3;

+        if (uVar3 < 5) {

+          uVar5 = 0;

+          local_d0 = uVar5;

+        }

+        else {

+          uVar5 = uVar3 - 4;

+          local_d0 = uVar5;

+        }

+      }

+      if ((*(uint *)(param_2 + 0x1c) & 2) == 0) {

+        iVar20 = -0x3ffffddb;

+        if (local_de == (bool)(byte)puVar21) {

+          if (puVar13 != (uint *)0x0) {

+            if (((((((uVar5 < 0x18) || (*(ushort *)((longlong)puVar13 + 0xe) <= uVar17)) ||

+                   (uVar5 = puVar13[2], uVar5 < 0x38)) || (0x11 < (ushort)puVar13[0xc])) ||

+                 (((uVar6 = puVar13[0xd], uVar6 != 0 &&

+                   ((uVar6 < (uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 ||

+                    (uVar5 < uVar6)))) || (uVar5 < *(ushort *)((longlong)puVar13 + 0x32))))) ||

+                ((uVar10 = *(ushort *)((longlong)puVar13 + 0x32) + uVar6, uVar5 < uVar10 ||

+                 ((ushort)puVar13[0xc] != 0x11)))) || (uVar10 < uVar6)) {

+              iVar4 = -0x3ffffddb;

+            }

+            else {

+              local_90 = puVar21;

+              if ((puVar13[0xd] != 0) && (*(short *)((longlong)puVar13 + 0x32) != (short)puVar21)) {

+                local_90 = (uint *)((ulonglong)puVar13[0xd] + (longlong)puVar13);

+              }

+              iVar4 = (int)puVar21;

+              local_b8 = (uint)*(ushort *)((longlong)puVar13 + 0x32);

+            }

+            HsmDbgBreakOnStatus(iVar4);

+LAB_10:

+            puVar21 = (uint *)0x0;

+          }

+          uVar5 = local_d0;

+          if (local_e0 == (bool)(byte)puVar21) {

+            if (puVar13 != (uint *)0x0) {

+              if (((((local_d0 < 0x18) || (*(ushort *)((longlong)puVar13 + 0xe) < 6)) ||

+                   ((uVar6 = puVar13[2], uVar6 < 0x40 || (0x11 < (ushort)puVar13[0xe])))) ||

+                  ((uVar10 = puVar13[0xf], uVar10 != 0 &&

+                   ((uVar10 < (uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 ||

+                    (uVar6 < uVar10)))))) ||

+                 ((uVar6 < *(ushort *)((longlong)puVar13 + 0x3a) ||

+                  (((uVar11 = *(ushort *)((longlong)puVar13 + 0x3a) + uVar10, uVar6 < uVar11 ||

+                    ((ushort)puVar13[0xe] != 0x11)) || (uVar11 < uVar10)))))) {

+                iVar4 = -0x3ffffddb;

+              }

+              else {

+                local_88 = puVar21;

+                if ((puVar13[0xf] != 0) && (*(short *)((longlong)puVar13 + 0x3a) != (short)puVar21))

+                {

+                  local_88 = (uint *)((ulonglong)puVar13[0xf] + (longlong)puVar13);

+                }

+                iVar4 = (int)puVar21;

+                local_b4 = (uint)*(ushort *)((longlong)puVar13 + 0x3a);

+              }

+              HsmDbgBreakOnStatus(iVar4);

+              puVar21 = (uint *)0x0;

+            }

+          }

+          else {

+            iVar4 = HsmiPrepareBitmapCommit(param_2,0x4256,&local_70,&local_9c);

+            HsmDbgBreakOnStatus(iVar4);

+            puVar21 = (uint *)0x0;

+            if (iVar4 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+              uVar12 = 0x2a;

+              goto LAB_11;

+            }

+            local_88 = local_70;

+            local_b4 = local_9c;

+            uVar5 = local_d0;

+          }

+          if (local_df == false) {

+            if (puVar13 != (uint *)0x0) {

+              if (((((0x17 < uVar5) && (6 < *(ushort *)((longlong)puVar13 + 0xe))) &&

+                   ((uVar5 = puVar13[2], 0x47 < uVar5 && ((ushort)puVar13[0x10] < 0x12)))) &&

+                  ((uVar6 = puVar13[0x11], uVar6 == 0 ||

+                   (((uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10 <= uVar6 &&

+                    (uVar6 <= uVar5)))))) &&

+                 ((*(ushort *)((longlong)puVar13 + 0x42) <= uVar5 &&

+                  (((uVar10 = *(ushort *)((longlong)puVar13 + 0x42) + uVar6, uVar10 <= uVar5 &&

+                    (uVar6 <= uVar10)) && ((ushort)puVar13[0x10] == 0x11)))))) {

+                local_80 = puVar21;

+                if ((puVar13[0x11] != 0) && (*(short *)((longlong)puVar13 + 0x42) != (short)puVar21)

+                   ) {

+                  local_80 = (uint *)((ulonglong)puVar13[0x11] + (longlong)puVar13);

+                }

+                iVar20 = (int)puVar21;

+                local_d4 = (uint)*(ushort *)((longlong)puVar13 + 0x42);

+              }

+              HsmDbgBreakOnStatus(iVar20);

+            }

+          }

+          else {

+            iVar4 = HsmiPrepareBitmapCommit(param_2,0x424d,&local_68,local_c8);

+            HsmDbgBreakOnStatus(iVar4);

+            if (iVar4 < 0) {

+              puVar21 = local_e8;

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+              uVar12 = 0x2b;

+              goto LAB_11;

+            }

+            local_80 = local_68;

+            local_d4 = local_c8[0];

+          }

+          goto LAB_12;

+        }

+        iVar4 = HsmiPrepareBitmapCommit(param_2,0x4244,&local_78,&local_a0);

+        HsmDbgBreakOnStatus(iVar4);

+        puVar21 = (uint *)0x0;

+        if (-1 < iVar4) {

+          local_90 = local_78;

+          local_b8 = local_a0;

+          goto LAB_10;

+        }

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+        uVar12 = 0x29;

+      }

+      else {

+LAB_12:

+        local_e8 = (uint *)ExAllocatePool2(0x100);

+        puVar21 = local_e8;

+        if (local_e8 == (uint *)0x0) {

+          iVar4 = -0x3fffff66;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2c,

+                       &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_2);

+          }

+          goto LAB_0;

+        }

+        puVar16 = local_e8 + 1;

+        uVar3 = local_cc;

+        if ((puVar13 != (uint *)0x0) && (10 < *(ushort *)((longlong)puVar13 + 0xe))) {

+          uVar3 = *(ushort *)((longlong)puVar13 + 0xe);

+        }

+        puVar14 = local_e8 + 5;

+        puVar16[0] = 0;

+        puVar16[1] = 0;

+        local_e8[3] = 0;

+        local_e8[4] = 0;

+        *(undefined2 *)(local_e8 + 4) = 0;

+        *(ushort *)((longlong)local_e8 + 0x12) = uVar3;

+        local_e8[3] = (uint)uVar3 * 8 + 0x10;

+        *puVar16 = 0x70526546;

+        memset(puVar14,0,(ulonglong)uVar3 << 3);

+        if (*(short *)((longlong)local_e8 + 0x12) == 0) {

+          iVar4 = -0x3ffffff3;

+        }

+        else if (((ulonglong)local_e8[3] + 3 & 0xfffffffffffffffc) + 1 < 0x3ffd) {

+          uVar5 = local_e8[3] + 3 & 0xfffffffc;

+          local_e8[3] = uVar5;

+          if ((short)*puVar14 != 0) {

+            *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+          }

+          *(short *)puVar14 = 7;

+          iVar4 = 0;

+          *(undefined2 *)((longlong)local_e8 + 0x16) = 1;

+          local_e8[6] = uVar5;

+          *(undefined1 *)((ulonglong)uVar5 + (longlong)puVar16) = 1;

+          local_e8[3] = local_e8[3] + 1;

+        }

+        else {

+          iVar4 = -0x3fffffdd;

+        }

+        HsmDbgBreakOnStatus(iVar4);

+        if (iVar4 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+          uVar12 = 0x2d;

+        }

+        else {

+          uVar5 = *(uint *)(param_2 + 0x1c);

+          uVar10 = uVar5 >> 5 & 1;

+          uVar6 = uVar10 | 2;

+          if ((uVar5 & 0x40) == 0) {

+            uVar6 = uVar10;

+          }

+          uVar10 = uVar6 | 4;

+          if ((uVar5 >> 8 & 1) == 0) {

+            uVar10 = uVar6;

+          }

+          uVar6 = uVar10 | 8;

+          if ((uVar5 >> 10 & 1) == 0) {

+            uVar6 = uVar10;

+          }

+          uVar19 = (ulonglong)uVar6;

+          uVar10 = uVar6 | 0x20;

+          if ((uVar5 >> 0xc & 1) == 0) {

+            uVar10 = uVar6;

+          }

+          uVar6 = uVar10 | 0x10;

+          if ((uVar5 & 2) == 0) {

+            uVar6 = uVar10;

+          }

+          uVar10 = uVar6 | 0x40;

+          if ((uVar5 >> 0xd & 1) == 0) {

+            uVar10 = uVar6;

+          }

+          uVar6 = uVar10 | 0x80;

+          if ((uVar5 >> 0xe & 1) == 0) {

+            uVar6 = uVar10;

+          }

+          uVar10 = uVar6 | 0x100;

+          if ((uVar5 >> 0xf & 1) == 0) {

+            uVar10 = uVar6;

+          }

+          if ((uVar5 >> 0x10 & 1) != 0) {

+            uVar10 = uVar10 | 0x200;

+          }

+          if (*(ushort *)((longlong)local_e8 + 0x12) < 2) {

+            iVar4 = -0x3ffffff3;

+          }

+          else if (((ulonglong)local_e8[3] + 3 & 0xfffffffffffffffc) + 4 < 0x3ffd) {

+            uVar5 = local_e8[3] + 3 & 0xfffffffc;

+            local_e8[3] = uVar5;

+            if ((short)local_e8[7] != 0) {

+              *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+            }

+            local_e8[7] = 0x4000a;

+            local_e8[8] = uVar5;

+            *(uint *)((ulonglong)uVar5 + (longlong)puVar16) = uVar10;

+            local_e8[3] = local_e8[3] + 4;

+            iVar4 = 0;

+          }

+          else {

+            iVar4 = -0x3fffffdd;

+          }

+          HsmDbgBreakOnStatus(iVar4);

+          if (iVar4 < 0) {

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+            uVar12 = 0x2e;

+          }

+          else {

+            FltAcquirePushLockExclusiveEx(param_2 + 0x40,0);

+            _Src = *(void **)(param_2 + 0x30);

+            iVar4 = 0;

+            if ((_Src != (void *)0x0) && (uVar5 = *(uint *)(param_2 + 0x38), uVar5 != 0)) {

+              if (*(ushort *)((longlong)local_e8 + 0x12) < 4) {

+                iVar4 = -0x3ffffff3;

+              }

+              else {

+                uVar19 = (ulonglong)(uVar5 & 0xffff);

+                if (((ulonglong)local_e8[3] + 3 & 0xfffffffffffffffc) + uVar19 < 0x3ffd) {

+                  if ((short)local_e8[0xb] != 0) {

+                    *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+                  }

+                  uVar6 = local_e8[3] + 3 & 0xfffffffc;

+                  local_e8[3] = uVar6;

+                  local_e8[0xc] = uVar6;

+                  *(undefined2 *)(local_e8 + 0xb) = 0x11;

+                  *(short *)((longlong)local_e8 + 0x2e) = (short)uVar5;

+                  if ((void *)((ulonglong)uVar6 + (longlong)puVar16) != _Src) {

+                    memmove((void *)((ulonglong)uVar6 + (longlong)puVar16),_Src,uVar19);

+                  }

+                  local_e8[3] = local_e8[3] + (uint)*(ushort *)((longlong)local_e8 + 0x2e);

+                }

+                else {

+                  iVar4 = -0x3fffffdd;

+                }

+              }

+              HsmDbgBreakOnStatus(iVar4);

+              if (iVar4 < 0) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2f,

+                             &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_2);

+                }

+                FltReleasePushLockEx(param_2 + 0x40,0);

+                goto LAB_0;

+              }

+            }

+            iVar4 = 0;

+            puVar14 = (uint *)0x0;

+            FltReleasePushLockEx(param_2 + 0x40);

+            uVar3 = 2;

+            if ((*(uint *)(param_2 + 0x1c) & 2) != 0) goto LAB_13;

+            uVar7 = HsmpGetStreamSize(param_2);

+            if (uVar3 < *(ushort *)((longlong)local_e8 + 0x12)) {

+              if (((ulonglong)local_e8[3] + 3 & 0xfffffffffffffffc) + 8 < 0x3ffd) {

+                uVar5 = local_e8[3] + 3 & 0xfffffffc;

+                local_e8[3] = uVar5;

+                if ((short)local_e8[9] != 0) {

+                  *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+                }

+                local_e8[9] = 0x80006;

+                local_e8[10] = uVar5;

+                *(undefined8 *)((ulonglong)uVar5 + (longlong)puVar16) = uVar7;

+                local_e8[3] = local_e8[3] + 8;

+              }

+              else {

+                iVar4 = -0x3fffffdd;

+              }

+            }

+            else {

+              iVar4 = -0x3ffffff3;

+            }

+            HsmDbgBreakOnStatus(iVar4);

+            if (iVar4 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+              uVar12 = 0x30;

+            }

+            else {

+              iVar4 = 0;

+              uVar7 = HsmpGetLastHydrationTime(param_2);

+              if ((ushort)((short)iVar4 + 7U) < *(ushort *)((longlong)local_e8 + 0x12)) {

+                if (((ulonglong)(iVar4 + 3) + (ulonglong)local_e8[3] & 0xfffffffffffffffc) +

+                    (ulonglong)(iVar4 + 8U) < 0x3ffd) {

+                  uVar5 = local_e8[3] + 3 & 0xfffffffc;

+                  local_e8[3] = uVar5;

+                  if ((short)local_e8[0x13] != (short)iVar4) {

+                    *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+                  }

+                  local_e8[0x13] = 0x80006;

+                  local_e8[0x14] = uVar5;

+                  *(undefined8 *)((ulonglong)uVar5 + (longlong)puVar16) = uVar7;

+                  local_e8[3] = local_e8[3] + iVar4 + 8U;

+                }

+                else {

+                  iVar4 = -0x3fffffdd;

+                }

+              }

+              else {

+                iVar4 = -0x3ffffff3;

+              }

+              HsmDbgBreakOnStatus(iVar4);

+              if (iVar4 < 0) {

+                if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                uVar12 = 0x31;

+              }

+              else {

+                iVar4 = 0;

+                uVar7 = HsmpGetLastDehydrationTime(param_2);

+                uVar5 = iVar4 + 8;

+                if ((ushort)uVar5 < *(ushort *)((longlong)local_e8 + 0x12)) {

+                  if (((ulonglong)(iVar4 + 3) + (ulonglong)local_e8[3] & 0xfffffffffffffffc) +

+                      (ulonglong)uVar5 < 0x3ffd) {

+                    uVar6 = local_e8[3] + 3 & 0xfffffffc;

+                    local_e8[3] = uVar6;

+                    if ((short)local_e8[0x15] != (short)iVar4) {

+                      *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+                    }

+                    local_e8[0x15] = 0x80006;

+                    local_e8[0x16] = uVar6;

+                    *(undefined8 *)((ulonglong)uVar6 + (longlong)puVar16) = uVar7;

+                    local_e8[3] = local_e8[3] + uVar5;

+                  }

+                  else {

+                    iVar4 = -0x3fffffdd;

+                  }

+                }

+                else {

+                  iVar4 = -0x3ffffff3;

+                }

+                HsmDbgBreakOnStatus(iVar4);

+                if (iVar4 < 0) {

+                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                     ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                  uVar12 = 0x32;

+                }

+                else {

+                  iVar4 = 0;

+                  uVar5 = HsmpGetLastDehydrationReason(param_2);

+                  uVar19 = (ulonglong)uVar5;

+                  if ((ushort)((short)iVar4 + 9U) < *(ushort *)((longlong)local_e8 + 0x12)) {

+                    if (((ulonglong)(iVar4 + 3) + (ulonglong)local_e8[3] & 0xfffffffffffffffc) +

+                        (ulonglong)(iVar4 + 4U) < 0x3ffd) {

+                      uVar6 = local_e8[3] + 3 & 0xfffffffc;

+                      local_e8[3] = uVar6;

+                      if ((short)local_e8[0x17] != (short)iVar4) {

+                        *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+                      }

+                      local_e8[0x17] = 0x4000a;

+                      local_e8[0x18] = uVar6;

+                      *(uint *)((ulonglong)uVar6 + (longlong)puVar16) = uVar5;

+                      local_e8[3] = local_e8[3] + iVar4 + 4U;

+                    }

+                    else {

+                      iVar4 = -0x3fffffdd;

+                    }

+                  }

+                  else {

+                    iVar4 = -0x3ffffff3;

+                  }

+                  HsmDbgBreakOnStatus(iVar4);

+                  if (-1 < iVar4) {

+                    iVar4 = 0;

+                    if (local_90 != (uint *)0x0) {

+                      if (*(ushort *)((longlong)local_e8 + 0x12) < 5) {

+                        iVar4 = -0x3ffffff3;

+                      }

+                      else {

+                        uVar19 = (ulonglong)local_b8 & 0xffff;

+                        if (((ulonglong)local_e8[3] + 3 & 0xfffffffffffffffc) + uVar19 < 0x3ffd) {

+                          if ((short)local_e8[0xd] != 0) {

+                            *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+                          }

+                          uVar5 = local_e8[3] + 3 & 0xfffffffc;

+                          local_e8[3] = uVar5;

+                          local_e8[0xe] = uVar5;

+                          *(undefined2 *)(local_e8 + 0xd) = 0x11;

+                          *(short *)((longlong)local_e8 + 0x36) = (short)local_b8;

+                          if ((uint *)((ulonglong)uVar5 + (longlong)puVar16) != local_90) {

+                            memmove((uint *)((ulonglong)uVar5 + (longlong)puVar16),local_90,uVar19);

+                          }

+                          local_e8[3] = local_e8[3] + (uint)*(ushort *)((longlong)local_e8 + 0x36);

+                        }

+                        else {

+                          iVar4 = -0x3fffffdd;

+                        }

+                      }

+                      HsmDbgBreakOnStatus(iVar4);

+                      if (iVar4 < 0) {

+                        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                        uVar12 = 0x34;

+                        goto LAB_11;

+                      }

+                    }

+                    iVar4 = 0;

+                    if (local_88 != (uint *)0x0) {

+                      if (*(ushort *)((longlong)local_e8 + 0x12) < 6) {

+                        iVar4 = -0x3ffffff3;

+                      }

+                      else {

+                        uVar19 = (ulonglong)local_b4 & 0xffff;

+                        if (((ulonglong)local_e8[3] + 3 & 0xfffffffffffffffc) + uVar19 < 0x3ffd) {

+                          if ((short)local_e8[0xf] != 0) {

+                            *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+                          }

+                          uVar5 = local_e8[3] + 3 & 0xfffffffc;

+                          local_e8[3] = uVar5;

+                          local_e8[0x10] = uVar5;

+                          *(undefined2 *)(local_e8 + 0xf) = 0x11;

+                          *(short *)((longlong)local_e8 + 0x3e) = (short)local_b4;

+                          if ((uint *)((ulonglong)uVar5 + (longlong)puVar16) != local_88) {

+                            memmove((uint *)((ulonglong)uVar5 + (longlong)puVar16),local_88,uVar19);

+                          }

+                          local_e8[3] = local_e8[3] + (uint)*(ushort *)((longlong)local_e8 + 0x3e);

+                        }

+                        else {

+                          iVar4 = -0x3fffffdd;

+                        }

+                      }

+                      HsmDbgBreakOnStatus(iVar4);

+                      if (iVar4 < 0) {

+                        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                        uVar12 = 0x35;

+                        goto LAB_11;

+                      }

+                    }

+                    iVar4 = 0;

+                    puVar14 = local_80;

+                    if (local_80 != (uint *)0x0) {

+                      if (*(ushort *)((longlong)local_e8 + 0x12) < 7) {

+                        iVar4 = -0x3ffffff3;

+                      }

+                      else {

+                        uVar19 = (ulonglong)local_d4 & 0xffff;

+                        if (((ulonglong)local_e8[3] + 3 & 0xfffffffffffffffc) + uVar19 < 0x3ffd) {

+                          if ((short)local_e8[0x11] != 0) {

+                            *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 1;

+                          }

+                          uVar5 = local_e8[3] + 3 & 0xfffffffc;

+                          local_e8[3] = uVar5;

+                          local_e8[0x12] = uVar5;

+                          *(undefined2 *)(local_e8 + 0x11) = 0x11;

+                          *(short *)((longlong)local_e8 + 0x46) = (short)local_d4;

+                          if ((uint *)((ulonglong)uVar5 + (longlong)puVar16) != local_80) {

+                            memmove((uint *)((ulonglong)uVar5 + (longlong)puVar16),local_80,uVar19);

+                          }

+                          local_e8[3] = local_e8[3] + (uint)*(ushort *)((longlong)local_e8 + 0x46);

+                        }

+                        else {

+                          iVar4 = -0x3fffffdd;

+                        }

+                      }

+                      HsmDbgBreakOnStatus(iVar4);

+                      if (iVar4 < 0) {

+                        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                        uVar12 = 0x36;

+                        goto LAB_11;

+                      }

+                    }

+LAB_13:

+                    if (puVar13 != (uint *)0x0) {

+                      uVar3 = 10;

+                      if (((10 < *(ushort *)((longlong)puVar13 + 0xe)) &&

+                          ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+                         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 &&

+                          (3 < (byte)WPP_GLOBAL_Control[0x29])))) {

+                        WPP_SF_qiq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),puVar14,uVar19,param_2

+                                  );

+                      }

+                      for (; uVar3 < *(ushort *)((longlong)puVar13 + 0xe); uVar3 = uVar3 + 1) {

+                        uVar19 = (ulonglong)uVar3;

+                        uVar5 = puVar13[uVar19 * 2 + 5];

+                        if (((uVar5 != 0) &&

+                            (uVar5 < (uint)*(ushort *)((longlong)puVar13 + 0xe) * 8 + 0x10)) ||

+                           (uVar6 = puVar13[2], uVar6 < uVar5)) {

+LAB_14:

+                          iVar4 = -0x3fff30fe;

+                          HsmDbgBreakOnStatus(-0x3fff30fe);

+                          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                          uVar12 = 0x38;

+                          iVar4 = -0x3fff30fe;

+                          goto LAB_11;

+                        }

+                        uVar17 = *(ushort *)((longlong)puVar13 + uVar19 * 8 + 0x12);

+                        if (((uVar6 < uVar17) || (uVar17 + uVar5 < uVar5)) ||

+                           (uVar6 < uVar17 + uVar5)) goto LAB_14;

+                        uVar5 = (uint)uVar17 + local_e8[3];

+                        if ((uVar5 < local_e8[3]) || (0x3ffc < uVar5)) {

+                          iVar4 = -0x3fff30fd;

+                          HsmDbgBreakOnStatus(-0x3fff30fd);

+                          if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                             (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0 ||

+                              ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_0;

+                          uVar12 = 0x39;

+                          iVar4 = -0x3fff30fd;

+                          goto LAB_11;

+                        }

+                        *(undefined8 *)(local_e8 + (ulonglong)uVar3 * 2 + 5) =

+                             *(undefined8 *)(puVar13 + (ulonglong)uVar3 * 2 + 4);

+                        memmove((void *)((ulonglong)local_e8[3] + (longlong)puVar16),

+                                (void *)((ulonglong)puVar13[(ulonglong)uVar3 * 2 + 5] +

+                                        (longlong)puVar13),

+                                (ulonglong)*(ushort *)((longlong)puVar13 + uVar19 * 8 + 0x12));

+                        local_e8[(ulonglong)uVar3 * 2 + 6] = local_e8[3];

+                        local_e8[3] = local_e8[3] +

+                                      (uint)*(ushort *)

+                                             ((longlong)local_e8 + (ulonglong)uVar3 * 8 + 0x16);

+                      }

+                    }

+                    *(ushort *)(local_e8 + 4) = (ushort)local_e8[4] | 2;

+                    uVar5 = RtlComputeCrc32(0,local_e8 + 3,local_e8[3] - 8);

+                    local_e8[2] = uVar5;

+                    uVar5 = *local_e8;

+                    *local_e8 = uVar5 & 0xfffffff1 | 1;

+                    uVar3 = (short)local_e8[3] + 4;

+                    local_d4 = (uint)uVar3;

+                    *local_e8 = (uint)uVar3 << 0x10 | uVar5 & 0xfff1 | 1;

+                    local_c8[0] = (uint)uVar3;

+                    if ((__Config & 2) != 0) {

+                      HsmiRpCompressBuffer(local_e8,local_c8);

+                    }

+                    local_d4 = local_c8[0];

+                    if ((*(uint *)(param_2 + 0x1c) & 0x100) == 0) {

+                      bVar1 = true;

+                      iVar4 = HsmpToggleFileAttributesNotify

+                                        (local_b0,local_c0,-(uint)(param_4 != '\0') & 8,0x401000,0);

+                      HsmDbgBreakOnStatus(iVar4);

+                      if (iVar4 < 0) {

+                        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                        uVar12 = 0x3a;

+                        goto LAB_11;

+                      }

+                    }

+                    bVar23 = *(char *)(local_c0 + 0x4b) == '\0';

+                    if (bVar23) {

+                      *(undefined1 *)(local_c0 + 0x4b) = 1;

+                    }

+                    uVar5 = *(uint *)(param_2 + 0x1c);

+                    uVar5 = ((uVar5 & 0x40) << 6 | uVar5 & 0x6000) * 2 | uVar5 & 0x1000 |

+                            DAT_9;

+                    uVar19 = (ulonglong)uVar5;

+                    lVar15 = local_c0;

+                    iVar4 = FltTagFileEx(*(undefined8 *)(local_b0 + 0x20));

+                    HsmDbgBreakOnStatus(iVar4);

+                    if (iVar4 < 0) {

+                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                        uVar12 = 0x3c;

+LAB_15:

+                        WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                                   &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_2);

+                      }

+                    }

+                    else {

+                      *(uint *)(param_2 + 0x18) = uVar5;

+                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                         (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                        WPP_SF_qLiqDD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),lVar15,uVar19,

+                                      param_2);

+                      }

+                      lVar18 = local_b0;

+                      lVar15 = local_c0;

+                      if (!bVar1) {

+                        iVar4 = HsmpToggleFileAttributesNotify

+                                          (local_b0,local_c0,-(uint)(param_4 != '\0') & 8,0,0x401000

+                                          );

+                        HsmDbgBreakOnStatus(iVar4);

+                        if (iVar4 < 0) {

+                          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                            uVar12 = 0x3e;

+                            goto LAB_15;

+                          }

+                          goto LAB_16;

+                        }

+                      }

+                      if ((*(uint *)(param_2 + 0x1c) & 2) == 0) {

+                        HsmpToggleFileSparseAttribute

+                                  (lVar18,lVar15,(*(uint *)(param_2 + 0x1c) & 0x120) != 0x100);

+                      }

+                      if ((*(uint *)(param_2 + 0x1c) & 4) != 0) {

+                        *(uint *)(param_2 + 0x1c) = *(uint *)(param_2 + 0x1c) & 0xffffffe3;

+                      }

+                    }

+LAB_16:

+                    if (bVar23) {

+                      *(undefined1 *)(local_c0 + 0x4b) = 0;

+                    }

+                    goto LAB_0;

+                  }

+                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                     ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+                  uVar12 = 0x33;

+                }

+              }

+            }

+          }

+        }

+      }

+LAB_11:

+      WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

+                 &WPP_0befeac6bcbe3d3c7e0534939debb108_Traceguids,param_2);

+      puVar21 = local_e8;

+      goto LAB_0;

+    }

+    iVar4 = -0x3fff30f5;

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_qiqDDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),lVar15,uVar7,param_2);

+    }

+  }

+LAB_4:

+  puVar21 = (uint *)0x0;

+LAB_0:

+  HsmiCompleteBitmapCommit(param_2,0x4244,iVar4,(longlong)local_78);

+  *(uint *)(param_2 + 0x1c) = *(uint *)(param_2 + 0x1c) & 0xffffff7f;

+  HsmiCompleteBitmapCommit(param_2,0x4256,iVar4,(longlong)local_70);

+  *(uint *)(param_2 + 0x1c) = *(uint *)(param_2 + 0x1c) & 0xfffffdff;

+  HsmiCompleteBitmapCommit(param_2,0x424d,iVar4,(longlong)local_68);

+  *(uint *)(param_2 + 0x1c) = *(uint *)(param_2 + 0x1c) & 0xfffff7ff;

+  if (local_a8 != (uint *)0x0) {

+    ExFreePoolWithTag(local_a8,0x70527348);

+  }

+  if (puVar21 != (uint *)0x0) {

+    ExFreePoolWithTag(puVar21,0x70527348);

+  }

+  return iVar4;

 }
```

## `CldiSyncEnsurePendingRanges`  (modified)

```diff
--- CldiSyncEnsurePendingRanges
+++ CldiSyncEnsurePendingRanges
@@ -1,414 +1,33 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-

-uint CldiSyncEnsurePendingRanges(uint *param_1)

+undefined8 CldiSyncEnsurePendingRanges(int *param_1)

 

 {

-  longlong *plVar1;

-  byte bVar2;

-  uint uVar3;

-  uint uVar4;

-  int iVar5;

-  longlong lVar6;

-  ulonglong uVar7;

-  ulonglong uVar8;

-  undefined *puVar9;

-  undefined2 in_DX;

-  undefined2 uVar10;

-  int *piVar11;

-  undefined8 *unaff_RBX;

-  int *unaff_RSI;

-  ulonglong unaff_RDI;

-  longlong lVar12;

-  undefined8 *in_R8;

-  uint unaff_R12D;

-  uint uVar13;

-  uint unaff_R14D;

-  undefined **unaff_R15;

-  ulonglong *puVar14;

-  undefined8 in_stack_00000030;

-  uint uStack0000000000000060;

-  undefined1 in_stack_00000064;

-  char in_stack_00000065;

-  int *in_stack_00000068;

-  uint in_stack_00000070;

-  uint in_stack_00000074;

-  int *in_stack_00000078;

-  uint in_stack_00000080;

-  undefined4 in_stack_00000084;

-  uint in_stack_00000088;

-  longlong in_stack_00000090;

-  uint in_stack_000000a0;

-  undefined4 in_stack_000000a4;

-  undefined8 in_stack_000000a8;

-  uint *in_stack_000000b0;

-  longlong in_stack_000000c0;

-  undefined8 in_stack_000000c8;

-  undefined8 in_stack_000000d0;

-  undefined8 in_stack_000000d8;

-  undefined8 in_stack_00000100;

-  undefined8 in_stack_00000108;

-  undefined8 in_stack_00000110;

-  int *in_stack_00000118;

-  undefined8 in_stack_00000120;

-  uint in_stack_00000178;

+  uint uVar1;

+  void *_Dst;

+  ulonglong uVar2;

+  undefined8 uVar3;

   

-  do {

-    puVar14 = (ulonglong *)*unaff_RBX;

-    WPP_SF_qisdi(*(undefined8 *)(param_1 + 6),in_DX,in_R8,unaff_RBX,puVar14,(char *)in_R8);

-LAB_0:

-    do {

-      unaff_R12D = unaff_R12D + 1;

-      uVar7 = (ulonglong)unaff_R12D;

-      uVar13 = (uint)unaff_RSI;

-      uVar3 = uVar13;

-      if (unaff_R14D <= unaff_R12D) goto LAB_1;

-      in_stack_00000110 = 0;

-      in_stack_00000118 = (int *)0x0;

-      in_stack_00000120 = 0;

-      uVar3 = *in_stack_000000b0;

-      lVar6 = (longlong)(in_stack_000000c0 + -1 + (ulonglong)in_stack_00000074) /

-              (longlong)(ulonglong)in_stack_00000074;

-      uVar8 = (ulonglong)unaff_RSI & 0xffffffff;

-      if (unaff_R14D != 0) {

-        do {

-          uVar4 = (uint)uVar8;

-          if (unaff_R12D <= uVar4) break;

-          lVar12 = (-(ulonglong)(uVar4 != 0) & 0xffffffffffffc010) + 0x7fe0;

-          lVar6 = (lVar6 + -1 + lVar12) / lVar12;

-          uVar8 = (ulonglong)(uVar4 + 1);

-        } while (uVar4 + 1 < unaff_R14D);

-      }

-      lVar12 = (-(ulonglong)(unaff_R12D != 0) & 0xffffffffffffc010) + 0x7fe0;

-      in_stack_00000078 = (int *)(((lVar6 + -1 + lVar12) / lVar12 + 1) * 0x2000);

-      puVar14 = (ulonglong *)CONCAT44((int)((ulonglong)puVar14 >> 0x20),5);

-      in_R8 = &stack0x00000110;

-      uStack0000000000000060 =

-           FltQueryInformationFile

-                     (*(undefined8 *)(CONCAT44(in_stack_00000084,in_stack_00000080) + 0x20),

-                      *(undefined8 *)(unaff_RBX[0x14] + uVar7 * 8),in_R8,0x18);

-      HsmDbgBreakOnStatus(uStack0000000000000060);

-      if ((int)uStack0000000000000060 < 0) {

-        puVar9 = WPP_GLOBAL_Control;

-        if ((((undefined **)WPP_GLOBAL_Control == unaff_R15) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-        uVar10 = 0x44;

-        goto LAB_3;

-      }

-      if (unaff_R12D < (uVar3 >> 0xc & 7)) {

-        if ((longlong)in_stack_00000118 < (longlong)in_stack_00000078) {

-          uVar4 = 0xc000cf02;

-          HsmDbgBreakOnStatus(-0x3fff30fe);

-          goto LAB_4;

-        }

-        if (in_stack_00000118 != in_stack_00000078) {

-          in_stack_00000118 = unaff_RSI;

-        }

-      }

-      if ((longlong)in_stack_00000118 < (longlong)in_stack_00000078) {

-        puVar14 = (ulonglong *)CONCAT44((int)((ulonglong)puVar14 >> 0x20),0x14);

-        uStack0000000000000060 =

-             FltSetInformationFile

-                       (*(undefined8 *)(CONCAT44(in_stack_00000084,in_stack_00000080) + 0x20),

-                        *(undefined8 *)(unaff_RBX[0x14] + uVar7 * 8),&stack0x00000078,8);

-        HsmDbgBreakOnStatus(uStack0000000000000060);

-        if ((int)uStack0000000000000060 < 0) {

-          puVar9 = WPP_GLOBAL_Control;

-          if ((((undefined **)WPP_GLOBAL_Control == unaff_R15) ||

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-          uVar10 = 0x45;

-        }

-        else {

-          uStack0000000000000060 =

-               HsmpSetFileVDL(*(undefined8 *)(CONCAT44(in_stack_00000084,in_stack_00000080) + 0x20),

-                              *(undefined8 *)(unaff_RBX[0x14] + uVar7 * 8),in_stack_00000078);

-          HsmDbgBreakOnStatus(uStack0000000000000060);

-          if (-1 < (int)uStack0000000000000060) goto LAB_5;

-          puVar9 = WPP_GLOBAL_Control;

-          if ((((undefined **)WPP_GLOBAL_Control == unaff_R15) ||

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-          uVar10 = 0x46;

-        }

-        puVar9 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-        WPP_SF_qisdil(puVar9,uVar10,unaff_RBX + 4,unaff_RBX,*unaff_RBX,(char *)(unaff_RBX + 4));

-        goto LAB_2;

-      }

-      in_stack_00000078 = in_stack_00000118;

-LAB_5:

-      unaff_RDI = (ulonglong)uStack0000000000000060;

-      in_R8 = (undefined8 *)unaff_RBX[0x14];

-      plVar1 = in_R8 + uVar7 + 1;

-      lVar6 = *plVar1;

-      if (lVar6 != 0) {

-        HsmpFileCacheSetFileSize(lVar6,(longlong)in_stack_00000078);

-        if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (4 < (byte)WPP_GLOBAL_Control[0x29])) {

-          in_DX = 0x49;

-          goto LAB_6;

-        }

-        goto LAB_0;

-      }

-      in_R8 = (undefined8 *)in_R8[uVar7];

-      uVar4 = HsmFileCacheCreateFileObject

-                        (*(undefined8 *)(CONCAT44(in_stack_00000084,in_stack_00000080) + 0x20),

-                         *(uint *)(CONCAT44(in_stack_00000084,in_stack_00000080) + 0x68),

-                         (undefined *)in_R8,(longlong)in_stack_00000078,puVar14,unaff_RBX,

-                         in_stack_00000030,plVar1);

-      unaff_RDI = (ulonglong)uVar4;

-      HsmDbgBreakOnStatus(uVar4);

-      if ((int)uVar4 < 0) {

-        if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-          WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x47,in_R8,unaff_RBX,*unaff_RBX,

-                       (char *)(unaff_RBX + 4));

-        }

-        goto LAB_4;

-      }

-    } while ((((undefined **)WPP_GLOBAL_Control == unaff_R15) ||

-             ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-            ((byte)WPP_GLOBAL_Control[0x29] < 5));

-    in_DX = 0x48;

-LAB_6:

-    in_stack_00000030 = CONCAT44(in_stack_00000030._4_4_,unaff_R12D);

-    in_R8 = unaff_RBX + 4;

-    param_1 = (uint *)WPP_GLOBAL_Control;

-  } while( true );

-LAB_1:

-  uVar4 = (uint)unaff_RDI;

-  if (in_stack_00000178 <= uVar3) goto LAB_7;

-  in_stack_00000080 = *in_stack_000000b0 >> 0xc & 7;

-  in_stack_00000088 = in_stack_00000080;

-  if (uVar3 < in_stack_00000080) {

-LAB_8:

-    uVar7 = (unaff_RBX[0x12] + 1) % 2 << 0xc;

-    if (in_stack_000000a0 != uVar13) {

-      in_stack_00000100 = CONCAT44(in_stack_000000a4,in_stack_000000a0);

-      in_stack_00000108 = in_stack_000000a8;

-      HsmIBitmapNORMALUnpinBlock((int *)&stack0x00000100);

-      in_stack_00000068 = unaff_RSI;

-      in_stack_000000a0 = uVar13;

+  uVar3 = 0;

+  if (*param_1 == param_1[1]) {

+    uVar1 = *param_1 * 2;

+    uVar2 = (ulonglong)uVar1;

+    if ((int)uVar1 < 4) {

+      uVar2 = 4;

     }

-    puVar14 = (ulonglong *)&stack0x000000a0;

-    uVar8 = HsmiBitmapNORMALLoadFromDisk

-                      (unaff_RBX,uVar3,uVar7,(ulonglong *)&stack0x00000068,puVar14);

-    uVar4 = (uint)uVar8;

-    HsmDbgBreakOnStatus(uVar4);

-    if ((int)uVar4 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4d,uVar7,unaff_RBX,*unaff_RBX,

-                      (char *)(unaff_RBX + 4));

-      }

-      goto LAB_4;

-    }

-    bVar2 = *(byte *)(in_stack_00000068 + 1);

-    in_R8 = (undefined8 *)(ulonglong)bVar2;

-    if (CONCAT11(bVar2,*(undefined1 *)((longlong)in_stack_00000068 + 5)) ==

-        *(short *)((longlong)in_stack_00000068 + 6)) {

-      if (*in_stack_00000068 == 0x704d7442) {

-        uStack0000000000000060 =

-             HsmiBitmapCheckVersion(bVar2,*(undefined1 *)((longlong)in_stack_00000068 + 5));

-        HsmDbgBreakOnStatus(uStack0000000000000060);

-        if ((int)uStack0000000000000060 < 0) {

-          if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            in_R8 = unaff_RBX + 4;

-            puVar14 = (ulonglong *)*unaff_RBX;

-            WPP_SF_qisdddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

-                           (ulonglong)*(byte *)(in_stack_00000068 + 1),in_R8,unaff_RBX,puVar14,

-                           (char *)in_R8);

-          }

-        }

-        else if (in_stack_00000068[2] == uVar3) {

-          if ((*(longlong *)(in_stack_00000068 + 4) != 0) &&

-             (*(longlong *)(in_stack_00000068 + 4) < (longlong)unaff_RBX[0x12])) {

-            uStack0000000000000060 = 0xc000cf02;

-            HsmDbgBreakOnStatus(-0x3fff30fe);

-            if (((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-               (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 &&

-                (1 < (byte)WPP_GLOBAL_Control[0x29])))) {

-              puVar14 = (ulonglong *)*unaff_RBX;

-              WPP_SF_qisdiid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_RBX + 4,in_R8,

-                             unaff_RBX,puVar14,(char *)(unaff_RBX + 4));

-            }

-          }

-        }

-        else {

-          uStack0000000000000060 = 0xc000cf02;

-          HsmDbgBreakOnStatus(-0x3fff30fe);

-          if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            in_R8 = unaff_RBX + 4;

-            puVar14 = (ulonglong *)*unaff_RBX;

-            WPP_SF_qisddd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x51,in_R8,unaff_RBX,puVar14,

-                          (char *)in_R8);

-          }

-        }

-      }

-      else {

-        uStack0000000000000060 = 0xc000cf02;

-        HsmDbgBreakOnStatus(-0x3fff30fe);

-        if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-          puVar14 = (ulonglong *)*unaff_RBX;

-          WPP_SF_qisdLLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),unaff_RBX + 4,in_R8,unaff_RBX,

-                         puVar14,(char *)(unaff_RBX + 4));

-        }

-      }

+    _Dst = (void *)ExAllocatePool2(0x100,uVar2 * 0x18,0x6d726c43);

+    if (_Dst == (void *)0x0) {

+      uVar3 = 0xc000009a;

+      HsmDbgBreakOnStatus(-0x3fffff66);

     }

     else {

-      uStack0000000000000060 = 0xc000003f;

-      HsmDbgBreakOnStatus(-0x3fffffc1);

-      if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        in_R8 = (undefined8 *)(ulonglong)*(byte *)(in_stack_00000068 + 1);

-        puVar14 = (ulonglong *)*unaff_RBX;

-        WPP_SF_qisdDDLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

-                        (ulonglong)*(byte *)((longlong)in_stack_00000068 + 5),in_R8,unaff_RBX,

-                        puVar14,(char *)(unaff_RBX + 4));

+      if (*(void **)(param_1 + 2) != (void *)0x0) {

+        memmove(_Dst,*(void **)(param_1 + 2),(longlong)*param_1 * 0x18);

+        ExFreePoolWithTag(*(undefined8 *)(param_1 + 2),0x6d726c43);

       }

-    }

-    unaff_RDI = (ulonglong)uStack0000000000000060;

-    if ((int)uStack0000000000000060 < 0) {

-      puVar9 = WPP_GLOBAL_Control;

-      if ((((undefined **)WPP_GLOBAL_Control == unaff_R15) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_2;

-      uVar10 = 0x54;

-      goto LAB_3;

+      *param_1 = (int)uVar2;

+      *(void **)(param_1 + 2) = _Dst;

     }

   }

-  else {

-    in_stack_00000064 = SUB81(unaff_RSI,0);

-    if (in_stack_000000a0 != uVar13) {

-      in_stack_000000c0 = CONCAT44(in_stack_000000a4,in_stack_000000a0);

-      in_stack_000000c8 = in_stack_000000a8;

-      HsmIBitmapNORMALUnpinBlock((int *)&stack0x000000c0);

-      in_stack_00000068 = unaff_RSI;

-      in_stack_000000a0 = uVar13;

-    }

-    uVar7 = HsmpFileCachePreparePinWrite

-                      (*(longlong *)(unaff_RBX[0x14] + 8 + (ulonglong)uVar3 * 8),0,

-                       (undefined *)in_R8,1,puVar14,&stack0x000000a8,&stack0x00000068,

-                       &stack0x00000064);

-    uStack0000000000000060 = (uint)uVar7;

-    HsmDbgBreakOnStatus(uStack0000000000000060);

-    if ((int)uStack0000000000000060 < 0) {

-      puVar9 = WPP_GLOBAL_Control;

-      if ((((undefined **)WPP_GLOBAL_Control == unaff_R15) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_2;

-      uVar10 = 0x4a;

-LAB_3:

-      puVar9 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-      WPP_SF_qisdd(puVar9,uVar10,in_R8,unaff_RBX,*unaff_RBX,(char *)(unaff_RBX + 4));

-LAB_2:

-      uVar4 = HsmiBitmapTranslateIOStatus(puVar9,uStack0000000000000060);

-      HsmDbgBreakOnStatus(uVar4);

-      goto LAB_4;

-    }

-    in_stack_000000a0 = 1;

-    *in_stack_00000068 = 0x704d7442;

-    *(undefined1 *)(in_stack_00000068 + 1) = 1;

-    *(undefined1 *)((longlong)in_stack_00000068 + 5) = 3;

-    *(undefined2 *)((longlong)in_stack_00000068 + 6) = 0x103;

-    in_stack_00000068[2] = uVar3;

-    in_R8 = (undefined8 *)0xffc;

-    piVar11 = in_stack_00000068;

-    iVar5 = RtlComputeCrc32(0);

-    in_stack_00000068[0x3ff] = iVar5;

-    if ((int)uStack0000000000000060 < 0) {

-      puVar9 = WPP_GLOBAL_Control;

-      if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        puVar9 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-        WPP_SF_dd(puVar9,0x4b,&WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,uVar3);

-      }

-      goto LAB_2;

-    }

-    uVar7 = HsmpFileCacheSetAddressRangeModified(in_stack_00000068,piVar11,in_R8);

-    uStack0000000000000060 = (uint)uVar7;

-    unaff_RDI = uVar7 & 0xffffffff;

-    HsmDbgBreakOnStatus(uStack0000000000000060);

-    if ((int)uStack0000000000000060 < 0) {

-      puVar9 = WPP_GLOBAL_Control;

-      if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        puVar9 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-        WPP_SF_d(puVar9,0x4c,&WPP_c1817e300bbb38b8d29e4f471d4baff6_Traceguids,uStack0000000000000060

-                );

-      }

-      goto LAB_2;

-    }

-    if (uVar3 < in_stack_00000088) goto LAB_8;

-  }

-  uVar3 = uVar3 + 1;

-  goto LAB_1;

-LAB_7:

-  if (in_stack_00000065 != '\0') {

-    *(uint *)(unaff_RBX + 2) = *(uint *)(unaff_RBX + 2) | 8;

-  }

-LAB_4:

-  if (in_stack_00000090 != 0) {

-    FltClose();

-  }

-  if (in_stack_000000a0 != uVar13) {

-    in_stack_000000d0 = CONCAT44(in_stack_000000a4,in_stack_000000a0);

-    in_stack_000000d8 = in_stack_000000a8;

-    HsmIBitmapNORMALUnpinBlock((int *)&stack0x000000d0);

-  }

-  if ((int)uVar4 < 0) {

-    lVar6 = unaff_RBX[0x14];

-    if (lVar6 != 0) {

-      do {

-        if (in_stack_00000070 != 0) break;

-        if (*(longlong *)(lVar6 + 8) != 0) {

-          HsmFileCacheCloseFileObject(*(longlong *)(lVar6 + 8));

-          *(int **)(unaff_RBX[0x14] + 8) = unaff_RSI;

-        }

-        if (*(longlong *)unaff_RBX[0x14] != 0) {

-          ObfDereferenceObject();

-          *(int **)unaff_RBX[0x14] = unaff_RSI;

-        }

-        uVar7 = (ulonglong)unaff_RSI & 0xffffffff;

-        uVar3 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RBX);

-        if (uVar3 != 0) {

-          do {

-            if (*(longlong *)(unaff_RBX[0x14] + 0x10 + uVar7 * 8) != 0) {

-              ObfDereferenceObject();

-              *(int **)(unaff_RBX[0x14] + 0x10 + uVar7 * 8) = unaff_RSI;

-            }

-            uVar13 = (int)uVar7 + 1;

-            uVar7 = (ulonglong)uVar13;

-            uVar3 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RBX);

-          } while (uVar13 < uVar3);

-        }

-        in_stack_00000070 = 1;

-        lVar6 = unaff_RBX[0x14];

-      } while (lVar6 != 0);

-      unaff_R15 = &WPP_GLOBAL_Control;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x55,(ulonglong)in_stack_00000070,

-                   unaff_RBX,*unaff_RBX,(char *)(unaff_RBX + 4));

-    }

-  }

-  *(uint *)(unaff_RBX + 3) = uVar4;

-  FltReleasePushLockEx(unaff_RBX + 6,0);

-  return uVar4;

+  return uVar3;

 }
```

## `HsmpReleaseBitmapLock`  (modified)

```diff
--- HsmpReleaseBitmapLock
+++ HsmFltProcessRetrieveProperties
@@ -1,10 +1,241 @@
 

-void HsmpReleaseBitmapLock(longlong param_1)

+uint HsmFltProcessRetrieveProperties

+               (ulonglong param_1,longlong param_2,uint *param_3,longlong param_4,longlong param_5,

+               longlong param_6,undefined8 param_7,longlong param_8,longlong param_9,uint param_10,

+               uint param_11)

 

 {

-  if (*(longlong *)(param_1 + 0xa0) != 0) {

-    FltReleasePushLockEx(*(longlong *)(param_1 + 0xa0) + 0x28,0);

-  }

-  return;

+  char cVar1;

+  bool bVar2;

+  uint uVar3;

+  undefined4 uVar4;

+  uint uVar5;

+  int iVar6;

+  uint *puVar7;

+  uint *puVar8;

+  void *pvVar9;

+  uint *puVar10;

+  undefined *puVar11;

+  undefined8 *puVar12;

+  longlong lVar13;

+  uint uVar14;

+  uint *puVar15;

+  uint *puVar16;

+  uint *puVar17;

+  uint *puVar18;

+  ulonglong local_res8;

+  longlong local_res10;

+  ulonglong in_stack_ffffffffffffff50;

+  uint *local_78;

+  uint *local_70;

+  longlong local_68;

+  uint *local_60;

+  undefined4 local_58 [2];

+  longlong local_50;

+  longlong local_48;

+  undefined8 local_40;

+  longlong local_38;

+  

+  uVar3 = (uint)(in_stack_ffffffffffffff50 >> 0x20);

+  local_40 = *(undefined8 *)(param_2 + 0x20);

+  puVar10 = (uint *)0x0;

+  local_68 = 0;

+  local_50 = 0;

+  local_58[0] = 0;

+  local_78 = (uint *)0x0;

+  local_70 = (uint *)0x0;

+  local_res8 = param_1;

+  local_res10 = param_2;

+  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29])) {

+    puVar11 = WPP_GLOBAL_Control;

+    if (param_5 != 0) {

+      HsmpGetStreamSize(param_5);

+    }

+    in_stack_ffffffffffffff50 = (ulonglong)uVar3 << 0x20;

+    WPP_SF_qqLiqLiqq(*(undefined8 *)(puVar11 + 0x18),0x20,puVar11,param_2);

+  }

+  uVar3 = *(uint *)(param_9 + 0x10);

+  if (((uVar3 < 0x20) || (param_10 < uVar3)) ||

+     ((*(uint *)(param_9 + 0x14) == 0 ||

+      (((param_10 - uVar3) / *(uint *)(param_9 + 0x14) < 0x18 || (param_11 < param_10)))))) {

+    uVar3 = 0xc000cf0b;

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    puVar10 = (uint *)0x0;

+    puVar17 = (uint *)0x0;

+  }

+  else {

+    uVar3 = HsmpLoadPropertyStream(param_2,param_5,(longlong)param_3,param_6,'\0');

+    HsmDbgBreakOnStatus(uVar3);

+    puVar17 = puVar10;

+    if (-1 < (int)uVar3) {

+      local_68 = *(longlong *)(param_6 + 0xe0);

+      lVar13 = (ulonglong)*(uint *)(param_9 + 0x10) + param_9;

+      local_res8 = CONCAT44(local_res8._4_4_,*(uint *)(param_9 + 0x14));

+      puVar7 = puVar10;

+      puVar15 = puVar10;

+      puVar18 = puVar10;

+      uVar3 = *(uint *)(param_9 + 0x14);

+      local_60 = param_3;

+      local_38 = local_68;

+      while( true ) {

+        uVar14 = (uint)puVar7;

+        if (uVar3 <= (uint)puVar15) break;

+        local_48 = (longlong)puVar15 * 3;

+        uVar3 = *(uint *)(lVar13 + (longlong)puVar15 * 0x18);

+        if (uVar3 != 0) {

+          for (puVar12 = *(undefined8 **)(local_68 + 0x50);

+              (puVar12 != (undefined8 *)(local_68 + 0x50) && (*(uint *)(puVar12 + 2) <= uVar3));

+              puVar12 = (undefined8 *)*puVar12) {

+            if ((*(uint *)(puVar12 + 2) == uVar3) &&

+               ((*(int *)((longlong)puVar12 + 0x14) == 0 &&

+                (bVar2 = HsmiIsLockOwned((longlong)puVar12,(ulonglong *)&local_60), !bVar2)))) {

+              uVar3 = 0xc000cf1a;

+              HsmDbgBreakOnStatus(-0x3fff30e6);

+              goto LAB_0;

+            }

+          }

+          puVar8 = puVar10;

+          for (puVar16 = *(uint **)(local_68 + 0x40);

+              (puVar16 != (uint *)(local_68 + 0x40) && (puVar8 = puVar16, puVar16[4] != uVar3));

+              puVar16 = *(uint **)puVar16) {

+          }

+          if (puVar8 != (uint *)0x0) {

+            if (*(char *)((longlong)puVar8 + 0x1b) == '\0') {

+              uVar3 = puVar8[6];

+            }

+            else {

+              uVar3 = puVar8[7];

+            }

+            uVar3 = uVar3 & 0xffffff;

+            if (uVar3 <= *(uint *)(lVar13 + 4 + local_48 * 8)) {

+              uVar5 = puVar8[6] & 0xffffff;

+              if (uVar5 <= uVar14) {

+                uVar5 = uVar14;

+              }

+              puVar7 = (uint *)(ulonglong)uVar5;

+              if ((*(char *)((longlong)puVar8 + 0x1b) != '\0') &&

+                 (puVar18 < (uint *)((ulonglong)uVar3 + 4))) {

+                puVar18 = (uint *)(ulonglong)(uVar3 + 4);

+              }

+            }

+          }

+        }

+        puVar15 = (uint *)(ulonglong)((uint)puVar15 + 1);

+        uVar3 = (uint)local_res8;

+      }

+      if ((uVar14 == 0) ||

+         (local_78 = (uint *)ExAllocatePool2(0x100,puVar7,0x72507348), local_78 != (uint *)0x0)) {

+        puVar7 = puVar10;

+        puVar17 = local_78;

+        if (((int)puVar18 == 0) ||

+           (local_70 = (uint *)ExAllocatePool2(0x100,puVar18,0x72507348), local_70 != (uint *)0x0))

+        {

+          for (; (uint)puVar7 < *(uint *)(param_9 + 0x14);

+              puVar7 = (uint *)(ulonglong)((uint)puVar7 + 1)) {

+            uVar3 = *(uint *)(lVar13 + (longlong)puVar7 * 0x18);

+            if (uVar3 != 0) {

+              puVar15 = (uint *)(local_68 + 0x40);

+              puVar16 = puVar10;

+              for (puVar18 = *(uint **)puVar15;

+                  (puVar18 != puVar15 && (puVar16 = puVar18, puVar18[4] != uVar3));

+                  puVar18 = *(uint **)puVar18) {

+              }

+              if ((puVar18 == puVar15) || (uVar14 = puVar16[6] & 0xffffff, uVar14 == 0)) {

+LAB_1:

+                *(undefined8 *)(lVar13 + 0x10 + (longlong)puVar7 * 0x18) = 0;

+              }

+              else {

+                local_60 = puVar16 + 7;

+                if (*(char *)((longlong)puVar16 + 0x1b) != '\0') {

+                  uVar14 = *local_60 & 0xffffff;

+                }

+                *(uint *)(lVar13 + 0x10 + (longlong)puVar7 * 0x18) = uVar14;

+                if (*(uint *)(lVar13 + 4 + (longlong)puVar7 * 0x18) < uVar14) {

+                  *(undefined4 *)(lVar13 + 0x14 + (longlong)puVar7 * 0x18) = 0x80000005;

+                }

+                else {

+                  local_50 = (ulonglong)puVar16[5] + 8;

+                  in_stack_ffffffffffffff50 = in_stack_ffffffffffffff50 & 0xffffffff00000000;

+                  uVar3 = FltReadFile(local_40,*(undefined8 *)(local_68 + 0x18),&local_50,

+                                      puVar16[6] & 0xffffff,local_78,in_stack_ffffffffffffff50,

+                                      local_58,0,0);

+                  HsmDbgBreakOnStatus(uVar3);

+                  if ((int)uVar3 < 0) {

+                    puVar10 = local_70;

+                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                      WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x21,

+                                  &WPP_763fdbe3267e397a59cf662dc14be4ed_Traceguids,local_res10);

+                    }

+                    goto LAB_0;

+                  }

+                  puVar15 = local_78;

+                  if (*(char *)((longlong)puVar16 + 0x1b) != '\0') {

+                    local_res8 = local_res8 & 0xffffffff00000000;

+                    in_stack_ffffffffffffff50 =

+                         CONCAT44((int)(in_stack_ffffffffffffff50 >> 0x20),puVar16[6]) &

+                         0xffffffff00ffffff;

+                    iVar6 = HsmiDecompressBuffer

+                                      ((ushort)(byte)(puVar16[6] >> 0x18),

+                                       *(byte *)((longlong)puVar16 + 0x1f),local_70,uVar14 + 4,

+                                       local_78,(int)in_stack_ffffffffffffff50,&local_res8);

+                    HsmDbgBreakOnStatus(iVar6);

+                    if ((iVar6 < 0) || ((uint)local_res8 != uVar14 + 4)) {

+                      HsmDbgBreakOnCorruption();

+                      goto LAB_1;

+                    }

+                    local_60 = local_70;

+                    puVar15 = local_70 + 1;

+                  }

+                  pvVar9 = *(void **)(lVar13 + 8 + (longlong)puVar7 * 0x18);

+                  cVar1 = FltIs32bitProcess(param_8);

+                  if (cVar1 != '\0') {

+                    pvVar9 = (void *)((ulonglong)pvVar9 & 0xffffffff);

+                  }

+                  uVar4 = RtlCrc32(puVar15,(ulonglong)uVar14,0);

+                  local_res8 = CONCAT44(local_res8._4_4_,uVar4);

+                  RtlCopyToUser(pvVar9,puVar15,(ulonglong)uVar14);

+                  uVar4 = 0;

+                  if ((uint)local_res8 != *local_60) {

+                    HsmDbgBreakOnCorruption();

+                    uVar4 = 0x8000cf00;

+                  }

+                  *(undefined4 *)(lVar13 + 0x14 + (longlong)puVar7 * 0x18) = uVar4;

+                }

+              }

+            }

+          }

+          *(ulonglong *)(param_8 + 0x20) = (ulonglong)param_10;

+          uVar3 = 0;

+          puVar10 = local_70;

+        }

+        else {

+          uVar3 = 0xc000009a;

+          HsmDbgBreakOnStatus(-0x3fffff66);

+          puVar10 = local_70;

+        }

+      }

+      else {

+        uVar3 = 0xc000009a;

+        HsmDbgBreakOnStatus(-0x3fffff66);

+        puVar17 = local_78;

+      }

+    }

+  }

+LAB_0:

+  if (local_68 != 0) {

+    ExReleaseResourceLite(param_6 + 0x78);

+    KeLeaveCriticalRegion();

+  }

+  if (puVar17 != (uint *)0x0) {

+    ExFreePoolWithTag(puVar17,0x72507348);

+  }

+  if (puVar10 != (uint *)0x0) {

+    ExFreePoolWithTag(puVar10,0x72507348);

+  }

+  HsmpUnloadPropertyStream(param_6);

+  return uVar3;

 }
```

## `HsmpRecallTerminateProgressiveHydration`  (modified)

```diff
--- HsmpRecallTerminateProgressiveHydration
+++ HsmpRecallTerminateProgressiveHydration
@@ -1,38 +1,46 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

-undefined8 HsmpRecallTerminateProgressiveHydration(longlong param_1,ulonglong param_2)

+void HsmpRecallTerminateProgressiveHydration(longlong param_1)

 

 {

-  uint *puVar1;

-  ulonglong in_RAX;

-  undefined4 unaff_EBX;

-  char unaff_BPL;

-  longlong unaff_RSI;

-  undefined8 in_R9;

-  char unaff_R14B;

-  longlong unaff_R15;

-  undefined4 uStack0000000000000028;

-  ulonglong uStack0000000000000030;

+  ulonglong uVar1;

+  longlong lVar2;

+  ulonglong uVar3;

+  undefined *puVar4;

   

-  puVar1 = (uint *)(param_1 + -0x80);

-  *puVar1 = *puVar1 + 1;

-  if ((POPCOUNT(*puVar1 & 0xff) & 1U) != 0) {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-    halt_baddata();

+  LOCK();

+  uVar1 = *(ulonglong *)(param_1 + 0x38);

+  if (uVar1 == 0) {

+    *(ulonglong *)(param_1 + 0x38) = 0;

+    uVar1 = 0;

   }

-  uStack0000000000000030 = in_RAX & 0xffffffffffffff48;

-  uStack0000000000000028 = *(undefined4 *)(unaff_RSI + 0x1c);

-  WPP_SF_qqLiqiqd(param_1,(short)param_2,&WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,in_R9);

-  *(undefined4 *)(unaff_R15 + 0x18) = unaff_EBX;

-  *(undefined8 *)(unaff_R15 + 0x20) = 0;

-  if (unaff_BPL != '\0') {

-    FltReleasePushLockEx(*(longlong *)(unaff_RSI + 0x10) + 0x18,0);

+  UNLOCK();

+  do {

+    uVar3 = uVar1;

+    if ((uVar3 & 1) != 0) {

+      return;

+    }

+    LOCK();

+    uVar1 = *(ulonglong *)(param_1 + 0x38);

+    if (uVar3 == uVar1) {

+      *(ulonglong *)(param_1 + 0x38) = uVar3 | 1;

+      uVar1 = uVar3;

+    }

+    UNLOCK();

+  } while (uVar1 != uVar3);

+  if (uVar1 != 0) {

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      lVar2 = *(longlong *)(param_1 + 0x10);

+      puVar4 = WPP_GLOBAL_Control;

+      HsmpGetStreamSize(lVar2);

+      WPP_SF_iqLi(*(undefined8 *)(puVar4 + 0x18),uVar3,puVar4,

+                  *(undefined8 *)(*(longlong *)(lVar2 + 0x10) + 0x20));

+    }

+    (*DAT_0)(*(undefined8 *)(*(longlong *)(param_1 + 0x10) + 8),uVar1);

   }

-  if (unaff_R14B != '\0') {

-    HsmpReleaseUserRequestRundownProtection(unaff_RSI);

-  }

-  return 4;

+  return;

 }
```

## `HsmOsGetProxiedProcessId`  (modified)

```diff
--- HsmOsGetProxiedProcessId
+++ HsmOsGetProxiedProcessId
@@ -1,110 +1,68 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 int HsmOsGetProxiedProcessId(longlong param_1)

 

 {

-  bool bVar1;

-  char cVar2;

-  uint in_EAX;

-  longlong lVar3;

+  char cVar1;

+  int iVar2;

+  void *pvVar3;

   longlong lVar4;

-  uint *puVar5;

+  longlong lVar5;

   longlong lVar6;

-  undefined8 uVar7;

-  byte bVar8;

-  undefined8 uStack0000000000000030;

-  undefined8 uStack0000000000000038;

-  undefined8 uStack0000000000000040;

-  undefined8 uStack0000000000000048;

-  undefined8 uStack0000000000000050;

-  undefined8 uStack0000000000000058;

-  undefined8 uStack0000000000000060;

-  undefined8 uStack0000000000000068;

-  undefined8 uStack0000000000000070;

-  undefined8 uStack0000000000000078;

-  undefined4 in_stack_00000080;

-  undefined4 in_stack_00000084;

-  undefined8 in_stack_00000088;

-  undefined4 in_stack_00000090;

-  ulonglong uStack0000000000000098;

+  longlong lVar7;

+  undefined1 auStack_88 [32];

+  undefined1 local_68;

+  int local_64;

+  longlong local_60;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  undefined8 local_48;

+  undefined8 uStack_40;

+  undefined8 local_38;

+  undefined8 uStack_30;

+  ulonglong local_28;

   

-  uStack0000000000000098 = (ulonglong)(in_EAX ^ (uint)&stack0x00000000);

-  uStack0000000000000050 = 0;

-  uStack0000000000000058 = 0;

-  uStack0000000000000060 = 0;

-  uStack0000000000000068 = 0;

-  uStack0000000000000070 = 0;

-  uStack0000000000000078 = 0;

-  uStack0000000000000030 = 0;

-  uStack0000000000000038 = 0;

-  uStack0000000000000040 = 0;

-  uStack0000000000000048 = 0;

-  bVar1 = false;

-  lVar6 = param_1;

-  if (param_1 == 0) {

-    lVar6 = PsGetCurrentProcess();

+  local_28 = __security_cookie ^ (ulonglong)auStack_88;

+  pvVar3 = HsmpGetRequestorThread(param_1);

+  local_58 = 0;

+  uStack_50 = 0;

+  local_48 = 0;

+  uStack_40 = 0;

+  local_38 = 0;

+  uStack_30 = 0;

+  iVar2 = 0;

+  local_64 = 0;

+  lVar4 = PsGetThreadProcess(pvVar3);

+  local_68 = 0;

+  lVar7 = lVar4;

+  local_60 = lVar4;

+  if (lVar4 == 0) {

+    lVar7 = PsGetCurrentProcess();

   }

-  lVar3 = PsGetCurrentProcess();

-  if (lVar6 != lVar3) {

-    KeStackAttachProcess(lVar6,&stack0x00000050);

+  lVar5 = PsGetCurrentProcess();

+  if (lVar7 != lVar5) {

+    KeStackAttachProcess(lVar7,&local_58);

+    local_68 = 1;

   }

-  if (param_1 == 0) {

-    uVar7 = PsGetCurrentProcess();

-    lVar4 = PsGetProcessWow64Process(uVar7);

-    if (lVar4 != 0) {

-      param_1 = PsGetCurrentProcess();

-      goto LAB_0;

+  lVar6 = PsGetThreadTeb(pvVar3);

+  if (lVar6 != 0) {

+    cVar1 = HsmpIs32bitProcess();

+    if (cVar1 == '\0') {

+      iVar2 = *(int *)(lVar6 + 0x28c);

+      local_64 = iVar2;

     }

-    uVar7 = PsGetCurrentProcess();

-    lVar4 = PsGetProcessPeb(uVar7);

-    if (lVar4 == 0) goto LAB_1;

-    param_1 = PsGetCurrentProcess();

-  }

-  else {

-    lVar4 = PsGetProcessWow64Process(param_1);

-    if (lVar4 != 0) {

-LAB_0:

-      lVar4 = PsGetProcessWow64Process(param_1);

-      puVar5 = (uint *)(lVar4 + 0x460);

-      goto LAB_2;

-    }

-    lVar4 = PsGetProcessPeb();

-    if (lVar4 == 0) {

-LAB_1:

-      puVar5 = (uint *)0x0;

-      goto LAB_2;

+    else {

+      iVar2 = *(int *)(lVar6 + 0x2180);

+      local_64 = iVar2;

     }

   }

-  lVar4 = PsGetProcessPeb(param_1);

-  puVar5 = (uint *)(lVar4 + 0x7a8);

-LAB_2:

-  if ((puVar5 == (uint *)0x0) || ((*puVar5 & 0x100) == 0)) {

-    bVar8 = 0;

+  if (iVar2 == 0) {

+    iVar2 = PsGetProcessId(lVar4);

   }

-  else {

-    bVar8 = 1;

+  if (lVar7 != lVar5) {

+    KeUnstackDetachProcess(&local_58);

   }

-  if (bVar8 != 0) {

-    in_stack_00000090 = 0;

-    SeCaptureSubjectContext(&stack0x00000030);

-    bVar1 = true;

-    SeLockSubjectContext(&stack0x00000030);

-    in_stack_00000080 = 1;

-    in_stack_00000084 = 1;

-    in_stack_00000088 = 0x12;

-    cVar2 = SePrivilegeCheck(&stack0x00000080,&stack0x00000030,1);

-    if (cVar2 == '\0') {

-      bVar8 = 0;

-    }

-  }

-  if (bVar1) {

-    SeUnlockSubjectContext(&stack0x00000030);

-    SeReleaseSubjectContext(&stack0x00000030);

-  }

-  if (lVar6 != lVar3) {

-    KeUnstackDetachProcess(&stack0x00000050);

-  }

-  return (int)bVar8;

+  return iVar2;

 }
```

## `CldiStreamAllocateRequest`  (modified)

```diff
--- CldiStreamAllocateRequest
+++ HsmiPrepareBitmapCommit
@@ -1,30 +1,13 @@
 

-uint * CldiStreamAllocateRequest

-                 (undefined8 *param_1,uint param_2,uint param_3,undefined8 *param_4,uint param_5,

-                 undefined8 param_6,undefined8 param_7,undefined8 param_8,undefined1 param_9,

-                 undefined8 *param_10)

+/* WARNING: Control flow encountered bad instruction data */

+

+int HsmiPrepareBitmapCommit(longlong param_1,int param_2,undefined8 *param_3,undefined4 *param_4)

 

 {

-  uint *extraout_RAX;

-  uint *puVar1;

-  undefined4 in_register_00000014;

-  undefined4 in_register_00000084;

+  int *unaff_RDI;

   

-  FltCloseCommunicationPort();

-  DAT_0 = 0;

-  CldStreamUninitialize

-            (param_1,CONCAT44(in_register_00000014,param_2),

-             (undefined *)CONCAT44(in_register_00000084,param_3));

-  puVar1 = extraout_RAX;

-  if (DAT_1 != '\0') {

-    ExDeletePagedLookasideList(&DAT_2);

-    ExDeletePagedLookasideList(&DAT_3);

-    ExDeletePagedLookasideList(&DAT_4);

-    ExDeletePagedLookasideList(&DAT_5);

-    ExDeletePagedLookasideList(&DAT_6);

-    ExDeletePagedLookasideList(&DAT_7);

-    puVar1 = (uint *)ExDeletePagedLookasideList(&DAT_8);

-  }

-  return puVar1;

+  *unaff_RDI = *unaff_RDI + -1;

+                    /* WARNING: Bad instruction - Truncating control flow here */

+  halt_baddata();

 }
```

## `CldiStreamCompleteRequest`  (modified)

```diff
--- CldiStreamCompleteRequest
+++ HsmpRpValidateBuffer
@@ -1,48 +1,26 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-void CldiStreamCompleteRequest(longlong *param_1,uint *param_2,ulonglong param_3,uint param_4)

+int * HsmpRpValidateBuffer(uint *param_1,uint param_2)

 

 {

-  int iVar1;

-  code *in_RAX;

-  longlong lVar2;

   longlong unaff_RBP;

-  uint unaff_R12D;

-  longlong unaff_R14;

-  longlong unaff_R15;

-  char in_CF;

-  longlong unaff_retaddr;

+  byte unaff_SIL;

+  uint unaff_EDI;

+  undefined8 unaff_R12;

+  byte unaff_R14B;

+  undefined *unaff_R15;

+  undefined8 uStack0000000000000028;

+  undefined8 uStack0000000000000030;

   

-  *(char *)((longlong)param_1 + -0x77) =

-       (*(char *)((longlong)param_1 + -0x77) - (byte)param_1) - in_CF;

-  *(byte *)((longlong)param_1 + -0x75) = *(byte *)((longlong)param_1 + -0x75) & (byte)param_1;

-  LOCK();

-  in_RAX[0x48000000] = SUB81(param_2,0);

-  UNLOCK();

-  if ((int)in_RAX != 0) {

-    iVar1 = (*in_RAX)(*(undefined8 *)(unaff_RBP + -1),unaff_retaddr,*(undefined8 *)(unaff_RBP + -9))

-    ;

-    if (iVar1 < 0) {

-      *(undefined8 *)(unaff_R15 + 0x20) = 0;

-      unaff_R12D = 4;

-      *(int *)(unaff_R15 + 0x18) = iVar1;

-    }

+  if (((WPP_GLOBAL_Control != unaff_R15) &&

+      ((unaff_SIL & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+     (unaff_R14B <= (byte)WPP_GLOBAL_Control[0x29])) {

+    uStack0000000000000030 = *(undefined8 *)(unaff_RBP + 0x77);

+    uStack0000000000000028 = *(undefined8 *)(unaff_RBP + -0x69);

+    WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x95,

+                 &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,unaff_R12);

   }

-  if (*(longlong *)(unaff_R14 + 0x88) == 0) {

-    lVar2 = 0;

-    if (unaff_R12D == 4) {

-      HsmpReleaseUserRequestRundownProtection(unaff_retaddr);

-    }

-    else if ((unaff_R12D == 0) && (lVar2 = unaff_retaddr, *(longlong *)(unaff_R14 + 0x20) != 0)) {

-      lVar2 = *(longlong *)(unaff_R14 + 0x20);

-    }

-    HsmpTracePreCallbackExit((ulonglong)unaff_R12D,unaff_R15,lVar2,'\x01','\0');

-    FltCompletePendedPreOperation();

-  }

-  else {

-    KeSetEvent(*(longlong *)(unaff_R14 + 0x88),0,0);

-  }

-  return;

+  return (int *)(ulonglong)unaff_EDI;

 }
```

## `HsmFltPreCLEANUP`  (modified)

```diff
--- HsmFltPreCLEANUP
+++ HsmFltPreSetDispositionInformation
@@ -1,568 +1,233 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

-

-uint HsmFltPreCLEANUP(longlong param_1,longlong param_2,longlong *param_3,longlong *param_4)

+uint HsmFltPreSetDispositionInformation

+               (int *param_1,int *param_2,longlong param_3,longlong param_4,longlong param_5,

+               longlong *param_6)

 

 {

-  ulonglong *_Src;

   int *piVar1;

-  undefined4 uVar2;

-  longlong lVar3;

-  ulonglong *puVar4;

-  undefined8 uVar5;

-  code *pcVar6;

-  longlong lVar7;

-  undefined1 *puVar8;

-  char cVar9;

+  uint uVar2;

+  char cVar3;

+  int iVar4;

+  uint uVar5;

+  int iVar6;

+  ulonglong uVar7;

+  longlong lVar8;

+  longlong lVar9;

   uint uVar10;

-  uint uVar11;

-  int iVar12;

-  longlong lVar13;

-  longlong lVar14;

-  undefined8 uVar15;

-  int *piVar16;

-  ulonglong uVar17;

-  ulonglong uVar18;

-  undefined8 uVar19;

-  longlong *plVar20;

-  undefined2 uVar21;

-  longlong *plVar22;

-  undefined1 *puVar23;

-  longlong lVar24;

-  longlong *plVar25;

-  uint uVar26;

-  longlong *in_R10;

-  undefined *puVar27;

-  longlong *in_R11;

-  ulonglong uVar28;

-  uint uVar29;

-  longlong *local_res10;

-  longlong *local_res18;

-  uint local_res20 [2];

-  undefined8 uStack_120;

-  undefined1 auStack_118 [32];

-  char local_f8 [64];

-  longlong local_b8;

-  longlong local_b0;

-  longlong local_a8;

-  ulonglong local_a0;

-  ulonglong *local_98;

-  longlong *local_90;

-  longlong *local_88;

-  int *local_80;

-  ulonglong local_78;

-  longlong *local_70;

-  ulonglong local_68;

-  undefined8 local_60;

-  undefined8 uStack_58;

-  undefined8 local_50;

-  uint uVar30;

+  int *piVar11;

+  bool bVar12;

+  uint local_78;

+  longlong local_70;

+  undefined8 local_68;

+  int *local_60;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  undefined8 local_48;

   

-  lVar13 = 0;

-  *param_3 = 0;

-  lVar14 = *(longlong *)(param_2 + 0x18);

-  local_b8 = 0;

-  uVar29 = 1;

-  uVar30 = 1;

-  local_80 = (int *)0x0;

-  local_b0 = 0;

-  FltGetStreamHandleContext(lVar14,*(undefined8 *)(param_2 + 0x20),&local_b0);

-  if (local_b0 != 0) {

-    if ((*(uint *)(*(longlong *)(local_b0 + 0x10) + 0x1c) & 1) == 0) {

-      if (local_b0 != 0) {

-        FltDeleteContext(local_b0);

-        goto LAB_0;

-      }

+  bVar12 = false;

+  local_78 = 0;

+  lVar8 = *(longlong *)(param_5 + 0x18);

+  iVar6 = 0;

+  local_68 = *(undefined8 *)(param_5 + 0x20);

+  uVar10 = 1;

+  if (param_4 == 0) {

+    return 1;

+  }

+  lVar9 = *(longlong *)(param_4 + 0x10);

+  if (*(char *)(lVar9 + 4) != '\x06') {

+    return 1;

+  }

+  if (*(int *)(lVar9 + 0x20) == 0xd) {

+    if (**(char **)(lVar9 + 0x38) == '\0') {

+LAB_0:

+      if (*(int *)(lVar9 + 0x20) == 0xd) {

+        if (**(char **)(lVar9 + 0x38) != '\0') {

+          return 1;

+        }

+      }

+      else {

+        if (*(int *)(lVar9 + 0x20) != 0x40) {

+          return 1;

+        }

+        if ((**(uint **)(lVar9 + 0x38) & 1) != 0) {

+          return 1;

+        }

+      }

+    }

+  }

+  else if ((*(int *)(lVar9 + 0x20) != 0x40) || ((**(uint **)(lVar9 + 0x38) & 1) == 0))

+  goto LAB_0;

+  if ((param_2 == (int *)0x0) || ((param_2[7] & 1U) == 0)) {

+    piVar11 = param_1 + 0x1c;

+    FltAcquirePushLockExclusiveEx(piVar11,0);

+    KeClearEvent(param_1 + 0x1e);

+    param_1[0x2a] = param_1[0x2a] + 1;

+    FltReleasePushLockEx(piVar11,0);

+    iVar4 = FltCancellableWaitForSingleObject(param_1 + 0x24,0,param_4);

+    HsmDbgBreakOnStatus(iVar4);

+    if (iVar4 < 0) {

+      FltAcquirePushLockExclusiveEx(piVar11,0);

+      piVar1 = param_1 + 0x2a;

+      *piVar1 = *piVar1 + -1;

+      if (*piVar1 == 0) {

+        KeSetEvent(param_1 + 0x1e,0,0);

+      }

+      FltReleasePushLockEx(piVar11,0);

+      *(int *)(param_4 + 0x18) = iVar4;

       goto LAB_1;

     }

-    if (local_b0 == 0) goto LAB_1;

-    if (*(longlong *)

-         (*(longlong *)(*(longlong *)(*(longlong *)(local_b0 + 0x10) + 0x10) + 0x10) + 0x20) ==

-        lVar14) {

-      if (param_1 != 0) {

-        lVar14 = FltGetRequestorProcess(param_1);

-        cVar9 = HsmOsIsPassThroughModeEnabled(lVar14);

-        if (cVar9 != '\0') goto LAB_0;

-      }

+    piVar11 = param_1;

+    if (param_1 != (int *)0x0) goto LAB_2;

+  }

+  else {

+    iVar4 = FltCancellableWaitForSingleObject(*(longlong *)(param_2 + 4) + 0x60,0,param_4);

+    HsmDbgBreakOnStatus(iVar4);

+    piVar11 = param_2;

+    if (-1 < iVar4) {

+LAB_2:

+      FltReferenceContext(piVar11);

+      local_60 = piVar11;

+      if (param_3 == 0) {

+        local_70 = 0;

+        FltGetStreamHandleContext(lVar8,local_68,&local_70);

+        param_3 = local_70;

+        uVar7 = HsmpIsPlaceholderHandle(local_70);

+        lVar9 = param_3;

+        if ((char)uVar7 == '\0') {

+          bVar12 = param_3 == 0;

+          if (!bVar12) {

+            FltDeleteContext(param_3);

+            FltReleaseContext(local_70);

+            lVar9 = 0;

+            local_70 = 0;

+            goto LAB_3;

+          }

+        }

+        else {

+LAB_3:

+          bVar12 = lVar9 == 0;

+          param_3 = 0;

+          if (!bVar12) {

+            if (*(longlong *)

+                 (*(longlong *)(*(longlong *)(*(longlong *)(lVar9 + 0x10) + 0x10) + 0x10) + 0x20) !=

+                lVar8) {

+              FltReleaseContext(lVar9);

+              lVar9 = 0;

+              local_70 = 0;

+            }

+            bVar12 = lVar9 == 0;

+            param_3 = 0;

+            if (!bVar12) {

+              lVar8 = FltGetRequestorProcess(param_4);

+              cVar3 = HsmOsIsPassThroughModeEnabled(lVar8);

+              if (cVar3 != '\0') {

+                FltReleaseContext(local_70);

+                local_70 = 0;

+              }

+              bVar12 = local_70 == 0;

+              param_3 = local_70;

+            }

+          }

+        }

+        bVar12 = !bVar12;

+        if (param_3 != 0) goto LAB_4;

+LAB_5:

+        uVar10 = 0;

+        param_1 = (int *)0x0;

+        *param_6 = (longlong)piVar11;

+        iVar6 = 0;

+      }

+      else {

+LAB_4:

+        lVar8 = *(longlong *)(param_4 + 0x10);

+        if (*(char *)(lVar8 + 4) == '\x06') {

+          uVar5 = uVar10;

+          if (*(int *)(lVar8 + 0x20) == 0xd) {

+            if (**(char **)(lVar8 + 0x38) == '\0') goto LAB_6;

+          }

+          else if ((*(int *)(lVar8 + 0x20) != 0x40) || ((**(uint **)(lVar8 + 0x38) & 1) == 0))

+          goto LAB_6;

+        }

+        else {

+LAB_6:

+          uVar5 = 0;

+        }

+        if ((*(uint *)(param_3 + 0x28) >> 0xb & 1) == uVar5) goto LAB_5;

+        if (*(char *)(lVar8 + 4) == '\x06') {

+          if (*(int *)(lVar8 + 0x20) == 0xd) {

+            if (**(char **)(lVar8 + 0x38) != '\0') {

+LAB_7:

+              *(uint *)(param_3 + 0x28) = *(uint *)(param_3 + 0x28) | 0x800;

+            }

+          }

+          else if ((*(int *)(lVar8 + 0x20) == 0x40) && ((**(uint **)(lVar8 + 0x38) & 1) != 0))

+          goto LAB_7;

+        }

+        lVar8 = *(longlong *)(param_4 + 0x10);

+        if (*(char *)(lVar8 + 4) == '\x06') {

+          if (*(int *)(lVar8 + 0x20) == 0xd) {

+            if (**(char **)(lVar8 + 0x38) == '\0') {

+LAB_8:

+              local_78 = 0x80;

+            }

+          }

+          else if ((*(int *)(lVar8 + 0x20) == 0x40) && ((**(uint **)(lVar8 + 0x38) & 1) == 0))

+          goto LAB_8;

+        }

+        local_48 = 0;

+        uVar5 = param_2[7];

+        local_58 = 0;

+        uStack_50 = 0;

+        KeInitializeEvent(&local_58,1,0);

+        *(undefined8 **)(param_4 + 0x40) = &local_58;

+        uVar2 = local_78 | 0x10;

+        if ((uVar5 & 2) == 0) {

+          uVar2 = local_78;

+        }

+        HsmpCldNotifyPreOperation(4,param_4,uVar2,0,HsmiInfoRenameNotificationCallback,param_4);

+        iVar6 = FltCancellableWaitForSingleObject(&local_58,0,param_4);

+        HsmDbgBreakOnStatus(iVar6);

+        if ((iVar6 == -0x3fffffb5) || (iVar6 == -0x3ffffee0)) {

+          FltCancelIo(param_4);

+          KeWaitForSingleObject(&local_58,0,0,0,0);

+        }

+        *(undefined8 *)(param_4 + 0x40) = 0;

+        if (iVar6 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x3e,

+                         &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_4);

+          }

+          *(int *)(param_4 + 0x18) = iVar6;

+          param_1 = piVar11;

+        }

+        else {

+          uVar10 = HsmiInfoPrepareForPostSetDispostionInformation

+                             (param_4,*(uint *)(param_4 + 0x18),&local_60,param_6);

+          param_1 = local_60;

+        }

+      }

+      if (bVar12) {

+        FltReleaseContext(param_2);

+      }

+      goto LAB_9;

     }

-    else {

-LAB_0:

-      FltReleaseContext(local_b0);

-      local_b0 = 0;

-    }

-    lVar14 = local_b0;

-    if (local_b0 == 0) goto LAB_1;

-    lVar13 = *(longlong *)(local_b0 + 0x10);

-    lVar24 = *(longlong *)(lVar13 + 0x10);

-    local_b8 = *(longlong *)(lVar24 + 0x10);

-    FltReferenceContext(lVar24);

-    goto LAB_2;

-  }

+    *(int *)(param_4 + 0x18) = iVar4;

 LAB_1:

-  lVar14 = local_b0;

-  lVar3 = *(longlong *)(param_2 + 0x18);

-  local_a8 = 0;

-  FltGetFileContext(lVar3,*(undefined8 *)(param_2 + 0x20),&local_a8);

-  puVar23 = auStack_118;

-  lVar24 = local_a8;

-  if (local_a8 != 0) {

-    if (*(longlong *)(*(longlong *)(local_a8 + 0x10) + 0x20) == lVar3) {

-      if (param_1 != 0) {

-        lVar13 = FltGetRequestorProcess(param_1);

-        cVar9 = HsmOsIsPassThroughModeEnabled(lVar13);

-        lVar24 = local_a8;

-        lVar13 = 0;

-        if (cVar9 != '\0') goto LAB_3;

-      }

-    }

-    else {

-LAB_3:

-      FltReleaseContext(local_a8);

-      local_a8 = 0;

-      lVar24 = 0;

-      lVar13 = 0;

-    }

-LAB_2:

-    puVar23 = auStack_118;

-    if (lVar24 != 0) {

-      uVar17 = *(ulonglong *)(param_2 + 0x20);

-      local_78 = uVar17;

-      local_68 = uVar17;

-      KeEnterCriticalRegion();

-      ExAcquireResourceExclusiveLite(lVar24 + 0x78);

-      local_a0 = *(ulonglong *)(lVar24 + 0xe0);

-      puVar23 = auStack_118;

-      if (local_a0 != 0) {

-        plVar22 = *(longlong **)(local_a0 + 0x60);

-        plVar20 = (longlong *)(local_a0 + 0x60);

-        local_res10 = plVar20;

-        local_res18 = plVar20;

-        if (plVar22 != plVar20) {

-          do {

-            plVar25 = plVar22;

-            if ((uVar17 <= (ulonglong)plVar22[-8]) && ((ulonglong)plVar22[-8] <= uVar17)) {

-              puVar23 = auStack_118;

-              if ((longlong *)plVar22[1] != local_res10) goto LAB_4;

-              lVar3 = *plVar22;

-              puVar23 = auStack_118;

-              if (*(longlong **)(lVar3 + 8) != plVar22) goto LAB_4;

-              *local_res10 = lVar3;

-              *(longlong **)(lVar3 + 8) = local_res10;

-              plVar22[1] = (longlong)plVar22;

-              *plVar22 = (longlong)plVar22;

-              *(undefined4 *)(plVar22 + -2) = 0xc0000008;

-              KeSetEvent(plVar22 + -5,0,0);

-              plVar20 = local_res18;

-              plVar25 = *(longlong **)local_res10[1];

-            }

-            plVar22 = (longlong *)*plVar25;

-            local_res10 = plVar25;

-          } while (plVar22 != plVar20);

-        }

-        in_R11 = *(longlong **)(local_a0 + 0x50);

-        param_4 = (longlong *)(local_a0 + 0x50);

-        local_res10 = (longlong *)((ulonglong)local_res10 & 0xffffffffffffff00);

-        puVar23 = auStack_118;

-        puVar8 = auStack_118;

-        in_R10 = param_4;

-        local_90 = param_4;

-        local_88 = param_4;

-        local_70 = in_R11;

-        if (in_R11 != param_4) {

-          do {

-            puVar23 = puVar8;

-            local_98 = (ulonglong *)(in_R11 + 3);

-            local_90 = in_R10;

-            local_70 = in_R11;

-            if ((int)in_R11[4] == 0) {

-              uVar10 = uVar29;

-              if (*local_98 <= uVar17) {

-                if (*local_98 < uVar17) {

-                  uVar10 = 0xffffffff;

-                }

-                else {

-                  local_res10 = (longlong *)CONCAT71(local_res10._1_7_,1);

-                  uVar10 = 0;

-                }

-              }

-              while (uVar10 == 0) {

-LAB_5:

-                plVar20 = (longlong *)*in_R10;

-                if (((longlong *)plVar20[1] == in_R10) &&

-                   (lVar3 = *plVar20, *(longlong **)(lVar3 + 8) == plVar20)) {

-                  *in_R10 = lVar3;

-                  *(longlong **)(lVar3 + 8) = in_R10;

-                  *(undefined8 *)(puVar23 + -8) = 0x1400526df;

-                  HsmiFreePropertyLock((longlong)in_R11);

-                  param_4 = local_88;

-                  in_R10 = (longlong *)local_90[1];

-                  break;

-                }

-LAB_4:

-                pcVar6 = (code *)swi(0x29);

-                (*pcVar6)();

-                puVar23 = puVar23 + 8;

-                uVar10 = uVar29;

-              }

-LAB_6:

-              cVar9 = (char)local_res10;

-            }

-            else {

-              uVar18 = 0;

-              local_res18 = (longlong *)((ulonglong)local_res18 & 0xffffffff00000000);

-              if (*(uint *)((longlong)in_R11 + 0x14) != 0) {

-                uVar17 = *local_98;

-                uVar28 = (ulonglong)*(uint *)((longlong)in_R11 + 0x14);

-                do {

-                  uVar10 = (uint)uVar18;

-                  uVar26 = (int)uVar28 + uVar10 >> 1;

-                  *(undefined8 *)(puVar23 + -8) = 0x140052c4a;

-                  uVar18 = HsmiCompareLockOwners

-                                     ((ulonglong *)(uVar17 + (ulonglong)uVar26 * 8),&local_78);

-                  uVar28 = uVar28 & 0xffffffff;

-                  uVar11 = uVar26 + 1;

-                  if (-1 < (int)uVar18) {

-                    uVar28 = (ulonglong)uVar26;

-                    uVar11 = uVar10;

-                  }

-                  uVar18 = (ulonglong)uVar11;

-                } while (uVar11 < (uint)uVar28);

-                uVar18 = (ulonglong)uVar11;

-                local_res18 = (longlong *)CONCAT44(local_res18._4_4_,uVar11);

-                uVar17 = local_68;

-                param_4 = local_88;

-              }

-              in_R11 = local_70;

-              in_R10 = local_90;

-              local_res20[0] = *(uint *)((longlong)local_70 + 0x14);

-              if (local_res20[0] <= (uint)uVar18) goto LAB_6;

-              puVar4 = (ulonglong *)(*local_98 + uVar18 * 8);

-              local_98 = puVar4;

-              *(undefined8 *)(puVar23 + -8) = 0x140052ca3;

-              uVar18 = HsmiCompareLockOwners(puVar4,&local_78);

-              puVar4 = local_98;

-              if ((int)uVar18 != 0) goto LAB_6;

-              local_res10 = (longlong *)CONCAT71(local_res10._1_7_,1);

-              if (local_res20[0] < 2) goto LAB_5;

-              uVar10 = local_res20[0] - 1;

-              *(uint *)((longlong)in_R11 + 0x14) = uVar10;

-              cVar9 = '\x01';

-              if ((uint)local_res18 < uVar10) {

-                _Src = local_98 + 1;

-                *(undefined8 *)(puVar23 + -8) = 0x140052ce6;

-                memmove(puVar4,_Src,(ulonglong)(uVar10 - (uint)local_res18) << 3);

-                param_4 = local_88;

-                in_R10 = local_90;

-              }

-            }

-            uVar18 = local_a0;

-            in_R10 = (longlong *)*in_R10;

-            in_R11 = (longlong *)*in_R10;

-            puVar8 = puVar23;

-          } while (in_R11 != param_4);

-          local_90 = in_R10;

-          local_70 = in_R11;

-          if (cVar9 != '\0') {

-            *(undefined8 *)(puVar23 + -8) = 0x140052713;

-            HsmiProcessPropertyLockRequestList(uVar18);

-          }

-        }

-      }

-      *(undefined8 *)(puVar23 + -8) = 0x1400525bf;

-      ExReleaseResourceLite(lVar24 + 0x78);

-      *(undefined8 *)(puVar23 + -8) = 0x1400525cb;

-      KeLeaveCriticalRegion();

-    }

-  }

-  if (lVar14 == 0) goto LAB_7;

-  *(longlong *)(puVar23 + 0x20) = lVar13;

-  *(undefined8 *)(puVar23 + -8) = 0x1400525eb;

-  HsmpTracePreCallbackEnter(param_1,'\0',1,lVar14,*(longlong *)(puVar23 + 0x20));

-  piVar16 = local_80;

-  if (((*(uint *)(lVar14 + 0x28) >> 0xc & 1) == 0) || ((*(uint *)(lVar14 + 0x28) >> 0xb & 1) != 0))

-  goto LAB_8;

-  local_50 = 0;

-  local_a0 = 0;

-  local_res20[0] = 0;

-  local_60 = 0;

-  uStack_58 = 0;

-  local_res18 = (longlong *)((ulonglong)local_res18 & 0xffffffff00000000);

-  *(undefined8 *)(puVar23 + -8) = 0x14005284f;

-  KeInitializeEvent(&local_60,1,0);

-  *(longlong *)(puVar23 + 0x28) = param_1;

-  *(undefined8 **)(param_1 + 0x40) = &local_60;

-  uVar10 = *(uint *)(lVar13 + 0x1c);

-  *(code **)(puVar23 + 0x20) = HsmiInfoRenameNotificationCallback;

-  *(undefined8 *)(puVar23 + -8) = 0x140052888;

-  HsmpCldNotifyPreOperation

-            (4,param_1,(uVar10 & 2) << 3,0,*(undefined **)(puVar23 + 0x20),

-             *(undefined8 *)(puVar23 + 0x28));

-  *(undefined8 *)(puVar23 + -8) = 0x140052898;

-  iVar12 = FltCancellableWaitForSingleObject(&local_60,0,param_1);

-  local_res10 = (longlong *)CONCAT44(local_res10._4_4_,iVar12);

-  *(undefined8 *)(puVar23 + -8) = 0x1400528a7;

-  HsmDbgBreakOnStatus(iVar12);

-  if (((int)local_res10 == -0x3fffffb5) ||

-     (iVar12 = (int)local_res10, (int)local_res10 == -0x3ffffee0)) {

-    *(undefined8 *)(puVar23 + -8) = 0x140052d01;

-    FltCancelIo(param_1);

-    *(undefined8 *)(puVar23 + 0x20) = 0;

-    *(undefined8 *)(puVar23 + -8) = 0x140052d22;

-    KeWaitForSingleObject(&local_60,0,0,0);

-    iVar12 = (int)local_res10;

-  }

-  *(undefined8 *)(param_1 + 0x40) = 0;

-  if (iVar12 < 0) {

+    *(undefined8 *)(param_4 + 0x20) = 0;

+    param_1 = (int *)0x0;

+  }

+  uVar10 = 4;

 LAB_9:

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      *(undefined8 *)(puVar23 + -8) = 0x140052901;

-      puVar27 = WPP_GLOBAL_Control;

-      uVar15 = HsmpGetStreamSize(lVar13);

-      lVar3 = *(longlong *)(lVar13 + 0x10);

-      uVar5 = *(undefined8 *)(puVar27 + 0x18);

-      *(int *)(puVar23 + 0x50) = iVar12;

-      lVar7 = local_b8;

-      *(longlong *)(puVar23 + 0x48) = lVar14;

-      *(undefined8 *)(puVar23 + 0x40) = uVar15;

-      *(undefined4 *)(puVar23 + 0x38) = *(undefined4 *)(lVar13 + 0x1c);

-      uVar15 = *(undefined8 *)(lVar3 + 0x20);

-      *(longlong *)(puVar23 + 0x30) = lVar13;

-      *(undefined8 *)(puVar23 + 0x28) = uVar15;

-      *(undefined8 *)(puVar23 + 0x20) = *(undefined8 *)(param_2 + 0x20);

-      *(undefined8 *)(puVar23 + -8) = 0x14005294c;

-      WPP_SF_qqiqLiqd(uVar5,0xb,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,lVar7);

-    }

-    uVar5 = *(undefined8 *)(param_2 + 0x20);

-    uVar15 = *(undefined8 *)(param_2 + 0x18);

-    local_res10 = (longlong *)CONCAT44(local_res10._4_4_,8);

-    *(undefined4 *)(puVar23 + 0x20) = 0x40;

-    *(undefined8 *)(puVar23 + -8) = 0x140052974;

-    iVar12 = FltSetInformationFile(uVar15,uVar5,&local_res10);

-    local_res18 = (longlong *)CONCAT44(local_res18._4_4_,iVar12);

-    *(undefined8 *)(puVar23 + -8) = 0x140052983;

-    HsmDbgBreakOnStatus(iVar12);

-    piVar16 = local_80;

-    if ((int)(uint)local_res18 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        lVar3 = *(longlong *)(lVar13 + 0x10);

-        uVar5 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-        *(uint *)(puVar23 + 0x40) = (uint)local_res18;

-        *(longlong *)(puVar23 + 0x38) = param_1;

-        uVar15 = *(undefined8 *)(lVar3 + 0x10);

-        *(undefined8 *)(puVar23 + 0x30) = *(undefined8 *)(lVar3 + 0x20);

-        *(undefined8 *)(puVar23 + 0x28) = *(undefined8 *)(param_2 + 0x20);

-        *(longlong *)(puVar23 + 0x20) = lVar13;

-        *(undefined8 *)(puVar23 + -8) = 0x1400529fb;

-        WPP_SF_qqqiqd(uVar5,0xc,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,uVar15);

-      }

-      goto LAB_7;

-    }

-LAB_10:

-    *param_3 = lVar14;

-    uVar29 = 0;

-    lVar14 = 0;

-    uVar30 = uVar29;

-    if (piVar16 == (int *)0x0) goto LAB_7;

-  }

-  else {

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      *(undefined8 *)(puVar23 + -8) = 0x140052d5f;

-      puVar27 = WPP_GLOBAL_Control;

-      uVar19 = HsmpGetStreamSize(lVar13);

-      lVar3 = *(longlong *)(lVar13 + 0x10);

-      uVar5 = *(undefined8 *)(puVar27 + 0x18);

-      *(undefined4 *)(puVar23 + 0x58) = *(undefined4 *)(param_1 + 0x18);

-      uVar2 = *(undefined4 *)(lVar13 + 0x1c);

-      *(int *)(puVar23 + 0x50) = iVar12;

-      lVar7 = local_b8;

-      *(longlong *)(puVar23 + 0x48) = lVar14;

-      *(undefined8 *)(puVar23 + 0x40) = uVar19;

-      *(undefined4 *)(puVar23 + 0x38) = uVar2;

-      uVar15 = *(undefined8 *)(lVar3 + 0x20);

-      *(longlong *)(puVar23 + 0x30) = lVar13;

-      *(undefined8 *)(puVar23 + 0x28) = uVar15;

-      *(undefined8 *)(puVar23 + 0x20) = *(undefined8 *)(param_2 + 0x20);

-      *(undefined8 *)(puVar23 + -8) = 0x140052da8;

-      WPP_SF_qqiqLiqdd(uVar5,lVar3,uVar19,lVar7);

-    }

-    lVar3 = local_b8;

-    iVar12 = *(int *)(param_1 + 0x18);

-    if (iVar12 < 0) goto LAB_9;

-    *(undefined8 *)(puVar23 + -8) = 0x140052a62;

-    piVar16 = (int *)HsmpAcquireFileNameLock(lVar3,lVar13,param_1);

-    if (piVar16 == (int *)0x0) goto LAB_7;

-    puVar4 = *(ulonglong **)(param_2 + 0x20);

-    *(longlong ***)(puVar23 + 0x20) = &local_res18;

-    lVar3 = local_b8;

-    local_98 = puVar4;

-    *(undefined8 *)(puVar23 + -8) = 0x140052a93;

-    uVar10 = HsmiCldGetSyncRootFileIdByFileObject

-                       (lVar3,(ulonglong)puVar4,&local_a0,(int *)local_res20,

-                        *(undefined4 **)(puVar23 + 0x20));

-    local_res10 = (longlong *)CONCAT44(local_res10._4_4_,uVar10);

-    *(undefined8 *)(puVar23 + -8) = 0x140052a9d;

-    HsmDbgBreakOnStatus(uVar10);

-    puVar4 = local_98;

-    lVar3 = local_b8;

-    if ((((int)local_res10 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

-       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (2 < (byte)WPP_GLOBAL_Control[0x29]))))

-    {

-      *(int *)(puVar23 + 0x30) = (int)local_res10;

-      uVar5 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-      *(ulonglong **)(puVar23 + 0x28) = puVar4;

-      *(longlong *)(puVar23 + 0x20) = lVar13;

-      *(undefined8 *)(puVar23 + -8) = 0x140052b9f;

-      WPP_SF_qqqd(uVar5,0x34,&WPP_3908498190613570cb26e49c321d2b2f_Traceguids,lVar3);

-    }

-    *(undefined8 *)(puVar23 + -8) = 0x140052aad;

-    HsmDbgBreakOnStatus((int)local_res10);

-    iVar12 = 0;

-    if ((int)local_res10 != -0x3fff30ed) {

-      iVar12 = (int)local_res10;

-    }

-    if (-1 < iVar12) {

-      if (((uint)local_res18 != 0) && (local_res20[0] == 1)) {

-        uVar5 = *(undefined8 *)(lVar13 + 8);

-        *(undefined8 *)(puVar23 + -8) = 0x140052ae6;

-        uVar17 = (*DAT_11)(uVar5);

-        if (uVar17 == local_a0) {

-          if ((*(uint *)(lVar13 + 0x1c) & 2) == 0) {

-            *(undefined8 *)(puVar23 + -8) = 0x140052e38;

-            HsmpCloseExternalBitmaps(lVar13);

-          }

-          lVar3 = *(longlong *)(param_2 + 0x20);

-          *(undefined8 *)(puVar23 + -8) = 0x140052b0c;

-          iVar12 = HsmpRpRemove(lVar13,lVar3,'\x01');

-          local_res10 = (longlong *)CONCAT44(local_res10._4_4_,iVar12);

-          *(undefined8 *)(puVar23 + -8) = 0x140052b16;

-          HsmDbgBreakOnStatus(iVar12);

-          if ((int)local_res10 < 0) {

-            uVar30 = uVar29;

-            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-              uVar21 = 0xe;

-              iVar12 = (int)local_res10;

-              goto LAB_12;

-            }

-            goto LAB_13;

-          }

-        }

-      }

-LAB_8:

-      *(undefined8 *)(puVar23 + -8) = 0x140052604;

-      HsmpRecallTerminateProgressiveHydration(lVar14);

-      if ((*(longlong *)(lVar13 + 0xa0) != 0) &&

-         (*(longlong *)(*(longlong *)(lVar13 + 0xa0) + 0x20) != 0)) {

-        if (param_1 != 0) {

-          *(undefined8 *)(puVar23 + -8) = 0x14005273a;

-          FltGetRequestorProcess(param_1);

-        }

-        *(undefined8 *)(puVar23 + -8) = 0x14005274a;

-        uVar15 = HsmpGetFileLock(lVar13);

-        uVar5 = *(undefined8 *)(param_2 + 0x20);

-        *(undefined8 *)(puVar23 + -8) = 0x14005275b;

-        iVar12 = FsRtlFastUnlockAll(uVar15,uVar5);

-        lVar3 = local_b8;

-        if ((((iVar12 + 0x80000000U & 0x80000000) == 0) && (iVar12 != -0x3fffff82)) &&

-           (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control &&

-            (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])))))) {

-          uVar5 = *(undefined8 *)(lVar24 + 0x20);

-          *(int *)(puVar23 + 0x40) = iVar12;

-          *(longlong *)(puVar23 + 0x38) = param_1;

-          uVar15 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-          *(undefined8 *)(puVar23 + 0x30) = uVar5;

-          *(undefined8 *)(puVar23 + 0x28) = *(undefined8 *)(param_2 + 0x20);

-          *(longlong *)(puVar23 + 0x20) = lVar13;

-          *(undefined8 *)(puVar23 + -8) = 0x1400527ec;

-          WPP_SF_qqqiqd(uVar15,0xf,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,lVar3);

-        }

-      }

-      if (*(char *)(lVar14 + 0x2d) != '\0') {

-        uVar5 = *(undefined8 *)(param_2 + 0x20);

-        uVar15 = *(undefined8 *)(param_2 + 0x18);

-        *(undefined8 *)(puVar23 + -8) = 0x140052e6c;

-        iVar12 = FltFlushBuffers2(uVar15,uVar5,1);

-        lVar3 = local_b8;

-        if ((((iVar12 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-          uVar5 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-          *(int *)(puVar23 + 0x40) = iVar12;

-          *(longlong *)(puVar23 + 0x38) = param_1;

-          *(undefined8 *)(puVar23 + 0x30) = *(undefined8 *)(lVar24 + 0x20);

-          *(undefined8 *)(puVar23 + 0x28) = *(undefined8 *)(param_2 + 0x20);

-          *(longlong *)(puVar23 + 0x20) = lVar13;

-          *(undefined8 *)(puVar23 + -8) = 0x140052ee7;

-          WPP_SF_qqqiqd(uVar5,0x10,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,lVar3);

-        }

-      }

-      lVar13 = *(longlong *)(lVar14 + 0x10);

-      if ((*(uint *)(lVar14 + 0x28) & 0x10) != 0) {

-        *(undefined8 *)(puVar23 + -8) = 0x140052ef8;

-        HsmpAcquireReparseUpdateLock(lVar13,'\x01');

-        if ((*(uint *)(lVar14 + 0x28) & 0x10) != 0) {

-          piVar1 = (int *)(lVar13 + 0x70);

-          *piVar1 = *piVar1 + -1;

-          if (*piVar1 == 0) {

-            *(undefined8 *)(puVar23 + -8) = 0x140052f11;

-            ExReInitializeRundownProtection(lVar13 + 0x78);

-            *(undefined8 *)(puVar23 + -8) = 0x140052f29;

-            KeSetEvent(lVar13 + 0x80,0,0);

-          }

-          *(uint *)(lVar14 + 0x28) = *(uint *)(lVar14 + 0x28) & 0xffffffef;

-        }

-        lVar13 = *(longlong *)(lVar13 + 0x10);

-        *(undefined8 *)(puVar23 + -8) = 0x140052f43;

-        FltReleasePushLockEx(lVar13 + 0x18,0);

-      }

-      goto LAB_10;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      uVar21 = 0xd;

-LAB_12:

-      lVar7 = local_b8;

-      lVar3 = *(longlong *)(lVar13 + 0x10);

-      *(int *)(puVar23 + 0x40) = iVar12;

-      uVar5 = *(undefined8 *)(lVar3 + 0x20);

-      *(longlong *)(puVar23 + 0x38) = param_1;

-      uVar15 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

-      *(undefined8 *)(puVar23 + 0x30) = uVar5;

-      *(undefined8 *)(puVar23 + 0x28) = *(undefined8 *)(param_2 + 0x20);

-      *(longlong *)(puVar23 + 0x20) = lVar13;

-      *(undefined8 *)(puVar23 + -8) = 0x140052e2b;

-      WPP_SF_qqqiqd(uVar15,uVar21,&WPP_e3630ce7b3b33dbc51129e886b811c0d_Traceguids,lVar7);

-      uVar30 = uVar29;

-    }

-  }

-LAB_13:

-  uVar29 = uVar30;

-  *(undefined8 *)(puVar23 + -8) = 0x140052b40;

-  HsmpReleaseFileNameLock(piVar16);

-LAB_7:

-  if (lVar24 != 0) {

-    *(undefined8 *)(puVar23 + -8) = 0x1400524b0;

-    FltReleaseContext(lVar24);

-  }

-  if (lVar14 != 0) {

-    *(undefined8 *)(puVar23 + -8) = 0x140052f60;

-    FltDeleteContext(lVar14);

-    *(undefined8 *)(puVar23 + -8) = 0x140052f6f;

-    FltReleaseContext(lVar14);

-    lVar14 = *param_3;

-    puVar23[0x20] = 1;

-    *(undefined8 *)(puVar23 + -8) = 0x140052f8b;

-    HsmpTracePreCallbackExit((ulonglong)uVar29,param_1,lVar14,'\0',puVar23[0x20]);

-  }

-  return uVar29;

+  if (param_1 != (int *)0x0) {

+    HsmpReleaseFileNameLock(param_1);

+  }

+  if (iVar6 < 0) {

+    *(undefined8 *)(param_4 + 0x20) = 0;

+    uVar10 = 4;

+    *(int *)(param_4 + 0x18) = iVar6;

+  }

+  return uVar10;

 }
```

## `HsmFltDeleteFILE_CONTEXT`  (modified)

```diff
--- HsmFltDeleteFILE_CONTEXT
+++ HsmFltDeleteFILE_CONTEXT
@@ -1,10 +1,22 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 void HsmFltDeleteFILE_CONTEXT(longlong param_1)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  if (*(longlong *)(param_1 + 8) != 0) {

+    if (DAT_0 == CldHsmDeleteFileContext) {

+      CldHsmDeleteFileContext(*(longlong *)(param_1 + 8));

+    }

+    else {

+      (*DAT_0)();

+    }

+  }

+  HsmpUninitializePropertyContext(param_1);

+  ExDeleteResourceLite(param_1 + 0x78);

+  if (*(longlong *)(param_1 + 0x10) != 0) {

+    FltReleaseContext();

+  }

+  return;

 }
```

## `HsmExpandKernelStackAndCallout`  (modified)

```diff
--- HsmExpandKernelStackAndCallout
+++ HsmExpandKernelStackAndCallout
@@ -1,32 +1,33 @@
 

-/* WARNING: Instruction at (ram,0x00014000a062) overlaps instruction at (ram,0x00014000a061)

-    */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 int HsmExpandKernelStackAndCallout(undefined *param_1,int *param_2)

 

 {

-  undefined8 uVar1;

-  longlong lVar2;

-  int iVar3;

-  undefined4 unaff_EBX;

-  undefined4 in_R8D;

-  undefined4 in_register_00000084;

-  undefined8 in_R9;

-  longlong in_R10;

-  undefined8 in_R11;

-  bool in_PF;

+  int iVar1;

+  longlong local_res10 [3];

+  undefined8 local_18 [2];

   

-  if (in_PF) {

-    register0x00000020 = (BADSPACEBASE *)(ulonglong)((int)&stack0x00000000 + 0x50);

+  local_18[0] = 0;

+  local_res10[0] = 0;

+  IoGetStackLimits(local_res10,local_18);

+  if ((ulonglong)((longlong)local_18 - local_res10[0]) < 0x3c00) {

+    iVar1 = KeExpandKernelStackAndCalloutEx(param_1,param_2,0x6000,0,0);

+    HsmDbgBreakOnStatus(iVar1);

+    if (iVar1 < 0) {

+      if (iVar1 == -0x3fffffe9) {

+        iVar1 = -0x3fffff66;

+        HsmDbgBreakOnStatus(-0x3fffff66);

+      }

+      *param_2 = iVar1;

+    }

   }

-  lVar2 = *(longlong *)register0x00000020;

-  *(undefined8 *)(lVar2 + 0x38) = in_R11;

-  *(undefined4 *)(lVar2 + 0x30) = unaff_EBX;

-  *(int *)(lVar2 + 0x28) = (int)param_1;

-  uVar1 = *(undefined8 *)(in_R10 + 0x18);

-  *(undefined4 *)(lVar2 + 0x20) = in_R8D;

-  *(undefined8 *)(lVar2 + -8) = 0x14000a061;

-  iVar3 = WPP_SF_qlldPl(uVar1,0x30,CONCAT44(in_register_00000084,in_R8D),in_R9);

-  return iVar3;

+  else if ((code *)param_1 == FltQueryInformationByNameCallout) {

+    FltQueryInformationByNameCallout(param_2);

+  }

+  else {

+    (*(code *)param_1)();

+  }

+  return *param_2;

 }
```

## `HsmpSetupContexts`  (modified)

```diff
--- HsmpSetupContexts
+++ HsmpGetStreamSize
@@ -1,587 +1,13 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* WARNING: Type propagation algorithm not settling */

-

-ulonglong HsmpSetupContexts(ulonglong param_1,undefined4 **param_2,uint param_3,uint *param_4)

+undefined8 HsmpGetStreamSize(longlong param_1)

 

 {

-  bool bVar1;

-  undefined8 uVar2;

-  char cVar3;

-  uint uVar4;

-  int iVar5;

-  ulonglong uVar6;

-  longlong lVar7;

-  uint *puVar8;

-  uint *puVar9;

-  longlong lVar10;

-  ulonglong uVar11;

-  undefined2 uVar12;

-  ulonglong uVar13;

-  uint *puVar14;

-  undefined *puVar15;

-  uint *puVar16;

-  undefined1 auStackY_158 [32];

-  uint *local_f8;

-  uint *local_f0;

-  undefined8 local_e8;

-  undefined8 local_e0;

-  uint *local_d8;

-  uint *local_d0;

-  ulonglong local_c8;

-  undefined8 local_c0;

-  uint uStack_b8;

-  uint uStack_b4;

-  uint local_b0;

-  longlong local_a8;

-  longlong local_a0 [3];

-  char cStack_82;

-  longlong local_88;

-  char cStack_81;

-  undefined8 local_80;

-  longlong lStack_78;

-  undefined8 local_70;

-  undefined8 uStack_68;

-  undefined8 local_60;

-  longlong lStack_58;

-  undefined8 local_50;

-  ulonglong local_48;

+  undefined8 uVar1;

   

-  local_48 = __security_cookie ^ (ulonglong)auStackY_158;

-  local_e0 = *(undefined8 *)(param_1 + 0x20);

-  uVar13 = 0;

-  local_f8 = (uint *)0x0;

-  local_f0 = (uint *)0x0;

-  local_d8 = (uint *)0x0;

-  local_a0[0] = 0;

-  puVar16 = (uint *)0x0;

-  local_a8 = 0;

-  local_b0 = 0;

-  uVar6 = uVar13;

-  local_c8 = param_1;

-  if (param_4 != (uint *)0x0) {

-    uVar6 = FltGetRequestorProcess(param_4);

+  uVar1 = 0;

+  if (*(undefined8 **)(param_1 + 0xa0) != (undefined8 *)0x0) {

+    uVar1 = **(undefined8 **)(param_1 + 0xa0);

   }

-  cVar3 = HsmOsIsPassThroughModeEnabled(uVar6);

-  uVar6 = uVar13;

-  if (cVar3 != '\0') goto LAB_0;

-  if (param_3 == 0) {

-    local_e8 = (uint *)0x0;

-    uVar4 = FltQueryInformationFile(local_e0,param_2,&local_e8);

-    uVar11 = (ulonglong)uVar4;

-    uVar6 = (ulonglong)uVar4;

-    HsmDbgBreakOnStatus(uVar4);

-    if (-1 < (int)uVar4) {

-      if (((ulonglong)local_e8 & 0x400) != 0) {

-        param_3 = local_e8._4_4_;

-      }

-      goto LAB_1;

-    }

-    if (uVar4 == 0xc000000d) {

-      MicrosoftTelemetryAssertTriggeredArgsKM(uVar11,0);

-    }

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

-    goto LAB_0;

-    uVar12 = 0x1b;

-  }

-  else {

-LAB_1:

-    if (((param_3 & 0xffff0fff) != DAT_2) ||

-       ((param_4 != (uint *)0x0 &&

-        ((*(longlong *)(param_4 + 8) == 3 || (*(longlong *)(param_4 + 8) == 0)))))) {

-      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (3 < (byte)WPP_GLOBAL_Control[0x29])))

-         ) {

-        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x1c,

-                    &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,local_e0);

-      }

-      FltGetStreamContext(local_e0,param_2,&local_f8);

-      if (local_f8 != (uint *)0x0) {

-        FltAcquirePushLockExclusiveEx(*(longlong *)(local_f8 + 4) + 0x18,0);

-        local_f8[7] = local_f8[7] & 0xfffffffe;

-        FltReleasePushLockEx(*(longlong *)(local_f8 + 4) + 0x18,0);

-        HsmpCldNullifyStreamContext((longlong)local_f8);

-      }

-      FltGetStreamHandleContext(local_e0,param_2);

-      if (local_f0 != (uint *)0x0) {

-        FltDeleteContext();

-      }

-      uVar6 = uVar13;

-      if ((param_4 != (uint *)0x0) && (*(longlong *)(param_4 + 8) == 3)) {

-        HsmpToggleFileSparseAttribute(param_1,(longlong)param_2,'\0');

-        HsmpToggleFileAttributes

-                  (param_1,(longlong)param_2,*(ushort *)(*(longlong *)(param_4 + 4) + 0x28) & 0x1000

-                   ,0x401000);

-      }

-      goto LAB_0;

-    }

-    lVar7 = IoGetTransactionParameterBlock(param_2);

-    if (lVar7 != 0) {

-      uVar6 = 0xc019005a;

-      HsmDbgBreakOnStatus(-0x3fe6ffa6);

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_0;

-      uVar12 = 0x1d;

-      goto LAB_3;

-    }

-    if (param_4 != (uint *)0x0) {

-      local_a0[1] = 0;

-      local_a0[2] = 0;

-      local_e8 = (uint *)0x0;

-      local_d0 = (uint *)((ulonglong)local_d0 & 0xffffffff00000000);

-      local_88 = lVar7;

-      uVar4 = FltQueryInformationFile

-                        (*(undefined8 *)(*(longlong *)(param_4 + 4) + 0x10),

-                         *(undefined8 *)(*(longlong *)(param_4 + 4) + 8),local_a0 + 1);

-      uVar6 = (ulonglong)uVar4;

-      HsmDbgBreakOnStatus(uVar4);

-      if (((int)uVar4 < 0) || ((int)local_d0 != 0x18)) {

-        local_c0 = *(uint **)(param_4 + 6);

-        uStack_b8 = param_4[8];

-        uStack_b4 = param_4[9];

-        uVar4 = FltGetFileNameInformation(param_4,0x102,&local_e8);

-        uVar6 = (ulonglong)uVar4;

-        HsmDbgBreakOnStatus(uVar4);

-        param_4[6] = (uint)local_c0;

-        param_4[7] = local_c0._4_4_;

-        param_4[8] = uStack_b8;

-        param_4[9] = uStack_b4;

-        if (-1 < (int)uVar4) {

-          uVar4 = FltParseFileNameInformation(local_e8);

-          uVar6 = (ulonglong)uVar4;

-          HsmDbgBreakOnStatus(uVar4);

-          if (-1 < (int)uVar4) {

-            bVar1 = (short)local_e8[0x12] != 0;

-            goto LAB_4;

-          }

-        }

-LAB_5:

-        bVar1 = false;

-      }

-      else {

-        if ((cStack_81 == '\0') && (cStack_82 == '\0')) goto LAB_5;

-        bVar1 = true;

-      }

-LAB_4:

-      if (local_e8 != (uint *)0x0) {

-        FltReleaseFileNameInformation();

-      }

-      HsmDbgBreakOnStatus((int)uVar6);

-      if ((int)uVar6 < 0) {

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-        uVar12 = 0x1e;

-        goto LAB_3;

-      }

-      if (bVar1) goto LAB_0;

-    }

-    uVar4 = FltGetStreamContext(local_e0,param_2,&local_f8);

-    HsmDbgBreakOnStatus(uVar4);

-    uVar2 = local_e0;

-    uVar6 = uVar13;

-    if (uVar4 != 0xc0000225) {

-      uVar6 = (ulonglong)uVar4;

-    }

-    if (-1 < (int)uVar6) {

-      if (local_f8 != (uint *)0x0) {

-        if ((local_f8[7] & 1) == 0) goto LAB_0;

-        goto LAB_6;

-      }

-      local_c0 = (uint *)0x0;

-      uVar4 = HsmpRpReadBuffer(local_e0,param_2,&local_d8);

-      uVar6 = (ulonglong)uVar4;

-      HsmDbgBreakOnStatus(uVar4);

-      puVar16 = local_d8;

-      if (((uVar4 == 0xc0000275) || (uVar4 == 0xc000029c)) ||

-         ((uVar4 == 0x80000005 || (uVar4 == 0xc0000010)))) {

-        uVar6 = 0;

-      }

-      else if ((int)uVar4 < 0) {

-        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-          WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x20,

-                      &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,uVar2);

-          puVar16 = local_d8;

-        }

-      }

-      else if ((*local_d8 & 0xffff0fff) == DAT_2) {

-        local_d0 = (uint *)CONCAT62(local_d0._2_6_,(short)local_d8[1]);

-        uVar4 = HsmiCldGetSyncRootFileIdByFileObject

-                          (param_1,(ulonglong)param_2,&local_c0,(int *)0x0,(undefined4 *)0x0);

-        HsmDbgBreakOnStatus(uVar4);

-        if (((((int)uVar4 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (2 < (byte)WPP_GLOBAL_Control[0x29])) {

-          WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x34,

-                      &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

-          HsmDbgBreakOnStatus(uVar4);

-LAB_7:

-          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-             (2 < (byte)WPP_GLOBAL_Control[0x29])) {

-            WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x21,

-                        &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

-          }

-        }

-        else {

-          HsmDbgBreakOnStatus(uVar4);

-          if ((int)uVar4 < 0) goto LAB_7;

-        }

-        uVar4 = HsmpCtxCreateStreamContext

-                          (param_1,param_2,local_c0,puVar16 + 2,(uint)(ushort)local_d0,&local_f8);

-        uVar6 = (ulonglong)uVar4;

-        HsmDbgBreakOnStatus(uVar4);

-        if ((int)uVar4 < 0) {

-          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            uVar12 = 0x22;

-LAB_8:

-            WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

-                        &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

-          }

-        }

-        else {

-          local_f8[6] = *puVar16;

-          FltAcquirePushLockExclusiveEx(*(longlong *)(local_f8 + 4) + 0x18,0);

-          local_d0 = local_f8;

-          local_e8 = (uint *)0x0;

-          local_c0 = (uint *)0x0;

-          local_d8 = *(uint **)(local_f8 + 4);

-          uVar4 = FltSetStreamContext(*(undefined8 *)(param_1 + 0x20),param_2,1,local_f8);

-          uVar11 = (ulonglong)uVar4;

-          HsmDbgBreakOnStatus(uVar4);

-          uVar6 = uVar13;

-          puVar9 = local_e8;

-          if (uVar4 != 0xc01c0002) {

-            if ((int)uVar4 < 0) {

-              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x56,

-                            &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

-              }

-              HsmDbgBreakOnStatus(-0x3fffffbd);

-              uVar6 = 0xc0000043;

-              puVar9 = local_c0;

-            }

-            else {

-              if (local_e8 != (uint *)0x0) {

-                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                   (3 < (byte)WPP_GLOBAL_Control[0x29])) {

-                  puVar9 = local_e8;

-                  puVar15 = WPP_GLOBAL_Control;

-                  HsmpGetStreamSize((longlong)local_e8);

-                  WPP_SF_qqLii(*(undefined8 *)(puVar15 + 0x18),0x57,puVar9,param_1);

-                }

-                FltReleaseContext(local_e8);

-              }

-              uVar6 = uVar11;

-              puVar9 = local_d0;

-              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                  (puVar9 = local_d0, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                 (puVar9 = local_d0, 4 < (byte)WPP_GLOBAL_Control[0x29])) {

-                puVar15 = WPP_GLOBAL_Control;

-                HsmpGetStreamSize((longlong)local_d0);

-                WPP_SF_qqLii(*(undefined8 *)(puVar15 + 0x18),0x58,puVar15,param_1);

-                puVar9 = local_d0;

-              }

-            }

-          }

-          local_c0 = puVar9;

-          HsmDbgBreakOnStatus((int)uVar6);

-          FltReleasePushLockEx(*(longlong *)(local_f8 + 4) + 0x18,0);

-          if ((int)uVar6 < 0) {

-            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-              uVar12 = 0x23;

-              goto LAB_8;

-            }

-          }

-          else {

-            puVar9 = local_c0;

-            if (local_f8 != local_c0) {

-              FltReleaseContext(local_f8);

-              local_f8 = puVar9;

-            }

-            puVar9 = local_f8;

-            iVar5 = HsmpRpCheckState((longlong)local_f8);

-            if ((-1 < iVar5) && ((puVar9[7] & 2) == 0)) {

-              local_50 = 0;

-              local_80 = 0;

-              lStack_78 = 0;

-              local_70 = 0;

-              uStack_68 = 0;

-              local_60 = 0;

-              lStack_58 = 0;

-              uVar4 = FltQueryInformationFile(local_e0,param_2,&local_80,0x38);

-              uVar6 = (ulonglong)uVar4;

-              HsmDbgBreakOnStatus(uVar4);

-              if ((int)uVar4 < 0) {

-                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                  uVar12 = 0x24;

-                  goto LAB_8;

-                }

-                goto LAB_9;

-              }

-              FltAcquirePushLockExclusiveEx(*(longlong *)(local_f8 + 4) + 0x18,0);

-              if (*(longlong *)(local_f8 + 0x28) != 0) {

-                FltAcquirePushLockExclusiveEx(*(longlong *)(local_f8 + 0x28) + 0x28,0);

-              }

-              lVar7 = *(longlong *)(*(longlong *)(local_f8 + 4) + 0x28);

-              lVar10 = lStack_78;

-              if (lStack_78 < lVar7) {

-                lVar10 = lVar7;

-              }

-              *(longlong *)(*(longlong *)(local_f8 + 4) + 0x28) = lVar10;

-              lVar7 = **(longlong **)(local_f8 + 0x28);

-              if (lStack_58 <= lVar7) {

-                lVar7 = lStack_58;

-              }

-              **(longlong **)(local_f8 + 0x28) = lVar7;

-              HsmpReleaseBitmapLock((longlong)local_f8);

-              FltReleasePushLockEx(*(longlong *)(local_f8 + 4) + 0x18,0);

-            }

-LAB_6:

-            uVar4 = HsmpCtxCreateStreamHandleContext

-                              (param_1,(longlong)param_2,(longlong)param_4,(longlong)local_f8,

-                               &local_f0);

-            uVar6 = (ulonglong)uVar4;

-            HsmDbgBreakOnStatus(uVar4);

-            if ((int)uVar4 < 0) {

-              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                uVar12 = 0x25;

-                goto LAB_8;

-              }

-            }

-            else {

-              local_c0 = local_f0;

-              local_e8 = (uint *)0x0;

-              local_d8 = (uint *)0x0;

-              uVar4 = FltSetStreamHandleContext(*(undefined8 *)(param_1 + 0x20),param_2,1,local_f0);

-              uVar6 = (ulonglong)uVar4;

-              HsmDbgBreakOnStatus(uVar4);

-              if (uVar4 == 0xc01c0002) {

-                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                   (3 < (byte)WPP_GLOBAL_Control[0x29])) {

-                  WPP_SF_qqq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x5f,

-                             &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

-                }

-                local_d8 = local_e8;

-                HsmDbgBreakOnStatus(0);

-                uVar6 = uVar13;

-              }

-              else {

-                if ((int)uVar4 < 0) {

-                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x60,

-                               &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,param_1);

-                  }

-                  uVar6 = 0xc0000043;

-                  HsmDbgBreakOnStatus(-0x3fffffbd);

-                }

-                else {

-                  local_d8 = local_c0;

-                }

-                if (local_e8 != (uint *)0x0) {

-                  FltReleaseContext();

-                }

-                HsmDbgBreakOnStatus((int)uVar6);

-                if ((int)uVar6 < 0) {

-                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                    puVar9 = local_f8;

-                    puVar15 = WPP_GLOBAL_Control;

-                    HsmpGetStreamSize((longlong)local_f8);

-                    WPP_SF_qqiqLiq(*(undefined8 *)(puVar15 + 0x18),*(undefined8 *)(puVar9 + 4),

-                                   puVar9,param_1);

-                  }

-                  goto LAB_9;

-                }

-              }

-              if (local_f0 != local_d8) {

-                FltReleaseContext();

-                local_f0 = local_d8;

-              }

-              if (param_4 != (uint *)0x0) {

-                HsmpDbgBreakOnOpen((longlong)local_f0,(longlong)param_2,(longlong)param_4);

-                puVar9 = local_f8;

-                local_c0 = local_f0;

-                puVar8 = (uint *)ExAllocatePool2(0x100,0x18,0x69437348);

-                if (puVar8 == (uint *)0x0) {

-                  uVar6 = 0xc000009a;

-                  HsmDbgBreakOnStatus(-0x3fffff66);

-                  HsmDbgBreakOnStatus(-0x3fffff66);

-                  param_1 = local_c8;

-                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                    WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x27,

-                                 &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,local_c8);

-                  }

-                }

-                else {

-                  *puVar8 = *puVar8 | 2;

-                  HsmpFillOutAttributionInformation

-                            ((longlong)local_c0,(longlong)puVar9,(longlong)param_4,puVar8);

-                  HsmDbgBreakOnStatus(0);

-                  cVar3 = HsmOsIsSyncProviderProcessFromAttributionInfo((longlong)puVar8);

-                  uVar11 = local_c8;

-                  if ((cVar3 == '\0') && (uVar6 = uVar13, (local_f0[10] & 0x40) != 0)) {

-LAB_10:

-                    if (((local_f8[7] & 2) == 0) &&

-                       ((local_f8[7] >> 8 & 1) == 0 && (local_f0[10] & 0x20) != 0)) {

-                      local_d0 = (uint *)((ulonglong)local_d0 & 0xffffffffffffff00);

-                      puVar9 = local_f8;

-                      HsmpCldIsHydrationDisallowed

-                                ((undefined8 *)puVar8,(longlong)local_f8,(longlong)local_f0,

-                                 (char *)&local_d0);

-                      if ((char)local_d0 == '\0') goto LAB_11;

-                      uVar6 = 0xc000cf18;

-                      HsmDbgBreakOnStatus(-0x3fff30e8);

-                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                        puVar14 = local_f8;

-                        puVar15 = WPP_GLOBAL_Control;

-                        HsmpGetStreamSize((longlong)local_f8);

-                        WPP_SF_qqiqLiqD(*(undefined8 *)(puVar15 + 0x18),puVar9,puVar14,uVar11);

-                      }

-                    }

-                    else {

-LAB_11:

-                      lVar7 = HsmOsGetProcessFromAttributionInfo((longlong)puVar8);

-                      HsmOsSetPebCloudFileOpened(lVar7);

-                      if (((local_f8[7] & 2) == 0) && ((local_f0[10] & 0x20) != 0)) {

-                        local_d0 = (uint *)((ulonglong)local_d0 & 0xffffffffffffff00);

-                        puVar9 = HsmOsCheckAppCompatPolicy((undefined8 *)puVar8,2,(char *)&local_d0)

-                        ;

-                        cVar3 = (char)local_d0;

-                        if ((int)puVar9 < 0) {

-                          cVar3 = '\x01';

-                        }

-                        uVar4 = HsmpDbgFullyHydrateOnUserModeOpen();

-                        if (((char)uVar4 == '\0') || ((char)param_4[0x14] != '\x01')) {

-                          bVar1 = false;

-                        }

-                        else {

-                          bVar1 = true;

-                        }

-                        if (cVar3 != '\0' || bVar1) {

-                          HsmpRecallInitiateHydration

-                                    (local_f0,local_f8,(ulonglong)param_2,(byte *)0x10008,param_4,

-                                     (uint *)0x0,-1);

-                          uVar4 = param_4[6];

-                          uVar6 = (ulonglong)uVar4;

-                          HsmDbgBreakOnStatus(uVar4);

-                          if ((int)uVar4 < 0) {

-                            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-                               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                              puVar15 = WPP_GLOBAL_Control;

-                              HsmpGetStreamSize((longlong)local_f8);

-                              uVar12 = 0x2a;

-                              goto LAB_12;

-                            }

-                            goto LAB_13;

-                          }

-                        }

-                      }

-                      iVar5 = FltGetEcpListFromCallbackData(DAT_14,param_4,local_a0);

-                      HsmDbgBreakOnStatus(iVar5);

-                      if ((-1 < iVar5) && (local_a0[0] != 0)) {

-                        iVar5 = FltFindExtraCreateParameter

-                                          (DAT_14,local_a0[0],&GUID_ECP_CREATE_REDIRECTION);

-                        HsmDbgBreakOnStatus(iVar5);

-                        if ((-1 < iVar5) && ((3 < local_b0 && ((local_f8[7] & 0x100) == 0)))) {

-                          *(ushort *)(local_a8 + 2) = *(ushort *)(local_a8 + 2) | 0x10;

-                          FltAcknowledgeEcp(DAT_14,local_a8);

-                        }

-                      }

-                      if ((*(uint *)(*(longlong *)(param_4 + 4) + 0x20) & 0x1000) != 0) {

-                        local_f0[10] = local_f0[10] | 0x1000;

-                      }

-                      uVar4 = 1;

-                      if ((local_f8[7] & 8) == 0) {

-                        uVar4 = (local_f8[7] & 0xff) >> 3 & 2;

-                      }

-                      HsmpCldNotifyPostOperation(1,(longlong)param_4,uVar4,0,0);

-                    }

-                  }

-                  else {

-                    uVar4 = HsmpPrepareForMgmtOperation(local_c8,param_2,0xfffffffe,'\0');

-                    uVar6 = (ulonglong)uVar4;

-                    HsmDbgBreakOnStatus(uVar4);

-                    if (-1 < (int)uVar4) {

-                      local_f0[10] = local_f0[10] | 8;

-                      goto LAB_10;

-                    }

-                    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-                       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_13;

-                    puVar15 = WPP_GLOBAL_Control;

-                    HsmpGetStreamSize((longlong)local_f8);

-                    uVar12 = 0x28;

-LAB_12:

-                    WPP_SF_qqiqLiqd(*(undefined8 *)(puVar15 + 0x18),uVar12,

-                                    &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,uVar11);

-                  }

-LAB_13:

-                  if (*(longlong *)(puVar8 + 4) != 0) {

-                    ObfDereferenceObject();

-                  }

-                  if ((*puVar8 & 1) != 0) {

-                    ExFreePoolWithTag(*(undefined8 *)(puVar8 + 2),0x69417348);

-                  }

-                  param_1 = local_c8;

-                  if ((*puVar8 & 2) != 0) {

-                    ExFreePoolWithTag(puVar8,0x69437348);

-                    param_1 = local_c8;

-                  }

-                }

-              }

-            }

-          }

-        }

-      }

-LAB_9:

-      if (puVar16 != (uint *)0x0) {

-        ExFreePoolWithTag(puVar16,0x70527348);

-      }

-      goto LAB_0;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

-    goto LAB_0;

-    uVar12 = 0x1f;

-  }

-LAB_3:

-  WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

-              &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,local_e0);

-LAB_0:

-  if (local_f8 != (uint *)0x0) {

-    if ((local_f8[7] & 4) != 0) {

-      HsmpReportCorruption(param_1,*(undefined8 *)(*(longlong *)(local_f8 + 4) + 0x20),0xc000cf02);

-    }

-    FltReleaseContext(local_f8);

-  }

-  if (local_f0 != (uint *)0x0) {

-    FltReleaseContext();

-  }

-  return uVar6;

+  return uVar1;

 }
```

## `CldSyncUnregisterStream`  (modified)

```diff
--- CldSyncUnregisterStream
+++ CldSyncUnregisterStream
@@ -1,47 +1,41 @@
-

-/* WARNING: Control flow encountered bad instruction data */

 

 void CldSyncUnregisterStream(longlong param_1,undefined8 param_2)

 

 {

-  int *piVar1;

-  char *pcVar2;

-  char cVar3;

-  byte in_AL;

-  byte bVar4;

-  undefined1 in_AH;

-  undefined2 in_register_00000002;

-  undefined4 in_register_00000004;

-  undefined8 *puVar5;

-  undefined8 *unaff_RBP;

-  int *unaff_RDI;

-  undefined8 uStack_10;

+  longlong lVar1;

+  undefined8 *puVar2;

+  longlong lVar3;

+  undefined8 *puVar4;

+  undefined8 local_res10;

   

-  piVar1 = (int *)(CONCAT44(in_register_00000004,

-                            CONCAT22(in_register_00000002,CONCAT11(in_AH,in_AL))) + 0x3b);

-  *piVar1 = *piVar1 + -1;

-  puVar5 = (undefined8 *)&stack0xfffffffffffffff8;

-  cVar3 = '\x10';

-  do {

-    unaff_RBP = unaff_RBP + -1;

-    puVar5 = puVar5 + -1;

-    *puVar5 = *unaff_RBP;

-    cVar3 = cVar3 + -1;

-  } while ('\0' < cVar3);

-  bVar4 = in_AL | *(byte *)CONCAT44(in_register_00000004,

-                                    CONCAT22(in_register_00000002,CONCAT11(in_AH,in_AL)));

-  *(int *)CONCAT44(in_register_00000004,CONCAT22(in_register_00000002,CONCAT11(in_AH,bVar4))) =

-       *(int *)CONCAT44(in_register_00000004,CONCAT22(in_register_00000002,CONCAT11(in_AH,bVar4))) +

-       CONCAT22(in_register_00000002,CONCAT11(in_AH,bVar4));

-  *(char *)unaff_RDI = (char)*unaff_RDI + (char)param_1;

-  bVar4 = bVar4 | *(byte *)CONCAT44(in_register_00000004,

-                                    CONCAT22(in_register_00000002,CONCAT11(in_AH,bVar4)));

-  pcVar2 = (char *)(CONCAT44(in_register_00000004,

-                             CONCAT22(in_register_00000002,CONCAT11(in_AH,bVar4))) + 0x71 +

-                   (longlong)unaff_RDI);

-  *pcVar2 = *pcVar2 + bVar4;

-  *unaff_RDI = *unaff_RDI - (int)param_1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  lVar1 = param_1 + 0x68;

+  local_res10 = param_2;

+  FltAcquirePushLockExclusiveEx(lVar1,0);

+  lVar3 = RtlLookupElementGenericTableAvl(param_1 + 0x70,&local_res10);

+  puVar4 = (undefined8 *)0x0;

+  if ((lVar3 != 0) && (puVar2 = *(undefined8 **)(lVar3 + 8), puVar2 != (undefined8 *)0x0)) {

+    *(undefined8 *)(lVar3 + 8) = 0;

+    puVar4 = puVar2;

+  }

+  FltReleasePushLockEx(lVar1,0);

+  if (lVar3 != 0) {

+    ExWaitForRundownProtectionRelease(lVar3 + 0x10);

+    if ((*(uint *)(*(longlong *)*puVar4 + 0x1c) & 2) == 0) {

+      if (*(longlong *)(lVar3 + 0x40) != 0) {

+        ExFreePoolWithTag(*(longlong *)(lVar3 + 0x40),0x6d726c43);

+      }

+      if (*(longlong *)(lVar3 + 0x50) != 0) {

+        ExFreePoolWithTag(*(longlong *)(lVar3 + 0x50),0x6d726c43);

+      }

+      FsRtlUninitializeBaseMcb(lVar3 + 0x20);

+    }

+    else if (*(longlong *)(lVar3 + 0x30) != 0) {

+      ExFreePoolWithTag(*(longlong *)(lVar3 + 0x30),0x73557348);

+    }

+    FltAcquirePushLockExclusiveEx(lVar1,0);

+    RtlDeleteElementGenericTableAvl(param_1 + 0x70,&local_res10);

+    FltReleasePushLockEx(lVar1,0);

+  }

+  return;

 }
```

## `HsmiOsSetPebCloudFileFlags`  (modified)

```diff
--- HsmiOsSetPebCloudFileFlags
+++ HsmiOsSetPebCloudFileFlags
@@ -1,73 +1,79 @@
 

-/* WARNING: Instruction at (ram,0x000140005ca7) overlaps instruction at (ram,0x000140005ca6)

-    */

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-undefined8 HsmiOsSetPebCloudFileFlags(longlong param_1,uint param_2)

+void HsmiOsSetPebCloudFileFlags(longlong param_1,uint param_2)

 

 {

-  byte *pbVar1;

-  char *pcVar2;

-  byte bVar3;

-  int iVar4;

-  ulonglong in_RAX;

-  byte bVar5;

-  longlong lVar6;

-  int unaff_EBX;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  undefined8 in_R8;

-  undefined *puVar7;

-  longlong in_R9;

-  undefined8 unaff_R13;

-  undefined8 uVar8;

-  char in_CF;

-  bool in_PF;

-  ulonglong uStack0000000000000028;

+  longlong lVar1;

+  longlong lVar2;

+  uint *puVar3;

+  longlong lVar4;

+  undefined8 uVar5;

+  undefined1 auStack_78 [32];

+  undefined1 local_58;

+  undefined8 local_50;

+  undefined8 uStack_48;

+  undefined8 local_40;

+  undefined8 uStack_38;

+  undefined8 local_30;

+  undefined8 uStack_28;

+  ulonglong local_20;

   

-  bVar5 = (byte)param_1;

-  if (!in_PF) {

-    pcVar2 = (char *)(unaff_RBP + 5 + param_1 * 4);

-    *pcVar2 = (*pcVar2 - bVar5) - in_CF;

+  local_20 = __security_cookie ^ (ulonglong)auStack_78;

+  local_50 = 0;

+  uStack_48 = 0;

+  local_40 = 0;

+  uStack_38 = 0;

+  local_30 = 0;

+  uStack_28 = 0;

+  local_58 = 0;

+  lVar4 = param_1;

+  if (param_1 == 0) {

+    lVar4 = PsGetCurrentProcess();

   }

-  pbVar1 = (byte *)(param_1 + -0x75);

-  bVar3 = *pbVar1;

-  *pbVar1 = *pbVar1 + bVar5;

-  pcVar2 = (char *)(unaff_RBP + 5 + in_R9 * 4);

-  *pcVar2 = (*pcVar2 - bVar5) - CARRY1(bVar3,bVar5);

-  *(uint *)(unaff_RBP + 0x5c890001) = *(uint *)(unaff_RBP + 0x5c890001) & (uint)unaff_RDI;

-  uStack0000000000000028 = in_RAX & 0xffffffffffffff50;

-  WPP_SF_qqLiqiqd(param_1,0x3b,in_R8,unaff_R13);

-  uVar8 = 2;

-  if (*(longlong *)(unaff_RBP + -0x49) != 0) {

-    HsmiRecallFreeHydrationContext(*(longlong *)(unaff_RBP + -0x49));

+  lVar1 = PsGetCurrentProcess();

+  if (lVar4 != lVar1) {

+    KeStackAttachProcess(lVar4,&local_50);

+    local_58 = 1;

   }

-  if (*(code **)(unaff_RBP + -0x19) != (code *)0x0) {

-    lVar6 = unaff_RDI;

-    iVar4 = (**(code **)(unaff_RBP + -0x19))();

-    if ((-1 < unaff_EBX) && (iVar4 < 0)) {

-      *(undefined8 *)(unaff_RSI + 0x20) = 0;

-      uVar8 = 4;

-      *(int *)(unaff_RSI + 0x18) = iVar4;

-      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-         (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (1 < (byte)WPP_GLOBAL_Control[0x29])))

-         ) {

-        puVar7 = WPP_GLOBAL_Control;

-        uStack0000000000000028 = HsmpGetStreamSize(unaff_RDI);

-        WPP_SF_qqLiqiqldd(*(undefined8 *)(puVar7 + 0x18),lVar6,puVar7,unaff_R13);

-      }

+  if (param_1 == 0) {

+    uVar5 = PsGetCurrentProcess();

+    lVar2 = PsGetProcessWow64Process(uVar5);

+    if (lVar2 != 0) {

+      param_1 = PsGetCurrentProcess();

+      goto LAB_0;

+    }

+    uVar5 = PsGetCurrentProcess();

+    lVar2 = PsGetProcessPeb(uVar5);

+    if (lVar2 == 0) goto LAB_1;

+    param_1 = PsGetCurrentProcess();

+  }

+  else {

+    lVar2 = PsGetProcessWow64Process(param_1);

+    if (lVar2 != 0) {

+LAB_0:

+      lVar2 = PsGetProcessWow64Process(param_1);

+      puVar3 = (uint *)(lVar2 + 0x460);

+      goto LAB_2;

+    }

+    lVar2 = PsGetProcessPeb();

+    if (lVar2 == 0) {

+LAB_1:

+      puVar3 = (uint *)0x0;

+      goto LAB_2;

     }

   }

-  if (*(longlong *)(unaff_RBP + -0x11) != 0) {

-    FltClose();

+  lVar2 = PsGetProcessPeb(param_1);

+  puVar3 = (uint *)(lVar2 + 0x7a8);

+LAB_2:

+  if (puVar3 != (uint *)0x0) {

+    LOCK();

+    *puVar3 = *puVar3 | param_2;

+    UNLOCK();

   }

-  if (*(longlong *)(unaff_RBP + -0x31) != 0) {

-    ObfDereferenceObject();

+  if (lVar4 != lVar1) {

+    KeUnstackDetachProcess(&local_50);

   }

-  if (*(uint **)(unaff_RBP + -0x51) != (uint *)0x0) {

-    HsmpCleanupAttributionInformation(*(uint **)(unaff_RBP + -0x51));

-  }

-  return uVar8;

+  return;

 }
```

## `HsmiCompressBuffer`  (modified)

```diff
--- HsmiCompressBuffer
+++ HsmiCompressBuffer
@@ -1,483 +1,110 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-/* 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 */

-

-int HsmiCompressBuffer(undefined8 param_1,uint param_2,longlong *param_3,int param_4,uint *param_5,

+int HsmiCompressBuffer(undefined8 param_1,uint param_2,undefined8 param_3,int param_4,uint *param_5,

                       undefined1 *param_6,byte *param_7)

 

 {

-  longlong lVar1;

-  uint uVar2;

-  short sVar3;

-  short sVar4;

-  int iVar5;

-  uint uVar6;

+  byte bVar1;

+  undefined1 uVar2;

+  char cVar3;

+  int iVar4;

+  longlong lVar5;

+  ulonglong uVar6;

   uint uVar7;

-  int iVar8;

-  undefined8 uVar9;

-  longlong lVar10;

-  uint *puVar11;

-  undefined2 uVar12;

-  longlong *plVar13;

-  int unaff_EBX;

-  longlong *unaff_RBP;

-  undefined *unaff_RSI;

-  uint uVar14;

-  longlong *unaff_RDI;

-  longlong *plVar15;

-  byte bVar16;

-  int unaff_R12D;

-  undefined8 unaff_R13;

-  byte bVar17;

-  uint unaff_R14D;

-  longlong unaff_R15;

-  undefined1 in_ZF;

-  char in_SF;

-  char in_OF;

-  undefined8 in_stack_00000020;

-  undefined8 uVar18;

-  undefined4 uVar21;

-  undefined8 uVar19;

-  ulonglong uVar20;

+  ulonglong uVar8;

+  uint uVar10;

+  ulonglong uVar11;

+  uint uVar12;

+  uint local_res10 [2];

+  undefined8 local_res18;

+  uint local_res20 [2];

+  undefined4 local_58 [6];

+  ulonglong uVar9;

   

-  if (in_OF == in_SF) {

-    *(int *)unaff_RDI = (int)*unaff_RDI + -1;

-                    /* WARNING: Bad instruction - Truncating control flow here */

-    halt_baddata();

+  iVar4 = 0;

+  local_res10[0] = 0;

+  local_58[0] = 0;

+  uVar7 = 0;

+  local_res20[0] = 0;

+  lVar5 = 0;

+  uVar12 = param_4 + 1U;

+  if (param_2 < param_4 + 1U) {

+    uVar12 = param_2;

   }

-  while( true ) {

-    if (!(bool)in_ZF) {

-      param_3 = unaff_RDI;

+  local_res18 = param_3;

+  for (uVar6 = 0; (uint)uVar6 < 3; uVar6 = (ulonglong)((uint)uVar6 + 1)) {

+    if (((uint)(&DAT_0)[uVar6 * 3] <= param_2) &&

+       (param_2 <= (uint)(&DAT_1)[uVar6 * 3])) {

+      iVar4 = RtlGetCompressionWorkSpaceSize

+                        ((&SupportedCompressionTypes)[uVar6 * 6],local_res10,local_58);

+      HsmDbgBreakOnStatus(iVar4);

+      if (iVar4 < 0) {

+        return iVar4;

+      }

+      if (uVar7 < local_res10[0]) {

+        uVar7 = local_res10[0];

+      }

     }

-    iVar5 = FltGetVolumeName(param_1,-(ulonglong)(unaff_EBX != 0) & (ulonglong)(unaff_RBP + -9),

-                             param_3);

-    HsmDbgBreakOnStatus(iVar5);

-    bVar16 = (byte)unaff_R12D;

-    bVar17 = (byte)unaff_R14D;

-    if (((iVar5 + 0x80000000U & 0x80000000) == 0) && (iVar5 != -0x3fffffdd)) {

-      if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-         (((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0 ||

-          ((byte)WPP_GLOBAL_Control[0x29] < bVar16)))) goto LAB_0;

-      uVar12 = 0x2f;

-      goto LAB_1;

-    }

-    if (unaff_EBX == 0) {

-      *(undefined2 *)(unaff_RBP + -9) = 0;

-      sVar4 = (short)(int)unaff_RBP[-0xb];

-      sVar3 = (short)unaff_R12D + sVar4;

-      *(short *)((longlong)unaff_RBP + -0xe) = sVar4 + 0x4e;

-      *(short *)((longlong)unaff_RBP + -0x46) = sVar3;

-      lVar10 = ExAllocatePool2(0x100,sVar3,0x73557348);

-      unaff_RBP[-8] = lVar10;

-      HsmDbgBreakOnStatus(~-(uint)(lVar10 != 0) & 0xc000009a);

-      if (lVar10 == 0) {

-        iVar5 = -0x3fffff66;

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-        uVar12 = 0x30;

-        goto LAB_1;

-      }

-      *(undefined2 *)(unaff_RBP + -2) = 0;

-      lVar10 = ExAllocatePool2(0x100,*(undefined2 *)((longlong)unaff_RBP + -0xe),0x73557348);

-      unaff_RBP[-1] = lVar10;

-      HsmDbgBreakOnStatus(~-(uint)(lVar10 != 0) & 0xc000009a);

-      if (lVar10 == 0) {

-        iVar5 = -0x3fffff66;

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-        uVar12 = 0x31;

-        goto LAB_1;

-      }

-      unaff_EBX = (int)unaff_RBP[-0xe];

-    }

-    else {

-      RtlCopyUnicodeString(unaff_RBP + -2,unaff_RBP + -9);

-      RtlAppendUnicodeToString(unaff_RBP + -2,unaff_RBP + 0x52);

-      RtlAppendUnicodeToString(unaff_RBP + -9);

-    }

-    uVar21 = (undefined4)((ulonglong)in_stack_00000020 >> 0x20);

-    unaff_RDI = (longlong *)0x0;

-    unaff_EBX = unaff_EBX + unaff_R14D;

-    *(int *)(unaff_RBP + -0xe) = unaff_EBX;

-    if (unaff_R12D <= unaff_EBX) break;

-    param_1 = *(undefined8 *)(unaff_R15 + 0x10);

-    param_3 = unaff_RBP + -0xb;

-    in_ZF = unaff_EBX == 0;

-    *(undefined4 *)(unaff_RBP + -0xb) = 0;

   }

-  if ((char)unaff_RBP[-0xf] == '\0') {

-LAB_2:

-    uVar14 = 0;

-    if (((*(byte *)(unaff_RBP + -0xd) & bVar16) == 0) || (DAT_3 != '\0')) {

-      uVar9 = *(undefined8 *)(unaff_R15 + 0x18);

-      uVar19 = *(undefined8 *)(unaff_R15 + 8);

-      unaff_RBP[0xf] = (longlong)(unaff_RBP + -2);

-      uVar18 = CONCAT44(uVar21,0x100001);

-      *(undefined4 *)(unaff_RBP + 0xd) = 0x30;

-      unaff_RBP[0xe] = 0;

-      *(undefined4 *)(unaff_RBP + 0x10) = 0x240;

-      unaff_RBP[0x11] = 0;

-      unaff_RBP[0x12] = 0;

-      iVar5 = FltCreateFileEx2(uVar19,uVar9,unaff_RBP + 4);

-      HsmDbgBreakOnStatus(iVar5);

-      uVar2 = DAT_4;

-      if (iVar5 < 0) {

-        if (((iVar5 != -0x3fffffcc) && (iVar5 != -0x3fffffc6)) &&

-           (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control &&

-            (((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

-             (bVar16 <= (byte)WPP_GLOBAL_Control[0x29])))))) {

-          uVar12 = 0x33;

-LAB_5:

-          WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

-                     &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,unaff_R13);

-        }

-      }

-      else {

-        puVar11 = (uint *)(unaff_RBP + 0x4a);

-        uVar6 = uVar14;

-        do {

-          uVar7 = uVar6 + 4;

-          *puVar11 = (uVar6 & 0xf) << 0xc | uVar2;

-          puVar11[1] = (uVar6 + 1 & 0xf) << 0xc | uVar2;

-          puVar11[2] = (uVar6 + 2 & 0xf) << 0xc | uVar2;

-          puVar11[3] = (uVar6 + 3 & 0xf) << 0xc | uVar2;

-          puVar11 = puVar11 + 4;

-          uVar6 = uVar7;

-        } while (uVar7 < 0x10);

-        unaff_RBP[-0xd] = (longlong)(unaff_RBP + 0x4a);

-        for (; (ulonglong)(longlong)(int)uVar14 < 0x10; uVar14 = uVar14 + unaff_R14D) {

-          unaff_RBP[9] = 0x40004;

-          uVar9 = *(undefined8 *)(unaff_R15 + 0x18);

-          unaff_RBP[10] = (longlong)unaff_RBP + (longlong)(int)uVar14 * 4 + 0x250;

-          uVar18 = CONCAT44((int)((ulonglong)uVar18 >> 0x20),0x21);

-          unaff_RBP[0x25] = 0;

-          unaff_RBP[0x26] = 0;

-          iVar5 = FltQueryDirectoryFile(uVar9,*unaff_RBP,unaff_RBP + 0x25,0x10,uVar18);

-          HsmDbgBreakOnStatus(iVar5);

-          uVar21 = (undefined4)((ulonglong)uVar18 >> 0x20);

-          if ((-1 < iVar5) && ((int)unaff_RBP[0x26] == *(int *)unaff_RBP[-0xd])) goto LAB_6;

-          unaff_RBP[-0xd] = unaff_RBP[-0xd] + 4;

-        }

-        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-            ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-           (4 < (byte)WPP_GLOBAL_Control[0x29])) {

-          uVar12 = 0x34;

-          goto LAB_5;

-        }

-      }

-      iVar5 = -0x3fe3fff1;

-      HsmDbgBreakOnStatus(-0x3fe3fff1);

-      goto LAB_0;

-    }

-LAB_6:

-    uVar19 = CONCAT44(uVar21,5);

-    plVar15 = unaff_RBP + 0x20;

-    iVar5 = FltQueryVolumeInformation();

-    uVar9 = HsmDbgBreakOnStatus(iVar5);

-    if (iVar5 == -0x7ffffffb) {

-      iVar5 = 0;

-      while( true ) {

-        uVar21 = (undefined4)((ulonglong)uVar19 >> 0x20);

-        if (unaff_R12D <= iVar5) break;

-        *(undefined4 *)(unaff_RBP + -0xe) = 0;

-        plVar15 = unaff_RBP + -0xe;

-        if (iVar5 != 0) {

-          plVar15 = (longlong *)0x0;

-        }

-        iVar8 = FltGetVolumeGuidName

-                          (*(undefined8 *)(unaff_R15 + 0x10),

-                           -(ulonglong)(iVar5 != 0) & (ulonglong)(unaff_RBP + -4));

-        uVar9 = HsmDbgBreakOnStatus(iVar8);

-        uVar21 = (undefined4)((ulonglong)uVar19 >> 0x20);

-        if (((iVar8 + 0x80000000U & 0x80000000) == 0) && (iVar8 != -0x3fffffdd)) {

-          if ((WPP_GLOBAL_Control != unaff_RSI) &&

-             (((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

-              (2 < (byte)WPP_GLOBAL_Control[0x29])))) {

-            uVar12 = 0x36;

-LAB_7:

-            uVar21 = (undefined4)((ulonglong)*(undefined8 *)(unaff_R15 + 0x10) >> 0x20);

-            plVar15 = (longlong *)&WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids;

-            uVar9 = WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

-                               &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,unaff_R13);

-          }

-          break;

-        }

-        if (iVar5 == 0) {

-          plVar15 = (longlong *)0x73557348;

-          *(undefined2 *)(unaff_RBP + -4) = 0;

-          *(short *)((longlong)unaff_RBP + -0x1e) = (short)unaff_RBP[-0xe] + (short)unaff_R12D;

-          lVar10 = ExAllocatePool2(0x100);

-          unaff_RBP[-3] = lVar10;

-          uVar14 = ~-(uint)(lVar10 != 0) & 0xc000009a;

-          *(uint *)(unaff_RBP + -0xd) = uVar14;

-          uVar9 = HsmDbgBreakOnStatus(uVar14);

-          uVar21 = (undefined4)((ulonglong)uVar19 >> 0x20);

-          if (lVar10 == 0) {

-            if (((WPP_GLOBAL_Control != unaff_RSI) &&

-                ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-               (2 < (byte)WPP_GLOBAL_Control[0x29])) {

-              uVar12 = 0x37;

-              goto LAB_7;

-            }

-            break;

-          }

-        }

-        iVar5 = iVar5 + unaff_R14D;

-      }

-      if (unaff_RBP[-3] != 0) {

-        plVar13 = unaff_RBP + 0x27;

-        *(undefined4 *)((longlong)unaff_RBP + -100) = 0;

-        *(short *)(unaff_RBP + -0xd) = (short)unaff_RBP[-4] + -0x14;

-        *(short *)((longlong)unaff_RBP + -0x66) = *(short *)((longlong)unaff_RBP + -0x1e) + -0x14;

-        unaff_RBP[-0xc] = unaff_RBP[-3] + 0x14;

-        iVar5 = RtlGUIDFromString(unaff_RBP + -0xd);

-        uVar9 = HsmDbgBreakOnStatus(iVar5);

-        if (iVar5 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_RSI) &&

-              ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-             (bVar16 <= (byte)WPP_GLOBAL_Control[0x29])) {

-            WPP_SF_qqZd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),plVar13,plVar15,unaff_R13,

-                        *(undefined8 *)(unaff_R15 + 0x10),(wchar_t *)(unaff_RBP + -0xd));

-          }

-          goto LAB_0;

-        }

-      }

-      uVar19 = CONCAT44(uVar21,3);

-      iVar5 = FltQueryVolumeInformation(uVar9,unaff_RBP + 0xb,unaff_RBP + 0x22,0x18,uVar19);

-      uVar21 = (undefined4)((ulonglong)uVar19 >> 0x20);

-      uVar9 = HsmDbgBreakOnStatus(iVar5);

-      if (iVar5 < 0) {

-        if (((WPP_GLOBAL_Control == unaff_RSI) ||

-            ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-        uVar12 = 0x39;

-      }

-      else {

-        uVar20 = CONCAT44(uVar21,0xc);

-        iVar5 = FltQueryVolumeInformation

-                          (uVar9,unaff_RBP + 0xb,(longlong)unaff_RBP + -0x6c,4,uVar20);

-        uVar9 = HsmDbgBreakOnStatus(iVar5);

-        if (iVar5 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_RSI) &&

-              ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-             (2 < (byte)WPP_GLOBAL_Control[0x29])) {

-            uVar20 = *(ulonglong *)(unaff_R15 + 0x10);

-            uVar9 = WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x3a,

-                               &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,unaff_R13);

-          }

-          *(uint *)((longlong)unaff_RBP + -0x6c) = unaff_R14D;

-        }

-        iVar5 = FltOpenVolume(uVar9,unaff_RBP + 3,unaff_RBP + -10);

-        uVar9 = HsmDbgBreakOnStatus(iVar5);

-        if (iVar5 < 0) {

-          if (((WPP_GLOBAL_Control != unaff_RSI) &&

-              ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-             (bVar16 <= (byte)WPP_GLOBAL_Control[0x29])) {

-            WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x3b,

-                      &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,unaff_R13);

-          }

-          goto LAB_0;

-        }

-        uVar20 = uVar20 & 0xffffffff00000000;

-        iVar5 = FltFsControlFile(uVar9,unaff_RBP[-10],0x90064,0,uVar20);

-        uVar9 = HsmDbgBreakOnStatus(iVar5);

-        if (iVar5 < 0) {

-          if (((WPP_GLOBAL_Control == unaff_RSI) ||

-              ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-          uVar12 = 0x3c;

-        }

-        else {

-          if ((*(uint *)(unaff_RBP + 0x20) & 0x80000) == 0) {

-            uVar20 = uVar20 & 0xffffffff00000000;

-            iVar5 = FltFsControlFile(uVar9,unaff_RBP[-10],0x900f4,0,uVar20);

-            HsmDbgBreakOnStatus(iVar5);

-            if (iVar5 == -0x3ffffd48) {

-              uVar20 = 0x10;

-              unaff_RBP[0x29] = 0;

-              unaff_RBP[0x2a] = 0;

-              iVar5 = FltFsControlFile();

-              HsmDbgBreakOnStatus(iVar5);

-            }

-            if ((((iVar5 < 0) && (WPP_GLOBAL_Control != unaff_RSI)) &&

-                ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-               (2 < (byte)WPP_GLOBAL_Control[0x29])) {

-              uVar20 = *(ulonglong *)(unaff_R15 + 0x10);

-              WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x3d,

-                         &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,unaff_R13);

-            }

-          }

-          iVar5 = FltGetVolumeProperties

-                            (*(undefined8 *)(unaff_R15 + 0x10),unaff_RBP + 0x14,0x48,

-                             (longlong)unaff_RBP + -0x74,uVar20);

-          HsmDbgBreakOnStatus(iVar5);

-          if (iVar5 == -0x7ffffffb) {

-            iVar5 = FltAllocateContext(DAT_8,unaff_R12D,0x1a0,0x200,unaff_RBP + -0x10);

-            HsmDbgBreakOnStatus(iVar5);

-            if (iVar5 < 0) {

-              if (((WPP_GLOBAL_Control == unaff_RSI) ||

-                  ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-              uVar12 = 0x3f;

-            }

-            else {

-              memset((void *)unaff_RBP[-0x10],0,0x1a0);

-              *(undefined4 *)unaff_RBP[-0x10] = 0x63497348;

-              FltInitializePushLock(unaff_RBP[-0x10] + 0x70);

-              KeInitializeEvent(unaff_RBP[-0x10] + 0x90,0,bVar17);

-              KeInitializeEvent(unaff_RBP[-0x10] + 0x78,0,bVar17);

-              ExInitializeRundownProtection(unaff_RBP[-0x10] + 0xb0);

-              uVar9 = ExInitializeResourceLite(unaff_RBP[-0x10] + 0x138);

-              FltCbdqInitialize(uVar9,unaff_RBP[-0x10] + 0xb8,HsmiDehydrationCsqINSERT_IO,

-                                HsmiDehydrationCsqREMOVE_IO,HsmiDehydrationCsqPEEK_NEXT_IO);

-              *(undefined8 *)(unaff_RBP[-0x10] + 0x20) = unaff_R13;

-              *(undefined8 *)(unaff_RBP[-0x10] + 0x28) = *(undefined8 *)(unaff_R15 + 0x10);

-              lVar10 = unaff_RBP[-0x10];

-              lVar1 = unaff_RBP[0x28];

-              *(longlong *)(lVar10 + 0x30) = unaff_RBP[0x27];

-              *(longlong *)(lVar10 + 0x38) = lVar1;

-              lVar10 = unaff_RBP[-0x10];

-              lVar1 = unaff_RBP[-8];

-              *(longlong *)(lVar10 + 0x40) = unaff_RBP[-9];

-              *(longlong *)(lVar10 + 0x48) = lVar1;

-              unaff_RBP[-8] = 0;

-              *(int *)(unaff_RBP[-0x10] + 0x50) = unaff_R12D;

-              uVar14 = (int)unaff_RBP[0x24] * *(int *)((longlong)unaff_RBP + 0x124);

-              *(uint *)(unaff_RBP[-0x10] + 0x54) = uVar14;

-              if (uVar14 < 0x1001) {

-                uVar14 = uVar14 * 0x10;

-              }

-              else if (uVar14 < 0x10001) {

-                uVar14 = 0x10000;

-              }

-              *(uint *)(unaff_RBP[-0x10] + 0x58) = uVar14;

-              *(int *)(unaff_RBP[-0x10] + 0x5c) = (int)unaff_RBP[0x3c];

-              *(undefined8 *)(unaff_RBP[-0x10] + 0x60) = 0x7fffffffffffffff;

-              *(uint *)(unaff_RBP[-0x10] + 0x68) = (uint)*(ushort *)(unaff_RBP + 0x16);

-              uVar14 = *(uint *)((longlong)unaff_RBP + -0x6c);

-              if (*(uint *)((longlong)unaff_RBP + -0x6c) <= unaff_R14D) {

-                uVar14 = 0;

-              }

-              *(uint *)(unaff_RBP[-0x10] + 0x6c) = uVar14;

-              *(byte *)(unaff_RBP[-0x10] + 0x18) =

-                   (byte)(*(uint *)(unaff_RBP + 0x20) >> 0x13) & bVar17;

-              iVar5 = (*DAT_9)(unaff_RBP[-0x10],unaff_RBP[-0x10] + 0x10);

-              HsmDbgBreakOnStatus(iVar5);

-              if (iVar5 < 0) {

-                if (((WPP_GLOBAL_Control == unaff_RSI) ||

-                    ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-                   ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-                uVar12 = 0x40;

-              }

-              else {

-                iVar5 = FltSetInstanceContext

-                                  (*(undefined8 *)(unaff_R15 + 0x18),unaff_R14D,unaff_RBP[-0x10],0);

-                HsmDbgBreakOnStatus(iVar5);

-                if (-1 < iVar5) {

-                  if (((WPP_GLOBAL_Control != unaff_RSI) &&

-                      ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

-                     (3 < (byte)WPP_GLOBAL_Control[0x29])) {

-                    WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x42,

-                                &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,

-                                *(undefined8 *)(unaff_R15 + 0x18));

-                  }

-                  goto LAB_0;

-                }

-                if (((WPP_GLOBAL_Control == unaff_RSI) ||

-                    ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-                   ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-                uVar12 = 0x41;

-              }

-              unaff_R13 = *(undefined8 *)(unaff_R15 + 0x18);

+  if ((uVar7 == 0) || (lVar5 = ExAllocatePool2(0x100,uVar7,0x72507348), lVar5 != 0)) {

+    uVar8 = 0;

+    uVar6 = 3;

+    do {

+      uVar10 = (uint)uVar6;

+      uVar9 = uVar8;

+      uVar11 = uVar6;

+      uVar7 = uVar12;

+      if (((uint)(&DAT_0)[uVar8 * 3] <= param_2) &&

+         (param_2 <= (uint)(&DAT_1)[uVar8 * 3])) {

+        iVar4 = RtlCompressBuffer((&SupportedCompressionTypes)[uVar8 * 6],param_1,param_2,

+                                  local_res18,param_4,0x200 << ((&DAT_2)[uVar8 * 0xc] & 7),

+                                  local_res20,lVar5);

+        HsmDbgBreakOnStatus(iVar4);

+        if ((iVar4 < 0) || (uVar11 = uVar8, uVar7 = local_res20[0], uVar12 <= local_res20[0])) {

+          if ((uint)uVar8 == 2) {

+            uVar9 = (ulonglong)(uVar10 - 1);

+            uVar11 = uVar6;

+            uVar7 = uVar12;

+            if (1 < uVar10) {

+              uVar9 = uVar8;

             }

           }

           else {

-            if (((WPP_GLOBAL_Control == unaff_RSI) ||

-                ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-               ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-            uVar12 = 0x3e;

+            uVar11 = uVar6;

+            uVar7 = uVar12;

+            if ((uint)uVar8 == uVar10) break;

           }

         }

       }

+      uVar12 = uVar7;

+      uVar10 = (uint)uVar11;

+      uVar7 = (int)uVar9 + 1;

+      uVar8 = (ulonglong)uVar7;

+      uVar6 = uVar11;

+    } while (uVar7 < 3);

+    if (lVar5 != 0) {

+      ExFreePoolWithTag(lVar5,0x72507348);

     }

-    else {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-      uVar12 = 0x35;

+    if (-1 < iVar4) {

+      if (uVar10 < 3) {

+        uVar6 = (ulonglong)uVar10;

+        bVar1 = *(byte *)((longlong)&SupportedCompressionTypes + uVar6 * 0xc + 1);

+        uVar2 = *(undefined1 *)(&SupportedCompressionTypes + uVar6 * 6);

+        cVar3 = (&DAT_2)[uVar6 * 0xc];

+        *param_5 = uVar12;

+        *param_6 = uVar2;

+        *param_7 = bVar1 & 0x1f | cVar3 << 4;

+      }

+      else {

+        *param_5 = 0;

+        *param_6 = 0;

+        *param_7 = 0;

+      }

     }

   }

   else {

-    unaff_RBP[7] = 0;

-    unaff_RBP[8] = 0;

-    uVar9 = RtlGetNtSystemRoot();

-    RtlInitUnicodeString(unaff_RBP + 7,uVar9);

-    sVar4 = *(short *)((longlong)unaff_RBP + 0x3a) + *(short *)((longlong)unaff_RBP + -0x46);

-    *(short *)((longlong)unaff_RBP + -0x2e) = sVar4;

-    *(undefined2 *)(unaff_RBP + -6) = 0;

-    lVar10 = ExAllocatePool2(0x100,sVar4,0x73557348);

-    unaff_RBP[-5] = lVar10;

-    HsmDbgBreakOnStatus(~-(uint)(lVar10 != 0) & 0xc000009a);

-    if (lVar10 != 0) {

-      RtlCopyUnicodeString(unaff_RBP + -6,unaff_RBP + -9);

-      if (5 < *(ushort *)(unaff_RBP + 7)) {

-        RtlAppendUnicodeToString(unaff_RBP + -6,unaff_RBP[8] + 6);

-        RtlAppendUnicodeToString(unaff_RBP + -6,L"\\");

-      }

-      lVar10 = unaff_RBP[-6];

-      lVar1 = unaff_RBP[-5];

-      *(undefined4 *)(unaff_RBP + -6) = _DAT_10;

-      *(undefined4 *)((longlong)unaff_RBP + -0x2c) = DAT_10_4;

-      *(undefined4 *)(unaff_RBP + -5) = (undefined4)DAT_11;

-      *(undefined4 *)((longlong)unaff_RBP + -0x24) = DAT_11._4_4_;

-      _DAT_10 = lVar10;

-      DAT_11 = lVar1;

-      goto LAB_2;

-    }

-    iVar5 = -0x3fffff66;

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((bVar17 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < bVar16)) goto LAB_0;

-    uVar12 = 0x32;

+    iVar4 = -0x3fffff66;

+    HsmDbgBreakOnStatus(-0x3fffff66);

   }

-LAB_1:

-  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

-             &WPP_6a018c9574be33c8c479aebdc1ce8226_Traceguids,unaff_R13);

-LAB_0:

-  if (unaff_RBP[2] != 0) {

-    ExFreePoolWithTag(unaff_RBP[2],0x62547348);

-  }

-  if (unaff_RBP[-3] != 0) {

-    ExFreePoolWithTag(unaff_RBP[-3],0x73557348);

-  }

-  if (unaff_RBP[-5] != 0) {

-    ExFreePoolWithTag(unaff_RBP[-5],0x73557348);

-  }

-  if (unaff_RBP[-8] != 0) {

-    ExFreePoolWithTag(unaff_RBP[-8],0x73557348);

-  }

-  if (unaff_RBP[-1] != 0) {

-    ExFreePoolWithTag(unaff_RBP[-1],0x73557348);

-  }

-  if (unaff_RBP[3] != 0) {

-    FltClose();

-  }

-  if (unaff_RBP[-10] != 0) {

-    ObfDereferenceObject();

-  }

-  if (unaff_RBP[4] != 0) {

-    FltClose();

-  }

-  if (*unaff_RBP != 0) {

-    ObfDereferenceObject();

-  }

-  if (unaff_RBP[-0x10] != 0) {

-    FltReleaseContext();

-  }

-  return iVar5;

+  return iVar4;

 }
```

## `HsmFltPreSET_EA`  (modified)

```diff
--- HsmFltPreSET_EA
+++ HsmFltPreSET_EA
@@ -1,232 +1,126 @@
-

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

 

 undefined8 HsmFltPreSET_EA(longlong param_1,longlong param_2)

 

 {

-  undefined *puVar1;

-  uint uVar2;

-  undefined4 uVar3;

-  uint uVar4;

-  longlong in_RAX;

-  ulonglong uVar5;

-  longlong lVar6;

-  longlong lVar7;

-  longlong lVar8;

-  ulonglong uVar9;

-  undefined8 uVar10;

-  undefined8 *puVar11;

-  undefined2 uVar12;

-  longlong unaff_RBP;

-  undefined8 unaff_RSI;

-  undefined8 *unaff_RDI;

-  byte in_R8B;

+  bool bVar1;

+  char cVar2;

+  int iVar3;

+  longlong lVar4;

+  longlong lVar5;

+  undefined *puVar6;

+  undefined2 uVar7;

+  undefined8 *puVar8;

+  undefined4 uVar9;

+  int *piVar10;

+  undefined8 uVar11;

+  uint *puVar12;

   undefined *puVar13;

-  byte in_R9B;

-  ushort uVar14;

-  ulonglong in_R10;

-  ulonglong unaff_R12;

-  longlong unaff_R13;

-  char unaff_R14B;

-  undefined8 unaff_R15;

-  undefined8 *in_stack_00000050;

-  char in_stack_00000058;

+  undefined8 uVar14;

+  uint local_res8 [2];

+  ulonglong uVar15;

+  undefined8 in_stack_ffffffffffffffc0;

+  undefined8 local_28;

+  int *piStack_20;

   

-  *(char *)(in_RAX + -0x75) = *(char *)(in_RAX + -0x75) + (char)param_1;

-  if ((int)param_1 < (int)in_RAX) {

-    uVar5 = ~-(ulonglong)((in_R8B & 2) != 0) & 0xfffffffffffff000 & param_1;

+  uVar9 = (undefined4)((ulonglong)in_stack_ffffffffffffffc0 >> 0x20);

+  local_res8[0] = 0;

+  local_28 = 0;

+  piStack_20 = (int *)0x0;

+  uVar14 = 1;

+  if (*(char *)(*(longlong *)(param_1 + 0x10) + 5) != '\x04') {

+    return 1;

   }

-  else {

-    uVar5 = HsmpGetStreamSize((longlong)unaff_RDI);

+  uVar11 = *(undefined8 *)(param_2 + 0x20);

+  lVar4 = HsmpGetStreamHandleContext(param_1,*(longlong *)(param_2 + 0x18),uVar11);

+  if (lVar4 == 0) {

+    return 1;

   }

-  *(ulonglong *)(unaff_RBP + -0x71) = uVar5;

-  uVar2 = HsmiMarkFileRangeNoLock((longlong)unaff_RDI,0x4244,in_R10,uVar5,in_R9B);

-  puVar11 = (undefined8 *)(ulonglong)uVar2;

-  HsmDbgBreakOnStatus(uVar2);

-  if ((int)uVar2 < 0) {

-    puVar13 = WPP_GLOBAL_Control;

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4))

-    goto LAB_0;

-    uVar12 = 0x3a;

-LAB_1:

-    puVar11 = *(undefined8 **)(WPP_GLOBAL_Control + 0x18);

-    puVar13 = WPP_GLOBAL_Control;

-  }

-  else {

-    uVar5 = *(ulonglong *)(unaff_RBP + -0x71);

-    uVar2 = HsmiMarkFileRangeNoLock

-                      ((longlong)unaff_RDI,0x4256,*(ulonglong *)(unaff_RBP + -0x61),uVar5,0);

-    puVar11 = (undefined8 *)(ulonglong)uVar2;

-    HsmDbgBreakOnStatus(uVar2);

-    lVar8 = _DAT_2;

-    if ((int)uVar2 < 0) {

-      puVar13 = WPP_GLOBAL_Control;

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)

-         ) goto LAB_0;

-      uVar12 = 0x3b;

-      goto LAB_1;

-    }

-    *(longlong *)(unaff_RDI[0x14] + 8) = _DAT_2;

-    uVar2 = HsmpComputeDehydrationReason

-                      (*(uint *)(CONCAT71((int7)((ulonglong)unaff_R15 >> 8),0x48) + 8));

-    HsmpSetLastDehydrationReasonNoLock((longlong)unaff_RDI,uVar2);

-    puVar1 = *(undefined **)(*(longlong *)(unaff_RBP + -0x51) + 0x60);

-    puVar13 = &DAT_3;

-    if (puVar1 != (undefined *)0x0) {

-      puVar13 = puVar1;

-    }

-    puVar11 = unaff_RDI;

-    lVar6 = HsmpGetStreamSize((longlong)unaff_RDI);

-    lVar7 = HsmpGetLastHydrationTime((longlong)puVar11);

-    uVar3 = HsmpGetLastDehydrationReason((longlong)puVar11);

-    TlmWriteDehydrationEvent((longlong)puVar13,uVar3,lVar7,lVar8,unaff_RSI,lVar6);

-    puVar1 = *(undefined **)(unaff_RBP + -0x69);

-    uVar5 = 0;

-    puVar13 = puVar1;

-    uVar2 = HsmpRpCommitNoLock(unaff_R13,(longlong)unaff_RDI,(longlong)puVar1,'\0','\0');

-    puVar11 = (undefined8 *)(ulonglong)uVar2;

-    HsmDbgBreakOnStatus(uVar2);

-    if ((int)uVar2 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_0;

-      uVar12 = 0x3c;

-LAB_4:

-      puVar13 = &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids;

-      puVar11 = *(undefined8 **)(WPP_GLOBAL_Control + 0x18);

-      uVar5 = unaff_R12;

-      WPP_SF_qqqid(puVar11,uVar12,&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,unaff_R12);

-      goto LAB_0;

-    }

-    puVar13 = (undefined *)0x1;

-    uVar2 = HsmpToggleFileSparseAttribute(unaff_R13,(longlong)puVar1,'\x01');

-    puVar11 = (undefined8 *)(ulonglong)uVar2;

-    HsmDbgBreakOnStatus(uVar2);

-    uVar5 = 0;

-    if ((int)uVar2 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_0;

-      uVar12 = 0x3d;

-      goto LAB_4;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x3e,

-                   &WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,unaff_R12);

-    }

-    uVar5 = *(longlong *)(unaff_RBP + -0x59) + -1 + (ulonglong)*(uint *)(unaff_R13 + 0x58) &

-            -(ulonglong)*(uint *)(unaff_R13 + 0x58);

-    *(ulonglong *)(unaff_RBP + -0x19) = uVar5;

-    lVar8 = HsmpGetStreamSize((longlong)unaff_RDI);

-    if ((longlong)*(ulonglong *)(unaff_RBP + -0x49) < lVar8) {

-      uVar9 = -(ulonglong)*(uint *)(unaff_R13 + 0x58) & *(ulonglong *)(unaff_RBP + -0x49);

+  uVar15 = *(ulonglong *)(lVar4 + 0x10);

+  bVar1 = false;

+  if ((*(uint *)(uVar15 + 0x1c) & 2) == 0) {

+    HsmpTracePreCallbackEnter(param_1,'\0',CONCAT71((int7)((ulonglong)uVar11 >> 8),1),lVar4,uVar15);

+    lVar5 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x28);

+    if (lVar5 == 0) {

+      lVar5 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x20);

     }

     else {

-      uVar9 = 0x7fffffffffffffff;

+      if ((*(byte *)(lVar5 + 10) & 5) == 0) {

+        lVar5 = MmMapLockedPagesSpecifyCache

+                          (lVar5,0,1,0,uVar15 & 0xffffffff00000000,CONCAT44(uVar9,0x40000010));

+      }

+      else {

+        lVar5 = *(longlong *)(lVar5 + 0x18);

+      }

+      if (lVar5 == 0) {

+        uVar9 = 0xc000009a;

+        HsmDbgBreakOnStatus(-0x3fffff66);

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          uVar7 = 0x3f;

+LAB_0:

+          WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar7,

+                      &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_1);

+        }

+LAB_1:

+        *(undefined8 *)(param_1 + 0x20) = 0;

+        uVar14 = 4;

+        *(undefined4 *)(param_1 + 0x18) = uVar9;

+        bVar1 = true;

+        goto LAB_2;

+      }

     }

-    *(ulonglong *)(unaff_RBP + -0x11) = uVar9;

-    if ((longlong)uVar9 <= (longlong)uVar5) {

-LAB_5:

-      *(undefined8 *)(unaff_R12 + 0x20) = 1;

-      in_stack_00000050 = (undefined8 *)ExAllocatePool2(0x102,0x1c);

-      uVar14 = 0;

-      if (in_stack_00000050 != (undefined8 *)0x0) {

-        *in_stack_00000050 = 0x634e7348;

-        *(undefined4 *)(in_stack_00000050 + 1) = 0x18;

-        *(undefined4 *)((longlong)in_stack_00000050 + 0xc) = 0x10000;

-        in_stack_00000050[2] = 0;

-        uVar3 = HsmpGetLastDehydrationReason((longlong)unaff_RDI);

-        if ((uVar14 < *(ushort *)((longlong)in_stack_00000050 + 0xe)) &&

-           (((ulonglong)*(uint *)(in_stack_00000050 + 1) + 3 & 0xfffffffffffffffc) + 4 < 0x1d)) {

-          uVar4 = *(uint *)(in_stack_00000050 + 1) + 3 & 0xfffffffc;

-          *(uint *)(in_stack_00000050 + 1) = uVar4;

-          if (*(ushort *)(in_stack_00000050 + 2) != uVar14) {

-            *(ushort *)((longlong)in_stack_00000050 + 0xc) =

-                 *(ushort *)((longlong)in_stack_00000050 + 0xc) | 1;

+    puVar12 = local_res8;

+    iVar3 = IoCheckEaBufferValidity(lVar5,*(undefined4 *)(*(longlong *)(param_1 + 0x10) + 0x18));

+    bVar1 = true;

+    if (-1 < iVar3) {

+      local_res8[0] = 0;

+      do {

+        puVar8 = &local_28;

+        piVar10 = (int *)((ulonglong)local_res8[0] + lVar5);

+        puVar13 = (undefined *)CONCAT71((int7)((ulonglong)puVar12 >> 8),1);

+        local_28._0_4_ =

+             (uint)CONCAT12(*(byte *)((longlong)piVar10 + 5),

+                            (ushort)*(byte *)((longlong)piVar10 + 5));

+        piStack_20 = piVar10 + 2;

+        cVar2 = RtlPrefixString(&KernelPurgeableEaNamePrefix);

+        if (cVar2 != '\0') {

+          uVar9 = 0xc000004f;

+          HsmDbgBreakOnStatus(-0x3fffffb1);

+          puVar6 = WPP_GLOBAL_Control;

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+            puVar13 = &WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids;

+            puVar6 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

+            puVar8 = (undefined8 *)0x40;

+            WPP_SF_qqqd(puVar6,0x40,&WPP_37ab41e92d3c3d67d614b1b09520a89e_Traceguids,param_1);

           }

-          *(undefined4 *)(in_stack_00000050 + 2) = 0x4000a;

-          *(uint *)((longlong)in_stack_00000050 + 0x14) = uVar4;

-          *(undefined4 *)((ulonglong)uVar4 + (longlong)in_stack_00000050) = uVar3;

-          *(int *)(in_stack_00000050 + 1) = *(int *)(in_stack_00000050 + 1) + 4;

+          TlmWriteDisallowPurgeableKernelEA(puVar6,puVar8,puVar13);

+          goto LAB_1;

         }

-      }

-      puVar13 = (undefined *)0x0;

-      uVar5 = 1;

-      puVar11 = (undefined8 *)0x3;

-      HsmpCldNotifyPostOperation(3,unaff_R12,0,1,in_stack_00000050);

-      goto LAB_0;

+        puVar12 = (uint *)CONCAT71((int7)((ulonglong)puVar13 >> 8),1);

+        cVar2 = RtlEqualString(&DoNotConvertToCloudFilesEA,&local_28);

+        if (cVar2 != '\0') {

+          HsmDbgBreakOnStatus(-0x3fffffb1);

+          uVar9 = 0xc000004f;

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              (uVar9 = 0xc000004f, (*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 4)) goto LAB_1;

+          uVar7 = 0x41;

+          uVar9 = 0xc000004f;

+          goto LAB_0;

+        }

+        local_res8[0] = local_res8[0] + *piVar10;

+        bVar1 = true;

+      } while (*piVar10 != 0);

     }

-    puVar13 = (undefined *)0x980c8;

-    uVar5 = unaff_RBP - 0x19;

-    uVar2 = FltFsControlFile(*(undefined8 *)(unaff_RBP + -0x31));

-    HsmDbgBreakOnStatus(uVar2);

-    if ((int)uVar2 < 0) {

-      puVar11 = (undefined8 *)WPP_GLOBAL_Control;

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 4)

-         ) goto LAB_0;

-      uVar12 = 0x3f;

-    }

-    else {

-      uVar5 = 1;

-      puVar13 = (undefined *)0x0;

-      uVar2 = HsmpPrepareForMgmtOperation(unaff_R13,*(undefined8 *)(unaff_RBP + -0x69),0,'\x01');

-      HsmDbgBreakOnStatus(uVar2);

-      if (-1 < (int)uVar2) goto LAB_5;

-      puVar11 = (undefined8 *)WPP_GLOBAL_Control;

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_0;

-      uVar12 = 0x40;

-    }

-    puVar11 = *(undefined8 **)(WPP_GLOBAL_Control + 0x18);

   }

-  uVar5 = unaff_R12;

-  WPP_SF_qqiqiid(puVar11,uVar12,puVar13,unaff_R12);

-LAB_0:

-  uVar9 = Feature_2629456187__private_IsEnabledDeviceUsageNoInline();

-  if (((int)uVar9 != 0) &&

-     (puVar11 = *(undefined8 **)(unaff_RBP + -0x39), puVar11 != (undefined8 *)0x0)) {

-    FltReleaseFileNameInformation();

+LAB_2:

+  FltReleaseContext(lVar4);

+  if (bVar1) {

+    HsmpTracePreCallbackExit(uVar14,param_1,0,'\0','\x01');

   }

-  if (*(char *)(unaff_RBP + -0x80) != '\0') {

-    *(undefined1 *)(*(longlong *)(unaff_RBP + -0x69) + 0x4b) = 0;

-  }

-  if (in_stack_00000058 != '\0') {

-    puVar11 = unaff_RDI;

-    HsmpReleaseBitmapLock((longlong)unaff_RDI);

-  }

-  if (*(char *)(unaff_RBP + -0x7f) != '\0') {

-    HsmpReInitializeUserRequestRundownProtection((longlong)unaff_RDI);

-    puVar11 = (undefined8 *)(unaff_RDI[2] + 0x18);

-    FltReleasePushLockEx(puVar11,0);

-  }

-  if (in_stack_00000050 != (undefined8 *)0x0) {

-    ExFreePoolWithTag(in_stack_00000050,0x634e7348);

-    puVar11 = in_stack_00000050;

-  }

-  if (unaff_R14B != '\0') {

-    puVar13 = (undefined *)(ulonglong)uVar2;

-    HsmpCompletePendedDehydrationRequests((longlong)unaff_RDI,'\x01',uVar2);

-    puVar11 = unaff_RDI;

-  }

-  HsmiOpCompleteOperation

-            (puVar11,unaff_R13,puVar13,uVar5,*(longlong *)(unaff_RBP + -0x29),

-             (uint *)(unaff_RBP + -0x41));

-  lVar8 = *(longlong *)(unaff_RBP + -0x21);

-  if (*(longlong *)(lVar8 + 0x10) != 0) {

-    FltReleaseContext();

-  }

-  uVar10 = ExFreePoolWithTag(lVar8,0x63447348);

-  if (*(char *)(unaff_RBP + -0x7e) == '\0') {

-    *(uint *)(unaff_R12 + 0x18) = uVar2;

-    uVar10 = FltCompletePendedPreOperation();

-  }

-  return uVar10;

+  return uVar14;

 }
```

## `HsmFltPreDIRECTORY_CONTROL`  (modified)

```diff
--- HsmFltPreDIRECTORY_CONTROL
+++ HsmFltPreDIRECTORY_CONTROL
@@ -1,19 +1,324 @@
 

 uint HsmFltPreDIRECTORY_CONTROL(uint *param_1,longlong param_2,ulonglong *param_3)

 

 {

-  longlong unaff_RBP;

-  uint unaff_EDI;

-  undefined8 unaff_R13;

+  bool bVar1;

+  bool bVar2;

+  bool bVar3;

+  char cVar4;

+  ushort uVar5;

+  uint uVar6;

+  longlong lVar7;

+  void *_Dst;

+  undefined *puVar8;

+  short sVar9;

+  uint uVar10;

+  ulonglong uVar11;

+  ulonglong *puVar12;

+  ulonglong uVar13;

+  ulonglong uVar14;

+  ulonglong uVar15;

+  ulonglong uVar16;

+  bool bVar17;

+  void *local_res20;

+  ulonglong local_a0;

+  longlong local_98;

+  longlong local_90;

+  undefined8 local_88;

+  longlong local_78;

+  void *pvStack_70;

+  undefined8 local_68;

+  longlong local_60;

+  longlong local_58;

+  void *pvStack_50;

   

-  if ((((undefined **)param_1 != &WPP_GLOBAL_Control) && ((param_1[0xb] & 1) != 0)) &&

-     (1 < *(byte *)((longlong)param_1 + 0x29))) {

-    WPP_SF_qqqd(*(undefined8 *)(param_1 + 6),0x13,&WPP_0654f2bb220338f45d660a0c24be4df2_Traceguids,

-                unaff_R13);

-  }

-  if (*(longlong *)(unaff_RBP + -0x31) != 0) {

-    ExFreePoolWithTag(*(longlong *)(unaff_RBP + -0x31),0x73557348);

-  }

-  return unaff_EDI;

+  local_90 = *(longlong *)(param_2 + 0x20);

+  uVar16 = 0;

+  *param_3 = 0;

+  bVar1 = false;

+  bVar3 = false;

+  uVar10 = 1;

+  local_58 = 0;

+  pvStack_50 = (void *)0x0;

+  uVar14 = 0;

+  bVar2 = true;

+  uVar11 = uVar16;

+  uVar13 = uVar16;

+  uVar15 = uVar16;

+  if (*(char *)(*(longlong *)(param_1 + 4) + 5) == '\x01') {

+    lVar7 = *(longlong *)(param_2 + 0x18);

+    puVar12 = &local_a0;

+    local_a0 = 0;

+    FltGetStreamHandleContext(lVar7,*(undefined8 *)(param_2 + 0x20),puVar12);

+    uVar11 = local_a0;

+    uVar15 = uVar14;

+    if (local_a0 != 0) {

+      if ((*(uint *)(*(longlong *)(local_a0 + 0x10) + 0x1c) & 1) == 0) {

+        if (local_a0 != 0) {

+          FltDeleteContext(local_a0);

+          goto LAB_0;

+        }

+      }

+      else if (local_a0 != 0) {

+        if (*(longlong *)

+             (*(longlong *)(*(longlong *)(*(longlong *)(local_a0 + 0x10) + 0x10) + 0x10) + 0x20) ==

+            lVar7) {

+          lVar7 = FltGetRequestorProcess(param_1);

+          cVar4 = HsmOsIsPassThroughModeEnabled(lVar7);

+          if (cVar4 != '\0') goto LAB_0;

+        }

+        else {

+LAB_0:

+          FltReleaseContext(local_a0);

+          local_a0 = 0;

+        }

+        uVar11 = local_a0;

+        if (local_a0 != 0) {

+          uVar13 = *(ulonglong *)(local_a0 + 0x10);

+          local_60 = *(longlong *)(uVar13 + 0x10);

+          local_68 = *(undefined8 *)(local_60 + 0x10);

+          local_88 = *(undefined8 *)(local_60 + 0x20);

+          if ((*(byte *)(*(longlong *)(param_1 + 4) + 6) & 8) == 0) {

+            lVar7 = FltGetRequestorProcess(param_1);

+            cVar4 = HsmOsIsSyncProviderProcess(lVar7);

+            uVar14 = 1;

+            if (cVar4 != '\0') {

+              uVar14 = uVar16;

+            }

+          }

+          else {

+            uVar14 = 0;

+          }

+          local_res20._0_1_ = (char)uVar14;

+          if (*(int *)(*(longlong *)(param_1 + 4) + 0x28) == 0x51) {

+switchD_140050d30_caseD_0:

+            cVar4 = HsmOsGetPlaceholderCompatMode((longlong)param_1);

+            bVar17 = cVar4 != '\x02';

+          }

+          else {

+            switch(*(int *)(*(longlong *)(param_1 + 4) + 0x28)) {

+            case 1:

+            case 2:

+            case 3:

+            case 0x25:

+            case 0x26:

+            case 0x3c:

+            case 0x3f:

+            case 0x4e:

+            case 0x4f:

+            case 0x50:

+              goto switchD_140050d30_caseD_0;

+            case 4:

+            case 5:

+            case 6:

+            case 7:

+            case 8:

+            case 9:

+            case 10:

+            case 0xb:

+            case 0xc:

+            case 0xd:

+            case 0xe:

+            case 0xf:

+            case 0x10:

+            case 0x11:

+            case 0x12:

+            case 0x13:

+            case 0x14:

+            case 0x15:

+            case 0x16:

+            case 0x17:

+            case 0x18:

+            case 0x19:

+            case 0x1a:

+            case 0x1b:

+            case 0x1c:

+            case 0x1d:

+            case 0x1e:

+            case 0x1f:

+            case 0x20:

+            case 0x21:

+            case 0x22:

+            case 0x23:

+            case 0x24:

+            case 0x27:

+            case 0x28:

+            case 0x29:

+            case 0x2a:

+            case 0x2b:

+            case 0x2c:

+            case 0x2d:

+            case 0x2e:

+            case 0x2f:

+            case 0x30:

+            case 0x31:

+            case 0x32:

+            case 0x33:

+            case 0x34:

+            case 0x35:

+            case 0x36:

+            case 0x37:

+            case 0x38:

+            case 0x39:

+            case 0x3a:

+            case 0x3b:

+            case 0x3d:

+            case 0x3e:

+            case 0x40:

+            case 0x41:

+            case 0x42:

+            case 0x43:

+            case 0x44:

+            case 0x45:

+            case 0x46:

+            case 0x47:

+            case 0x48:

+            case 0x49:

+            case 0x4a:

+            case 0x4b:

+            case 0x4c:

+            case 0x4d:

+            default:

+              bVar17 = false;

+            }

+          }

+          if (((char)local_res20 != '\0') || (bVar1 = false, bVar17 != false)) {

+            bVar1 = true;

+            HsmpTracePreCallbackEnter

+                      ((longlong)param_1,uVar11 == 0,

+                       CONCAT71((int7)((ulonglong)puVar12 >> 8),uVar11 != 0),uVar11,

+                       *(longlong *)(uVar11 + 0x10));

+            if ((char)local_res20 == '\0') {

+LAB_1:

+              uVar15 = uVar16;

+              if (bVar17 != false) {

+                uVar10 = HsmiMungeQueryDirectory((longlong)param_1,param_2);

+                HsmDbgBreakOnStatus(uVar10);

+                uVar15 = (ulonglong)uVar10;

+                uVar10 = 4;

+                bVar1 = bVar2;

+              }

+            }

+            else {

+              uVar6 = HsmpAcquireUserRequestRundownProtection(uVar13,param_1);

+              uVar15 = (ulonglong)uVar6;

+              HsmDbgBreakOnStatus(uVar6);

+              if ((int)uVar6 < 0) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (bVar1 = bVar2, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  WPP_SF_qqLqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x13,

+                                 &WPP_23c031617105374e664d37900f58dae3_Traceguids,local_68);

+                  uVar10 = 1;

+                }

+              }

+              else {

+                bVar3 = true;

+                local_78 = 0;

+                pvStack_70 = (void *)0x0;

+                local_90 = *(longlong *)(*(longlong *)(param_1 + 4) + 8);

+                local_88 = *(undefined8 *)(*(longlong *)(param_1 + 4) + 0x10);

+                local_98 = 0;

+                if (local_90 == 0) {

+                  uVar6 = FltGetFileNameInformation(0,0x101,&local_98);

+                }

+                else {

+                  uVar6 = FltGetFileNameInformationUnsafe(local_90,0,0x101,&local_98);

+                }

+                uVar16 = (ulonglong)uVar6;

+                HsmDbgBreakOnStatus(uVar6);

+                if ((int)uVar6 < 0) {

+                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xd,

+                               &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,local_88);

+                  }

+                  local_res20 = pvStack_70;

+                }

+                else {

+                  uVar16 = 0;

+                  sVar9 = (*(short *)(local_98 + 8) - *(short *)(local_98 + 0x18)) + 2;

+                  local_78 = (ulonglong)CONCAT42((int)((ulonglong)local_78 >> 0x20),sVar9) << 0x10;

+                  _Dst = (void *)ExAllocatePool2(0x100,sVar9,0x73557348);

+                  pvStack_70 = _Dst;

+                  if (_Dst == (void *)0x0) {

+                    uVar16 = 0xc000009a;

+                    HsmDbgBreakOnStatus(-0x3fffff66);

+                    local_res20 = (void *)0x0;

+                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+                       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                      WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xe,

+                                 &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,local_88);

+                    }

+                  }

+                  else {

+                    HsmDbgBreakOnStatus(0);

+                    uVar5 = *(short *)(local_98 + 8) - *(ushort *)(local_98 + 0x18);

+                    local_78 = CONCAT62(local_78._2_6_,uVar5);

+                    memmove(_Dst,(void *)((ulonglong)*(ushort *)(local_98 + 0x18) +

+                                         *(longlong *)(local_98 + 0x10)),(ulonglong)uVar5);

+                    local_res20 = (void *)0x0;

+                    *(undefined2 *)((longlong)_Dst + (ulonglong)(uVar5 >> 1) * 2) = 0;

+                    local_58 = local_78;

+                    pvStack_50 = pvStack_70;

+                  }

+                }

+                if (local_98 != 0) {

+                  FltReleaseFileNameInformation();

+                }

+                if (local_res20 != (void *)0x0) {

+                  ExFreePoolWithTag(local_res20,0x73557348);

+                }

+                HsmDbgBreakOnStatus((int)uVar16);

+                if (-1 < (int)uVar16) {

+                  puVar8 = HsmpRecallInitiatePopulationEx

+                                     (uVar11,uVar13,*(longlong *)(*(longlong *)(param_1 + 4) + 8),

+                                      param_1,(ushort *)&local_58,0,(undefined *)0x0,bVar17);

+                  uVar10 = (uint)puVar8;

+                  goto LAB_1;

+                }

+                uVar15 = uVar16;

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (bVar1 = bVar2, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  WPP_SF_qqLqiqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x14,

+                                 &WPP_23c031617105374e664d37900f58dae3_Traceguids,local_68);

+                }

+              }

+            }

+          }

+        }

+      }

+    }

+  }

+  if (pvStack_50 != (void *)0x0) {

+    ExFreePoolWithTag(pvStack_50,0x73557348);

+  }

+  if ((int)(uint)uVar15 < 0) {

+    param_1[6] = (uint)uVar15;

+    param_1[8] = 0;

+    param_1[9] = 0;

+    uVar10 = 4;

+  }

+  else {

+    if (uVar10 == 0) {

+      *param_3 = uVar13;

+      goto LAB_2;

+    }

+    if (uVar10 == 2) goto LAB_2;

+  }

+  if (bVar3) {

+    HsmpReleaseUserRequestRundownProtection(uVar13);

+  }

+LAB_2:

+  if (uVar11 != 0) {

+    FltReleaseContext(uVar11);

+  }

+  if ((bVar1) && (uVar10 != 2)) {

+    HsmpTracePreCallbackExit((ulonglong)uVar10,param_1,*param_3,uVar11 == 0,uVar11 != 0);

+  }

+  return uVar10;

 }
```

## `CldStreamCdqREMOVE_IO`  (modified)

```diff
--- CldStreamCdqREMOVE_IO
+++ HsmpCldGetSyncPolicyByPath
@@ -1,20 +1,29 @@
 

-void CldStreamCdqREMOVE_IO(undefined8 param_1,longlong param_2)

+/* WARNING: Control flow encountered bad instruction data */

+

+uint HsmpCldGetSyncPolicyByPath(longlong param_1,ushort *param_2,uint *param_3)

 

 {

-  ulonglong uVar1;

-  undefined8 *puVar2;

+  char *pcVar1;

+  code *pcVar2;

+  char in_AL;

+  char cVar3;

+  undefined7 in_register_00000001;

+  char cVar4;

   

-  for (puVar2 = *(undefined8 **)(param_2 + 0x30); puVar2 != (undefined8 *)(param_2 + 0x30);

-      puVar2 = (undefined8 *)*puVar2) {

-    uVar1 = Feature_2089223483__private_IsEnabledDeviceUsageNoInline();

-    if ((int)uVar1 == 0) {

-      CldiStreamPrepareRequestForCdqCompletion((uint *)(puVar2 + -3));

-    }

-    else {

-      CldiStreamPrepareRequestForNonCdqCompletion((uint *)(puVar2 + -3));

-    }

-  }

-  return;

+  cVar4 = (char)param_1;

+  *(char *)CONCAT71(in_register_00000001,in_AL) =

+       *(char *)CONCAT71(in_register_00000001,in_AL) + cVar4;

+  pcVar1 = (char *)(CONCAT71(in_register_00000001,in_AL) + -0x75);

+  *pcVar1 = *pcVar1 + cVar4;

+  cVar3 = in_AL + '\x03';

+  *(char *)CONCAT71(in_register_00000001,cVar3) =

+       *(char *)CONCAT71(in_register_00000001,cVar3) + cVar3;

+  pcVar1 = (char *)(CONCAT71(in_register_00000001,cVar3) + -0x75);

+  *pcVar1 = *pcVar1 + cVar4;

+  pcVar2 = (code *)swi(0xfd);

+  (*pcVar2)();

+                    /* WARNING: Bad instruction - Truncating control flow here */

+  halt_baddata();

 }
```

## `HsmpBuildFullLinkPath`  (modified)

```diff
--- HsmpBuildFullLinkPath
+++ HsmiCldGetSyncRootInfoByPath
@@ -1,124 +1,218 @@
 

-uint HsmpBuildFullLinkPath(longlong param_1,undefined8 param_2,short *param_3,undefined4 *param_4)

+uint HsmiCldGetSyncRootInfoByPath(longlong param_1,ushort *param_2,longlong *param_3)

 

 {

-  ushort uVar1;

-  uint uVar2;

-  longlong lVar3;

-  ushort uVar4;

-  undefined2 uVar5;

-  undefined8 uVar6;

-  undefined4 uVar7;

-  undefined4 uVar8;

-  undefined4 uVar9;

-  undefined4 uVar10;

-  longlong local_res8;

-  undefined8 in_stack_ffffffffffffff78;

-  longlong local_58;

-  undefined8 local_50;

-  undefined8 uStack_48;

-  undefined8 local_40;

-  undefined8 uStack_38;

+  uint uVar1;

+  longlong lVar2;

+  undefined8 uVar3;

+  char cVar4;

+  undefined4 in_EAX;

+  uint uVar5;

+  int iVar6;

+  longlong *plVar7;

+  longlong lVar8;

+  ulonglong uVar9;

+  undefined2 uVar10;

+  uint uVar11;

+  longlong unaff_RBX;

+  ulonglong uVar12;

+  ulonglong uVar13;

+  short *psVar14;

+  longlong lVar15;

+  uint uVar16;

+  uint uVar17;

+  longlong *plVar18;

+  longlong in_R11;

+  ulonglong uVar19;

+  ulonglong uVar20;

+  undefined4 local_res8 [2];

+  longlong local_res10;

+  longlong *local_res18;

+  undefined8 local_res20;

   

-  local_58 = 0;

-  local_res8 = 0;

-  uVar6 = *(undefined8 *)(param_1 + 0x20);

-  local_40 = 0;

-  uStack_38 = 0;

-  local_50 = 0;

-  uStack_48 = 0;

-  uVar2 = HsmpOpenFileByIdEx(param_1,uVar6,param_2,0x100080,in_stack_ffffffffffffff78,0x200001,'\0',

-                             &local_58,&local_res8);

-  HsmDbgBreakOnStatus(uVar2);

-  if ((int)uVar2 < 0) {

+  *(undefined4 *)(unaff_RBX + 0x18) = in_EAX;

+  lVar2 = *(longlong *)(param_2 + 8);

+  uVar9 = 0;

+  uVar12 = 0;

+  uVar19 = 0;

+  uVar3 = *(undefined8 *)(param_1 + 0x30);

+  *(undefined4 *)(in_R11 + 8) = 0;

+  *(undefined8 *)(in_R11 + 0x10) = 0;

+  plVar7 = (longlong *)ExAllocateFromPagedLookasideList(&DAT_0);

+  if (plVar7 == (longlong *)0x0) {

+    uVar5 = 0xc000009a;

+    HsmDbgBreakOnStatus(-0x3fffff66);

     if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

-    goto LAB_0;

-    uVar5 = 0x13;

-  }

-  else {

-    uVar2 = HsmiQueryFullFilePath

-                      (*(undefined8 *)(param_1 + 0x20),uVar6,local_res8,0x101,

-                       (undefined4 *)&local_40);

-    HsmDbgBreakOnStatus(uVar2);

-    if ((int)uVar2 < 0) {

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+    uVar10 = 0xd;

+    plVar18 = (longlong *)0x0;

+LAB_2:

+    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar10,

+               &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,plVar18);

+    goto LAB_1;

+  }

+  *plVar7 = param_1;

+  plVar7[1] = (longlong)param_2;

+  if ((*(longlong *)(lVar2 + 0x20) == 0) && (*(longlong *)(lVar2 + 0x10) != 0)) {

+    FltAcquirePushLockExclusiveEx(lVar2 + 0x18,0);

+    if (*(longlong *)(lVar2 + 0x20) == 0) {

+      lVar15 = *(longlong *)(lVar2 + 8);

+      local_res20 = *(undefined8 *)(lVar2 + 0x10);

+      FltAcquirePushLockSharedEx(lVar15 + 8,0);

+      lVar8 = RtlLookupElementGenericTableAvl(lVar15 + 0x10,&local_res20);

+      if (lVar8 == 0) {

+        HsmDbgBreakOnStatus(-0x3fff30ff);

+      }

+      else {

+        *(undefined8 *)(lVar2 + 0x20) = *(undefined8 *)(lVar8 + 8);

+      }

+      FltReleasePushLockEx(lVar15 + 8,0);

+    }

+    FltReleasePushLockEx(lVar2 + 0x18,0);

+  }

+  lVar15 = *(longlong *)(lVar2 + 0x20);

+  uVar20 = uVar9;

+  if (lVar15 != 0) {

+    uVar5 = CldStreamOpen((longlong *)param_2);

+    uVar20 = (ulonglong)uVar5;

+    HsmDbgBreakOnStatus(uVar5);

+    if ((int)uVar5 < 0) {

       if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_0;

-      uVar5 = 0x14;

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+      uVar10 = 0xe;

+      plVar18 = plVar7;

+      goto LAB_2;

+    }

+  }

+  uVar5 = (uint)uVar20;

+  lVar8 = IoGetCurrentProcess();

+  uVar13 = uVar9;

+  if (lVar8 != *(longlong *)PsInitialSystemProcess_exref) {

+    if ((lVar15 == 0) || (*(longlong *)(lVar15 + 0x60) == 0)) {

+      lVar15 = 0;

     }

     else {

-      if (param_3 == (short *)0x0) {

-        uVar9 = (undefined4)uStack_38;

-        uVar10 = uStack_38._4_4_;

-        uStack_38 = 0;

-        uVar7 = (undefined4)local_40;

-        uVar8 = local_40._4_4_;

+      lVar15 = *(longlong *)(*(longlong *)(lVar15 + 0x60) + 0x68);

+    }

+    lVar8 = IoGetCurrentProcess();

+    uVar13 = uVar12;

+    psVar14 = DAT_3;

+    uVar12 = uVar9;

+    uVar9 = uVar19;

+    if (lVar8 != lVar15) {

+      while( true ) {

+        uVar19 = uVar12;

+        uVar5 = (uint)uVar20;

+        if ((*(short **)(psVar14 + 4) == (short *)0x0) ||

+           ((**(short **)(psVar14 + 4) == 0x2a && (*psVar14 == 2)))) break;

+        if (uVar19 == 0) {

+          uVar5 = ZwQueryInformationProcess(0xffffffffffffffff,0x1b,0,0,local_res8);

+          HsmDbgBreakOnStatus(uVar5);

+          if (((uVar5 + 0x80000000 & 0x80000000) == 0) && (uVar5 != 0xc0000004)) {

+            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+            uVar10 = 0xf;

+          }

+          else {

+            uVar19 = ExAllocatePool2(0x100,local_res8[0],0x6e706c43);

+            if (uVar19 == 0) {

+              uVar5 = 0xc000009a;

+              HsmDbgBreakOnStatus(-0x3fffff66);

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+              uVar10 = 0x10;

+            }

+            else {

+              uVar5 = ZwQueryInformationProcess

+                                (0xffffffffffffffff,0x1b,uVar19,local_res8[0],local_res8);

+              uVar20 = (ulonglong)uVar5;

+              HsmDbgBreakOnStatus(uVar5);

+              if (-1 < (int)uVar5) goto LAB_4;

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

+              uVar10 = 0x11;

+            }

+          }

+          WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar10,

+                    &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,param_1);

+          goto LAB_1;

+        }

+LAB_4:

+        uVar5 = (uint)uVar20;

+        cVar4 = FsRtlDoesNameContainWildCards(psVar14);

+        if (cVar4 == '\0') {

+          iVar6 = RtlCompareUnicodeString(psVar14,uVar19);

+          if (iVar6 == 0) break;

+        }

+        else {

+          cVar4 = FsRtlIsNameInExpression();

+          if (cVar4 != '\0') break;

+        }

+        psVar14 = psVar14 + 0x14;

+        uVar12 = uVar19;

+      }

+      uVar9 = uVar19;

+      if ((*(short **)(psVar14 + 0xc) == (short *)0x0) ||

+         ((**(short **)(psVar14 + 0xc) == 0x2a && (psVar14[8] == 2)))) {

+LAB_5:

+        uVar13 = (ulonglong)*(uint *)(psVar14 + 0x10);

+      }

+      else {

+        uVar5 = FltGetFileNameInformationUnsafe(uVar3,0,0x102,&local_res10);

+        HsmDbgBreakOnStatus(uVar5);

+        if ((int)uVar5 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x12,

+                       &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,param_1);

+          }

+          goto LAB_1;

+        }

+        if ((*(longlong *)(local_res10 + 0x50) == 0) && (*(longlong *)(local_res10 + 0x40) != 0)) {

+          cVar4 = FsRtlDoesNameContainWildCards(psVar14 + 8);

+          if (cVar4 != '\0') {

+            cVar4 = FsRtlIsNameInExpression(psVar14 + 8,local_res10 + 0x38,1,0);

+            if (cVar4 != '\0') goto LAB_5;

+          }

+          iVar6 = RtlCompareUnicodeString(psVar14 + 8,local_res10 + 0x38,1);

+          if (iVar6 == 0) goto LAB_5;

+        }

+      }

+    }

+  }

+  uVar19 = uVar9;

+  FltAcquirePushLockExclusiveEx(lVar2 + 0x18,0);

+  uVar1 = *(uint *)(lVar2 + 0x28);

+  uVar16 = uVar1;

+  if (((byte)uVar1 & 0xf) <= ((byte)uVar13 & 0xf)) {

+    uVar16 = (uint)uVar13;

+  }

+  uVar11 = (uint)uVar13 >> 4;

+  uVar17 = (uVar16 ^ uVar1) & 0xf ^ uVar1;

+  uVar16 = uVar1 >> 4;

+  if (((byte)(uVar1 >> 4) & 0xf) <= ((byte)uVar11 & 0xf)) {

+    uVar16 = uVar11;

+  }

+  *(uint *)(lVar2 + 0x28) = (uVar16 << 4 ^ uVar17) & 0xf0 ^ uVar17;

+  FltReleasePushLockEx(lVar2 + 0x18,0);

+  *local_res18 = (longlong)plVar7;

+  plVar7 = (longlong *)0x0;

 LAB_1:

-        *param_4 = uVar7;

-        param_4[1] = uVar8;

-        param_4[2] = uVar9;

-        param_4[3] = uVar10;

-        goto LAB_0;

-      }

-      uVar4 = (ushort)local_40 + 2;

-      if ((ushort)local_40 <= uVar4) {

-        local_50._0_4_ = (uint)(ushort)local_50;

-        uVar1 = uVar4 + *param_3;

-        if (uVar4 <= uVar1) {

-          uVar4 = uVar1 + 2;

-          if (uVar1 <= uVar4) {

-            local_50 = (ulonglong)CONCAT42(local_50._4_4_,uVar4) << 0x10;

-            lVar3 = ExAllocatePool2(0x100,uVar4,0x73557348);

-            uVar2 = ~-(uint)(lVar3 != 0) & 0xc000009a;

-            uStack_48 = lVar3;

-            HsmDbgBreakOnStatus(uVar2);

-            if (lVar3 == 0) {

-              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

-                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x16,

-                           &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,param_1);

-              }

-              goto LAB_0;

-            }

-            RtlAppendUnicodeStringToString(&local_50,&local_40);

-            if (*(short *)(uStack_48 + -2 + (local_50 >> 1 & 0x7fff) * 2) != 0x5c) {

-              RtlAppendUnicodeToString(&local_50,L"\\");

-            }

-            RtlAppendUnicodeStringToString(&local_50,param_3);

-            *(undefined2 *)(uStack_48 + (local_50 >> 1 & 0x7fff) * 2) = 0;

-            uVar9 = (undefined4)uStack_48;

-            uVar10 = uStack_48._4_4_;

-            uStack_48 = 0;

-            uVar7 = (uint)local_50;

-            uVar8 = local_50._4_4_;

-            goto LAB_1;

-          }

-        }

-      }

-      local_50._0_4_ = CONCAT22(0xffff,(ushort)local_50);

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_0;

-      uVar5 = 0x15;

-    }

-  }

-  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar5,

-             &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,param_1);

-LAB_0:

-  if (local_res8 != 0) {

-    ObfDereferenceObject(local_res8);

-  }

-  if (local_58 != 0) {

-    FltClose();

-  }

-  if (uStack_38 != 0) {

-    ExFreePoolWithTag(uStack_38,0x73557348);

-  }

-  if (uStack_48 != 0) {

-    ExFreePoolWithTag(uStack_48,0x73557348);

-  }

-  return uVar2;

+  if (local_res10 != 0) {

+    FltReleaseFileNameInformation();

+  }

+  if (uVar19 != 0) {

+    ExFreePoolWithTag(uVar19,0x6e706c43);

+  }

+  if (plVar7 != (longlong *)0x0) {

+    ExFreeToPagedLookasideList(&DAT_0,plVar7);

+  }

+  return uVar5;

 }
```

## `HsmpCldGetSyncRootProviderInfo`  (modified)

```diff
--- HsmpCldGetSyncRootProviderInfo
+++ HsmpCreateProcessInfo
@@ -1,314 +1,69 @@
 

-uint HsmpCldGetSyncRootProviderInfo

-               (longlong param_1,longlong param_2,undefined8 param_3,undefined4 *param_4,

-               uint param_5,uint *param_6)

+ulonglong * HsmpCreateProcessInfo(longlong param_1)

 

 {

-  int iVar1;

-  uint uVar2;

-  char cVar3;

-  uint uVar4;

-  uint *puVar5;

-  undefined8 uVar6;

-  longlong lVar7;

-  uint uVar8;

-  undefined2 uVar9;

-  int iVar10;

-  int iVar11;

-  int iVar12;

-  undefined4 local_res10;

-  undefined4 uStackX_14;

-  ulonglong in_stack_ffffffffffffff38;

-  undefined8 in_stack_ffffffffffffff40;

-  undefined4 uVar13;

-  longlong lStack_98;

-  uint auStack_90 [2];

-  undefined8 uStack_88;

-  undefined8 uStack_80;

-  uint *puStack_78;

-  int iStack_70;

-  uint uStack_6c;

-  uint uStack_68;

-  undefined8 uStack_60;

-  undefined8 uStack_58;

-  uint *puStack_50;

-  longlong local_48;

-  longlong lStack_40;

+  undefined1 uVar1;

+  int iVar2;

+  ulonglong *puVar3;

+  undefined2 in_DX;

+  undefined8 uVar4;

+  longlong unaff_RBX;

+  ulonglong uVar5;

+  ulonglong unaff_RSI;

+  undefined1 *unaff_RDI;

+  undefined1 *puVar6;

+  undefined *puVar7;

+  longlong *unaff_R14;

+  longlong *plVar8;

+  longlong unaff_R15;

+  bool in_OF;

+  undefined8 in_stack_00000090;

   

-  uVar13 = (undefined4)((ulonglong)in_stack_ffffffffffffff40 >> 0x20);

-  uVar6 = *(undefined8 *)(param_2 + 0x20);

-  uStack_60 = 0;

-  uStack_88 = 0;

-  puStack_78 = (uint *)0x0;

-  lStack_98 = 0;

-  auStack_90[0] = 0;

-  iVar11 = 0;

-  iVar10 = 0;

-  uStack_80 = uVar6;

-  uStack_58 = uVar6;

-  lStack_40 = HsmpGetStreamHandleContext(param_1,*(longlong *)(param_2 + 0x18),uVar6);

-  if (lStack_40 != 0) {

-    lVar7 = *(longlong *)(*(longlong *)(lStack_40 + 0x10) + 0x10);

-    uStack_60 = *(undefined8 *)(lVar7 + 0x10);

-    uStack_88 = *(undefined8 *)(lVar7 + 0x20);

+  puVar6 = unaff_RDI + 1;

+  uVar1 = in(in_DX);

+  *unaff_RDI = uVar1;

+  if (in_OF) {

+    uVar5 = (ulonglong)((int)&stack0x00000000 - 0x30);

+    *(undefined8 *)(uVar5 + 0x20) = 0;

+    puVar7 = (undefined *)0x0;

+    uVar4 = 0;

+    *(undefined8 *)(uVar5 - 8) = 0x140076ba6;

+    iVar2 = KeWaitForSingleObject(&DAT_0,0,0,0);

+    *(undefined8 *)(uVar5 - 8) = 0x140076bb4;

+    HsmDbgBreakOnStatus(iVar2);

+    if ((-1 < iVar2) && (DAT_1 = DAT_1 + -1, DAT_1 < 1)) {

+      *(undefined8 *)(uVar5 - 8) = 0x140076bde;

+      ExReInitializeRundownProtection();

+      *(undefined8 *)(uVar5 - 8) = 0x140076bea;

+      CldiStreamStartCountdownTimer('\0',uVar4,puVar7);

+    }

+    *(undefined8 *)(uVar5 - 8) = 0x140076bfd;

+    puVar3 = (ulonglong *)KeSetEvent(&DAT_0,0,0);

+    return puVar3;

   }

-  iVar1 = *(int *)(*(longlong *)(param_1 + 0x10) + 0x28);

-  iVar12 = 0;

-  if (iVar1 < 0x3d) {

-    if (iVar1 == 0x3c) {

-      iVar11 = 0x58;

-      iVar10 = 0x3c;

-      iVar12 = iVar11;

+  do {

+    ExFreePoolWithTag(puVar6);

+    plVar8 = unaff_R14;

+    do {

+      unaff_R14 = plVar8 + 2;

+      unaff_R15 = unaff_R15 + -1;

+      if (unaff_R15 == 0) {

+        ExFreePoolWithTag(in_stack_00000090,0x67706c43);

+        KeLeaveCriticalRegion();

+        return (ulonglong *)(unaff_RSI & 0xffffffff);

+      }

+      if ((undefined8 *)*unaff_R14 != (undefined8 *)0x0) {

+        FltReleaseContext(**(undefined8 **)*unaff_R14);

+      }

+      puVar6 = (undefined1 *)plVar8[3];

+      plVar8 = unaff_R14;

+    } while (puVar6 == (undefined1 *)0x0);

+    if (*(longlong *)(puVar6 + 0x10) != unaff_RBX) {

+      FsRtlUninitializeBaseMcb(puVar6);

     }

-    else {

-      if (iVar1 == 1) {

-        iVar11 = 0x40;

-      }

-      else {

-        if (iVar1 != 2) {

-          if (iVar1 == 3) {

-            iVar11 = 0x5e;

-          }

-          else {

-            if (iVar1 != 0x25) {

-              iVar10 = 0;

-              if (iVar1 == 0x26) goto LAB_0;

-              goto LAB_1;

-            }

-            iVar11 = 0x68;

-          }

-          iVar10 = 0x4f;

-          iVar12 = 0x6a;

-          goto LAB_1;

-        }

-        iVar11 = 0x44;

-      }

-      iVar10 = 0x4e;

-      iVar12 = 0x50;

+    if (*(longlong *)(puVar6 + 0x28) != unaff_RBX) {

+      FsRtlUninitializeBaseMcb(puVar6 + 0x18);

     }

-  }

-  else if (iVar1 == 0x3f) {

-    iVar11 = 0x72;

-    iVar10 = 0x3f;

-    iVar12 = iVar11;

-  }

-  else if (iVar1 == 0x4e) {

-LAB_0:

-    iVar11 = 0x50;

-    iVar10 = 0x4e;

-    iVar12 = 0x50;

-  }

-  else if (iVar1 == 0x4f) {

-    iVar11 = 0x6a;

-    iVar10 = 0x4f;

-    iVar12 = 0x6a;

-  }

-  else if (iVar1 == 0x50) {

-    iVar11 = 0x60;

-    iVar10 = 0x50;

-    iVar12 = iVar11;

-  }

-  else if (iVar1 == 0x51) {

-    iVar11 = 0x7a;

-    iVar10 = 0x51;

-    iVar12 = iVar11;

-  }

-LAB_1:

-  uVar4 = *(uint *)(*(longlong *)(param_1 + 0x10) + 0x18);

-  uVar8 = (iVar12 - iVar11) + uVar4;

-  iStack_70 = iVar1;

-  if (uVar8 < uVar4) {

-    uVar4 = 0xc000000d;

-    HsmDbgBreakOnStatus(-0x3ffffff3);

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      WPP_SF_qqqiDDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),WPP_GLOBAL_Control,uVar6,param_1);

-    }

-    goto LAB_2;

-  }

-  if (0x100000 < uVar8) {

-    uVar8 = 0x100000;

-  }

-  puVar5 = (uint *)ExAllocatePool2(0x100,uVar8,0x64517348);

-  puStack_78 = puVar5;

-  puStack_50 = puVar5;

-  if (puVar5 == (uint *)0x0) {

-    uVar4 = 0xc000009a;

-    HsmDbgBreakOnStatus(-0x3fffff66);

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

-    goto LAB_2;

-    uVar9 = 0xb;

-    uVar4 = 0xc000009a;

-  }

-  else {

-    uVar4 = FltAllocateCallbackDataEx

-                      (*(undefined8 *)(CONCAT44(uStackX_14,local_res10) + 0x18),

-                       *(undefined8 *)(CONCAT44(uStackX_14,local_res10) + 0x20),1,&lStack_98);

-    HsmDbgBreakOnStatus(uVar4);

-    if ((int)uVar4 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_2;

-      uVar9 = 0xc;

-    }

-    else {

-      uVar4 = FltPropagateIrpExtension(param_1,lStack_98,0);

-      HsmDbgBreakOnStatus(uVar4);

-      if ((int)uVar4 < 0) {

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-        uVar9 = 0xd;

-      }

-      else {

-        *(undefined1 *)(*(longlong *)(lStack_98 + 0x10) + 4) = 0xc;

-        *(undefined1 *)(*(longlong *)(lStack_98 + 0x10) + 5) = 1;

-        *(uint *)(*(longlong *)(lStack_98 + 0x10) + 0x18) = uVar8;

-        *(undefined8 *)(*(longlong *)(lStack_98 + 0x10) + 0x20) =

-             *(undefined8 *)(*(longlong *)(param_1 + 0x10) + 0x20);

-        *(int *)(*(longlong *)(lStack_98 + 0x10) + 0x28) = iVar10;

-        *(undefined4 *)(*(longlong *)(lStack_98 + 0x10) + 0x30) =

-             *(undefined4 *)(*(longlong *)(param_1 + 0x10) + 0x30);

-        *(uint **)(*(longlong *)(lStack_98 + 0x10) + 0x38) = puVar5;

-        *(undefined8 *)(*(longlong *)(lStack_98 + 0x10) + 0x40) = 0;

-        *(undefined1 *)(*(longlong *)(lStack_98 + 0x10) + 6) =

-             *(undefined1 *)(*(longlong *)(param_1 + 0x10) + 6);

-        FltPerformSynchronousIo(lStack_98);

-        uVar4 = *(uint *)(lStack_98 + 0x18);

-        HsmDbgBreakOnStatus(uVar4);

-        uVar8 = *(uint *)(lStack_98 + 0x20);

-        uStack_6c = uVar8;

-        FltFreeCallbackData();

-        lStack_98 = 0;

-        *(uint *)(param_1 + 0x18) = uVar4;

-        if ((int)uVar4 < 0) {

-          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < 4)) goto LAB_2;

-          uVar9 = 0x12;

-        }

-        else {

-          lVar7 = *(longlong *)(param_1 + 0x10);

-          uVar2 = *(uint *)(lVar7 + 0x18);

-          uStack_68 = uVar2;

-          if (*(longlong *)(lVar7 + 0x40) == 0) {

-            lVar7 = *(longlong *)(lVar7 + 0x38);

-            local_48 = lVar7;

-            if ((*(char *)(param_1 + 0x50) == '\0') ||

-               (ProbeForWrite(lVar7,uVar2,1), -1 < (int)uVar4)) {

-LAB_3:

-              cVar3 = HsmOsGetPlaceholderCompatMode(param_1);

-              if (iVar10 == 0x3c) {

-                uVar6 = HsmiMungeQueryDirectoryBufferForFileIdExtdDirectoryInformation

-                                  (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90);

-                uVar4 = (uint)uVar6;

-LAB_4:

-                HsmDbgBreakOnStatus(uVar4);

-              }

-              else {

-                if (iVar10 == 0x3f) {

-                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdExtdBothDirectoryInformation

-                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

-                  ;

-                  uVar4 = (uint)uVar6;

-                  goto LAB_4;

-                }

-                if (iVar10 == 0x4e) {

-                  uVar6 = HsmiMungeQueryDirectoryBufferWithoutShortnameFileId64

-                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

-                  ;

-                  uVar4 = (uint)uVar6;

-                  goto LAB_4;

-                }

-                if (iVar10 == 0x4f) {

-                  uVar6 = HsmiMungeQueryDirectoryBufferWithShortnameFileId64

-                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

-                  ;

-                  uVar4 = (uint)uVar6;

-                  goto LAB_4;

-                }

-                if (iVar10 == 0x50) {

-                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdAllExtdDirectoryInformation

-                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

-                  ;

-                  uVar4 = (uint)uVar6;

-                  goto LAB_4;

-                }

-                if (iVar10 == 0x51) {

-                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdAllExtdBothDirectoryInformation

-                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

-                  ;

-                  uVar4 = (uint)uVar6;

-                  goto LAB_4;

-                }

-              }

-              if (-1 < (int)uVar4) {

-                *(ulonglong *)(param_1 + 0x20) = (ulonglong)auStack_90[0];

-                goto LAB_2;

-              }

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-              uVar9 = 0x11;

-            }

-            else {

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-              uVar9 = 0x10;

-            }

-          }

-          else {

-            uVar4 = FltLockUserBuffer(param_1);

-            HsmDbgBreakOnStatus(uVar4);

-            if ((int)uVar4 < 0) {

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-              uVar9 = 0xe;

-            }

-            else {

-              lVar7 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x40);

-              if ((*(byte *)(lVar7 + 10) & 5) == 0) {

-                lVar7 = MmMapLockedPagesSpecifyCache

-                                  (lVar7,0,1,0,in_stack_ffffffffffffff38 & 0xffffffff00000000,

-                                   CONCAT44(uVar13,0x40000010));

-              }

-              else {

-                lVar7 = *(longlong *)(lVar7 + 0x18);

-              }

-              if (lVar7 != 0) goto LAB_3;

-              uVar4 = 0xc0000017;

-              HsmDbgBreakOnStatus(-0x3fffffe9);

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

-              uVar9 = 0xf;

-              uVar4 = 0xc0000017;

-            }

-          }

-        }

-      }

-    }

-  }

-  WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,

-               &WPP_23c031617105374e664d37900f58dae3_Traceguids,param_1);

-LAB_2:

-  if ((int)uVar4 < 0) {

-    *(uint *)(param_1 + 0x18) = uVar4;

-    *(undefined8 *)(param_1 + 0x20) = 0;

-  }

-  if (lStack_98 != 0) {

-    FltFreeCallbackData();

-  }

-  if (puStack_78 != (uint *)0x0) {

-    ExFreePoolWithTag(puStack_78,0x64517348);

-  }

-  if (lStack_40 != 0) {

-    FltReleaseContext();

-  }

-  return uVar4;

+  } while( true );

 }
```

## `HsmFltPreSET_INFORMATION`  (modified)

```diff
--- HsmFltPreSET_INFORMATION
+++ HsmiCtxCreateFileContext
@@ -1,10 +1,118 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-uint HsmFltPreSET_INFORMATION(uint *param_1,longlong param_2,longlong *param_3)

+int HsmiCtxCreateFileContext

+              (longlong param_1,longlong param_2,undefined8 param_3,undefined8 *param_4)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  byte *pbVar1;

+  byte bVar2;

+  ushort uVar3;

+  ushort uVar4;

+  uint uVar5;

+  int iVar6;

+  int iVar7;

+  uint uVar8;

+  uint uVar9;

+  char *in_RAX;

+  int *unaff_RBX;

+  longlong unaff_RBP;

+  longlong unaff_RSI;

+  ulonglong uVar10;

+  undefined8 unaff_R12;

+  char unaff_R14B;

+  byte unaff_R15B;

+  

+  *in_RAX = *in_RAX + (char)in_RAX;

+  pbVar1 = (byte *)(in_RAX + -1);

+  bVar2 = *pbVar1;

+  *pbVar1 = *pbVar1 + (byte)param_1;

+  iVar6 = (int)in_RAX + -0x2d412 + (uint)CARRY1(bVar2,(byte)param_1);

+  HsmDbgBreakOnStatus(iVar6);

+  if (iVar6 < 0) {

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((unaff_R15B & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x10,

+                &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R12);

+    }

+  }

+  else {

+    uVar10 = *(ulonglong *)(unaff_RBP + 7);

+    if ((uVar10 == 0) || (0x10000 < (longlong)uVar10)) {

+      if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+         (((unaff_R15B & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

+          (1 < (byte)WPP_GLOBAL_Control[0x29])))) {

+        WPP_SF_qi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x11,

+                  &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R12);

+      }

+    }

+    else {

+      unaff_RBX = (int *)ExAllocatePool2(0x100,uVar10 & 0xffffffff,0x69537348);

+      if (unaff_RBX == (int *)0x0) {

+        iVar6 = -0x3fffff66;

+        HsmDbgBreakOnStatus(-0x3fffff66);

+      }

+      else {

+        iVar6 = FltReadFile(*(undefined8 *)(unaff_RSI + 0x20),*(undefined8 *)(unaff_RBP + -0x39),

+                            unaff_RBP + -0x11,*(undefined4 *)(unaff_RBP + 7),unaff_RBX);

+        HsmDbgBreakOnStatus(iVar6);

+        if (iVar6 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((unaff_R15B & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x12,

+                       &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R12);

+          }

+        }

+        else {

+          uVar8 = *(uint *)(unaff_RBP + 7);

+          if ((((0x17 < uVar8) && (*unaff_RBX == 0x6e497253)) &&

+              (((*(byte *)(unaff_RBX + 3) & unaff_R14B + 2U) == 0 ||

+               (iVar7 = RtlComputeCrc32(0,unaff_RBX + 2,uVar8 - 8), unaff_RBX[1] == iVar7)))) &&

+             (uVar5 = unaff_RBX[2], uVar5 <= uVar8)) {

+            uVar3 = *(ushort *)((longlong)unaff_RBX + 0xe);

+            if ((uVar3 != 0) && ((uint)uVar3 * 8 + 0x10 < uVar5)) {

+              uVar10 = 0;

+              while( true ) {

+                uVar8 = (uint)uVar3;

+                if (8 < uVar3) {

+                  uVar8 = 9;

+                }

+                if (uVar8 <= (uint)uVar10) {

+                  **(undefined8 **)(unaff_RBP + -9) = unaff_RBX;

+                  unaff_RBX = (int *)0x0;

+                  goto LAB_0;

+                }

+                if (((0x11 < *(ushort *)(unaff_RBX + uVar10 * 2 + 4)) ||

+                    ((((uVar8 = unaff_RBX[uVar10 * 2 + 5], uVar8 != 0 &&

+                       (uVar8 < (uint)uVar3 * 8 + 0x10)) || (uVar5 < uVar8)) ||

+                     ((uVar4 = *(ushort *)((longlong)unaff_RBX + uVar10 * 8 + 0x12), uVar5 < uVar4

+                      || (uVar9 = uVar4 + uVar8, uVar5 < uVar9)))))) || (uVar9 < uVar8)) break;

+                uVar10 = (ulonglong)((uint)uVar10 + 1);

+              }

+            }

+          }

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x13,

+                       &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R12);

+          }

+        }

+      }

+    }

+  }

+LAB_0:

+  if (*(longlong *)(unaff_RBP + -0x39) != 0) {

+    ObfDereferenceObject(*(undefined8 *)(unaff_RBP + -0x39));

+  }

+  if (*(longlong *)(unaff_RBP + -0x29) != 0) {

+    FltClose();

+  }

+  if (unaff_RBX != (int *)0x0) {

+    ExFreePoolWithTag(unaff_RBX,0x69537348);

+  }

+  return iVar6;

 }
```

## `CldHsmCreateStreamHandleContext`  (modified)

```diff
--- CldHsmCreateStreamHandleContext
+++ HsmFltProcessQueryPlaceholder
@@ -1,212 +1,34 @@
 

-ulonglong CldHsmCreateStreamHandleContext(longlong param_1,longlong *param_2,longlong *param_3)

+/* WARNING: Variable defined which should be unmapped: param_5 */

+/* WARNING: Variable defined which should be unmapped: param_12 */

+

+ulonglong *

+HsmFltProcessQueryPlaceholder

+          (undefined8 param_1,longlong param_2,ulonglong param_3,undefined8 param_4,longlong param_5

+          ,longlong param_6,undefined8 param_7,undefined8 param_8,ulonglong *param_9,

+          undefined8 param_10,uint param_11,ulonglong *param_12)

 

 {

-  longlong lVar1;

-  undefined8 uVar2;

-  char cVar3;

-  uint uVar4;

-  int iVar5;

-  longlong *plVar6;

-  longlong lVar7;

-  ulonglong uVar8;

-  undefined2 uVar9;

-  uint uVar10;

-  ulonglong uVar11;

-  ulonglong uVar12;

-  short *psVar13;

-  longlong lVar14;

-  uint uVar15;

-  uint uVar16;

-  longlong *plVar17;

-  ulonglong uVar18;

-  ulonglong uVar19;

-  undefined4 local_res8 [2];

-  longlong local_res10;

-  longlong *local_res18;

-  undefined8 local_res20;

+  longlong unaff_RBX;

+  longlong unaff_RBP;

+  longlong unaff_RSI;

+  undefined4 unaff_EDI;

+  undefined8 uVar1;

+  undefined **in_R10;

+  uint unaff_R13D;

+  undefined4 unaff_R15D;

   

-  lVar1 = param_2[2];

-  uVar8 = 0;

-  uVar11 = 0;

-  uVar18 = 0;

-  uVar2 = *(undefined8 *)(param_1 + 0x30);

-  local_res8[0] = 0;

-  local_res10 = 0;

-  local_res18 = param_3;

-  plVar6 = (longlong *)ExAllocateFromPagedLookasideList(&DAT_0);

-  if (plVar6 == (longlong *)0x0) {

-    uVar19 = 0xc000009a;

-    HsmDbgBreakOnStatus(-0x3fffff66);

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-    uVar9 = 0xd;

-    plVar17 = (longlong *)0x0;

-    uVar19 = 0xc000009a;

-LAB_2:

-    WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,

-               &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,plVar17);

-    goto LAB_1;

+  if (((in_R10 != &WPP_GLOBAL_Control) && ((*(uint *)((longlong)in_R10 + 0x2c) & 1) != 0)) &&

+     (2 < *(byte *)((longlong)in_R10 + 0x29))) {

+    uVar1 = *(undefined8 *)(unaff_RBP + 0x6f);

+    if (unaff_RBX != 0) {

+      HsmpGetStreamSize(unaff_RBX);

+    }

+    WPP_SF_lqqLiqLiqqd(in_R10[3],0xf2,uVar1,unaff_EDI);

   }

-  *plVar6 = param_1;

-  plVar6[1] = (longlong)param_2;

-  if ((*(longlong *)(lVar1 + 0x20) == 0) && (*(longlong *)(lVar1 + 0x10) != 0)) {

-    FltAcquirePushLockExclusiveEx(lVar1 + 0x18,0);

-    if (*(longlong *)(lVar1 + 0x20) == 0) {

-      lVar14 = *(longlong *)(lVar1 + 8);

-      local_res20 = *(undefined8 *)(lVar1 + 0x10);

-      FltAcquirePushLockSharedEx(lVar14 + 8,0);

-      lVar7 = RtlLookupElementGenericTableAvl(lVar14 + 0x10,&local_res20);

-      if (lVar7 == 0) {

-        HsmDbgBreakOnStatus(-0x3fff30ff);

-      }

-      else {

-        *(undefined8 *)(lVar1 + 0x20) = *(undefined8 *)(lVar7 + 8);

-      }

-      FltReleasePushLockEx(lVar14 + 8,0);

-    }

-    FltReleasePushLockEx(lVar1 + 0x18,0);

+  if (unaff_R13D == 4) {

+    *(undefined4 *)(unaff_RSI + 0x18) = unaff_R15D;

   }

-  lVar14 = *(longlong *)(lVar1 + 0x20);

-  uVar19 = uVar8;

-  if (lVar14 != 0) {

-    uVar4 = CldStreamOpen(param_2);

-    uVar19 = (ulonglong)uVar4;

-    HsmDbgBreakOnStatus(uVar4);

-    if ((int)uVar4 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-      uVar9 = 0xe;

-      plVar17 = plVar6;

-      goto LAB_2;

-    }

-  }

-  lVar7 = IoGetCurrentProcess();

-  uVar12 = uVar8;

-  if (lVar7 != *(longlong *)PsInitialSystemProcess_exref) {

-    if ((lVar14 == 0) || (*(longlong *)(lVar14 + 0x60) == 0)) {

-      lVar14 = 0;

-    }

-    else {

-      lVar14 = *(longlong *)(*(longlong *)(lVar14 + 0x60) + 0x68);

-    }

-    lVar7 = IoGetCurrentProcess();

-    uVar12 = uVar11;

-    psVar13 = DAT_3;

-    uVar11 = uVar8;

-    uVar8 = uVar18;

-    if (lVar7 != lVar14) {

-      for (; (uVar18 = uVar11, *(short **)(psVar13 + 4) != (short *)0x0 &&

-             ((**(short **)(psVar13 + 4) != 0x2a || (*psVar13 != 2)))); psVar13 = psVar13 + 0x14) {

-        if (uVar18 == 0) {

-          uVar4 = ZwQueryInformationProcess(0xffffffffffffffff,0x1b,0,0,local_res8);

-          uVar19 = (ulonglong)uVar4;

-          HsmDbgBreakOnStatus(uVar4);

-          if (((uVar4 + 0x80000000 & 0x80000000) == 0) && (uVar4 != 0xc0000004)) {

-            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-            uVar9 = 0xf;

-          }

-          else {

-            uVar18 = ExAllocatePool2(0x100,local_res8[0],0x6e706c43);

-            if (uVar18 == 0) {

-              uVar19 = 0xc000009a;

-              HsmDbgBreakOnStatus(-0x3fffff66);

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-              uVar9 = 0x10;

-              uVar19 = 0xc000009a;

-            }

-            else {

-              uVar4 = ZwQueryInformationProcess

-                                (0xffffffffffffffff,0x1b,uVar18,local_res8[0],local_res8);

-              uVar19 = (ulonglong)uVar4;

-              HsmDbgBreakOnStatus(uVar4);

-              if (-1 < (int)uVar4) goto LAB_4;

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_1;

-              uVar9 = 0x11;

-            }

-          }

-          WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,

-                    &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,param_1);

-          goto LAB_1;

-        }

-LAB_4:

-        cVar3 = FsRtlDoesNameContainWildCards(psVar13);

-        if (cVar3 == '\0') {

-          iVar5 = RtlCompareUnicodeString(psVar13,uVar18);

-          if (iVar5 == 0) break;

-        }

-        else {

-          cVar3 = FsRtlIsNameInExpression();

-          if (cVar3 != '\0') break;

-        }

-        uVar11 = uVar18;

-      }

-      uVar8 = uVar18;

-      if ((*(short **)(psVar13 + 0xc) == (short *)0x0) ||

-         ((**(short **)(psVar13 + 0xc) == 0x2a && (psVar13[8] == 2)))) {

-LAB_5:

-        uVar12 = (ulonglong)*(uint *)(psVar13 + 0x10);

-      }

-      else {

-        uVar4 = FltGetFileNameInformationUnsafe(uVar2,0,0x102,&local_res10);

-        uVar19 = (ulonglong)uVar4;

-        HsmDbgBreakOnStatus(uVar4);

-        if ((int)uVar4 < 0) {

-          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x12,

-                       &WPP_348648e011a2357d0f99b2df4bf49833_Traceguids,param_1);

-          }

-          goto LAB_1;

-        }

-        if ((*(longlong *)(local_res10 + 0x50) == 0) && (*(longlong *)(local_res10 + 0x40) != 0)) {

-          cVar3 = FsRtlDoesNameContainWildCards(psVar13 + 8);

-          if (cVar3 != '\0') {

-            cVar3 = FsRtlIsNameInExpression(psVar13 + 8,local_res10 + 0x38,1,0);

-            if (cVar3 != '\0') goto LAB_5;

-          }

-          iVar5 = RtlCompareUnicodeString(psVar13 + 8,local_res10 + 0x38,1);

-          if (iVar5 == 0) goto LAB_5;

-        }

-      }

-    }

-  }

-  uVar18 = uVar8;

-  FltAcquirePushLockExclusiveEx(lVar1 + 0x18,0);

-  uVar4 = *(uint *)(lVar1 + 0x28);

-  uVar15 = uVar4;

-  if (((byte)uVar4 & 0xf) <= ((byte)uVar12 & 0xf)) {

-    uVar15 = (uint)uVar12;

-  }

-  uVar10 = (uint)uVar12 >> 4;

-  uVar16 = (uVar15 ^ uVar4) & 0xf ^ uVar4;

-  uVar15 = uVar4 >> 4;

-  if (((byte)(uVar4 >> 4) & 0xf) <= ((byte)uVar10 & 0xf)) {

-    uVar15 = uVar10;

-  }

-  *(uint *)(lVar1 + 0x28) = (uVar15 << 4 ^ uVar16) & 0xf0 ^ uVar16;

-  FltReleasePushLockEx(lVar1 + 0x18,0);

-  *local_res18 = (longlong)plVar6;

-  plVar6 = (longlong *)0x0;

-LAB_1:

-  if (local_res10 != 0) {

-    FltReleaseFileNameInformation();

-  }

-  if (uVar18 != 0) {

-    ExFreePoolWithTag(uVar18,0x6e706c43);

-  }

-  if (plVar6 != (longlong *)0x0) {

-    ExFreeToPagedLookasideList(&DAT_0,plVar6);

-  }

-  return uVar19;

+  return (ulonglong *)(ulonglong)unaff_R13D;

 }
```

## `CldiStreamCompleteCanceledRequest`  (modified)

```diff
--- CldiStreamCompleteCanceledRequest
+++ CldiStreamCompleteCanceledRequest
@@ -1,10 +1,116 @@
-

-/* WARNING: Control flow encountered bad instruction data */

 

 void CldiStreamCompleteCanceledRequest(uint *param_1,uint param_2)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  longlong *plVar1;

+  longlong *plVar2;

+  longlong lVar3;

+  undefined *puVar4;

+  longlong lVar5;

+  ulonglong uVar6;

+  undefined8 uVar7;

+  uint uVar8;

+  uint uVar9;

+  uint *puVar10;

+  void *pvVar11;

+  longlong lVar12;

+  uint uVar13;

+  void *pvVar14;

+  uint uVar15;

+  uint local_res18 [2];

+  void *local_res20;

+  

+  plVar1 = *(longlong **)(param_1 + 0x1e);

+  local_res18[0] = 0;

+  local_res20 = (void *)0x0;

+  plVar2 = (longlong *)*plVar1;

+  uVar8 = *param_1 & 0xffff;

+  lVar3 = plVar2[1];

+  puVar4 = *(undefined **)(*(longlong *)(*plVar2 + 0x10) + 0x20);

+  if (param_2 == 0xc0000120) {

+    uVar15 = (uint)(*(longlong *)(param_1 + 0x24) == 0);

+    uVar9 = 0xc000cf1f;

+    if (*(longlong *)(param_1 + 0x24) != 0) {

+      uVar9 = param_2;

+    }

+  }

+  else {

+    uVar15 = 2;

+    uVar9 = param_2;

+  }

+  lVar5 = *(longlong *)(param_1 + 0x1c);

+  TlmWriteCvForCldStreamCancelIO((longlong)(param_1 + 0x2a),uVar9);

+  uVar6 = Feature_3667029304__private_IsEnabledDeviceUsageNoInline();

+  if ((int)uVar6 == 0) {

+    pvVar11 = *(void **)(*(longlong *)*plVar1 + 0x30);

+    pvVar14 = (void *)0x0;

+    uVar13 = *(uint *)(*(longlong *)*plVar1 + 0x38);

+  }

+  else {

+    puVar10 = local_res18;

+    uVar7 = HsmCaptureFileIdentity(*plVar2,&local_res20,puVar10);

+    HsmDbgBreakOnStatus((int)uVar7);

+    pvVar11 = local_res20;

+    pvVar14 = local_res20;

+    uVar13 = local_res18[0];

+    if (((((int)uVar7 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+      WPP_SF_iqdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),&WPP_GLOBAL_Control,puVar10,puVar4);

+      pvVar11 = local_res20;

+      pvVar14 = local_res20;

+      uVar13 = local_res18[0];

+    }

+  }

+  if (uVar8 == 1) {

+    if (*(char *)((longlong)param_1 + 0x6a) == '\0') {

+      lVar12 = *(longlong *)*plVar1;

+      uVar7 = HsmpGetStreamSize(*plVar2);

+      CldSyncSendCancelHydrationRequest

+                (*(ulonglong **)(plVar2[2] + 0x20),puVar4,lVar5,*(undefined8 *)(lVar12 + 0x28),

+                 pvVar11,uVar13,uVar15,uVar7,~(*(int *)(lVar12 + 0x1c) << 0xb) & 0x1000,

+                 *(ulonglong *)(param_1 + 0x58),*(longlong *)(param_1 + 0x5a),

+                 (undefined8 *)(param_1 + 0x2a));

+    }

+    else if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+             ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+            (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+      if (*plVar2 == 0) {

+        uVar6 = 0;

+      }

+      else {

+        uVar6 = (ulonglong)*(uint *)(*plVar2 + 0x1c);

+      }

+      WPP_SF_iqLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar6,pvVar11,puVar4);

+    }

+  }

+  else if (uVar8 == 2) {

+    CldSyncSendCancelPopulationRequest

+              (*(undefined8 **)(plVar2[2] + 0x20),puVar4,lVar5,

+               *(undefined8 *)(*(longlong *)*plVar1 + 0x28),pvVar11,uVar13,uVar15,

+               (undefined8 *)(param_1 + 0x2a));

+  }

+  else if (uVar8 == 3) {

+    CldSyncSendCancelNotificationRequest

+              (*(undefined8 **)(plVar2[2] + 0x20),puVar4,lVar5,param_1[0x4c],

+               *(undefined8 *)(param_1 + 0xe),*(undefined8 *)(*(longlong *)*plVar1 + 0x28),pvVar11,

+               uVar13,uVar15,(undefined8 *)(param_1 + 0x2a));

+  }

+  uVar6 = Feature_3667029304__private_IsEnabledDeviceUsageNoInline();

+  if ((int)uVar6 != 0) {

+    HsmFreeFileIdentity((longlong)pvVar14);

+  }

+  uVar6 = Feature_2089223483__private_IsEnabledDeviceUsageNoInline();

+  if ((int)uVar6 != 0) {

+    CldiStreamCdqACQUIRE(lVar3 + 0x90);

+  }

+  uVar6 = (ulonglong)uVar9;

+  CldiStreamCompleteRequest(plVar1,param_1,uVar6,0);

+  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29])

+     ) {

+    WPP_SF_qqiqdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),param_1,uVar6,plVar1);

+  }

+  return;

 }
```

## `HsmiFltPostECPCREATE`  (modified)

```diff
--- HsmiFltPostECPCREATE
+++ HsmiInfoPrepareForPostRename
@@ -1,390 +1,265 @@
 

-undefined8 HsmiFltPostECPCREATE(uint *param_1,longlong param_2,longlong *param_3,uint param_4)

+int HsmiInfoPrepareForPostRename(longlong *param_1,uint param_2,undefined8 *param_3)

 

 {

-  int *piVar1;

-  code *pcVar2;

-  bool bVar3;

-  bool bVar4;

-  char cVar5;

+  undefined8 *puVar1;

+  int iVar2;

+  undefined8 uVar3;

+  ulonglong uVar4;

+  ulonglong uVar5;

+  uint *_Dst;

+  uint *unaff_RBX;

+  uint *unaff_RSI;

   uint uVar6;

+  ulonglong unaff_RDI;

+  size_t _Size;

+  uint in_R9D;

   uint uVar7;

-  longlong lVar8;

-  ulonglong uVar9;

-  undefined8 uVar10;

-  uint uVar11;

-  undefined2 uVar12;

-  uint *puVar13;

-  longlong *plVar14;

-  longlong *plVar15;

-  char *pcVar16;

-  uint uVar17;

-  uint *local_res8;

-  char local_res10 [8];

-  char local_res18 [8];

-  uint local_res20 [2];

-  uint local_68;

-  int *local_60;

-  undefined8 local_58;

-  longlong local_50;

+  uint uVar8;

+  undefined8 in_R10;

+  longlong lVar9;

+  char in_R11B;

+  longlong unaff_R12;

+  int unaff_R13D;

+  uint uVar10;

+  ulonglong unaff_R14;

+  int unaff_R15D;

+  char in_stack_00000070;

+  int in_stack_00000078;

+  uint *in_stack_00000080;

+  longlong in_stack_00000090;

+  uint *in_stack_000000a0;

   

-  uVar10 = *(undefined8 *)(param_2 + 0x18);

-  plVar15 = (longlong *)CONCAT71((int7)((ulonglong)param_3 >> 8),1);

-  local_50 = *(longlong *)(param_2 + 0x20);

-  plVar14 = (longlong *)0x0;

-  uVar6 = 0;

-  local_60 = (int *)0x0;

-  uVar11 = 0;

-  uVar17 = 0;

-  local_68 = 0;

-  bVar3 = false;

-  local_res10[0] = '\0';

-  local_res8 = param_1;

-  local_res20[0] = param_4;

-  local_58 = uVar10;

-  HsmpTracePostCallbackEnter((longlong)param_1,param_3,'\x01','\0');

-  FltGetInstanceContext(uVar10,&local_60);

-  if (local_60 == (int *)0x0) goto LAB_0;

-  if (*local_60 == 0x32497348) {

-    KeEnterCriticalRegion();

-    ExAcquireResourceExclusiveLite(local_60 + 2,1);

-    lVar8 = RtlLookupElementGenericTableAvl(local_60 + 0x1c,&local_res8);

-    if (lVar8 != 0) {

-      lVar8 = RtlLookupElementGenericTableAvl(local_60 + 0x36,lVar8 + 8);

-      if (lVar8 != 0) {

-        piVar1 = (int *)(lVar8 + 8);

-        *piVar1 = *piVar1 + -1;

-        if (*piVar1 == 0) {

-          RtlDeleteElementGenericTableAvl(local_60 + 0x36,lVar8);

-        }

-      }

-      RtlDeleteElementGenericTableAvl(local_60 + 0x1c,&local_res8);

-    }

-    ExReleaseResourceLite(local_60 + 2);

-    KeLeaveCriticalRegion();

-    goto LAB_0;

-  }

-  uVar7 = local_res8[6];

-  HsmDbgBreakOnStatus(uVar7);

-  bVar3 = true;

-  if ((int)uVar7 < 0) {

-    uVar11 = 0;

-    if ((((uVar7 != 0xc0000034) && (uVar11 = uVar17, uVar7 != 0xc000003a)) &&

-        ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

-       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (4 < (byte)WPP_GLOBAL_Control[0x29]))))

-    {

-      uVar12 = 0x1c;

+code_r0x00014004fbbf:

+  unaff_RSI[0xe] = in_R9D;

+LAB_0:

+  iVar2 = (int)unaff_RDI;

+  if (unaff_R14 < (ulonglong)(iVar2 + 0x40) + 4) goto LAB_1;

+  uVar10 = unaff_RBX[0x11];

+  if ((uVar10 & 0xffff0fff) == DAT_2) {

+    uVar4 = HsmOsDisguisePlaceholder(in_R11B,((uint)in_R10 & unaff_RBX[0xe]) == 0);

+    if ((char)uVar4 == '\0') {

+LAB_3:

+      unaff_RSI[0x10] = uVar10;

       goto LAB_1;

     }

   }

-  else {

-LAB_2:

+  else if ((unaff_RBX[0xe] >> 10 & 1) != 0) goto LAB_3;

+  unaff_RSI[0x10] = unaff_RBX[0x10];

+LAB_1:

+  if ((ulonglong)(iVar2 + 0x3c) + 4 <= unaff_R14) {

+    unaff_RSI[0xf] = unaff_RBX[0xf];

+  }

+  uVar10 = (uint)unaff_R14;

+  if (uVar10 < unaff_RBX[0xf] + 0x44 + iVar2) goto LAB_4;

+  _Size = (size_t)unaff_RBX[0xf];

+  _Dst = unaff_RSI + 0x11;

+LAB_5:

+  do {

+    memmove(_Dst,unaff_RBX + 0x14,_Size);

+    in_R11B = in_stack_00000070;

+LAB_4:

     do {

-      lVar8 = local_50;

-      for (uVar11 = 0; uVar11 < 0x10; uVar11 = uVar11 + 1) {

-        if ((*(uint *)((longlong)param_3 + (ulonglong)uVar11 * 0x30 + 0x14) & 1) != 0) {

-          plVar14 = (longlong *)(ulonglong)(uVar11 << 0xc | 0x9000001a);

-          break;

-        }

-      }

-      uVar11 = (uint)plVar14;

-      uVar10 = local_58;

-      if (local_res8[6] != 0x104) {

-        if (*(longlong *)(local_50 + 0x18) == 0) goto LAB_3;

-        bVar4 = true;

-        if (uVar11 == 0) {

-LAB_4:

-          if (-1 < (int)uVar7) goto LAB_0;

-          plVar14 = plVar15;

-          if (!bVar4) goto LAB_5;

-        }

-        else {

-          uVar9 = Feature_CLFS_Signing__private_IsEnabledDeviceUsageNoInline();

-          if ((int)uVar9 != 0) {

-            puVar13 = local_res8;

-            plVar15 = plVar14;

-            uVar7 = HsmiIsUnsupportedLogfilePlaceholder

-                              ((longlong)local_60,(longlong)local_res8,uVar11,local_res10);

-            cVar5 = local_res10[0];

-            if ((int)uVar7 < 0) {

-              if (local_res10[0] != '\0') goto LAB_6;

-            }

-            else {

-              if (local_res10[0] == '\0') goto LAB_7;

+      if ((unaff_RDI & 0xffffffff) + 4 <= unaff_R14) {

+        *unaff_RSI = unaff_R13D + 7U & 0xfffffff8;

+      }

 LAB_6:

-              uVar7 = 0xc000cf0a;

-              HsmDbgBreakOnStatus(-0x3fff30f6);

-            }

-            uVar10 = local_58;

-            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_8;

-            pcVar16 = "Encountered an unsupported CLFS Logfile placeholder: ";

-            if (cVar5 == '\0') {

-              pcVar16 = "Failed to check if placeholder is a CLFS Logfile: ";

-            }

-            WPP_SF_sqqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),puVar13,plVar15,pcVar16);

-            bVar4 = true;

-            goto LAB_4;

-          }

+      if (*unaff_RBX == 0) {

+        if ((unaff_RDI & 0xffffffff) + 4 <= unaff_R14) {

+          *(int *)((unaff_RDI & 0xffffffff) + unaff_R12) = unaff_R15D;

+        }

+        uVar6 = (int)unaff_RDI + unaff_R13D;

 LAB_7:

-          HsmpTracePostCallbackEnter((longlong)local_res8,param_3,'\0','\x01');

-          uVar9 = HsmpSetupContexts((ulonglong)local_60,

-                                    *(undefined4 ***)(*(longlong *)(local_res8 + 4) + 8),uVar11,

-                                    local_res8);

-          uVar7 = (uint)uVar9;

-          HsmDbgBreakOnStatus(uVar7);

-          uVar10 = local_58;

-          plVar15 = plVar14;

-          if (-1 < (int)uVar7) {

+        *in_stack_000000a0 = uVar6;

+        return unaff_R15D;

+      }

+      uVar6 = (int)unaff_RDI + (unaff_R13D + 7U & 0xfffffff8);

+      unaff_RDI = (ulonglong)uVar6;

+      unaff_RBX = (uint *)((longlong)unaff_RBX + (ulonglong)*unaff_RBX);

+      if (in_stack_00000080 <= unaff_RBX) goto LAB_7;

+      in_R10 = 0x401000;

+      uVar7 = 0x401000;

+      if (uVar10 <= uVar6) goto LAB_7;

+      if (in_stack_00000078 == 1) {

+        unaff_RSI = (uint *)((ulonglong)uVar6 + unaff_R12);

+        unaff_R13D = unaff_RBX[0xf] + 0x40;

+        if (uVar6 + 0x38 <= uVar10) {

+          uVar3 = *(undefined8 *)(unaff_RBX + 2);

+          *(undefined8 *)unaff_RSI = *(undefined8 *)unaff_RBX;

+          *(undefined8 *)(unaff_RSI + 2) = uVar3;

+          uVar3 = *(undefined8 *)(unaff_RBX + 6);

+          *(undefined8 *)(unaff_RSI + 4) = *(undefined8 *)(unaff_RBX + 4);

+          *(undefined8 *)(unaff_RSI + 6) = uVar3;

+          uVar3 = *(undefined8 *)(unaff_RBX + 10);

+          *(undefined8 *)(unaff_RSI + 8) = *(undefined8 *)(unaff_RBX + 8);

+          *(undefined8 *)(unaff_RSI + 10) = uVar3;

+          *(undefined8 *)(unaff_RSI + 0xc) = *(undefined8 *)(unaff_RBX + 0xc);

+        }

+        if ((ulonglong)(uVar6 + 0x38) + 4 <= unaff_R14) {

+          if ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2) {

+            uVar7 = unaff_RBX[0xe];

+            uVar4 = HsmOsDisguisePlaceholder(in_R11B,(uVar7 & 0x401000) == 0);

+            if ((char)uVar4 != '\0') {

+              uVar7 = uVar7 & 0xffffe9ff;

+              if (uVar7 == 0) {

+                uVar7 = 0x80;

+              }

+              unaff_RSI[0xe] = uVar7;

+              goto LAB_8;

+            }

+          }

+          unaff_RSI[0xe] = unaff_RBX[0xe];

+        }

 LAB_8:

-            bVar4 = true;

-            uVar10 = local_58;

-            goto LAB_4;

-          }

-          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-            plVar14 = (longlong *)&WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids;

-            WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x22,

-                         &WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids,local_58);

-          }

-        }

-        plVar15 = plVar14;

-        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-          plVar15 = (longlong *)&WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids;

-          WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x23,

-                       &WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids,uVar10);

-        }

-        FltCancelFileOpen(uVar10,lVar8);

+        if ((ulonglong)(uVar6 + 0x3c) + 4 <= unaff_R14) {

+          unaff_RSI[0xf] = unaff_RBX[0xf];

+        }

+        if (uVar10 < unaff_RBX[0xf] + 0x40 + uVar6) goto LAB_4;

+        _Size = (size_t)unaff_RBX[0xf];

+        _Dst = unaff_RSI + 0x10;

         goto LAB_5;

       }

-      local_res20[0] = local_res20[0] & 0xffffff00;

-      local_res18[0] = '\0';

-      if ((local_res8[8] & 0xffff0fff) != DAT_9) {

-LAB_3:

-        bVar4 = false;

-        goto LAB_4;

-      }

-      local_68 = local_68 + 1;

-      if (0x100 < local_68) {

-        uVar7 = 0xc0000280;

-        HsmDbgBreakOnStatus(-0x3ffffd80);

-        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-          WPP_SF_qqcqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x1d,plVar15,local_58);

-        }

-        goto LAB_5;

-      }

-      plVar15 = (longlong *)CONCAT71((int7)((ulonglong)plVar15 >> 8),local_68 == 1);

-      uVar9 = HsmiCreateEnsureDirectoryFullyPopulated

-                        ((ulonglong)local_60,local_res8,local_68 == 1,

-                         *(ushort *)(*(longlong *)(local_res8 + 10) + 6),(undefined1 *)local_res20,

-                         local_res18);

-      uVar7 = (uint)uVar9;

-      HsmDbgBreakOnStatus(uVar7);

-      uVar6 = uVar11;

-      if ((int)uVar7 < 0) {

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_5;

-        uVar12 = 0x1e;

-        goto LAB_1;

-      }

-      if (local_res18[0] != '\0') {

-        *(uint *)((longlong)param_3 + 0x14) = *(uint *)((longlong)param_3 + 0x14) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x44) = *(uint *)((longlong)param_3 + 0x44) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x74) = *(uint *)((longlong)param_3 + 0x74) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0xa4) = *(uint *)((longlong)param_3 + 0xa4) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0xd4) = *(uint *)((longlong)param_3 + 0xd4) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x104) = *(uint *)((longlong)param_3 + 0x104) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x134) = *(uint *)((longlong)param_3 + 0x134) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x164) = *(uint *)((longlong)param_3 + 0x164) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x194) = *(uint *)((longlong)param_3 + 0x194) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x1c4) = *(uint *)((longlong)param_3 + 0x1c4) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 500) = *(uint *)((longlong)param_3 + 500) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x224) = *(uint *)((longlong)param_3 + 0x224) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x254) = *(uint *)((longlong)param_3 + 0x254) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x284) = *(uint *)((longlong)param_3 + 0x284) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x2b4) = *(uint *)((longlong)param_3 + 0x2b4) & 0xfffffffd;

-        *(uint *)((longlong)param_3 + 0x2e4) = *(uint *)((longlong)param_3 + 0x2e4) & 0xfffffffd;

-        goto LAB_2;

-      }

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x14) = *(uint *)((longlong)param_3 + 0x14) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x14) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x2a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x44) = *(uint *)((longlong)param_3 + 0x44) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x44) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x5a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x74) = *(uint *)((longlong)param_3 + 0x74) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x74) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x8a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0xa4) = *(uint *)((longlong)param_3 + 0xa4) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0xa4) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0xba) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0xd4) = *(uint *)((longlong)param_3 + 0xd4) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0xd4) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0xea) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x104) = *(uint *)((longlong)param_3 + 0x104) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x104) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x11a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x134) = *(uint *)((longlong)param_3 + 0x134) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x134) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x14a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x164) = *(uint *)((longlong)param_3 + 0x164) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x164) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x17a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x194) = *(uint *)((longlong)param_3 + 0x194) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x194) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x1aa) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x1c4) = *(uint *)((longlong)param_3 + 0x1c4) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x1c4) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x1da) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 500) = *(uint *)((longlong)param_3 + 500) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 500) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x20a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x224) = *(uint *)((longlong)param_3 + 0x224) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x224) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x23a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x254) = *(uint *)((longlong)param_3 + 0x254) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x254) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x26a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x284) = *(uint *)((longlong)param_3 + 0x284) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x284) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x29a) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x2b4) = *(uint *)((longlong)param_3 + 0x2b4) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x2b4) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x2ca) = 0;

-      if ((char)local_res20[0] == '\0') {

-        *(uint *)((longlong)param_3 + 0x2e4) = *(uint *)((longlong)param_3 + 0x2e4) & 0xfffffffe;

-      }

-      else {

-        *(undefined4 *)((longlong)param_3 + 0x2e4) = 0x80000000;

-      }

-      *(undefined2 *)((longlong)param_3 + 0x2fa) = 0;

-      FltSetCallbackDataDirty(local_res8);

-      FltReissueSynchronousIo(*(undefined8 *)(param_2 + 0x18),local_res8);

-      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        WPP_SF_qqcqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x1f,plVar15,local_58);

-      }

-      uVar7 = local_res8[6];

-      HsmDbgBreakOnStatus(uVar7);

-    } while (-1 < (int)uVar7);

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      uVar12 = 0x20;

-LAB_1:

-      plVar15 = (longlong *)&WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids;

-      WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

-                  &WPP_8b908a43e843315e7697704ee5f03bcd_Traceguids,local_58);

-      uVar11 = uVar6;

-    }

-  }

-LAB_5:

-  local_res8[6] = uVar7;

-  local_res8[8] = 0;

-  local_res8[9] = 0;

-LAB_0:

-  if (param_3 != (longlong *)0x0) {

-    if ((longlong *)*param_3 != param_3) {

-      *(longlong **)(param_3[0x5a] + 8) = param_3;

-      lVar8 = param_3[0x5a];

-      *param_3 = lVar8;

-      if (*(char *)(*(longlong *)(local_res8 + 4) + 4) == '\0') {

-        plVar15 = param_3;

-        FltRemoveOpenReparseEntry(DAT_10);

-      }

-      else {

-        if ((*(longlong **)(lVar8 + 8) != param_3) ||

-           (plVar14 = (longlong *)param_3[1], (longlong *)*plVar14 != param_3)) {

-          pcVar2 = (code *)swi(0x29);

-          (*pcVar2)(3);

-          pcVar2 = (code *)swi(3);

-          uVar10 = (*pcVar2)();

-          return uVar10;

-        }

-        *plVar14 = lVar8;

-        *(longlong **)(lVar8 + 8) = plVar14;

-        FltObjectDereference(DAT_10);

-      }

-    }

-    ExFreeToPagedLookasideList(&DAT_11,param_3);

-  }

-  if (local_60 != (int *)0x0) {

-    if (bVar3) {

-      ExReleaseRundownProtection(local_60 + 0x2c);

-    }

-    FltReleaseContext();

-  }

-  if (uVar11 != 0) {

-    HsmpTracePostCallbackExit(0,(longlong)local_res8,plVar15,'\x01');

-  }

-  return 0;

+      if (in_stack_00000078 == 2) {

+        unaff_RSI = (uint *)(unaff_RDI + unaff_R12);

+        unaff_R13D = unaff_RBX[0xf] + 0x44;

+        if (uVar6 + 0x38 <= uVar10) {

+          uVar3 = *(undefined8 *)(unaff_RBX + 2);

+          *(undefined8 *)unaff_RSI = *(undefined8 *)unaff_RBX;

+          *(undefined8 *)(unaff_RSI + 2) = uVar3;

+          uVar3 = *(undefined8 *)(unaff_RBX + 6);

+          *(undefined8 *)(unaff_RSI + 4) = *(undefined8 *)(unaff_RBX + 4);

+          *(undefined8 *)(unaff_RSI + 6) = uVar3;

+          uVar3 = *(undefined8 *)(unaff_RBX + 10);

+          *(undefined8 *)(unaff_RSI + 8) = *(undefined8 *)(unaff_RBX + 8);

+          *(undefined8 *)(unaff_RSI + 10) = uVar3;

+          *(undefined8 *)(unaff_RSI + 0xc) = *(undefined8 *)(unaff_RBX + 0xc);

+        }

+        if (unaff_R14 < (ulonglong)(uVar6 + 0x38) + 4) goto LAB_0;

+        if ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2) {

+          uVar10 = unaff_RBX[0xe];

+          uVar4 = HsmOsDisguisePlaceholder(in_R11B,(uVar10 & 0x401000) == 0);

+          if ((char)uVar4 != '\0') {

+            in_R9D = uVar10 & 0xffffe9ff;

+            if (in_R9D == 0) {

+              in_R9D = 0x80;

+            }

+            goto code_r0x00014004fbbf;

+          }

+        }

+        unaff_RSI[0xe] = unaff_RBX[0xe];

+        goto LAB_0;

+      }

+      if (in_stack_00000078 != 0x26) {

+        if (in_stack_00000078 == 0x4e) {

+          uVar4 = (ulonglong)uVar6;

+          uVar7 = unaff_RBX[0xf];

+          unaff_R13D = uVar7 + 0x50;

+          if (uVar6 + 0x50 <= uVar10) {

+            uVar3 = *(undefined8 *)(unaff_RBX + 2);

+            *(undefined8 *)(uVar4 + in_stack_00000090) = *(undefined8 *)unaff_RBX;

+            ((undefined8 *)(uVar4 + in_stack_00000090))[1] = uVar3;

+            uVar3 = *(undefined8 *)(unaff_RBX + 6);

+            puVar1 = (undefined8 *)(uVar4 + 0x10 + in_stack_00000090);

+            *puVar1 = *(undefined8 *)(unaff_RBX + 4);

+            puVar1[1] = uVar3;

+            uVar3 = *(undefined8 *)(unaff_RBX + 10);

+            puVar1 = (undefined8 *)(uVar4 + 0x20 + in_stack_00000090);

+            *puVar1 = *(undefined8 *)(unaff_RBX + 8);

+            puVar1[1] = uVar3;

+            uVar3 = *(undefined8 *)(unaff_RBX + 0xe);

+            puVar1 = (undefined8 *)(uVar4 + 0x30 + in_stack_00000090);

+            *puVar1 = *(undefined8 *)(unaff_RBX + 0xc);

+            puVar1[1] = uVar3;

+            uVar3 = *(undefined8 *)(unaff_RBX + 0x12);

+            puVar1 = (undefined8 *)(uVar4 + 0x40 + in_stack_00000090);

+            *puVar1 = *(undefined8 *)(unaff_RBX + 0x10);

+            puVar1[1] = uVar3;

+          }

+          lVar9 = in_stack_00000090;

+          if (((ulonglong)(uVar6 + 0x38) + 4 <= unaff_R14) &&

+             ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2)) {

+            uVar8 = unaff_RBX[0xe];

+            uVar5 = HsmOsDisguisePlaceholder(in_R11B,(uVar8 & 0x401000) == 0);

+            if ((char)uVar5 != '\0') {

+              uVar8 = uVar8 & 0xffffe9ff;

+              if (uVar8 == 0) {

+                uVar8 = 0x80;

+              }

+              *(uint *)(uVar4 + 0x38 + lVar9) = uVar8;

+            }

+          }

+          if ((((ulonglong)(uVar6 + 0x44) + 4 <= unaff_R14) &&

+              ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2)) &&

+             (uVar5 = HsmOsDisguisePlaceholder(in_R11B,(unaff_RBX[0xe] & 0x401000) == 0),

+             (char)uVar5 != '\0')) {

+            *(int *)(uVar4 + 0x44 + lVar9) = unaff_R15D;

+          }

+          if (unaff_RBX[0xf] + 0x50 + uVar6 <= uVar10) {

+            memmove((void *)(lVar9 + 0x50 + uVar4),unaff_RBX + 0x14,(ulonglong)unaff_RBX[0xf]);

+            in_R11B = in_stack_00000070;

+          }

+          unaff_R12 = in_stack_00000090;

+          if (uVar4 + 4 <= unaff_R14) {

+            *(uint *)(uVar4 + in_stack_00000090) = uVar7 + 0x57 & 0xfffffff8;

+          }

+        }

+        goto LAB_6;

+      }

+      unaff_RSI = (uint *)((ulonglong)uVar6 + unaff_R12);

+      unaff_R13D = unaff_RBX[0xf] + 0x50;

+      if (uVar6 + 0x38 <= uVar10) {

+        uVar3 = *(undefined8 *)(unaff_RBX + 2);

+        *(undefined8 *)unaff_RSI = *(undefined8 *)unaff_RBX;

+        *(undefined8 *)(unaff_RSI + 2) = uVar3;

+        uVar3 = *(undefined8 *)(unaff_RBX + 6);

+        *(undefined8 *)(unaff_RSI + 4) = *(undefined8 *)(unaff_RBX + 4);

+        *(undefined8 *)(unaff_RSI + 6) = uVar3;

+        uVar3 = *(undefined8 *)(unaff_RBX + 10);

+        *(undefined8 *)(unaff_RSI + 8) = *(undefined8 *)(unaff_RBX + 8);

+        *(undefined8 *)(unaff_RSI + 10) = uVar3;

+        *(undefined8 *)(unaff_RSI + 0xc) = *(undefined8 *)(unaff_RBX + 0xc);

+      }

+      if ((ulonglong)(uVar6 + 0x38) + 4 <= unaff_R14) {

+        uVar7 = 0x401000;

+        if ((unaff_RBX[0x11] & 0xffff0fff) == DAT_2) {

+          uVar8 = unaff_RBX[0xe];

+          uVar7 = 0x401000;

+          uVar4 = HsmOsDisguisePlaceholder(in_R11B,(uVar8 & 0x401000) == 0);

+          if ((char)uVar4 != '\0') {

+            uVar8 = uVar8 & 0xffffe9ff;

+            if (uVar8 == 0) {

+              uVar8 = 0x80;

+            }

+            unaff_RSI[0xe] = uVar8;

+            goto LAB_9;

+          }

+        }

+        unaff_RSI[0xe] = unaff_RBX[0xe];

+      }

+LAB_9:

+      if ((ulonglong)(uVar6 + 0x40) + 4 <= unaff_R14) {

+        uVar8 = unaff_RBX[0x11];

+        if ((uVar8 & 0xffff0fff) == DAT_2) {

+          uVar4 = HsmOsDisguisePlaceholder(in_R11B,(uVar7 & unaff_RBX[0xe]) == 0);

+          if ((char)uVar4 != '\0') {

+LAB_10:

+            unaff_RSI[0x10] = unaff_RBX[0x10];

+            goto LAB_11;

+          }

+        }

+        else if ((unaff_RBX[0xe] >> 10 & 1) == 0) goto LAB_10;

+        unaff_RSI[0x10] = uVar8;

+      }

+LAB_11:

+      if ((ulonglong)(uVar6 + 0x48) + 8 <= unaff_R14) {

+        *(undefined8 *)(unaff_RSI + 0x12) = *(undefined8 *)(unaff_RBX + 0x12);

+      }

+      if ((ulonglong)(uVar6 + 0x3c) + 4 <= unaff_R14) {

+        unaff_RSI[0xf] = unaff_RBX[0xf];

+      }

+    } while (uVar10 < unaff_RBX[0xf] + 0x50 + uVar6);

+    _Size = (size_t)unaff_RBX[0xf];

+    _Dst = unaff_RSI + 0x14;

+  } while( true );

 }
```

## `HsmIBitmapNORMALOpen`  (modified)

```diff
--- HsmIBitmapNORMALOpen
+++ HsmFltProcessStoreProperties
@@ -1,76 +1,508 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

+/* WARNING: Variable defined which should be unmapped: param_12 */

+/* WARNING: Variable defined which should be unmapped: param_7 */

+/* WARNING: Variable defined which should be unmapped: param_5 */

 

-int HsmIBitmapNORMALOpen

-              (ulonglong param_1,undefined8 param_2,longlong param_3,undefined4 param_4,

-              longlong param_5,uint param_6,undefined8 *param_7)

+ulonglong HsmFltProcessStoreProperties

+                    (undefined8 param_1,longlong param_2,ulonglong param_3,undefined8 param_4,

+                    longlong param_5,longlong ****param_6,undefined8 param_7,longlong param_8,

+                    ulonglong param_9,uint param_10,int param_11,int param_12)

 

 {

-  uint uVar1;

-  int iVar2;

-  longlong lVar3;

-  undefined8 uVar4;

-  undefined8 *unaff_RBX;

-  ulonglong unaff_RSI;

-  int unaff_EDI;

-  uint uVar5;

-  ulonglong uVar6;

-  byte unaff_R14B;

-  undefined **unaff_R15;

-  uint in_stack_00000070;

-  longlong in_stack_00000090;

-  int in_stack_000000a0;

+  ushort uVar1;

+  uint uVar2;

+  ushort uVar3;

+  uint uVar4;

+  undefined1 (*pauVar5) [16];

+  ushort uVar6;

+  undefined8 uVar7;

+  undefined8 uVar8;

+  undefined8 uVar9;

+  byte bVar10;

+  uint in_EAX;

+  uint uVar11;

+  uint uVar12;

+  ulonglong uVar13;

+  ushort uVar14;

+  ushort uVar15;

+  undefined8 uVar16;

+  undefined1 (*pauVar17) [16];

+  byte bVar18;

+  ushort uVar19;

+  undefined1 (*unaff_RBX) [16];

+  uint unaff_ESI;

+  undefined1 (*pauVar21) [16];

+  undefined1 (*unaff_R12) [16];

+  longlong unaff_R13;

+  byte bVar22;

+  undefined1 (*unaff_R14) [16];

+  undefined *unaff_R15;

+  uint *puVar23;

+  void *pvVar24;

+  undefined8 uVar25;

+  byte in_stack_00000080;

+  undefined1 (*in_stack_00000088) [16];

+  void *in_stack_00000090;

+  undefined2 *in_stack_00000098;

+  uint uStack00000000000000a0;

+  int in_stack_000000a4;

+  void *in_stack_000000a8;

+  uint in_stack_000000b0;

+  undefined1 (*in_stack_000000b8) [16];

+  undefined1 (*in_stack_000000c0) [16];

+  uint in_stack_000000d0;

+  uint uStack00000000000000d4;

+  byte in_stack_000000d8;

+  uint *in_stack_000000e8;

+  undefined1 (*in_stack_000000f0) [16];

+  longlong in_stack_000000f8;

+  undefined1 (*in_stack_00000100) [16];

+  int in_stack_00000110;

+  int *in_stack_00000198;

+  size_t in_stack_000001a0;

+  undefined4 uStack00000000000001d0;

+  byte bStack00000000000001d4;

+  undefined2 uStack00000000000001dc;

+  undefined2 uStack00000000000001de;

+  undefined8 in_stack_000001e0;

+  undefined8 in_stack_000001e8;

+  undefined8 in_stack_000001f0;

+  undefined8 in_stack_000001f8;

+  uint uStack0000000000000200;

+  undefined1 (*in_stack_00000208) [16];

+  undefined4 uStack0000000000000210;

+  undefined4 uStack0000000000000214;

+  uint uVar20;

+  undefined4 uVar26;

   

-  uVar4 = *(undefined8 *)(param_1 + 0x18);

-  WPP_SF_qisdil(uVar4,(undefined2)param_2,param_3,unaff_RBX,*unaff_RBX,(char *)param_3);

-  iVar2 = HsmiBitmapTranslateIOStatus(uVar4,unaff_EDI);

-  HsmDbgBreakOnStatus(iVar2);

-  if (in_stack_00000090 != 0) {

+code_r0x000140087bd4:

+  bVar22 = (byte)unaff_R14;

+  uVar19 = (ushort)unaff_RBX;

+  uVar20 = (uint)unaff_RBX;

+  if (in_EAX != 0) {

+    pauVar21 = (undefined1 (*) [16])0x4;

+    pauVar17 = in_stack_00000100;

+    uVar11 = HsmpAccessCheck(unaff_R13,(ulonglong)in_stack_00000100,4);

+    uVar13 = (ulonglong)uVar11;

+    HsmDbgBreakOnStatus(uVar11);

+    if ((int)uVar11 < 0) {

+      if (((WPP_GLOBAL_Control != unaff_R15) &&

+          (uVar13 = (ulonglong)*(uint *)(WPP_GLOBAL_Control + 0x2c),

+          (bVar22 & (byte)*(uint *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+        pauVar17 = (undefined1 (*) [16])0x6d;

+        uVar13 = *(ulonglong *)(WPP_GLOBAL_Control + 0x18);

+        pauVar21 = unaff_R12;

+        WPP_SF_qiD(uVar13,0x6d,unaff_R12,unaff_R13);

+      }

+      TlmWriteAccessDeniedForAddSubDirectory(uVar13,pauVar17,pauVar21);

+      goto LAB_0;

+    }

+  }

+  uStack00000000000000d4 = uStack0000000000000200 | 0x401000;

+  if (in_stack_000000d0 == uVar20) {

+    uStack00000000000000a0 = uStack0000000000000200 >> 9 & (uint)unaff_R14;

+  }

+  else {

+    uStack00000000000000a0 = 0x10;

+    if ((bStack00000000000001d4 & 0x40) != 0) {

+      uStack00000000000000a0 = 0x16;

+      uStack00000000000000d4 = uStack0000000000000200 & 0xffbfefff;

+    }

+  }

+  if ((bStack00000000000001d4 & bVar22) != 0) {

+    uStack00000000000000a0 = uStack00000000000000a0 | 0x40;

+  }

+  if ((_bStack00000000000001d4 & 0x400) != 0) {

+    uStack00000000000000a0 = uStack00000000000000a0 | 0x100;

+  }

+  pauVar21 = (undefined1 (*) [16])(*in_stack_000000c0 + (ushort)uStack00000000000001dc);

+  pauVar17 = (undefined1 (*) [16])(ulonglong)uStack00000000000000a0;

+  puVar23 = in_stack_000000e8;

+  uVar11 = HsmpRpBuildBuffer(in_stack_00000208,uStack00000000000000a0,pauVar21,

+                             uStack00000000000001de,in_stack_000000e8);

+  uVar26 = (undefined4)((ulonglong)puVar23 >> 0x20);

+  HsmDbgBreakOnStatus(uVar11);

+  if ((int)uVar11 < 0) {

+    if (((WPP_GLOBAL_Control != unaff_R15) &&

+        ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+      pauVar17 = (undefined1 (*) [16])0x6e;

+      goto LAB_1;

+    }

+  }

+  else {

+    *in_stack_00000098 = 0x58;

+    in_stack_00000098[1] = 0x1e32;

+    in_stack_00000098[2] = uVar19;

+    *(uint **)(in_stack_00000098 + 4) = in_stack_000000e8;

+    in_stack_00000098[3] = (short)in_stack_000000e8[1] + 8;

+    *(undefined8 **)(in_stack_00000098 + 0x10) = &stack0x000001e0;

+    *(uint *)(in_stack_00000098 + 0x14) = uStack00000000000000d4;

+    if (in_stack_000000d0 == 0) {

+      if (0 < (longlong)in_stack_00000208) {

+        in_stack_00000098[1] = in_stack_00000098[1] | (ushort)unaff_R14;

+      }

+      *(undefined1 (**) [16])(in_stack_00000098 + 8) = in_stack_00000208;

+      *(undefined1 (**) [16])(in_stack_00000098 + 0xc) = in_stack_00000208;

+      in_stack_00000098[1] = in_stack_00000098[1] | 0xc;

+    }

+    *(undefined4 *)(in_stack_00000098 + 0x16) = 8;

+    uVar16 = CONCAT44(uVar26,0x100180);

+    pauVar21 = (undefined1 (*) [16])&stack0x000000f0;

+    pauVar17 = in_stack_000000b8;

+    uVar11 = FltCreateFileEx2(DAT_2,in_stack_000000b8,pauVar21,&stack0x00000088,uVar16);

+    uVar26 = (undefined4)((ulonglong)uVar16 >> 0x20);

+    HsmDbgBreakOnStatus(uVar11);

+    bVar18 = (byte)unaff_RBX;

+    pauVar5 = unaff_R14;

+    if ((((uVar11 == 0xc0000035) || (uVar11 == 0xc0000279)) &&

+        ((_bStack00000000000001d4 & 0x4000) != 0)) &&

+       (uVar13 = Feature_1245077819__private_IsEnabledDeviceUsageNoInline(), pauVar5 = unaff_RBX,

+       in_stack_00000080 = bVar18, (int)uVar13 != 0)) {

+      pauVar21 = (undefined1 (*) [16])0x40;

+      pauVar17 = in_stack_00000100;

+      uVar11 = HsmpAccessCheck(unaff_R13,(ulonglong)in_stack_00000100,0x40);

+      HsmDbgBreakOnStatus(uVar11);

+      if ((int)uVar11 < 0) {

+        pauVar21 = (undefined1 (*) [16])&stack0x00000108;

+        pauVar17 = in_stack_000000b8;

+        uVar11 = FltCreateFileEx(DAT_2,in_stack_000000b8,pauVar21,&stack0x000000e0,

+                                 CONCAT44(uVar26,0x100080));

+        if (-1 < (int)uVar11) {

+          pauVar21 = (undefined1 (*) [16])0x10000;

+          pauVar17 = unaff_RBX;

+          uVar11 = HsmpAccessCheck(unaff_R13,(ulonglong)unaff_RBX,0x10000);

+          ObfDereferenceObject(unaff_RBX);

+          FltClose(unaff_RBX);

+        }

+        if ((int)uVar11 < 0) {

+          if (((WPP_GLOBAL_Control != unaff_R15) &&

+              ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            pauVar17 = (undefined1 (*) [16])0x6f;

+            goto LAB_1;

+          }

+          goto LAB_0;

+        }

+      }

+    }

+    bVar10 = (byte)pauVar5;

+    if ((byte)pauVar5 == 0) {

+      pauVar21 = (undefined1 (*) [16])&stack0x000000f0;

+      pauVar17 = in_stack_000000b8;

+      uVar11 = FltCreateFileEx(DAT_2,in_stack_000000b8,pauVar21,&stack0x00000088,0x100180);

+      HsmDbgBreakOnStatus(uVar11);

+      bVar10 = in_stack_00000080;

+    }

+    if ((int)uVar11 < 0) {

+      if (((WPP_GLOBAL_Control != unaff_R15) &&

+          ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+        pauVar17 = (undefined1 (*) [16])0x70;

+        goto LAB_1;

+      }

+    }

+    else {

+      if (bVar10 == 0) {

+        pauVar21 = (undefined1 (*) [16])0x8;

+        pauVar17 = in_stack_00000088;

+        uVar11 = HsmpMarkHandleUsnSourceInfo(unaff_R13,in_stack_00000088,8,0);

+        HsmDbgBreakOnStatus(uVar11);

+        if ((int)uVar11 < 0) {

+          if (((WPP_GLOBAL_Control != unaff_R15) &&

+              ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            pauVar17 = (undefined1 (*) [16])0x71;

+            goto LAB_1;

+          }

+          goto LAB_0;

+        }

+        pvVar24 = *in_stack_000000c0 + (ushort)uStack00000000000001dc;

+        pauVar17 = in_stack_00000088;

+        pauVar21 = in_stack_00000208;

+        uVar11 = HsmpRpCreate(unaff_R13,(longlong)in_stack_00000088,(longlong)in_stack_00000208,

+                              uStack00000000000000a0,pvVar24,uStack00000000000001de,bVar18);

+        uVar26 = (undefined4)((ulonglong)pvVar24 >> 0x20);

+        HsmDbgBreakOnStatus(uVar11);

+        if ((int)uVar11 < 0) {

+          if (((WPP_GLOBAL_Control != unaff_R15) &&

+              ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            pauVar17 = (undefined1 (*) [16])0x72;

+            goto LAB_1;

+          }

+          goto LAB_0;

+        }

+        if ((in_stack_000000d0 == uVar20) && (in_stack_00000208 != unaff_RBX)) {

+          pauVar21 = (undefined1 (*) [16])CONCAT71((int7)((ulonglong)pauVar21 >> 8),bVar22);

+          pauVar17 = in_stack_00000088;

+          uVar11 = HsmpToggleFileSparseAttribute(unaff_R13,(longlong)in_stack_00000088,bVar22);

+          HsmDbgBreakOnStatus(uVar11);

+          if ((int)uVar11 < 0) {

+            if (((WPP_GLOBAL_Control != unaff_R15) &&

+                ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              pauVar17 = (undefined1 (*) [16])0x73;

+              goto LAB_1;

+            }

+            goto LAB_0;

+          }

+          uVar16 = CONCAT44(uVar26,0x14);

+          pauVar21 = (undefined1 (*) [16])&stack0x00000208;

+          pauVar17 = in_stack_00000088;

+          uVar11 = FltSetInformationFile(in_stack_000000b8,in_stack_00000088,pauVar21,8,uVar16);

+          uVar26 = (undefined4)((ulonglong)uVar16 >> 0x20);

+          HsmDbgBreakOnStatus(uVar11);

+          if ((int)uVar11 < 0) {

+            if (((WPP_GLOBAL_Control != unaff_R15) &&

+                ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              pauVar17 = (undefined1 (*) [16])0x74;

+              goto LAB_1;

+            }

+            goto LAB_0;

+          }

+          pauVar17 = in_stack_00000088;

+          pauVar21 = in_stack_00000208;

+          uVar11 = HsmpSetFileVDL(in_stack_000000b8,in_stack_00000088,in_stack_00000208);

+          HsmDbgBreakOnStatus(uVar11);

+          if ((int)uVar11 < 0) {

+            if (((WPP_GLOBAL_Control != unaff_R15) &&

+                ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+              pauVar17 = (undefined1 (*) [16])0x75;

+              goto LAB_1;

+            }

+            goto LAB_0;

+          }

+        }

+        uVar9 = in_stack_000001f8;

+        uVar8 = in_stack_000001f0;

+        uVar7 = in_stack_000001e8;

+        uVar16 = in_stack_000001e0;

+        uVar13 = _uStack0000000000000200 >> 0x20;

+        uVar25 = CONCAT44(uVar26,4);

+        pauVar21 = (undefined1 (*) [16])&stack0x00000220;

+        pauVar17 = in_stack_00000088;

+        uVar11 = FltSetInformationFile(in_stack_000000b8,in_stack_00000088,pauVar21,0x28,uVar25);

+        uVar26 = (undefined4)((ulonglong)uVar25 >> 0x20);

+        HsmDbgBreakOnStatus(uVar11);

+        if ((int)uVar11 < 0) {

+          if (((WPP_GLOBAL_Control != unaff_R15) &&

+              ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            pauVar17 = (undefined1 (*) [16])0x76;

+            goto LAB_1;

+          }

+          goto LAB_0;

+        }

+        pauVar21 = (undefined1 (*) [16])(in_stack_000000c0[4] + 8);

+        pauVar17 = in_stack_00000088;

+        uVar11 = HsmpQueryLastEffectiveUsn

+                           (in_stack_000000b8,(ulonglong)in_stack_00000088,(longlong *)pauVar21);

+        HsmDbgBreakOnStatus(uVar11);

+        if ((int)uVar11 < 0) {

+          if (((WPP_GLOBAL_Control != unaff_R15) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            pauVar17 = (undefined1 (*) [16])0x77;

+            goto LAB_1;

+          }

+          goto LAB_0;

+        }

+        pauVar21 = (undefined1 (*) [16])&stack0x00000220;

+        pauVar17 = in_stack_00000088;

+        uVar11 = FltQueryInformationFile

+                           (in_stack_000000b8,in_stack_00000088,pauVar21,0x28,CONCAT44(uVar26,4));

+        HsmDbgBreakOnStatus(uVar11);

+        if ((int)uVar11 < 0) {

+          if (((WPP_GLOBAL_Control != unaff_R15) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            pauVar17 = (undefined1 (*) [16])0x78;

+            goto LAB_1;

+          }

+          goto LAB_0;

+        }

+        *(undefined8 *)in_stack_000000c0[1] = uVar16;

+        *(undefined8 *)(in_stack_000000c0[1] + 8) = uVar7;

+        *(undefined8 *)in_stack_000000c0[2] = uVar8;

+        *(undefined8 *)(in_stack_000000c0[2] + 8) = uVar9;

+        *(ulonglong *)in_stack_000000c0[3] = CONCAT44((int)uVar13,uStack00000000000000d4);

+      }

+      else {

+        *(undefined8 *)in_stack_000000c0[1] = in_stack_000001e0;

+        *(undefined8 *)(in_stack_000000c0[1] + 8) = in_stack_000001e8;

+        *(undefined8 *)in_stack_000000c0[2] = in_stack_000001f0;

+        *(undefined8 *)(in_stack_000000c0[2] + 8) = in_stack_000001f8;

+        *(undefined4 *)in_stack_000000c0[3] = *(undefined4 *)(in_stack_00000098 + 0x14);

+        *(undefined8 *)(in_stack_000000c0[4] + 8) = *(undefined8 *)(in_stack_00000098 + 0x18);

+        pauVar17 = in_stack_000000c0;

+      }

+      if (((WPP_GLOBAL_Control != unaff_R15) &&

+          ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+         (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+        pauVar17 = (undefined1 (*) [16])0x79;

+        pauVar21 = unaff_R12;

+        WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x79,unaff_R12,unaff_R13);

+      }

+    }

+  }

+LAB_0:

+  *(uint *)in_stack_000000c0[4] = uVar11;

+  if (in_stack_00000088 != (undefined1 (*) [16])0x0) {

+    if ((int)uVar11 < 0) {

+      pauVar17 = in_stack_00000088;

+      HsmpSetFileDisposition(*(undefined8 *)(unaff_R13 + 0x20),in_stack_00000088);

+    }

+    ObfDereferenceObject(in_stack_00000088);

+    in_stack_00000088 = unaff_RBX;

+  }

+  if (in_stack_000000f0 != (undefined1 (*) [16])0x0) {

     FltClose();

-  }

-  if (in_stack_000000a0 != (int)unaff_RSI) {

-    HsmIBitmapNORMALUnpinBlock((int *)&stack0x000000d0);

-  }

-  if (iVar2 < 0) {

-    lVar3 = unaff_RBX[0x14];

-    if (lVar3 != 0) {

-      do {

-        if (in_stack_00000070 != 0) break;

-        if (*(longlong *)(lVar3 + 8) != 0) {

-          HsmFileCacheCloseFileObject(*(longlong *)(lVar3 + 8));

-          *(ulonglong *)(unaff_RBX[0x14] + 8) = unaff_RSI;

-        }

-        if (*(longlong *)unaff_RBX[0x14] != 0) {

-          ObfDereferenceObject();

-          *(ulonglong *)unaff_RBX[0x14] = unaff_RSI;

-        }

-        uVar6 = unaff_RSI & 0xffffffff;

-        uVar1 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RBX);

-        if (uVar1 != 0) {

-          do {

-            if (*(longlong *)(unaff_RBX[0x14] + 0x10 + uVar6 * 8) != 0) {

-              ObfDereferenceObject();

-              *(ulonglong *)(unaff_RBX[0x14] + 0x10 + uVar6 * 8) = unaff_RSI;

-            }

-            uVar5 = (int)uVar6 + 1;

-            uVar6 = (ulonglong)uVar5;

-            uVar1 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RBX);

-          } while (uVar5 < uVar1);

-        }

-        in_stack_00000070 = 1;

-        lVar3 = unaff_RBX[0x14];

-      } while (lVar3 != 0);

-      unaff_R15 = &WPP_GLOBAL_Control;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-       (unaff_R14B <= (byte)WPP_GLOBAL_Control[0x29])) {

-      WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x55,(ulonglong)in_stack_00000070,

-                   unaff_RBX,*unaff_RBX,(char *)(unaff_RBX + 4));

-    }

-  }

-  *(int *)(unaff_RBX + 3) = iVar2;

-  FltReleasePushLockEx(unaff_RBX + 6,0);

-  return iVar2;

+    in_stack_000000f0 = unaff_RBX;

+  }

+  if (((int)uVar11 < 0) && ((in_stack_000000d8 & bVar22) != 0)) goto LAB_3;

+  uVar12 = uVar20;

+  if (uStack00000000000001d0 != uVar20) {

+    uVar12 = in_stack_000000b0 + uStack00000000000001d0;

+  }

+  if (uVar12 == 0) goto LAB_3;

+  pauVar21 = (undefined1 (*) [16])0x50;

+  memset(&stack0x000001d0,0,0x50);

+  in_stack_000000c0 = (undefined1 (*) [16])((longlong)in_stack_000000a8 + (ulonglong)uVar12);

+  uVar11 = in_stack_00000110 - uVar12;

+  pauVar17 = (undefined1 (*) [16])(ulonglong)uVar11;

+  if (uVar11 < 0x50) {

+    uVar11 = 0xc000cf0b;

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    unaff_ESI = ~-(uint)(in_stack_000000a4 != 0) & 0xc000cf0b;

+    if (((WPP_GLOBAL_Control == unaff_R15) ||

+        ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

+       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_3;

+    pauVar17 = (undefined1 (*) [16])0x67;

+    goto LAB_4;

+  }

+  _uStack00000000000001d0 = *in_stack_000000c0;

+  in_stack_000001e0 = *(undefined8 *)in_stack_000000c0[1];

+  in_stack_000001e8 = *(undefined8 *)(in_stack_000000c0[1] + 8);

+  in_stack_000001f0 = *(undefined8 *)in_stack_000000c0[2];

+  in_stack_000001f8 = *(undefined8 *)(in_stack_000000c0[2] + 8);

+  _uStack0000000000000200 = *(ulonglong *)in_stack_000000c0[3];

+  in_stack_00000208 = *(undefined1 (**) [16])(in_stack_000000c0[3] + 8);

+  _uStack0000000000000210 = *(undefined8 *)in_stack_000000c0[4];

+  pauVar21 = (undefined1 (*) [16])(uStack00000000000001d0._8_8_ >> 0x20 & 0xffff);

+  uVar2 = (uint)pauVar21;

+  uVar6 = uStack00000000000001d0._14_2_;

+  uVar14 = uStack00000000000001d0._10_2_;

+  uVar3 = uStack00000000000001d0._8_2_;

+  uVar4 = uVar2 + uVar6;

+  if (uVar2 + uVar6 < (uint)uVar3 + (uint)uVar14) {

+    uVar4 = (uint)uVar3 + (uint)uVar14;

+  }

+  if (((uVar11 < uVar3) || (uVar11 - uVar3 < (uint)uVar14)) ||

+     ((uVar11 < uVar2 || ((uVar11 - uVar2 < (uint)uVar6 || (0x1000 < uVar6)))))) {

+LAB_5:

+    uVar11 = 0xc000cf0b;

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    unaff_ESI = ~-(uint)(in_stack_000000a4 != 0) & 0xc000cf0b;

+    if ((WPP_GLOBAL_Control == unaff_R15) ||

+       (((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0 ||

+        ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_3;

+    pauVar17 = (undefined1 (*) [16])0x68;

+    uVar16 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+    goto LAB_6;

+  }

+  pauVar21 = (undefined1 (*) [16])(ulonglong)(uint)uStack00000000000001d0;

+  if ((uStack00000000000001d0 != 0) &&

+     (((uint)uStack00000000000001d0 < uVar4 || (uVar11 < (uint)uStack00000000000001d0))))

+  goto LAB_5;

+  for (uVar15 = uVar19; in_stack_000000b0 = uVar12, uVar15 < uVar14 >> 1;

+      uVar15 = uVar15 + (ushort)unaff_R14) {

+    uVar1 = *(ushort *)(*in_stack_000000c0 + (ulonglong)uVar15 * 2 + (ulonglong)uVar3);

+    pauVar17 = (undefined1 (*) [16])(ulonglong)uVar1;

+    if ((uVar1 == 0x5c) || (uVar1 == 0x3a)) {

+      uVar11 = 0xc000cf0b;

+      HsmDbgBreakOnStatus(-0x3fff30f5);

+      if ((WPP_GLOBAL_Control == unaff_R15) ||

+         (((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0 ||

+          ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_0;

+      pauVar17 = (undefined1 (*) [16])0x69;

+      goto LAB_7;

+    }

+  }

+  if ((uStack00000000000001d0 & 3) != 0) {

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    uVar11 = 0xc000cf0b;

+    if (((WPP_GLOBAL_Control != unaff_R15) &&

+        (uVar11 = 0xc000cf0b, (bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0)) &&

+       (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+      pauVar17 = (undefined1 (*) [16])0x6a;

+LAB_4:

+      uVar16 = *(undefined8 *)(WPP_GLOBAL_Control + 0x18);

+LAB_6:

+      uVar11 = 0xc000cf0b;

+      WPP_SF_qiD(uVar16,(short)pauVar17,unaff_R12,unaff_R13);

+      pauVar21 = unaff_R12;

+    }

+LAB_3:

+    if (((in_stack_000000a4 != 0) && (uVar11 = unaff_ESI, WPP_GLOBAL_Control != unaff_R15)) &&

+       (((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) != 0 &&

+        (3 < (byte)WPP_GLOBAL_Control[0x29])))) {

+      WPP_SF_qqdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),pauVar17,pauVar21,unaff_R13);

+    }

+    *in_stack_00000198 = in_stack_000000a4;

+    if (in_stack_000000e8 != (uint *)0x0) {

+      ExFreePoolWithTag(in_stack_000000e8,0x70527348);

+    }

+    if (in_stack_000000f8 != 0) {

+      FltFreeExtraCreateParameterList(DAT_2);

+    }

+    if (in_stack_000000a8 != (void *)0x0) {

+      if (-1 < (int)uVar11) {

+        memmove(in_stack_00000090,in_stack_000000a8,in_stack_000001a0);

+      }

+      ExFreePoolWithTag(in_stack_000000a8,0x70537348);

+    }

+    if (in_stack_00000100 != (undefined1 (*) [16])0x0) {

+      ObfDereferenceObject();

+    }

+    return (ulonglong)uVar11;

+  }

+  in_EAX = uStack0000000000000200 & 0x10;

+  if (((((_uStack0000000000000200 & 0x10) == 0) && ((in_stack_000000d8 & 2) == 0)) &&

+      (in_stack_00000208 != unaff_RBX)) ||

+     ((((_uStack0000000000000200 & 0x10) != 0 && ((in_stack_000000d8 & 4) == 0)) &&

+      ((bStack00000000000001d4 & 0x40) == 0)))) {

+    uVar11 = 0xc000cf0b;

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    if (((WPP_GLOBAL_Control == unaff_R15) ||

+        ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

+       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+    pauVar17 = (undefined1 (*) [16])0x6b;

+  }

+  else {

+    if (uVar6 != uVar19) goto LAB_8;

+    uVar11 = 0xc000cf0b;

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    if (((WPP_GLOBAL_Control == unaff_R15) ||

+        ((bVar22 & (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) ||

+       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

+    pauVar17 = (undefined1 (*) [16])0x6c;

+  }

+LAB_7:

+  uVar11 = 0xc000cf0b;

+LAB_1:

+  pauVar21 = unaff_R12;

+  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),(short)pauVar17,unaff_R12,unaff_R13);

+  goto LAB_0;

+LAB_8:

+  in_stack_000000a4 = in_stack_000000a4 + (uint)unaff_R14;

+  uStack0000000000000210 = 0xc000cf07;

+  in_stack_00000080 = bVar22;

+  in_stack_000000d0 = in_EAX;

+  goto code_r0x000140087bd4;

 }
```

## `CldiSyncInsertPendingRange`  (modified)

```diff
--- CldiSyncInsertPendingRange
+++ HsmIBitmapNORMALPrepareCommit
@@ -1,28 +1,17 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-int CldiSyncInsertPendingRange

-              (uint *param_1,undefined8 param_2,undefined8 param_3,undefined8 param_4)

+int HsmIBitmapNORMALPrepareCommit

+              (ushort *param_1,ushort **param_2,undefined8 param_3,undefined4 *param_4,

+              ushort **param_5)

 

 {

-  byte *pbVar1;

-  char *pcVar2;

-  byte bVar3;

-  char in_AL;

-  undefined7 in_register_00000001;

-  byte bVar4;

-  longlong unaff_R13;

+  int unaff_EBX;

+  undefined8 in_stack_000000a0;

+  longlong in_stack_000000a8;

   

-  bVar4 = (byte)param_1;

-  *(char *)CONCAT71(in_register_00000001,in_AL) =

-       *(char *)CONCAT71(in_register_00000001,in_AL) + in_AL;

-  pbVar1 = (byte *)(CONCAT71(in_register_00000001,in_AL) + -0x75);

-  bVar3 = *pbVar1;

-  *pbVar1 = *pbVar1 + bVar4;

-  pcVar2 = (char *)(unaff_R13 + 5 + (longlong)param_1 * 4);

-  *pcVar2 = (*pcVar2 - bVar4) - CARRY1(bVar3,bVar4);

-  out((undefined2)param_2,in_AL);

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  ObfDereferenceObject(in_stack_000000a0);

+  if (in_stack_000000a8 != 0) {

+    FltClose();

+  }

+  return unaff_EBX;

 }
```

## `CldiSyncTransferOrAckDataByObject`  (modified)

```diff
--- CldiSyncTransferOrAckDataByObject
+++ CldiSyncTransferOrAckDataByObject
@@ -1,373 +1,210 @@
-

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 uint CldiSyncTransferOrAckDataByObject

                (longlong param_1,ulonglong param_2,ulonglong param_3,char param_4,ulonglong param_5,

                undefined *param_6,longlong param_7)

 

 {

-  ushort uVar1;

-  ushort uVar2;

+  longlong *plVar1;

+  longlong lVar2;

   longlong lVar3;

-  undefined8 uVar4;

+  undefined1 auVar4 [16];

   uint uVar5;

-  undefined4 uVar6;

-  int *in_RAX;

-  uint uVar7;

-  uint uVar8;

-  undefined8 *puVar9;

-  short sVar10;

-  longlong unaff_RBP;

-  void *pvVar11;

+  ulonglong uVar6;

+  ulonglong uVar7;

+  longlong lVar8;

+  undefined2 uVar9;

+  undefined8 uVar10;

+  ulonglong uVar11;

   ulonglong uVar12;

-  uint uVar13;

-  size_t _Size;

-  void *pvVar14;

-  void *_Src;

-  uint uVar15;

-  uint uVar16;

-  longlong unaff_R15;

-  void *_Src_00;

+  int iVar13;

+  int *piVar14;

+  ulonglong uVar15;

+  int iVar16;

+  int iVar17;

+  uint local_res18;

+  int local_58;

+  ulonglong local_48;

   

-  *in_RAX = *in_RAX + (int)in_RAX;

-  *(char *)in_RAX = (char)*in_RAX + (char)in_RAX;

-  *(longlong *)(unaff_RBP + -0x21) = param_1;

-  *(longlong *)(unaff_RBP + 7) = param_1;

-  uVar13 = (uint)param_1;

-  *(longlong *)(unaff_RBP + -0x41) = param_1;

-  pvVar14 = (void *)(param_1 & 0xffffffff);

-  *(uint *)(unaff_RBP + -0x49) = uVar13;

-  *(longlong *)(unaff_RBP + -0x31) = param_1;

-  _Src = (void *)(param_1 & 0xffffffff);

-  *(uint *)(unaff_RBP + -0x45) = uVar13;

-  *(uint *)(unaff_RBP + -0x11) = uVar13 + 3;

-  *(uint *)(unaff_RBP + -1) = uVar13 + 3;

-  uVar5 = HsmiCldGetSyncRootInfo(unaff_R15,param_2,param_3,(longlong *)(unaff_RBP + -0x21));

-  *(uint *)(unaff_RBP + -0x39) = uVar5;

+  local_res18 = (uint)param_3;

+  plVar1 = *(longlong **)(param_1 + 8);

+  uVar7 = param_3 & 0xffffffff;

+  if ((*(uint *)(*(longlong *)*plVar1 + 0x1c) & 2) == 0) {

+    if ((param_5 & 0xfff) == 0) {

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+         (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+        WPP_SF_cqdiiqi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),param_2,param_3,param_4);

+      }

+      uVar6 = (longlong)param_5 / 0x1000;

+      if (param_6 == (undefined *)0xffffffffffffffff) {

+        uVar11 = 0x7ffffffffffff;

+      }

+      else {

+        auVar4._8_8_ = (longlong)(param_6 + 0xfff) >> 0x3f;

+        auVar4._0_8_ = (ulonglong)(param_6 + 0xfff) & 0xfffffffffffff000;

+        uVar11 = SUB168(auVar4 / SEXT816(0x1000),0);

+      }

+      uVar10 = 0;

+      FltAcquirePushLockExclusiveEx(param_1 + 0x18);

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+         (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+        WPP_SF_cqii(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar10,param_3,param_4);

+      }

+      uVar15 = uVar11;

+      FsRtlRemoveBaseMcbEntry();

+      local_58 = 0;

+      param_3 = uVar7;

+      local_48 = uVar11;

+LAB_0:

+      if ((int)param_3 < 0) {

+        lVar8 = (ulonglong)(-(uint)(local_58 != 0) & 0x10) + 0x38;

+LAB_1:

+        piVar14 = (int *)(param_1 + lVar8);

+        if (piVar14 != (int *)0x0) {

+          iVar17 = 0;

+          iVar13 = piVar14[1] + -1;

+          if (-1 < iVar13) {

+            iVar16 = iVar17;

+            do {

+              uVar5 = iVar13 + iVar16 >> 1;

+              uVar15 = (ulonglong)uVar5;

+              iVar17 = uVar5 + 1;

+              if ((longlong)uVar6 <=

+                  *(longlong *)(*(longlong *)(piVar14 + 2) + (longlong)(int)uVar5 * 0x18)) {

+                iVar17 = iVar16;

+                iVar13 = uVar5 - 1;

+              }

+              iVar16 = iVar17;

+            } while (iVar17 <= iVar13);

+          }

+          if ((iVar17 == piVar14[1]) ||

+             ((longlong)uVar6 < *(longlong *)(*(longlong *)(piVar14 + 2) + (longlong)iVar17 * 0x18))

+             ) {

+            iVar17 = iVar17 + -1;

+          }

+          iVar13 = 0;

+          if (-1 < iVar17) {

+            iVar13 = iVar17;

+          }

+          lVar8 = (longlong)iVar13 * 0x18;

+          do {

+            uVar5 = local_res18;

+            if ((piVar14[1] <= iVar13) || ((longlong)uVar11 < 1)) goto LAB_2;

+            lVar2 = *(longlong *)(*(longlong *)(piVar14 + 2) + 8 + lVar8);

+            lVar3 = *(longlong *)(*(longlong *)(piVar14 + 2) + lVar8);

+            uVar7 = lVar2 + lVar3;

+            if (((longlong)uVar6 < (longlong)uVar7) &&

+               (uVar11 = local_48 + uVar6, lVar3 < (longlong)uVar11)) {

+              uVar12 = uVar6;

+              if (lVar3 < (longlong)uVar6) {

+LAB_3:

+                uVar15 = uVar12;

+                uVar7 = CldiSyncSplitPendingRange(piVar14,iVar13,uVar12);

+                uVar5 = (uint)uVar7;

+                HsmDbgBreakOnStatus(uVar5);

+                uVar11 = local_48;

+                if ((int)uVar5 < 0) goto LAB_2;

+              }

+              else {

+                uVar12 = uVar7;

+                if ((longlong)uVar11 <= (longlong)uVar7) {

+                  uVar12 = uVar11;

+                }

+                if ((lVar3 < (longlong)uVar12) && ((longlong)uVar12 < lVar3 + lVar2))

+                goto LAB_3;

+              }

+              if (uVar12 != uVar6) {

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+                   (3 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  WPP_SF_qddii(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

+                               *(undefined8 *)(piVar14 + 2),uVar15,piVar14);

+                }

+                local_48 = local_48 + (uVar6 - uVar12);

+                CldiSyncRemovePendingRange((longlong)piVar14,iVar13);

+                uVar6 = uVar12;

+              }

+            }

+            iVar13 = iVar13 + 1;

+            lVar8 = lVar8 + 0x18;

+            uVar11 = local_48;

+          } while( true );

+        }

+      }

+      else if (local_58 == 0) {

+        if (param_4 == '\0') {

+          lVar8 = 0x38;

+          goto LAB_1;

+        }

+      }

+      else if ((local_58 == 1) && (param_4 != '\0')) {

+        lVar8 = 0x48;

+        goto LAB_1;

+      }

+      goto LAB_4;

+    }

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+      return 0xc000cf0b;

+    }

+    if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0) {

+      return 0xc000cf0b;

+    }

+    if ((byte)WPP_GLOBAL_Control[0x29] < 4) {

+      return 0xc000cf0b;

+    }

+    uVar9 = 0xe;

+  }

+  else {

+    HsmDbgBreakOnStatus(-0x3fff30f5);

+    if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+      return 0xc000cf0b;

+    }

+    if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0) {

+      return 0xc000cf0b;

+    }

+    if ((byte)WPP_GLOBAL_Control[0x29] < 4) {

+      return 0xc000cf0b;

+    }

+    uVar9 = 0xd;

+  }

+  uVar5 = 0xc000cf0b;

+LAB_5:

+  WPP_SF_cqdiiqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,param_3,param_4);

+  return uVar5;

+LAB_2:

+  local_res18 = uVar5;

+  param_3 = (ulonglong)local_res18;

+LAB_4:

+  local_58 = local_58 + 1;

+  if (1 < local_58) goto code_r0x00014006c189;

+  goto LAB_0;

+code_r0x00014006c189:

+  uVar10 = 0;

+  FltReleasePushLockEx(param_1 + 0x18);

+  if (param_4 == '\0') {

+    uVar7 = CldStreamTransferData(plVar1,param_2 & 0xffffffff,(uint)param_3,param_5,param_6,param_7)

+    ;

+    uVar5 = (uint)uVar7;

+  }

+  else {

+    uVar5 = CldStreamAckData(plVar1,uVar10,(uint)param_3,param_5,param_6);

+  }

   HsmDbgBreakOnStatus(uVar5);

-  lVar3 = *(longlong *)(unaff_RBP + -0x21);

-  if (*(int *)(unaff_RBP + -0x39) < 0) {

-    if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-       ((byte)((byte)*(undefined4 *)(unaff_RBP + -0x25) &

-              (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) {

-LAB_0:

-      uVar16 = *(uint *)(unaff_RBP + -0x39);

-    }

-    else {

-      uVar16 = *(uint *)(unaff_RBP + -0x39);

-      if ((byte)((char)param_1 + 5U) <= (byte)WPP_GLOBAL_Control[0x29]) {

-        sVar10 = (short)param_1 + 0x37;

-LAB_1:

-        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),sVar10,

-                    &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,unaff_R15);

-      }

-    }

-  }

-  else {

-    uVar5 = HsmpCldGetSyncRootFileIdEx

-                      (unaff_R15,*(longlong *)(unaff_RBP + 0x5f),param_3,

-                       (ulonglong *)(unaff_RBP + 7),(int *)0x0,(undefined4 *)0x0);

-    *(uint *)(unaff_RBP + -0x39) = uVar5;

-    HsmDbgBreakOnStatus(uVar5);

-    if (-1 < *(int *)(unaff_RBP + -0x39)) {

-      if (lVar3 == 0) {

-LAB_2:

-        _Src_00 = (void *)0x0;

-        pvVar11 = pvVar14;

-      }

-      else {

-        uVar5 = *(uint *)(lVar3 + 8);

-        if (uVar5 < 0x18) {

-          *(undefined8 *)(unaff_RBP + -0x31) = 0;

-          *(undefined4 *)(unaff_RBP + -0x45) = 0;

-          goto LAB_2;

-        }

-        uVar1 = *(ushort *)(lVar3 + 0xe);

-        *(ushort *)(unaff_RBP + -0x29) = uVar1;

-        uVar16 = uVar13;

-        uVar15 = uVar13;

-        if (uVar1 == 0) {

-          pvVar14 = (void *)0x0;

-        }

-        else {

-          if (((*(ushort *)(lVar3 + 0x10) < 0x12) &&

-              (((uVar8 = *(uint *)(lVar3 + 0x14), uVar8 == 0 ||

-                (((uint)uVar1 * 8 + 0x10 <= uVar8 && (uVar8 <= uVar5)))) &&

-               (*(ushort *)(lVar3 + 0x12) <= uVar5)))) &&

-             (((uVar7 = *(ushort *)(lVar3 + 0x12) + uVar8, uVar8 <= uVar7 && (uVar7 <= uVar5)) &&

-              (*(ushort *)(lVar3 + 0x10) == 0x11)))) {

-            if ((*(uint *)(lVar3 + 0x14) != 0) && (*(short *)(lVar3 + 0x12) != 0)) {

-              _Src = (void *)(lVar3 + (ulonglong)*(uint *)(lVar3 + 0x14));

-            }

-            uVar15 = (uint)*(ushort *)(lVar3 + 0x12);

-          }

-          if ((ushort)*(undefined4 *)(unaff_RBP + -0x25) < uVar1) {

-            if ((((0x1f < uVar5) && (*(ushort *)(lVar3 + 0x18) < 0x12)) &&

-                ((uVar16 = *(uint *)(lVar3 + 0x1c), uVar16 == 0 ||

-                 (((uint)uVar1 * 8 + 0x10 <= uVar16 && (uVar16 <= uVar5)))))) &&

-               ((*(ushort *)(lVar3 + 0x1a) <= uVar5 &&

-                (((uVar8 = *(ushort *)(lVar3 + 0x1a) + uVar16, uVar16 <= uVar8 && (uVar8 <= uVar5))

-                 && (*(ushort *)(lVar3 + 0x18) == 0x11)))))) {

-              if ((*(uint *)(lVar3 + 0x1c) == 0) || (*(short *)(lVar3 + 0x1a) == 0)) {

-                *(undefined8 *)(unaff_RBP + -0x41) = 0;

-              }

-              else {

-                *(ulonglong *)(unaff_RBP + -0x41) = (ulonglong)*(uint *)(lVar3 + 0x1c) + lVar3;

-              }

-              uVar13 = (uint)*(ushort *)(lVar3 + 0x1a);

-              *(uint *)(unaff_RBP + -0x49) = (uint)*(ushort *)(lVar3 + 0x1a);

-            }

-            pvVar14 = *(void **)(unaff_RBP + -0x41);

-            uVar16 = uVar13;

-            if ((((2 < *(ushort *)(unaff_RBP + -0x29)) && (0x27 < uVar5)) &&

-                (uVar1 = *(ushort *)(lVar3 + 0x20), uVar1 < 0x12)) &&

-               (((uVar8 = *(uint *)(lVar3 + 0x24), uVar8 == 0 ||

-                 (((uint)*(ushort *)(unaff_RBP + -0x29) * 8 + 0x10 <= uVar8 && (uVar8 <= uVar5))))

-                && ((*(ushort *)(lVar3 + 0x22) <= uVar5 &&

-                    ((uVar7 = *(ushort *)(lVar3 + 0x22) + uVar8, uVar8 <= uVar7 && (uVar7 <= uVar5))

-                    )))))) {

-              *(void **)(unaff_RBP + -0x41) = pvVar14;

-              *(uint *)(unaff_RBP + -0x49) = uVar13;

-              if (uVar1 == 0x11) {

-                if ((*(uint *)(lVar3 + 0x24) == 0) || (*(short *)(lVar3 + 0x22) == 0)) {

-                  *(undefined8 *)(unaff_RBP + -0x31) = 0;

-                }

-                else {

-                  *(ulonglong *)(unaff_RBP + -0x31) = (ulonglong)*(uint *)(lVar3 + 0x24) + lVar3;

-                }

-                *(uint *)(unaff_RBP + -0x45) = (uint)*(ushort *)(lVar3 + 0x22);

-                *(void **)(unaff_RBP + -0x41) = pvVar14;

-                *(uint *)(unaff_RBP + -0x49) = uVar13;

-              }

-            }

-          }

-        }

-        uVar13 = uVar15;

-        uVar1 = *(ushort *)(lVar3 + 0xe);

-        uVar4 = *(undefined8 *)(unaff_RBP + -0x31);

-        uVar6 = *(undefined4 *)(unaff_RBP + -0x45);

-        *(undefined4 *)(unaff_RBP + -0x21) = uVar6;

-        *(undefined8 *)(unaff_RBP + -9) = uVar4;

-        *(void **)(unaff_RBP + -0x19) = pvVar14;

-        if ((((((*(ushort *)(unaff_RBP + -0x11) < uVar1) && (0x2f < uVar5)) &&

-              (uVar2 = *(ushort *)(lVar3 + 0x28), uVar2 < 0x12)) &&

-             ((uVar15 = *(uint *)(lVar3 + 0x2c), uVar15 == 0 ||

-              (((uint)uVar1 * 8 + 0x10 <= uVar15 && (uVar15 <= uVar5)))))) &&

-            (*(ushort *)(lVar3 + 0x2a) <= uVar5)) &&

-           ((uVar8 = uVar15 + *(ushort *)(lVar3 + 0x2a), uVar15 <= uVar8 && (uVar8 <= uVar5)))) {

-          *(undefined8 *)(unaff_RBP + -0x31) = uVar4;

-          *(void **)(unaff_RBP + -0x41) = pvVar14;

-          *(uint *)(unaff_RBP + -0x49) = uVar16;

-          *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-          if (uVar2 == 10) {

-            sVar10 = *(short *)(lVar3 + 0x2a);

-            *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-            *(void **)(unaff_RBP + -0x41) = pvVar14;

-            *(uint *)(unaff_RBP + -0x49) = uVar16;

-            *(undefined8 *)(unaff_RBP + -0x31) = uVar4;

-            if (sVar10 == 4) {

-              memmove((void *)(unaff_RBP + -0x11),

-                      (void *)((ulonglong)*(uint *)(lVar3 + 0x2c) + lVar3),4);

-              pvVar14 = *(void **)(unaff_RBP + -0x19);

-              *(undefined4 *)(unaff_RBP + -0x45) = *(undefined4 *)(unaff_RBP + -0x21);

-              *(void **)(unaff_RBP + -0x41) = pvVar14;

-              *(undefined8 *)(unaff_RBP + -0x31) = *(undefined8 *)(unaff_RBP + -9);

-              *(uint *)(unaff_RBP + -0x49) = uVar16;

-            }

-          }

-        }

-        uVar1 = *(ushort *)(lVar3 + 0xe);

-        uVar4 = *(undefined8 *)(unaff_RBP + -0x31);

-        uVar6 = *(undefined4 *)(unaff_RBP + -0x45);

-        *(undefined4 *)(unaff_RBP + -0x21) = uVar6;

-        *(undefined8 *)(unaff_RBP + -9) = uVar4;

-        *(void **)(unaff_RBP + -0x19) = pvVar14;

-        if (((((4 < uVar1) && (0x37 < uVar5)) && (uVar2 = *(ushort *)(lVar3 + 0x30), uVar2 < 0x12))

-            && ((uVar15 = *(uint *)(lVar3 + 0x34), uVar15 == 0 ||

-                (((uint)uVar1 * 8 + 0x10 <= uVar15 && (uVar15 <= uVar5)))))) &&

-           ((*(ushort *)(lVar3 + 0x32) <= uVar5 &&

-            ((uVar8 = *(ushort *)(lVar3 + 0x32) + uVar15, uVar15 <= uVar8 && (uVar8 <= uVar5)))))) {

-          *(undefined8 *)(unaff_RBP + -0x31) = uVar4;

-          *(void **)(unaff_RBP + -0x41) = pvVar14;

-          *(uint *)(unaff_RBP + -0x49) = uVar16;

-          *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-          if (uVar2 == 10) {

-            sVar10 = *(short *)(lVar3 + 0x32);

-            *(uint *)(unaff_RBP + -0x49) = uVar16;

-            *(void **)(unaff_RBP + -0x41) = pvVar14;

-            *(undefined8 *)(unaff_RBP + -0x31) = uVar4;

-            *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-            if (sVar10 == 4) {

-              memmove((void *)(unaff_RBP + -1),(void *)((ulonglong)*(uint *)(lVar3 + 0x34) + lVar3),

-                      4);

-              pvVar14 = *(void **)(unaff_RBP + -0x19);

-              *(undefined4 *)(unaff_RBP + -0x45) = *(undefined4 *)(unaff_RBP + -0x21);

-              *(void **)(unaff_RBP + -0x41) = pvVar14;

-              *(undefined8 *)(unaff_RBP + -0x31) = *(undefined8 *)(unaff_RBP + -9);

-              *(uint *)(unaff_RBP + -0x49) = uVar16;

-            }

-          }

-        }

-        uVar1 = *(ushort *)(lVar3 + 0xe);

-        uVar4 = *(undefined8 *)(unaff_RBP + -0x31);

-        uVar6 = *(undefined4 *)(unaff_RBP + -0x45);

-        *(undefined4 *)(unaff_RBP + -0x21) = uVar6;

-        *(undefined8 *)(unaff_RBP + -9) = uVar4;

-        *(void **)(unaff_RBP + -0x19) = pvVar14;

-        if (((((uVar1 < 6) || (uVar5 < 0x40)) || (uVar2 = *(ushort *)(lVar3 + 0x38), 0x11 < uVar2))

-            || ((uVar15 = *(uint *)(lVar3 + 0x3c), uVar15 != 0 &&

-                ((uVar15 < (uint)uVar1 * 8 + 0x10 || (uVar5 < uVar15)))))) ||

-           ((uVar5 < *(ushort *)(lVar3 + 0x3a) ||

-            ((uVar8 = *(ushort *)(lVar3 + 0x3a) + uVar15, uVar8 < uVar15 || (uVar5 < uVar8)))))) {

-          uVar16 = *(uint *)(unaff_RBP + -0x49);

-        }

-        else {

-          *(undefined8 *)(unaff_RBP + -0x31) = uVar4;

-          *(void **)(unaff_RBP + -0x41) = pvVar14;

-          *(uint *)(unaff_RBP + -0x49) = uVar16;

-          *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-          if (uVar2 == 10) {

-            sVar10 = *(short *)(lVar3 + 0x3a);

-            *(void **)(unaff_RBP + -0x41) = pvVar14;

-            *(uint *)(unaff_RBP + -0x49) = uVar16;

-            *(undefined8 *)(unaff_RBP + -0x31) = uVar4;

-            *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-            if (sVar10 == 4) {

-              memmove((void *)(unaff_RBP + 3),(void *)((ulonglong)*(uint *)(lVar3 + 0x3c) + lVar3),4

-                     );

-              pvVar14 = *(void **)(unaff_RBP + -0x19);

-              *(undefined8 *)(unaff_RBP + -0x31) = *(undefined8 *)(unaff_RBP + -9);

-              *(undefined4 *)(unaff_RBP + -0x45) = *(undefined4 *)(unaff_RBP + -0x21);

-              *(void **)(unaff_RBP + -0x41) = pvVar14;

-              *(uint *)(unaff_RBP + -0x49) = uVar16;

-            }

-          }

-        }

-        uVar1 = *(ushort *)(lVar3 + 0xe);

-        uVar4 = *(undefined8 *)(unaff_RBP + -0x31);

-        uVar6 = *(undefined4 *)(unaff_RBP + -0x45);

-        *(uint *)(unaff_RBP + -0x21) = uVar16;

-        *(undefined8 *)(unaff_RBP + -0x19) = uVar4;

-        *(void **)(unaff_RBP + -9) = pvVar14;

-        if ((((uVar1 < 7) || (uVar5 < 0x48)) || (uVar2 = *(ushort *)(lVar3 + 0x40), 0x11 < uVar2))

-           || ((((uVar15 = *(uint *)(lVar3 + 0x44), uVar15 != 0 &&

-                 ((uVar15 < (uint)uVar1 * 8 + 0x10 || (uVar5 < uVar15)))) ||

-                (uVar5 < *(ushort *)(lVar3 + 0x42))) ||

-               ((uVar8 = *(ushort *)(lVar3 + 0x42) + uVar15, uVar8 < uVar15 || (uVar5 < uVar8))))))

-        {

-          uVar5 = *(uint *)(unaff_RBP + -0x49);

-LAB_3:

-          pvVar11 = (void *)(ulonglong)uVar5;

-          _Src_00 = *(void **)(unaff_RBP + -0x41);

-        }

-        else {

-          *(undefined8 *)(unaff_RBP + -0x31) = uVar4;

-          *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-          if (uVar2 == 10) {

-            sVar10 = *(short *)(lVar3 + 0x42);

-            *(undefined8 *)(unaff_RBP + -0x31) = uVar4;

-            *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-            if (sVar10 == 4) {

-              memmove((void *)(unaff_RBP + -0x25),

-                      (void *)((ulonglong)*(uint *)(lVar3 + 0x44) + lVar3),4);

-              *(undefined8 *)(unaff_RBP + -0x41) = *(undefined8 *)(unaff_RBP + -9);

-              *(undefined4 *)(unaff_RBP + -0x45) = uVar6;

-              uVar5 = *(uint *)(unaff_RBP + -0x21);

-              *(undefined8 *)(unaff_RBP + -0x31) = *(undefined8 *)(unaff_RBP + -0x19);

-              goto LAB_3;

-            }

-          }

-          pvVar11 = (void *)(ulonglong)uVar16;

-          _Src_00 = pvVar14;

-        }

-      }

-      uVar5 = *(uint *)(unaff_RBP + 0x77);

-      puVar9 = *(undefined8 **)(unaff_RBP + 0x6f);

-      if (7 < uVar5) {

-        *puVar9 = *(undefined8 *)(unaff_RBP + 7);

-      }

-      if (0xb < uVar5) {

-        *(undefined4 *)(puVar9 + 1) = *(undefined4 *)(unaff_RBP + -0x11);

-      }

-      if (0xf < uVar5) {

-        *(undefined4 *)((longlong)puVar9 + 0xc) = *(undefined4 *)(unaff_RBP + -1);

-      }

-      if (0x13 < uVar5) {

-        *(undefined4 *)(puVar9 + 2) = *(undefined4 *)(unaff_RBP + 3);

-      }

-      if (0x17 < uVar5) {

-        *(undefined4 *)((longlong)puVar9 + 0x14) = *(undefined4 *)(unaff_RBP + -0x25);

-      }

-      if ((0x1b < uVar5) && (*(longlong *)(unaff_RBP + 0x5f) != 0)) {

-        uVar6 = (*DAT_4)(*(undefined8 *)

-                                  (*(longlong *)(*(longlong *)(unaff_RBP + 0x5f) + 0x10) + 8));

-        puVar9 = *(undefined8 **)(unaff_RBP + 0x6f);

-        *(undefined4 *)(puVar9 + 3) = uVar6;

-      }

-      _Size = 0x200;

-      if ((_Src_00 != (void *)0x0) && (0x21b < uVar5)) {

-        pvVar14 = (void *)0x200;

-        if ((uint)pvVar11 < 0x201) {

-          pvVar14 = pvVar11;

-        }

-        memmove((void *)((longlong)puVar9 + 0x1c),_Src_00,(size_t)pvVar14);

-        puVar9 = *(undefined8 **)(unaff_RBP + 0x6f);

-        if (0x1fe < (uint)pvVar11) {

-          pvVar11 = (void *)0x1fe;

-        }

-        *(undefined2 *)((longlong)puVar9 + ((ulonglong)pvVar11 & 0xfffffffffffffffe) + 0x1c) = 0;

-        uVar5 = *(uint *)(unaff_RBP + 0x77);

-      }

-      if ((*(void **)(unaff_RBP + -0x31) != (void *)0x0) && (0x41b < uVar5)) {

-        uVar5 = *(uint *)(unaff_RBP + -0x45);

-        uVar12 = (ulonglong)uVar5;

-        if (uVar5 < 0x201) {

-          _Size = (size_t)uVar5;

-        }

-        memmove((void *)((longlong)puVar9 + 0x21c),*(void **)(unaff_RBP + -0x31),_Size);

-        puVar9 = *(undefined8 **)(unaff_RBP + 0x6f);

-        if (0x1fe < uVar5) {

-          uVar12 = 0x1fe;

-        }

-        *(undefined2 *)((longlong)puVar9 + (uVar12 & 0xfffffffffffffffe) + 0x21c) = 0;

-      }

-      uVar5 = *(uint *)(unaff_RBP + 0x77);

-      if (0x41f < uVar5) {

-        *(uint *)((longlong)puVar9 + 0x41c) = uVar13;

-      }

-      if ((_Src != (void *)0x0) && (0x420 < (int)uVar5)) {

-        uVar16 = uVar5 - 0x420;

-        if (uVar13 < uVar5 - 0x420) {

-          uVar16 = uVar13;

-        }

-        memmove(puVar9 + 0x84,_Src,(ulonglong)uVar16);

-      }

-      uVar13 = uVar13 + 0x420;

-      uVar16 = *(uint *)(unaff_RBP + -0x39);

-      goto LAB_5;

-    }

-    if (((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-       ((byte)((byte)*(undefined4 *)(unaff_RBP + -0x25) &

-              (byte)*(undefined4 *)(WPP_GLOBAL_Control + 0x2c)) == 0)) goto LAB_0;

-    uVar16 = *(uint *)(unaff_RBP + -0x39);

-    if (1 < (byte)WPP_GLOBAL_Control[0x29]) {

-      sVar10 = 0x38;

-      goto LAB_1;

-    }

-  }

-  uVar5 = *(uint *)(unaff_RBP + 0x77);

-LAB_5:

-  if (lVar3 != 0) {

-    ExFreePoolWithTag(lVar3,0);

-  }

-  if (-1 < (int)uVar16) {

-    if (uVar5 < uVar13) {

-      uVar16 = 0x80000005;

-    }

-    if (*(uint **)(unaff_RBP + 0x7f) != (uint *)0x0) {

-      **(uint **)(unaff_RBP + 0x7f) = uVar13;

-    }

-  }

-  return uVar16;

+  if (-1 < (int)uVar5) {

+    return uVar5;

+  }

+  if ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) {

+    return uVar5;

+  }

+  if ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0) {

+    return uVar5;

+  }

+  if ((byte)WPP_GLOBAL_Control[0x29] < 2) {

+    return uVar5;

+  }

+  uVar9 = 0x12;

+  goto LAB_5;

 }
```

## `HsmOsGetPlaceholderCompatMode`  (modified)

```diff
--- HsmOsGetPlaceholderCompatMode
+++ HsmOsGetPlaceholderCompatMode
@@ -1,13 +1,332 @@
+

+/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

 char HsmOsGetPlaceholderCompatMode(longlong param_1)

 

 {

-  char in_AL;

-  undefined7 in_register_00000001;

+  char cVar1;

+  char cVar2;

+  char cVar3;

+  int iVar4;

+  void *pvVar5;

+  ulonglong uVar6;

+  ulonglong uVar7;

+  ulonglong uVar8;

+  longlong lVar9;

+  uint *puVar10;

+  uint *puVar11;

+  char *pcVar12;

+  undefined8 uVar13;

+  uint *puVar14;

+  undefined1 auStack_c8 [32];

+  char local_a8;

+  char local_a7;

+  char local_a6;

+  char local_a5;

+  ulonglong local_a0;

+  int local_98 [2];

+  undefined8 local_90;

+  wchar_t *local_88;

+  undefined8 local_80;

+  undefined8 local_78;

+  ulonglong local_70;

+  undefined8 local_68;

+  undefined8 uStack_60;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  undefined8 local_48;

+  undefined8 uStack_40;

+  ulonglong local_38;

+  uint *puVar15;

   

-  *(char *)CONCAT71(in_register_00000001,in_AL) =

-       *(char *)CONCAT71(in_register_00000001,in_AL) + in_AL;

-  *(char *)(param_1 + -0x75) = *(char *)(param_1 + -0x75) + (char)param_1;

-  return in_AL;

+  local_38 = __security_cookie ^ (ulonglong)auStack_c8;

+  pvVar5 = HsmpGetRequestorThread(param_1);

+  uVar6 = HsmpGetRequestorMode(param_1);

+  local_68 = 0;

+  uStack_60 = 0;

+  local_58 = 0;

+  uStack_50 = 0;

+  local_48 = 0;

+  uStack_40 = 0;

+  local_a5 = '\0';

+  local_a6 = '\0';

+  cVar3 = '\0';

+  local_a8 = '\0';

+  puVar15 = (uint *)0x0;

+  puVar14 = (uint *)0x0;

+  if (DAT_0 == '\0') {

+    local_90 = 0x320030;

+    local_88 = L"AlwaysExposePlaceholders";

+    local_a7 = '\0';

+    local_98[0] = 0;

+    iVar4 = HsmOsGetPolicyDWord(&local_90,&local_a7,local_98);

+    if (iVar4 < 0) goto LAB_1;

+    DAT_0 = '\x01';

+    if ((local_a7 == '\0') || (local_98[0] == 0)) {

+      DAT_2 = '\0';

+      goto LAB_3;

+    }

+    DAT_2 = '\x01';

+  }

+  else {

+LAB_1:

+    if (DAT_2 == '\0') {

+LAB_3:

+      if ((char)uVar6 != '\0') {

+        uVar7 = PsGetThreadProcess(pvVar5);

+        uVar6 = uVar7;

+        local_a0 = uVar7;

+        if (uVar7 == 0) {

+          uVar6 = PsGetCurrentProcess();

+        }

+        uVar8 = PsGetCurrentProcess();

+        if (uVar6 != uVar8) {

+          KeStackAttachProcess(uVar6,&local_68);

+        }

+        local_a5 = uVar6 != uVar8;

+        cVar2 = HsmiOsIsSyncProviderProcess(uVar7);

+        if (cVar2 == '\0') {

+          lVar9 = PsGetThreadTeb(pvVar5);

+          if (lVar9 != 0) {

+            cVar3 = HsmpIs32bitProcess();

+            if (cVar3 == '\0') {

+              cVar3 = *(char *)(lVar9 + 0x280);

+              local_a8 = cVar3;

+            }

+            else {

+              cVar3 = *(char *)(lVar9 + 0x2174);

+              local_a8 = cVar3;

+            }

+          }

+          cVar2 = cVar3;

+          cVar1 = local_a8;

+          if (cVar3 == '\0') {

+            puVar11 = puVar15;

+            if (uVar7 == 0) {

+              uVar13 = PsGetCurrentProcess();

+              lVar9 = PsGetProcessWow64Process(uVar13);

+              if (lVar9 != 0) {

+                uVar6 = PsGetCurrentProcess();

+                goto LAB_4;

+              }

+              uVar13 = PsGetCurrentProcess();

+              lVar9 = PsGetProcessPeb(uVar13);

+              if (lVar9 != 0) {

+                uVar6 = PsGetCurrentProcess();

+                goto LAB_5;

+              }

+            }

+            else {

+              lVar9 = PsGetProcessWow64Process(uVar7);

+              uVar6 = uVar7;

+              if (lVar9 == 0) {

+                lVar9 = PsGetProcessPeb();

+                if (lVar9 != 0) {

+LAB_5:

+                  lVar9 = PsGetProcessPeb(uVar6);

+                  puVar11 = (uint *)(lVar9 + 0x2c8);

+                }

+              }

+              else {

+LAB_4:

+                lVar9 = PsGetProcessWow64Process(uVar6);

+                puVar11 = (uint *)(lVar9 + 0x1d8);

+              }

+            }

+            puVar10 = puVar15;

+            if (uVar7 == 0) {

+              uVar13 = PsGetCurrentProcess();

+              lVar9 = PsGetProcessWow64Process(uVar13);

+              if (lVar9 != 0) {

+                uVar6 = PsGetCurrentProcess();

+                goto LAB_6;

+              }

+              uVar13 = PsGetCurrentProcess();

+              lVar9 = PsGetProcessPeb(uVar13);

+              if (lVar9 != 0) {

+                uVar6 = PsGetCurrentProcess();

+                goto LAB_7;

+              }

+            }

+            else {

+              lVar9 = PsGetProcessWow64Process(uVar7);

+              uVar6 = uVar7;

+              if (lVar9 == 0) {

+                lVar9 = PsGetProcessPeb();

+                if (lVar9 != 0) {

+LAB_7:

+                  lVar9 = PsGetProcessPeb(uVar6);

+                  puVar10 = (uint *)(lVar9 + 0x7b0);

+                }

+              }

+              else {

+LAB_6:

+                lVar9 = PsGetProcessWow64Process(uVar6);

+                puVar10 = (uint *)(lVar9 + 0x468);

+              }

+            }

+            cVar2 = (char)*puVar10;

+            cVar1 = cVar2;

+            if (cVar2 == '\0') {

+              if ((puVar11 == (uint *)0x0) || ((*puVar11 & 0x20000000) == 0)) {

+                puVar10 = puVar15;

+                if (uVar7 == 0) {

+                  uVar13 = PsGetCurrentProcess();

+                  lVar9 = PsGetProcessWow64Process(uVar13);

+                  if (lVar9 != 0) {

+                    uVar6 = PsGetCurrentProcess();

+                    goto LAB_8;

+                  }

+                  uVar13 = PsGetCurrentProcess();

+                  lVar9 = PsGetProcessPeb(uVar13);

+                  if (lVar9 != 0) {

+                    uVar6 = PsGetCurrentProcess();

+                    goto LAB_9;

+                  }

+                }

+                else {

+                  lVar9 = PsGetProcessWow64Process(uVar7);

+                  uVar6 = uVar7;

+                  if (lVar9 == 0) {

+                    lVar9 = PsGetProcessPeb();

+                    if (lVar9 != 0) {

+LAB_9:

+                      lVar9 = PsGetProcessPeb(uVar6);

+                      puVar10 = (uint *)(lVar9 + 0x7a8);

+                    }

+                  }

+                  else {

+LAB_8:

+                    lVar9 = PsGetProcessWow64Process(uVar6);

+                    puVar10 = (uint *)(lVar9 + 0x460);

+                  }

+                }

+                HsmiOsIsForegroundHydrator(uVar7,puVar11,puVar10,&local_a6);

+                cVar2 = cVar3;

+                cVar1 = local_a8;

+              }

+              else {

+                cVar2 = '\x01';

+                local_a8 = '\x01';

+                cVar1 = local_a8;

+              }

+            }

+          }

+          local_a8 = cVar1;

+          if (cVar2 != '\0') goto LAB_10;

+          local_a0 = (ulonglong)Feature_CloudFileDisguisePlaceholders__private_featureState;

+          if ((Feature_CloudFileDisguisePlaceholders__private_featureState & 0x10) == 0) {

+            local_a0 = (ulonglong)(Feature_CloudFileDisguisePlaceholders__private_featureState | 1);

+            wil_details_FeatureReporting_ReportUsageToService(0x140028f70,local_a0,3);

+            wil_details_FeatureStateCache_TryEnableDeviceUsageFastPath

+                      ((uint)local_a0,3,&Feature_CloudFileDisguisePlaceholders__private_descriptor);

+          }

+          local_80 = 0;

+          local_78 = 0;

+          local_70 = uVar7;

+          puVar11 = HsmiOsGetProcessFlags((longlong)&local_80);

+          if (((ulonglong)puVar11 & 1) == 0) {

+            if (((local_a6 != '\0') && (((ulonglong)puVar11 & 2) != 0)) &&

+               (local_a0 = (ulonglong)

+                           Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState,

+               (Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState & 0x10) == 0))

+            {

+              local_a0 = (ulonglong)

+                         (Feature_CloudFileDisguisePlaceholdersForGUIApps__private_featureState | 1)

+              ;

+              wil_details_FeatureReporting_ReportUsageToService(0x140029018,local_a0,3);

+              wil_details_FeatureStateCache_TryEnableDeviceUsageFastPath

+                        ((uint)local_a0,3,

+                         &Feature_CloudFileDisguisePlaceholdersForGUIApps__private_descriptor);

+            }

+            cVar2 = '\x01';

+          }

+          else {

+            cVar2 = '\x02';

+          }

+          local_a8 = cVar2;

+          if (uVar7 == 0) {

+            uVar13 = PsGetCurrentProcess();

+            lVar9 = PsGetProcessWow64Process(uVar13);

+            if (lVar9 != 0) {

+              uVar6 = PsGetCurrentProcess();

+              goto LAB_11;

+            }

+            uVar13 = PsGetCurrentProcess();

+            lVar9 = PsGetProcessPeb(uVar13);

+            if (lVar9 != 0) {

+              uVar6 = PsGetCurrentProcess();

+              goto LAB_12;

+            }

+          }

+          else {

+            lVar9 = PsGetProcessWow64Process(uVar7);

+            uVar6 = uVar7;

+            if (lVar9 == 0) {

+              lVar9 = PsGetProcessPeb();

+              puVar14 = puVar15;

+              if (lVar9 != 0) {

+LAB_12:

+                lVar9 = PsGetProcessPeb(uVar6);

+                puVar14 = (uint *)(lVar9 + 0x7a8);

+              }

+            }

+            else {

+LAB_11:

+              lVar9 = PsGetProcessWow64Process(uVar6);

+              puVar14 = (uint *)(lVar9 + 0x460);

+            }

+          }

+          if (uVar7 == 0) {

+            uVar13 = PsGetCurrentProcess();

+            lVar9 = PsGetProcessWow64Process(uVar13);

+            if (lVar9 != 0) {

+              uVar7 = PsGetCurrentProcess();

+              goto LAB_13;

+            }

+            uVar13 = PsGetCurrentProcess();

+            lVar9 = PsGetProcessPeb(uVar13);

+            if (lVar9 != 0) {

+              uVar7 = PsGetCurrentProcess();

+              goto LAB_14;

+            }

+          }

+          else {

+            lVar9 = PsGetProcessWow64Process(uVar7);

+            if (lVar9 == 0) {

+              lVar9 = PsGetProcessPeb();

+              if (lVar9 == 0) goto LAB_15;

+LAB_14:

+              lVar9 = PsGetProcessPeb(uVar7);

+              pcVar12 = (char *)(lVar9 + 0x7b0);

+            }

+            else {

+LAB_13:

+              lVar9 = PsGetProcessWow64Process(uVar7);

+              pcVar12 = (char *)(lVar9 + 0x468);

+            }

+            if (pcVar12 != (char *)0x0) {

+              *pcVar12 = cVar2;

+            }

+          }

+LAB_15:

+          if (puVar14 != (uint *)0x0) {

+            LOCK();

+            *puVar14 = *puVar14 | 0x20;

+            UNLOCK();

+            cVar2 = local_a8;

+          }

+          goto LAB_10;

+        }

+      }

+    }

+  }

+  local_a8 = '\x02';

+  cVar2 = '\x02';

+LAB_10:

+  if (local_a5 != '\0') {

+    KeUnstackDetachProcess(&local_68);

+  }

+  return cVar2;

 }
```

## `HsmpUnloadPropertyStream`  (modified)

```diff
--- HsmpUnloadPropertyStream
+++ HsmFltPreSetRenameInformation
@@ -1,719 +1,56 @@
 

-uint HsmpUnloadPropertyStream(longlong param_1)

+int HsmFltPreSetRenameInformation

+              (longlong param_1,longlong param_2,ulonglong param_3,longlong param_4,longlong param_5

+              ,undefined8 *param_6)

 

 {

   longlong lVar1;

-  ushort uVar2;

-  ushort uVar3;

-  uint uVar4;

-  uint uVar5;

-  int iVar6;

-  uint uVar7;

-  undefined4 uVar8;

-  undefined8 uVar9;

-  ulonglong uVar10;

-  longlong lVar11;

-  longlong lVar12;

-  uint uVar13;

-  undefined *puVar14;

-  undefined2 uVar15;

-  uint in_EDX;

-  ulonglong uVar16;

-  undefined8 uVar17;

-  longlong unaff_RBX;

-  longlong *plVar18;

+  int iVar2;

+  ulonglong in_RAX;

+  byte *pbVar3;

+  undefined2 uVar4;

   longlong unaff_RBP;

-  uint unaff_ESI;

-  longlong unaff_RDI;

-  uint in_R8D;

-  ushort *puVar19;

-  short in_R9W;

-  short in_R10W;

-  uint in_R11D;

-  void *pvVar20;

-  uint uVar21;

-  undefined8 unaff_R12;

-  longlong unaff_R13;

-  byte bVar22;

-  uint unaff_R14D;

-  short unaff_R15W;

-  int *piVar23;

-  void *pvVar24;

-  void *pvVar25;

+  longlong unaff_RSI;

+  uint unaff_R15D;

+  undefined4 in_stack_00000020;

+  longlong *in_stack_00000038;

   

-  *(char *)(unaff_RDI + 0x32) = *(char *)(unaff_RDI + 0x32) << 1;

-  uVar5 = unaff_ESI;

-  if ((((*(ushort *)(unaff_RBX + 0x22) <= in_R8D) &&

-       (uVar4 = *(ushort *)(unaff_RBX + 0x22) + in_EDX, in_EDX <= uVar4)) && (uVar4 <= in_R8D)) &&

-     ((in_R9W == 0xb && (*(short *)(unaff_RBX + 0x22) == in_R10W)))) {

-    unaff_R12 = *(undefined8 *)((ulonglong)*(uint *)(unaff_RBX + 0x24) + unaff_RBX);

-    *(undefined8 *)(unaff_RBP + -0x69) = unaff_R12;

-    uVar5 = in_R11D;

-  }

-  HsmDbgBreakOnStatus(uVar5);

-  bVar22 = (byte)unaff_R14D;

-  if ((int)uVar5 < 0) {

+  pbVar3 = (byte *)(in_RAX & 0xffffffffffffff20);

+  *pbVar3 = *pbVar3 - (byte)pbVar3;

+  *pbVar3 = *pbVar3 & (byte)pbVar3;

+  iVar2 = HsmpOpenFileByPath(param_1,param_2,(int)param_3,param_4,in_stack_00000020,param_5,param_6,

+                             in_stack_00000038);

+  HsmDbgBreakOnStatus(iVar2);

+  lVar1 = *(longlong *)(unaff_RBP + -0x18);

+  if (iVar2 < 0) {

     if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-    uVar15 = 0x11;

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_0;

+    uVar4 = 0x2d;

   }

   else {

-    uVar5 = ObReferenceObjectByHandle

-                      (unaff_R12,0,*(undefined8 *)IoFileObjectType_exref,1,unaff_RBP + -0x49);

-    HsmDbgBreakOnStatus(uVar5);

-    if (-1 < (int)uVar5) {

-      uVar5 = FltGetVolumeFromFileObject

-                        (Globals,*(undefined8 *)(unaff_RBP + -0x49),unaff_RBP + -0x29);

-      HsmDbgBreakOnStatus(uVar5);

-      if ((int)uVar5 < 0) {

-        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-        uVar15 = 0x13;

-      }

-      else {

-        uVar5 = FltAttachVolumeAtAltitude

-                          (Globals,*(undefined8 *)(unaff_RBP + -0x29),unaff_RBP + 0x17,

-                           unaff_RBP + -9,unaff_RBP + -0x21);

-        HsmDbgBreakOnStatus(uVar5);

-        if (uVar5 == 0xc01c0012) {

-          uVar5 = FltGetVolumeInstanceFromName

-                            (Globals,*(undefined8 *)(unaff_RBP + -0x29),(ushort *)(unaff_RBP + -9),

-                             unaff_RBP + -0x21);

-          HsmDbgBreakOnStatus(uVar5);

-        }

-        else {

-          TlmWriteFilterAttachEvent

-                    (uVar5,(ushort *)(unaff_RBP + 0x17),(ushort *)(unaff_RBP + -9),

-                     *(undefined8 *)(unaff_RBP + -0x29));

-        }

-        if ((int)uVar5 < 0) {

-          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-             ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-          uVar15 = 0x14;

-        }

-        else {

-          uVar5 = FltGetInstanceContext(*(undefined8 *)(unaff_RBP + -0x21),unaff_RBP + -0x51);

-          HsmDbgBreakOnStatus(uVar5);

-          if ((int)uVar5 < 0) {

-            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-               ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-            uVar15 = 0x15;

-          }

-          else {

-            uVar10 = *(ulonglong *)(unaff_RBP + -0x49);

-            uVar5 = HsmpAccessCheck(*(longlong *)(unaff_RBP + -0x51),uVar10,unaff_R14D);

-            HsmDbgBreakOnStatus(uVar5);

-            pvVar20 = (void *)0x0;

-            if ((int)uVar5 < 0) {

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-              uVar15 = 0x16;

-            }

-            else {

-              *(undefined8 *)(unaff_RBP + -0x59) =

-                   *(undefined8 *)(*(longlong *)(unaff_RBP + -0x51) + 0x10);

-              if (unaff_R15W == 1) goto LAB_0;

-              if (unaff_R15W == (short)unaff_R14D) {

-                piVar23 = (int *)0x0;

-                uVar4 = 0;

-                uVar21 = 0;

-                uVar5 = unaff_ESI;

-                if (0x17 < *(uint *)(unaff_RBP + 0x7f)) {

-                  uVar4 = uVar21;

-                  if (((((3 < *(ushort *)(unaff_RBX + 0xe)) &&

-                        (uVar21 = *(uint *)(unaff_RBX + 8), 0x2f < uVar21)) &&

-                       (*(ushort *)(unaff_RBX + 0x28) < 0x12)) &&

-                      (((uVar13 = *(uint *)(unaff_RBX + 0x2c), uVar13 == 0 ||

-                        (((uint)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 <= uVar13 &&

-                         (uVar13 <= uVar21)))) &&

-                       ((*(ushort *)(unaff_RBX + 0x2a) <= uVar21 &&

-                        ((uVar7 = *(ushort *)(unaff_RBX + 0x2a) + uVar13, uVar13 <= uVar7 &&

-                         (uVar7 <= uVar21)))))))) && (*(ushort *)(unaff_RBX + 0x28) == 0x11)) {

-                    if ((*(uint *)(unaff_RBX + 0x2c) != 0) && (*(ushort *)(unaff_RBX + 0x2a) != 0))

-                    {

-                      piVar23 = (int *)(unaff_RBX + (ulonglong)*(uint *)(unaff_RBX + 0x2c));

-                    }

-                    uVar5 = 0;

-                    uVar4 = (uint)*(ushort *)(unaff_RBX + 0x2a);

-                  }

-                  if ((int)uVar5 < 0) {

-                    uVar4 = 0;

-                  }

-                }

-                HsmDbgBreakOnStatus(uVar5);

-                if ((int)uVar5 < 0) {

-                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                     ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                  uVar15 = 0x17;

-                }

-                else {

-                  if (piVar23 != (int *)0x0) {

-                    uVar21 = 0;

-                    if (((0x17 < uVar4) && (uVar21 = 1, *piVar23 == 0x6e497253)) &&

-                       (((*(byte *)(piVar23 + 3) & bVar22) == 0 ||

-                        (iVar6 = RtlComputeCrc32(0,piVar23 + 2,uVar4 - 8), uVar21 = unaff_R14D,

-                        piVar23[1] == iVar6)))) {

-                      uVar13 = piVar23[2];

-                      uVar21 = 3;

-                      if (uVar13 <= uVar4) {

-                        uVar2 = *(ushort *)((longlong)piVar23 + 0xe);

-                        uVar10 = 0;

-                        uVar21 = 4;

-                        if ((uVar2 != 0) && (uVar21 = 5, (uint)uVar2 * 8 + 0x10 < uVar13)) {

-                          uVar21 = 0x10000;

-                          while( true ) {

-                            uVar5 = (uint)uVar2;

-                            if (8 < uVar2) {

-                              uVar5 = 9;

-                            }

-                            if (uVar5 <= (uint)uVar10) {

-                              uVar5 = unaff_ESI;

-                              if (((((7 < *(ushort *)((longlong)piVar23 + 0xe)) && (0x4f < uVar13))

-                                   && (*(ushort *)(piVar23 + 0x12) < 0x12)) &&

-                                  ((uVar21 = piVar23[0x13], uVar21 == 0 ||

-                                   (((uint)*(ushort *)((longlong)piVar23 + 0xe) * 8 + 0x10 <= uVar21

-                                    && (uVar21 <= uVar13)))))) &&

-                                 ((*(ushort *)((longlong)piVar23 + 0x4a) <= uVar13 &&

-                                  (((uVar7 = *(ushort *)((longlong)piVar23 + 0x4a) + uVar21,

-                                    uVar21 <= uVar7 && (uVar7 <= uVar13)) &&

-                                   ((*(ushort *)(piVar23 + 0x12) == 0x10 &&

-                                    (*(short *)((longlong)piVar23 + 0x4a) == 0x10)))))))) {

-                                memmove((void *)(*(longlong *)(unaff_RBP + 0x67) + 0x108),

-                                        (void *)((ulonglong)(uint)piVar23[0x13] + (longlong)piVar23)

-                                        ,0x10);

-                                uVar5 = 0;

-                              }

-                              HsmDbgBreakOnStatus(uVar5);

-                              if ((int)uVar5 < 0) {

-                                if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                                   ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                                uVar15 = 0x1a;

-                                goto LAB_1;

-                              }

-                              uVar5 = HsmCldPersistSyncRootInfo

-                                                (*(longlong *)(unaff_RBP + -0x51),

-                                                 *(undefined8 *)(unaff_RBP + -0x49),piVar23,uVar4);

-                              HsmDbgBreakOnStatus(uVar5);

-                              if (((-1 < (int)uVar5) ||

-                                  ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control)) ||

-                                 (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0 ||

-                                  ((byte)WPP_GLOBAL_Control[0x29] < bVar22)))) goto LAB_0;

-                              uVar15 = 0x1b;

-                              unaff_ESI = uVar5;

-                              goto LAB_2;

-                            }

-                            if ((((0x11 < *(ushort *)(piVar23 + uVar10 * 2 + 4)) ||

-                                 ((uVar5 = piVar23[uVar10 * 2 + 5], uVar5 != 0 &&

-                                  (uVar5 < (uint)uVar2 * 8 + 0x10)))) || (uVar13 < uVar5)) ||

-                               (((uVar3 = *(ushort *)((longlong)piVar23 + uVar10 * 8 + 0x12),

-                                 uVar13 < uVar3 || (uVar7 = uVar3 + uVar5, uVar7 < uVar5)) ||

-                                (uVar13 < uVar7)))) break;

-                            uVar21 = uVar21 + 1;

-                            uVar10 = (ulonglong)((uint)uVar10 + 1);

-                          }

-                        }

-                      }

-                    }

-                    uVar5 = 0xc000000d;

-                    HsmDbgBreakOnStatus(-0x3ffffff3);

-                    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                       (bVar22 <= (byte)WPP_GLOBAL_Control[0x29])) {

-                      WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x19,

-                                &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,uVar21);

-                    }

-                    goto LAB_0;

-                  }

-                  uVar5 = 0xc000cf0b;

-                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                     ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                  uVar15 = 0x18;

-                  uVar5 = 0xc000cf0b;

-                }

-                goto LAB_1;

-              }

-              if (unaff_R15W == 3) {

-                uVar5 = HsmCldDeleteSyncRootInfo

-                                  (*(longlong *)(unaff_RBP + -0x51),

-                                   *(undefined8 *)(unaff_RBP + -0x49));

-                HsmDbgBreakOnStatus(uVar5);

-                if (((-1 < (int)uVar5) || ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control))

-                   || (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0 ||

-                       ((byte)WPP_GLOBAL_Control[0x29] < bVar22)))) goto LAB_0;

-                uVar15 = 0x1c;

-                goto LAB_3;

-              }

-              uVar4 = 0;

-              if (unaff_R15W == 7) {

-                pvVar24 = (void *)0x0;

-                uVar5 = HsmiQueryFullFilePath

-                                  (*(undefined8 *)(*(longlong *)(unaff_RBP + -0x51) + 0x20),uVar10,

-                                   *(longlong *)(unaff_RBP + -0x49),0x101,

-                                   (undefined4 *)(unaff_RBP + 7));

-                HsmDbgBreakOnStatus(uVar5);

-                if ((int)uVar5 < 0) {

-                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                     ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                  uVar15 = 0x1d;

-                  unaff_ESI = uVar5;

-                }

-                else {

-                  uVar5 = *(uint *)(unaff_RBP + 0x7f);

-                  if (((((((uVar5 < 0x18) || (*(ushort *)(unaff_RBX + 0xe) < 0x17)) ||

-                         (uVar21 = *(uint *)(unaff_RBX + 8), uVar21 < 200)) ||

-                        (0x11 < *(ushort *)(unaff_RBX + 0xc0))) ||

-                       ((uVar13 = *(uint *)(unaff_RBX + 0xc4), uVar13 != 0 &&

-                        ((uVar13 < (uint)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 ||

-                         (uVar21 < uVar13)))))) || (uVar21 < *(ushort *)(unaff_RBX + 0xc2))) ||

-                     (((uVar7 = *(ushort *)(unaff_RBX + 0xc2) + uVar13, uVar7 < uVar13 ||

-                       (uVar21 < uVar7)) ||

-                      ((*(ushort *)(unaff_RBX + 0xc0) != 6 || (*(short *)(unaff_RBX + 0xc2) != 8))))

-                     )) {

-                    uVar9 = *(undefined8 *)(unaff_RBP + -0x41);

-                  }

-                  else {

-                    unaff_ESI = 0;

-                    uVar9 = *(undefined8 *)((ulonglong)*(uint *)(unaff_RBX + 0xc4) + unaff_RBX);

-                  }

-                  HsmDbgBreakOnStatus(unaff_ESI);

-                  if ((int)unaff_ESI < 0) {

-                    uVar5 = unaff_ESI;

-                    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                       ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                    uVar15 = 0x1e;

-                  }

-                  else {

-                    pvVar25 = pvVar20;

-                    if (((((((0x17 < uVar5) && (9 < *(ushort *)(unaff_RBX + 0xe))) &&

-                           (uVar5 = *(uint *)(unaff_RBX + 8), pvVar25 = pvVar24, 0x5f < uVar5)) &&

-                          (*(ushort *)(unaff_RBX + 0x58) < 0x12)) &&

-                         (((uVar21 = *(uint *)(unaff_RBX + 0x5c), uVar21 == 0 ||

-                           (((uint)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 <= uVar21 &&

-                            (uVar21 <= uVar5)))) && (*(ushort *)(unaff_RBX + 0x5a) <= uVar5)))) &&

-                        ((uVar13 = *(ushort *)(unaff_RBX + 0x5a) + uVar21, uVar21 <= uVar13 &&

-                         (uVar13 <= uVar5)))) && (*(ushort *)(unaff_RBX + 0x58) == 0x11)) {

-                      if ((*(uint *)(unaff_RBX + 0x5c) != 0) && (*(ushort *)(unaff_RBX + 0x5a) != 0)

-                         ) {

-                        pvVar20 = (void *)(unaff_RBX + (ulonglong)*(uint *)(unaff_RBX + 0x5c));

-                      }

-                      uVar4 = (uint)*(ushort *)(unaff_RBX + 0x5a);

-                      pvVar25 = pvVar20;

-                    }

-                    uVar5 = CldSyncReportSyncStatusOnRoot

-                                      (*(longlong **)(unaff_RBP + -0x59),uVar9,

-                                       (undefined2 *)(unaff_RBP + 7),pvVar25,uVar4);

-                    HsmDbgBreakOnStatus(uVar5);

-                    if ((((-1 < (int)uVar5) ||

-                         ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control)) ||

-                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                       ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                    uVar15 = 0x1f;

-                    unaff_ESI = uVar5;

-                  }

-                }

-              }

-              else {

-                uVar5 = unaff_ESI;

-                if (((0x17 < *(uint *)(unaff_RBP + 0x7f)) && (4 < *(ushort *)(unaff_RBX + 0xe))) &&

-                   ((uVar21 = *(uint *)(unaff_RBX + 8), 0x37 < uVar21 &&

-                    (*(ushort *)(unaff_RBX + 0x30) < 0x12)))) {

-                  uVar13 = *(uint *)(unaff_RBX + 0x34);

-                  uVar10 = (ulonglong)uVar13;

-                  if (((uVar13 == 0) ||

-                      (((ulonglong)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 <= uVar10 &&

-                       (uVar13 <= uVar21)))) &&

-                     ((*(ushort *)(unaff_RBX + 0x32) <= uVar21 &&

-                      ((((uVar7 = *(ushort *)(unaff_RBX + 0x32) + uVar13, uVar13 <= uVar7 &&

-                         (uVar7 <= uVar21)) && (*(ushort *)(unaff_RBX + 0x30) == 6)) &&

-                       (*(short *)(unaff_RBX + 0x32) == 8)))))) {

-                    *(undefined8 *)(unaff_RBP + -0x61) =

-                         *(undefined8 *)((ulonglong)*(uint *)(unaff_RBX + 0x34) + unaff_RBX);

-                    uVar5 = uVar4;

-                  }

-                }

-                HsmDbgBreakOnStatus(uVar5);

-                if ((int)uVar5 < 0) {

-                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                     ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                  uVar15 = 0x20;

-                  unaff_ESI = uVar5;

-                }

-                else {

-                  if (unaff_R15W != 4) {

-                    if (unaff_R15W != 5) {

-                      uVar5 = 0xc0000010;

-                      HsmDbgBreakOnStatus(-0x3ffffff0);

-                      goto LAB_0;

-                    }

-                    if (((((*(uint *)(unaff_RBP + 0x7f) < 0x18) ||

-                          (*(ushort *)(unaff_RBX + 0xe) < 0x17)) ||

-                         ((uVar5 = *(uint *)(unaff_RBX + 8), uVar5 < 200 ||

-                          (0x11 < *(ushort *)(unaff_RBX + 0xc0))))) ||

-                        ((uVar4 = *(uint *)(unaff_RBX + 0xc4), uVar4 != 0 &&

-                         ((uVar4 < (uint)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 || (uVar5 < uVar4))

-                         )))) || (((uVar5 < *(ushort *)(unaff_RBX + 0xc2) ||

-                                   (((uVar21 = *(ushort *)(unaff_RBX + 0xc2) + uVar4, uVar21 < uVar4

-                                     || (uVar5 < uVar21)) || (*(ushort *)(unaff_RBX + 0xc0) != 6))))

-                                  || (*(short *)(unaff_RBX + 0xc2) != 8)))) {

-                      uVar5 = unaff_ESI;

-                      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                         ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                      uVar15 = 0x2d;

-                      goto LAB_2;

-                    }

-                    lVar11 = *(longlong *)((ulonglong)*(uint *)(unaff_RBX + 0xc4) + unaff_RBX);

-                    FltAcquirePushLockExclusiveEx(&DAT_4,0);

-                    uVar10 = Feature_4003440952__private_IsEnabledDeviceUsageNoInline();

-                    if ((int)uVar10 != 0) {

-                      lVar1 = unaff_R13 + 0x90;

-                      FltAcquirePushLockSharedEx(lVar1,0);

-                      lVar12 = CldiPortLookupSyncRootNoLock

-                                         (unaff_R13,*(undefined8 *)(unaff_RBP + -0x61));

-                      if ((lVar12 == 0) || (*(longlong *)(lVar12 + 0x18) != lVar11)) {

-                        uVar5 = 0xc000cf0b;

-                        HsmDbgBreakOnStatus(-0x3fff30f5);

-                        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                           (bVar22 <= (byte)WPP_GLOBAL_Control[0x29])) {

-                          WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2e,

-                                      &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,unaff_R13);

-                        }

-                        FltReleasePushLockEx(lVar1,0);

-                        goto LAB_5;

-                      }

-                      FltReleasePushLockEx(lVar1,0);

-                    }

-                    uVar10 = Feature_2414246201__private_IsEnabledDeviceUsageNoInline();

-                    if ((int)uVar10 == 0) {

-                      uVar5 = CldSyncDisconnectRootDeprecated

-                                        (*(longlong *)(unaff_RBP + -0x59),lVar11,

-                                         *(longlong *)(unaff_RBP + -0x61),

-                                         (undefined8 *)(unaff_RBP + -0x39));

-                    }

-                    else {

-                      uVar9 = CldSyncDisconnectRoot

-                                        (*(longlong *)(unaff_RBP + -0x59),unaff_R13,lVar11,

-                                         *(longlong *)(unaff_RBP + -0x61),

-                                         (undefined8 *)(unaff_RBP + -0x39));

-                      uVar5 = (uint)uVar9;

-                    }

-                    HsmDbgBreakOnStatus(uVar5);

-                    if ((int)uVar5 < 0) {

-                      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                         (bVar22 <= (byte)WPP_GLOBAL_Control[0x29])) {

-                        uVar15 = 0x2f;

-                        goto LAB_6;

-                      }

-                    }

-                    else {

-                      FltAcquirePushLockExclusiveEx(unaff_R13 + 0x90,0);

-                      RtlDeleteElementGenericTableAvl(unaff_R13 + 0x98,unaff_RBP + -0x61);

-                      FltReleasePushLockEx(unaff_R13 + 0x90,0);

-                      piVar23 = (int *)(unaff_R13 + 0x8c);

-                      *piVar23 = *piVar23 + -1;

-                      if (*piVar23 == 0) {

-                        lVar11 = IoGetCurrentProcess();

-                        HsmOsClearProcessAsSyncProvider(lVar11);

-                        CldReleaseProcessInfo((undefined8 *)(unaff_R13 + 0x68));

-                      }

-                    }

-                    goto LAB_5;

-                  }

-                  *(undefined8 *)(unaff_RBP + -0x39) = 0;

-                  *(undefined4 *)(unaff_RBP + -0x2d) = 0;

-                  *(undefined4 *)(unaff_RBP + -0x31) = 0;

-                  *(undefined4 *)(unaff_RBP + -0x11) = 0;

-                  *(undefined8 *)(unaff_RBP + -0x19) = 0;

-                  uVar9 = HsmpCheckLegacyFilterAbsence();

-                  uVar5 = (uint)uVar9;

-                  HsmDbgBreakOnStatus(uVar5);

-                  if ((int)uVar5 < 0) {

-                    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                       ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                    uVar15 = 0x21;

-                    unaff_ESI = uVar5;

-                  }

-                  else {

-                    uVar5 = HsmiQueryFullFilePath

-                                      (*(undefined8 *)(*(longlong *)(unaff_RBP + -0x51) + 0x20),

-                                       uVar10,*(longlong *)(unaff_RBP + -0x49),0x101,

-                                       (undefined4 *)(unaff_RBP + 7));

-                    HsmDbgBreakOnStatus(uVar5);

-                    if ((int)uVar5 < 0) {

-                      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                         ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                      uVar15 = 0x22;

-                      unaff_ESI = uVar5;

-                    }

-                    else {

-                      uVar4 = *(uint *)(unaff_RBP + 0x7f);

-                      uVar5 = unaff_ESI;

-                      if (((0x17 < uVar4) && (5 < *(ushort *)(unaff_RBX + 0xe))) &&

-                         ((((uVar21 = *(uint *)(unaff_RBX + 8), 0x3f < uVar21 &&

-                            (*(ushort *)(unaff_RBX + 0x38) < 0x12)) &&

-                           ((uVar13 = *(uint *)(unaff_RBX + 0x3c), uVar13 == 0 ||

-                            (((uint)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 <= uVar13 &&

-                             (uVar13 <= uVar21)))))) &&

-                          ((*(ushort *)(unaff_RBX + 0x3a) <= uVar21 &&

-                           ((((uVar7 = *(ushort *)(unaff_RBX + 0x3a) + uVar13, uVar13 <= uVar7 &&

-                              (uVar7 <= uVar21)) && (*(ushort *)(unaff_RBX + 0x38) == 10)) &&

-                            (*(short *)(unaff_RBX + 0x3a) == 4)))))))) {

-                        *(undefined4 *)(unaff_RBP + -0x2d) =

-                             *(undefined4 *)((ulonglong)*(uint *)(unaff_RBX + 0x3c) + unaff_RBX);

-                        uVar5 = 0;

-                      }

-                      HsmDbgBreakOnStatus(uVar5);

-                      if ((int)uVar5 < 0) {

-                        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                           ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                        uVar15 = 0x23;

-                        unaff_ESI = uVar5;

-                      }

-                      else {

-                        uVar5 = unaff_ESI;

-                        if (((((0x17 < uVar4) && (0xe < *(ushort *)(unaff_RBX + 0xe))) &&

-                             ((uVar21 = *(uint *)(unaff_RBX + 8), 0x87 < uVar21 &&

-                              (*(ushort *)(unaff_RBX + 0x80) < 0x12)))) &&

-                            ((uVar13 = *(uint *)(unaff_RBX + 0x84), uVar13 == 0 ||

-                             (((uint)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 <= uVar13 &&

-                              (uVar13 <= uVar21)))))) &&

-                           (((*(ushort *)(unaff_RBX + 0x82) <= uVar21 &&

-                             (((uVar7 = *(ushort *)(unaff_RBX + 0x82) + uVar13, uVar13 <= uVar7 &&

-                               (uVar7 <= uVar21)) && (*(ushort *)(unaff_RBX + 0x80) == 10)))) &&

-                            (*(short *)(unaff_RBX + 0x82) == 4)))) {

-                          *(undefined4 *)(unaff_RBP + -0x11) =

-                               *(undefined4 *)((ulonglong)*(uint *)(unaff_RBX + 0x84) + unaff_RBX);

-                          uVar5 = 0;

-                        }

-                        HsmDbgBreakOnStatus(uVar5);

-                        if ((int)uVar5 < 0) {

-                          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                             ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                          uVar15 = 0x24;

-                          unaff_ESI = uVar5;

-                        }

-                        else {

-                          uVar5 = unaff_ESI;

-                          if (((((0x17 < uVar4) && (0xd < *(ushort *)(unaff_RBX + 0xe))) &&

-                               ((uVar21 = *(uint *)(unaff_RBX + 8), 0x7f < uVar21 &&

-                                (*(ushort *)(unaff_RBX + 0x78) < 0x12)))) &&

-                              ((uVar13 = *(uint *)(unaff_RBX + 0x7c), uVar13 == 0 ||

-                               (((uint)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 <= uVar13 &&

-                                (uVar13 <= uVar21)))))) &&

-                             (((*(ushort *)(unaff_RBX + 0x7a) <= uVar21 &&

-                               (((uVar7 = *(ushort *)(unaff_RBX + 0x7a) + uVar13, uVar13 <= uVar7 &&

-                                 (uVar7 <= uVar21)) && (*(ushort *)(unaff_RBX + 0x78) == 10)))) &&

-                              (*(short *)(unaff_RBX + 0x7a) == 4)))) {

-                            *(undefined4 *)(unaff_RBP + -0x31) =

-                                 *(undefined4 *)((ulonglong)*(uint *)(unaff_RBX + 0x7c) + unaff_RBX)

-                            ;

-                            uVar5 = 0;

-                          }

-                          HsmDbgBreakOnStatus(uVar5);

-                          if ((int)uVar5 < 0) {

-                            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                               ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                            uVar15 = 0x25;

-                            unaff_ESI = uVar5;

-                          }

-                          else {

-                            if (((((0x17 < uVar4) && (0x16 < *(ushort *)(unaff_RBX + 0xe))) &&

-                                 ((uVar5 = *(uint *)(unaff_RBX + 8), 199 < uVar5 &&

-                                  (*(ushort *)(unaff_RBX + 0xc0) < 0x12)))) &&

-                                ((uVar4 = *(uint *)(unaff_RBX + 0xc4), uVar4 == 0 ||

-                                 (((uint)*(ushort *)(unaff_RBX + 0xe) * 8 + 0x10 <= uVar4 &&

-                                  (uVar4 <= uVar5)))))) &&

-                               ((*(ushort *)(unaff_RBX + 0xc2) <= uVar5 &&

-                                ((((uVar21 = *(ushort *)(unaff_RBX + 0xc2) + uVar4, uVar4 <= uVar21

-                                   && (uVar21 <= uVar5)) && (*(ushort *)(unaff_RBX + 0xc0) == 6)) &&

-                                 (*(short *)(unaff_RBX + 0xc2) == 8)))))) {

-                              unaff_ESI = 0;

-                              *(undefined8 *)(unaff_RBP + -0x41) =

-                                   *(undefined8 *)

-                                    ((ulonglong)*(uint *)(unaff_RBX + 0xc4) + unaff_RBX);

-                            }

-                            HsmDbgBreakOnStatus(unaff_ESI);

-                            if (-1 < (int)unaff_ESI) {

-                              uVar10 = Feature_2089703736__private_IsEnabledDeviceUsageNoInline();

-                              if ((int)uVar10 == 0) {

-                                uVar10 = *(ulonglong *)(unaff_RBP + -0x41);

-                                plVar18 = *(longlong **)(unaff_RBP + -0x59);

-                              }

-                              else {

-                                unaff_ESI = FltQueryInformationFile

-                                                      (*(undefined8 *)

-                                                        (*(longlong *)(unaff_RBP + -0x51) + 0x20),

-                                                       *(undefined8 *)(unaff_RBP + -0x49),

-                                                       unaff_RBP + -0x19,8,6);

-                                HsmDbgBreakOnStatus(unaff_ESI);

-                                if ((int)unaff_ESI < 0) {

-                                  uVar5 = unaff_ESI;

-                                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                                     ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                                  uVar15 = 0x27;

-                                  goto LAB_2;

-                                }

-                                uVar10 = *(ulonglong *)(unaff_RBP + -0x41);

-                                plVar18 = *(longlong **)(unaff_RBP + -0x59);

-                                if (*(ulonglong *)(unaff_RBP + -0x19) != uVar10) {

-                                  *(undefined1 *)(unaff_RBP + 0x6f) = 0;

-                                  puVar19 = (ushort *)(unaff_RBP + 7);

-                                  uVar16 = uVar10;

-                                  iVar6 = CldSyncIsPathWithinSyncRootByFileId

-                                                    ((longlong)plVar18,uVar10,puVar19,

-                                                     (undefined1 *)(unaff_RBP + 0x6f));

-                                  HsmDbgBreakOnStatus(iVar6);

-                                  if ((iVar6 < 0) || (*(char *)(unaff_RBP + 0x6f) == '\0')) {

-                                    uVar5 = 0xc000000d;

-                                    HsmDbgBreakOnStatus(-0x3ffffff3);

-                                    if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                                       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0 &&

-                                        (bVar22 <= (byte)WPP_GLOBAL_Control[0x29])))) {

-                                      WPP_SF_iiidd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar16

-                                                   ,puVar19,*(undefined8 *)(unaff_RBP + -0x69));

-                                    }

-                                    goto LAB_0;

-                                  }

-                                }

-                              }

-                              FltAcquirePushLockExclusiveEx(&DAT_4,0);

-                              uVar5 = CldSyncConnectRoot(plVar18,unaff_R13,uVar10,

-                                                         (undefined2 *)(unaff_RBP + 7),

-                                                         *(uint *)(unaff_RBP + -0x2d),

-                                                         *(undefined4 *)(unaff_RBP + -0x31),

-                                                         *(longlong *)(unaff_RBP + -0x61),

-                                                         (longlong *)(unaff_RBP + -0x39));

-                              HsmDbgBreakOnStatus(uVar5);

-                              if ((int)uVar5 < 0) {

-                                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                                   (bVar22 <= (byte)WPP_GLOBAL_Control[0x29])) {

-                                  uVar15 = 0x2a;

-LAB_6:

-                                  WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar15,

-                                            &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,

-                                            *(undefined8 *)(unaff_RBP + -0x69));

-                                }

-                              }

-                              else {

-                                FltAcquirePushLockExclusiveEx(unaff_R13 + 0x90,0);

-                                uVar9 = *(undefined8 *)(unaff_RBP + -0x61);

-                                uVar5 = CldiPortInsertSyncRootNoLock

-                                                  (unaff_R13,*(undefined8 *)(unaff_RBP + -0x39),

-                                                   uVar9,uVar10);

-                                uVar17 = 0;

-                                FltReleasePushLockEx(unaff_R13 + 0x90);

-                                if ((int)uVar5 < 0) {

-                                  CldSyncDisconnectRootByObject

-                                            (*(undefined8 **)(unaff_RBP + -0x39),0xc0000002);

-                                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                                     (bVar22 <= (byte)WPP_GLOBAL_Control[0x29])) {

-                                    uVar15 = 0x2b;

-                                    goto LAB_6;

-                                  }

-                                }

-                                else {

-                                  plVar18 = (longlong *)(unaff_R13 + 0x68);

-                                  if ((*plVar18 == 0) ||

-                                     (lVar11 = IoGetCurrentProcess(), *plVar18 == lVar11)) {

-                                    uVar9 = IoGetCurrentProcess();

-                                    CldCaptureProcessInfo(uVar9,plVar18);

-                                    lVar11 = IoGetCurrentProcess();

-                                    HsmOsSetProcessAsSyncProvider(lVar11);

-                                    *(int *)(unaff_R13 + 0x8c) = *(int *)(unaff_R13 + 0x8c) + 1;

-                                    *(undefined4 *)(unaff_R13 + 0x104) =

-                                         *(undefined4 *)(unaff_RBP + -0x11);

-                                  }

-                                  else {

-                                    uVar5 = 0xc000cf18;

-                                    HsmDbgBreakOnStatus(-0x3fff30e8);

-                                    puVar14 = WPP_GLOBAL_Control;

-                                    if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                                       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0 &&

-                                        (bVar22 <= (byte)WPP_GLOBAL_Control[0x29])))) {

-                                      puVar14 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-                                      WPP_SF_qiqDZd(puVar14,uVar17,uVar9,unaff_R13);

-                                    }

-                                    uVar8 = PsGetCurrentProcessId();

-                                    MicrosoftTelemetryAssertTriggeredArgsMsgKM

-                                              (puVar14,*(undefined4 *)(unaff_R13 + 0x80),uVar8,

-                                               "ConnectingPortContext\'s SyncProvider is already set"

-                                              );

-                                  }

-                                }

-                              }

-LAB_5:

-                              FltReleasePushLockEx(&DAT_4,0);

-                              goto LAB_0;

-                            }

-                            uVar5 = unaff_ESI;

-                            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                               ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-                            uVar15 = 0x26;

-                          }

-                        }

-                      }

-                    }

-                  }

-                }

-              }

-LAB_2:

-              unaff_R12 = *(undefined8 *)(unaff_RBP + -0x69);

-              uVar5 = unaff_ESI;

-            }

-          }

-        }

-      }

-LAB_3:

-      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar15,

-                &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,unaff_R12);

+    iVar2 = HsmpPrepareForMgmtOperation(unaff_RSI,lVar1,unaff_R15D,'\0');

+    HsmDbgBreakOnStatus(iVar2);

+    if (-1 < iVar2) {

+      iVar2 = HsmiUpdateFileAttributes

+                        (*(undefined8 *)(unaff_RSI + 0x20),lVar1,*(uint *)(unaff_RBP + -0x20));

+      HsmDbgBreakOnStatus(iVar2);

       goto LAB_0;

     }

     if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < bVar22)) goto LAB_0;

-    uVar15 = 0x12;

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_0;

+    uVar4 = 0x2e;

   }

-LAB_1:

-  WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar15,

-           &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,uVar5);

+  WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar4,

+             &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,unaff_RSI);

 LAB_0:

-  if (*(longlong *)(unaff_RBP + 0xf) != 0) {

-    ExFreePoolWithTag(*(longlong *)(unaff_RBP + 0xf),0x73557348);

+  if (lVar1 != 0) {

+    ObfDereferenceObject(lVar1);

   }

-  if (*(longlong *)(unaff_RBP + -0x51) != 0) {

-    FltReleaseContext();

+  if (*(longlong *)(unaff_RBP + -0x10) != 0) {

+    FltClose();

   }

-  if (*(longlong *)(unaff_RBP + -0x21) != 0) {

-    FltObjectDereference();

-  }

-  if (*(longlong *)(unaff_RBP + -0x29) != 0) {

-    FltObjectDereference();

-  }

-  if (*(longlong *)(unaff_RBP + -0x49) != 0) {

-    ObfDereferenceObject();

-  }

-  return uVar5;

+  return iVar2;

 }
```

## `HsmiOpenFile`  (modified)

```diff
--- HsmiOpenFile
+++ HsmiOpenFile
@@ -1,12 +1,109 @@
 

-/* WARNING: Control flow encountered bad instruction data */

+/* WARNING: Type propagation algorithm not settling */

 

 int HsmiOpenFile(undefined8 param_1,undefined8 param_2,undefined8 param_3,undefined4 param_4,

                 undefined8 param_5,undefined4 param_6,char param_7,longlong *param_8,

                 longlong *param_9)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  int iVar1;

+  longlong *plVar2;

+  undefined2 uVar3;

+  undefined8 *local_b8;

+  longlong local_b0;

+  longlong local_a8;

+  longlong local_a0 [6];

+  undefined4 local_70 [2];

+  undefined8 local_68;

+  undefined8 local_60;

+  undefined4 local_58;

+  undefined8 local_50;

+  undefined8 uStack_48;

+  undefined1 local_40 [24];

+  

+  local_a0[5] = local_a0[5] & 0xffffffffffff0000;

+  *param_8 = 0;

+  *param_9 = 0;

+  local_a8 = 0;

+  local_a0[0] = 0;

+  local_a0[1] = 0;

+  local_a0[2] = 0;

+  local_b0 = 0;

+  local_a0[3] = 0;

+  local_a0[4] = 0;

+  local_b8 = (undefined8 *)0x0;

+  if (param_7 == '\0') {

+LAB_0:

+    plVar2 = (longlong *)0x0;

+    local_70[0] = 0x30;

+    local_68 = 0;

+    local_58 = 0x240;

+    local_50 = 0;

+    uStack_48 = 0;

+    if (local_b0 != 0) {

+      plVar2 = local_a0 + 1;

+      local_a0[1] = 0x28;

+      local_a0[3] = 0;

+      local_a0[4] = 0;

+      local_a0[5] = 1;

+      local_a0[2] = local_b0;

+    }

+    local_60 = param_3;

+    iVar1 = FltCreateFileEx2(DAT_1,param_2,local_a0,&local_a8,param_4,local_70,local_40,0,0,

+                             7,1,param_6,0,0,0x800,plVar2);

+    HsmDbgBreakOnStatus(iVar1);

+    if (iVar1 == -0x3fffffaa) {

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29])

+         ) {

+        WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xc,

+                  &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,param_1);

+      }

+      iVar1 = -0x3fffffcc;

+    }

+    *param_8 = local_a0[0];

+    *param_9 = local_a8;

+    local_a0[0] = 0;

+    local_a8 = 0;

+  }

+  else {

+    iVar1 = FltAllocateExtraCreateParameterList(DAT_1,0,&local_b0);

+    HsmDbgBreakOnStatus(iVar1);

+    if (iVar1 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

+         ) goto LAB_2;

+      uVar3 = 10;

+    }

+    else {

+      iVar1 = FltAllocateExtraCreateParameterFromLookasideList

+                        (DAT_1,&GUID_ECP_OPEN_PARAMETERS,8,0,0,&DAT_14002b300,&local_b8);

+      HsmDbgBreakOnStatus(iVar1);

+      if (-1 < iVar1) {

+        FltInsertExtraCreateParameter(DAT_1,local_b0,local_b8);

+        *local_b8 = 0;

+        *(undefined2 *)local_b8 = 8;

+        *(undefined4 *)((longlong)local_b8 + 4) = 3;

+        goto LAB_0;

+      }

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

+         ) goto LAB_2;

+      uVar3 = 0xb;

+    }

+    WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar3,

+              &WPP_e04056f4b0da39b6a3bd8dcd61993cdf_Traceguids,param_1);

+  }

+LAB_2:

+  if (local_b0 != 0) {

+    FltFreeExtraCreateParameterList(DAT_1);

+  }

+  if (local_a8 != 0) {

+    ObfDereferenceObject();

+  }

+  if (local_a0[0] != 0) {

+    FltClose();

+  }

+  return iVar1;

 }
```

## `CldHsmIsCallbackRequested`  (modified)

```diff
--- CldHsmIsCallbackRequested
+++ HsmiCldGetSyncRootFileIdByFileObject
@@ -1,10 +1,203 @@
 

-/* WARNING: Control flow encountered bad instruction data */

-

-ulonglong CldHsmIsCallbackRequested(int param_1,ulonglong *param_2,longlong param_3,char param_4)

+/* WARNING: Variable defined which should be unmapped: param_5 */

+

+uint HsmiCldGetSyncRootFileIdByFileObject

+               (longlong param_1,ulonglong param_2,ulonglong *param_3,int *param_4,

+               undefined4 *param_5)

 

 {

-                    /* WARNING: Bad instruction - Truncating control flow here */

-  halt_baddata();

+  char cVar1;

+  bool bVar2;

+  uint uVar3;

+  int iVar4;

+  char *in_RAX;

+  ulonglong uVar5;

+  uint *puVar6;

+  uint uVar7;

+  uint *puVar8;

+  void *pvVar9;

+  uint uVar10;

+  uint *unaff_RDI;

+  uint *puVar11;

+  uint *in_R11;

+  longlong lVar12;

+  longlong unaff_R13;

+  uint uVar13;

+  ulonglong unaff_R14;

+  uint unaff_R15D;

+  uint *in_stack_00000068;

+  uint *in_stack_00000070;

+  uint *puStack0000000000000078;

+  longlong in_stack_00000090;

+  longlong in_stack_00000098;

+  undefined8 in_stack_000000a0;

+  uint uStack00000000000000e8;

+  undefined8 in_stack_000000f0;

+  longlong in_stack_00000120;

+  longlong in_stack_00000128;

+  uint in_stack_00000130;

+  int iStack0000000000000140;

+  undefined4 uStack0000000000000144;

+  

+  *in_RAX = *in_RAX + (char)in_RAX;

+  uVar10 = (uint)unaff_RDI;

+  uVar5 = (ulonglong)unaff_RDI & 0xffffffff;

+  lVar12 = (ulonglong)*(uint *)(in_stack_00000128 + 0x10) + in_stack_00000128;

+  uStack00000000000000e8 = *(uint *)(in_stack_00000128 + 0x14);

+  puVar6 = in_R11 + 0x14;

+  puStack0000000000000078 = in_R11;

+  _iStack0000000000000140 = puVar6;

+  while( true ) {

+    uVar13 = (uint)uVar5;

+    if (uStack00000000000000e8 <= (uint)unaff_R14) break;

+    in_stack_00000098 = unaff_R14 * 3;

+    uVar7 = *(uint *)(lVar12 + unaff_R14 * 0x18);

+    if (uVar7 != 0) {

+      for (puVar11 = *(uint **)puVar6; (puVar11 != puVar6 && (puVar11[4] <= uVar7));

+          puVar11 = *(uint **)puVar11) {

+        if ((puVar11[4] == uVar7) &&

+           ((puVar11[5] == uVar10 &&

+            (bVar2 = HsmiIsLockOwned((longlong)puVar11,(ulonglong *)&stack0x00000080),

+            puVar6 = _iStack0000000000000140, !bVar2)))) {

+          HsmDbgBreakOnStatus(-0x3fff30e6);

+          in_stack_00000070 = unaff_RDI;

+          in_stack_00000068 = unaff_RDI;

+          uVar10 = 0xc000cf1a;

+          goto LAB_0;

+        }

+      }

+      param_4 = (int *)(puStack0000000000000078 + 0x10);

+      puVar8 = unaff_RDI;

+      for (puVar11 = *(uint **)param_4;

+          (puVar11 != (uint *)param_4 && (puVar8 = puVar11, puVar11[4] != uVar7));

+          puVar11 = *(uint **)puVar11) {

+      }

+      if (puVar8 != (uint *)0x0) {

+        if (*(char *)((longlong)puVar8 + 0x1b) == '\0') {

+          uVar7 = puVar8[6];

+        }

+        else {

+          uVar7 = puVar8[7];

+        }

+        uVar7 = uVar7 & 0xffffff;

+        puVar6 = _iStack0000000000000140;

+        if (uVar7 <= *(uint *)(lVar12 + 4 + in_stack_00000098 * 8)) {

+          uVar3 = puVar8[6] & 0xffffff;

+          if (uVar3 <= uVar13) {

+            uVar3 = uVar13;

+          }

+          uVar5 = (ulonglong)uVar3;

+          if ((*(char *)((longlong)puVar8 + 0x1b) != '\0') && (unaff_R15D < uVar7 + 4)) {

+            unaff_R15D = uVar7 + 4;

+          }

+        }

+      }

+    }

+    unaff_R14 = (ulonglong)((uint)unaff_R14 + 1);

+  }

+  if ((uVar13 == 0) ||

+     (in_stack_00000068 = (uint *)ExAllocatePool2(0x100,uVar5,0x72507348,param_4),

+     in_stack_00000068 != (uint *)0x0)) {

+    if ((unaff_R15D == 0) ||

+       (in_stack_00000070 = (uint *)ExAllocatePool2(0x100,unaff_R15D,0x72507348),

+       in_stack_00000070 != (uint *)0x0)) {

+      uVar5 = (ulonglong)unaff_RDI & 0xffffffff;

+      while( true ) {

+        _iStack0000000000000140 = (uint *)CONCAT44(uStack0000000000000144,(uint)uVar5);

+        if (*(uint *)(in_stack_00000128 + 0x14) <= (uint)uVar5) break;

+        uVar13 = *(uint *)(lVar12 + uVar5 * 0x18);

+        if (uVar13 != 0) {

+          puVar6 = puStack0000000000000078 + 0x10;

+          puVar8 = unaff_RDI;

+          for (puVar11 = *(uint **)puVar6;

+              (puVar11 != puVar6 && (puVar8 = puVar11, puVar11[4] != uVar13));

+              puVar11 = *(uint **)puVar11) {

+          }

+          if ((puVar11 == puVar6) || (uVar13 = puVar8[6] & 0xffffff, uVar13 == 0)) {

+LAB_1:

+            *(uint **)(lVar12 + 0x10 + uVar5 * 0x18) = unaff_RDI;

+          }

+          else {

+            puVar6 = puVar8 + 7;

+            if (*(char *)((longlong)puVar8 + 0x1b) != (char)unaff_RDI) {

+              uVar13 = *puVar6 & 0xffffff;

+            }

+            *(uint *)(lVar12 + 0x10 + uVar5 * 0x18) = uVar13;

+            if (*(uint *)(lVar12 + 4 + uVar5 * 0x18) < uVar13) {

+              *(undefined4 *)(lVar12 + 0x14 + uVar5 * 0x18) = 0x80000005;

+            }

+            else {

+              in_stack_00000090 = (ulonglong)puVar8[5] + 8;

+              uVar7 = FltReadFile(in_stack_000000a0,*(undefined8 *)(puStack0000000000000078 + 6),

+                                  &stack0x00000090,puVar8[6] & 0xffffff);

+              HsmDbgBreakOnStatus(uVar7);

+              if ((int)uVar7 < 0) {

+                uVar10 = uVar7;

+                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

+                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+                  WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x21,

+                              &WPP_763fdbe3267e397a59cf662dc14be4ed_Traceguids,in_stack_000000f0);

+                }

+                goto LAB_0;

+              }

+              puVar11 = in_stack_00000068;

+              if (*(char *)((longlong)puVar8 + 0x1b) != (char)unaff_RDI) {

+                uStack00000000000000e8 = uVar10;

+                iVar4 = HsmiDecompressBuffer

+                                  ((ushort)(byte)(puVar8[6] >> 0x18),

+                                   *(byte *)((longlong)puVar8 + 0x1f),in_stack_00000070,uVar13 + 4,

+                                   in_stack_00000068,puVar8[6] & 0xffffff,&stack0x000000e8);

+                HsmDbgBreakOnStatus(iVar4);

+                if ((iVar4 < 0) || (uStack00000000000000e8 != uVar13 + 4)) {

+                  HsmDbgBreakOnCorruption();

+                  goto LAB_1;

+                }

+                puVar11 = in_stack_00000070 + 1;

+                puVar6 = in_stack_00000070;

+              }

+              pvVar9 = *(void **)(lVar12 + 8 + uVar5 * 0x18);

+              cVar1 = FltIs32bitProcess(in_stack_00000120);

+              if (cVar1 != '\0') {

+                pvVar9 = (void *)((ulonglong)pvVar9 & 0xffffffff);

+              }

+              uStack00000000000000e8 = RtlCrc32(puVar11,(ulonglong)uVar13,0);

+              RtlCopyToUser(pvVar9,puVar11,(ulonglong)uVar13);

+              uVar13 = uVar10;

+              if (uStack00000000000000e8 != *puVar6) {

+                HsmDbgBreakOnCorruption();

+                uVar13 = 0x8000cf00;

+              }

+              *(uint *)(lVar12 + 0x14 + uVar5 * 0x18) = uVar13;

+            }

+          }

+        }

+        uVar5 = (ulonglong)(iStack0000000000000140 + 1);

+      }

+      *(ulonglong *)(in_stack_00000120 + 0x20) = (ulonglong)in_stack_00000130;

+    }

+    else {

+      HsmDbgBreakOnStatus(-0x3fffff66);

+      uVar10 = 0xc000009a;

+    }

+  }

+  else {

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    in_stack_00000070 = unaff_RDI;

+    uVar10 = 0xc000009a;

+  }

+LAB_0:

+  if (puStack0000000000000078 != unaff_RDI) {

+    ExReleaseResourceLite(unaff_R13 + 0x78);

+    KeLeaveCriticalRegion();

+  }

+  if (in_stack_00000068 != (uint *)0x0) {

+    ExFreePoolWithTag(in_stack_00000068,0x72507348);

+  }

+  if (in_stack_00000070 != (uint *)0x0) {

+    ExFreePoolWithTag(in_stack_00000070,0x72507348);

+  }

+  HsmpUnloadPropertyStream(unaff_R13);

+  return uVar10;

 }
```

## `CldiPortProcessServiceCommands`  (modified)

```diff
--- CldiPortProcessServiceCommands
+++ CldSyncGetRootInfo
@@ -1,814 +1,46 @@
 

-void * CldiPortProcessServiceCommands(longlong param_1,short param_2,longlong param_3,uint param_4)

+void * CldSyncGetRootInfo(longlong param_1)

 

 {

-  ushort uVar1;

-  ushort uVar2;

-  uint uVar3;

-  uint uVar4;

-  int iVar5;

-  uint uVar6;

-  uint uVar7;

-  uint uVar8;

-  undefined4 uVar9;

-  ulonglong uVar10;

-  longlong *plVar11;

-  ulonglong uVar12;

-  longlong lVar13;

-  undefined8 uVar14;

-  longlong lVar15;

-  longlong lVar16;

-  undefined *puVar17;

-  undefined2 uVar18;

-  void *pvVar19;

-  void *pvVar20;

-  void *pvVar21;

-  ushort *puVar22;

-  int iVar23;

-  int *piVar24;

-  void *pvVar25;

-  uint local_res10 [2];

-  undefined8 local_c8;

-  longlong local_c0;

-  longlong *local_b8;

-  longlong local_b0;

-  ulonglong local_a8;

-  ulonglong local_a0;

-  undefined8 *local_98;

-  undefined4 local_90;

-  uint local_8c;

-  longlong local_88;

-  longlong local_80;

-  ulonglong local_78;

-  ulonglong local_70;

-  ushort local_68 [4];

-  wchar_t *local_60;

-  ushort local_58 [4];

-  longlong lStack_50;

-  ushort local_48 [4];

-  wchar_t *local_40;

+  uint uVar1;

+  void *_Src;

+  ulonglong uVar2;

+  void *_Dst;

+  undefined8 uVar3;

   

-  pvVar19 = (void *)0x0;

-  local_68[0] = 0xc;

-  local_68[1] = 0xe;

-  local_68[2] = 0;

-  local_68[3] = 0;

-  local_c8 = 0;

-  local_78 = 0;

-  local_a0 = 0;

-  local_70 = 0;

-  local_a8 = 0;

-  local_60 = L"CldFlt";

-  local_88 = 0;

-  local_40 = L"180451";

-  local_80 = 0;

-  local_b0 = 0;

-  local_98 = (undefined8 *)0x0;

-  uVar7 = 0xc0000225;

-  local_c0 = 0;

-  local_48[0] = 0xc;

-  local_48[1] = 0xe;

-  local_48[2] = 0;

-  local_48[3] = 0;

-  local_58[0] = 0;

-  local_58[1] = 0;

-  local_58[2] = 0;

-  local_58[3] = 0;

-  lStack_50 = 0;

-  if (param_2 == 6) {

-    local_b8 = (longlong *)0x0;

-    uVar7 = 0;

-    local_res10[0] = 0;

-    if (((((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 5)) ||

-           (uVar4 = *(uint *)(param_3 + 8), uVar4 < 0x38)) || (0x11 < *(ushort *)(param_3 + 0x30)))

-         || ((uVar8 = *(uint *)(param_3 + 0x34), uVar8 != 0 &&

-             ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))))) ||

-        ((uVar4 < *(ushort *)(param_3 + 0x32) ||

-         ((uVar3 = *(ushort *)(param_3 + 0x32) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3)))))) ||

-       ((*(ushort *)(param_3 + 0x30) != 6 || (*(short *)(param_3 + 0x32) != 8)))) {

-      pvVar19 = (void *)0xc0000225;

+  _Dst = (void *)0x0;

+  if (param_1 != 0) {

+    uVar2 = CldiSyncReferenceRoot(param_1);

+    HsmDbgBreakOnStatus((int)uVar2);

+    if ((int)uVar2 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+         (_Dst = (void *)0x0, 1 < (byte)WPP_GLOBAL_Control[0x29])) {

+        WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x22,

+                  &WPP_028866cd16db3b910821a8d7e4c3d7b2_Traceguids,param_1);

+      }

     }

     else {

-      local_c0 = *(longlong *)((ulonglong)*(uint *)(param_3 + 0x34) + param_3);

-    }

-    HsmDbgBreakOnStatus((int)pvVar19);

-    if ((int)pvVar19 < 0) {

-      pvVar20 = pvVar19;

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0xd;

-    }

-    else {

-      if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0xe)) ||

-           ((uVar4 = *(uint *)(param_3 + 8), uVar4 < 0x80 || (0x11 < *(ushort *)(param_3 + 0x78)))))

-          || ((uVar8 = *(uint *)(param_3 + 0x7c), uVar8 != 0 &&

-              ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))))) ||

-         (((uVar4 < *(ushort *)(param_3 + 0x7a) ||

-           (((uVar3 = *(ushort *)(param_3 + 0x7a) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3)) ||

-            (*(ushort *)(param_3 + 0x78) != 10)))) || (*(short *)(param_3 + 0x7a) != 4)))) {

-        pvVar19 = (void *)0xc0000225;

-      }

-      else {

-        pvVar19 = (void *)0x0;

-        uVar7 = *(uint *)((ulonglong)*(uint *)(param_3 + 0x7c) + param_3);

-        local_res10[0] = uVar7;

-      }

-      HsmDbgBreakOnStatus((int)pvVar19);

-      pvVar20 = pvVar19;

-      if (-1 < (int)pvVar19) {

-        if (local_c0 == 0) {

-          *(uint *)(param_1 + 0x88) = uVar7;

-        }

-        else {

-          uVar10 = Feature_1966059833__private_IsEnabledDeviceUsageNoInline();

-          if ((int)uVar10 == 0) {

-            FltAcquirePushLockSharedEx(param_1 + 0x90,0);

-            plVar11 = (longlong *)CldiPortLookupSyncRootNoLock(param_1,local_c0);

-            local_b8 = plVar11;

-            FltReleasePushLockEx(param_1 + 0x90,0);

-            if (plVar11 == (longlong *)0x0) {

-              pvVar20 = (void *)0xc000cf0b;

-              HsmDbgBreakOnStatus(-0x3fff30f5);

-              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x10,

-                          &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,param_1);

-                pvVar20 = (void *)0xc000cf0b;

-              }

-            }

-            else {

-              *(uint *)(plVar11 + 6) = uVar7;

-            }

-          }

-          else {

-            uVar10 = CldiPortLookupAndReferenceSyncRoot(param_1,local_c0,(longlong *)&local_b8);

-            if ((int)uVar10 < 0) {

-              pvVar20 = (void *)0xc000cf0b;

-              HsmDbgBreakOnStatus(-0x3fff30f5);

-              if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                 (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                WPP_SF_qiD(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xf,

-                           &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,param_1);

-              }

-            }

-            else {

-              *(uint *)(local_b8 + 6) = uVar7;

-              ExReleaseRundownProtection(local_b8 + 0xb);

-              pvVar20 = (void *)(uVar10 & 0xffffffff);

-            }

-          }

-        }

-        goto LAB_0;

-      }

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0xe;

-    }

-LAB_1:

-    uVar7 = (uint)pvVar19;

-  }

-  else {

-    if ((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 3)) ||

-        (uVar4 = *(uint *)(param_3 + 8), uVar4 < 0x28)) ||

-       (((0x11 < *(ushort *)(param_3 + 0x20) ||

-         (((uVar8 = *(uint *)(param_3 + 0x24), uVar8 != 0 &&

-           ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))) ||

-          (uVar4 < *(ushort *)(param_3 + 0x22))))) ||

-        (((uVar3 = *(ushort *)(param_3 + 0x22) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3)) ||

-         ((*(ushort *)(param_3 + 0x20) != 0xb || (*(short *)(param_3 + 0x22) != 8)))))))) {

-      pvVar19 = (void *)0xc0000225;

-    }

-    else {

-      local_c8 = *(undefined8 *)((ulonglong)*(uint *)(param_3 + 0x24) + param_3);

-    }

-    HsmDbgBreakOnStatus((int)pvVar19);

-    if ((int)pvVar19 < 0) {

-      pvVar20 = pvVar19;

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0x11;

-      goto LAB_1;

-    }

-    uVar4 = ObReferenceObjectByHandle

-                      (local_c8,0,*(undefined8 *)IoFileObjectType_exref,1,&local_a8,0);

-    pvVar19 = (void *)(ulonglong)uVar4;

-    HsmDbgBreakOnStatus(uVar4);

-    if ((int)uVar4 < 0) {

-      pvVar20 = pvVar19;

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0x12;

-      goto LAB_1;

-    }

-    uVar4 = FltGetVolumeFromFileObject(Globals,local_a8,&local_88);

-    pvVar20 = (void *)(ulonglong)uVar4;

-    HsmDbgBreakOnStatus(uVar4);

-    if ((int)uVar4 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0x13;

-LAB_2:

-      WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar18,

-                &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,local_c8);

-      goto LAB_0;

-    }

-    uVar4 = FltAttachVolumeAtAltitude(Globals,local_88,local_48,local_68,&local_80);

-    HsmDbgBreakOnStatus(uVar4);

-    if (uVar4 == 0xc01c0012) {

-      uVar4 = FltGetVolumeInstanceFromName(Globals,local_88,local_68,&local_80);

-      HsmDbgBreakOnStatus(uVar4);

-    }

-    else {

-      TlmWriteFilterAttachEvent(uVar4,local_48,local_68,local_88);

-    }

-    pvVar20 = (void *)(ulonglong)uVar4;

-    if ((int)uVar4 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0x14;

-      goto LAB_2;

-    }

-    uVar4 = FltGetInstanceContext(local_80,&local_b0);

-    pvVar20 = (void *)(ulonglong)uVar4;

-    HsmDbgBreakOnStatus(uVar4);

-    if ((int)uVar4 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0x15;

-      goto LAB_2;

-    }

-    uVar10 = local_a8;

-    uVar4 = HsmpAccessCheck(local_b0,local_a8,2);

-    pvVar20 = (void *)(ulonglong)uVar4;

-    HsmDbgBreakOnStatus(uVar4);

-    pvVar19 = (void *)0x0;

-    if ((int)uVar4 < 0) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0x16;

-      goto LAB_2;

-    }

-    local_b8 = *(longlong **)(local_b0 + 0x10);

-    if (param_2 == 1) goto LAB_0;

-    if (param_2 != 2) {

-      if (param_2 == 3) {

-        uVar7 = HsmCldDeleteSyncRootInfo(local_b0,local_a8);

-        pvVar20 = (void *)(ulonglong)uVar7;

-        HsmDbgBreakOnStatus(uVar7);

-        if ((((-1 < (int)uVar7) || ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control)) ||

-            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-        uVar18 = 0x1c;

-      }

-      else {

-        uVar7 = 0;

-        if (param_2 == 7) {

-          pvVar25 = (void *)0x0;

-          uVar4 = HsmiQueryFullFilePath

-                            (*(undefined8 *)(local_b0 + 0x20),uVar10,local_a8,0x101,

-                             (undefined4 *)local_58);

-          pvVar21 = (void *)(ulonglong)uVar4;

-          HsmDbgBreakOnStatus(uVar4);

-          pvVar20 = (void *)0x0;

-          if ((int)uVar4 < 0) {

-            pvVar20 = pvVar21;

-            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-            uVar18 = 0x1d;

-          }

-          else {

-            if (((((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0x17)) ||

-                   (uVar4 = *(uint *)(param_3 + 8), uVar4 < 200)) ||

-                  (0x11 < *(ushort *)(param_3 + 0xc0))) ||

-                 ((uVar8 = *(uint *)(param_3 + 0xc4), uVar8 != 0 &&

-                  ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))))) ||

-                (uVar4 < *(ushort *)(param_3 + 0xc2))) ||

-               (((uVar3 = *(ushort *)(param_3 + 0xc2) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3)) ||

-                ((*(ushort *)(param_3 + 0xc0) != 6 || (*(short *)(param_3 + 0xc2) != 8)))))) {

-              pvVar20 = (void *)0xc0000225;

-              uVar10 = local_a0;

-            }

-            else {

-              uVar10 = *(ulonglong *)((ulonglong)*(uint *)(param_3 + 0xc4) + param_3);

-            }

-            HsmDbgBreakOnStatus((int)pvVar20);

-            if ((int)pvVar20 < 0) {

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-              uVar18 = 0x1e;

-            }

-            else {

-              pvVar20 = pvVar19;

-              if (((((((0x17 < param_4) && (9 < *(ushort *)(param_3 + 0xe))) &&

-                     (uVar4 = *(uint *)(param_3 + 8), pvVar20 = pvVar25, 0x5f < uVar4)) &&

-                    (*(ushort *)(param_3 + 0x58) < 0x12)) &&

-                   (((uVar8 = *(uint *)(param_3 + 0x5c), uVar8 == 0 ||

-                     (((uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 <= uVar8 && (uVar8 <= uVar4))))

-                    && (*(ushort *)(param_3 + 0x5a) <= uVar4)))) &&

-                  ((uVar3 = *(ushort *)(param_3 + 0x5a) + uVar8, uVar8 <= uVar3 && (uVar3 <= uVar4))

-                  )) && (*(ushort *)(param_3 + 0x58) == 0x11)) {

-                if ((*(uint *)(param_3 + 0x5c) != 0) && (*(ushort *)(param_3 + 0x5a) != 0)) {

-                  pvVar19 = (void *)(param_3 + (ulonglong)*(uint *)(param_3 + 0x5c));

-                }

-                uVar7 = (uint)*(ushort *)(param_3 + 0x5a);

-                pvVar20 = pvVar19;

-              }

-              uVar7 = CldSyncReportSyncStatusOnRoot(local_b8,uVar10,local_58,pvVar20,uVar7);

-              pvVar20 = (void *)(ulonglong)uVar7;

-              HsmDbgBreakOnStatus(uVar7);

-              if ((((-1 < (int)uVar7) || ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control))

-                  || ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-              uVar18 = 0x1f;

-            }

+      _Src = *(void **)(param_1 + 0x20);

+      if (_Src != (void *)0x0) {

+        uVar1 = *(uint *)((longlong)_Src + 8);

+        uVar3 = 0x69726943;

+        uVar2 = (ulonglong)uVar1;

+        _Dst = (void *)ExAllocatePool2(0x100);

+        if (_Dst == (void *)0x0) {

+          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+            WPP_SF_qL(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar2,uVar3,param_1);

           }

         }

         else {

-          if (((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 5)) ||

-             ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 0x38 || (0x11 < *(ushort *)(param_3 + 0x30)))

-             )) {

-LAB_3:

-            pvVar19 = (void *)0xc0000225;

-          }

-          else {

-            uVar4 = *(uint *)(param_3 + 0x34);

-            uVar10 = (ulonglong)uVar4;

-            if (((uVar4 != 0) &&

-                ((uVar10 < (ulonglong)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4)))) ||

-               (((uVar7 < *(ushort *)(param_3 + 0x32) ||

-                 (((uVar8 = *(ushort *)(param_3 + 0x32) + uVar4, uVar8 < uVar4 || (uVar7 < uVar8))

-                  || (*(ushort *)(param_3 + 0x30) != 6)))) || (*(short *)(param_3 + 0x32) != 8))))

-            goto LAB_3;

-            local_c0 = *(longlong *)((ulonglong)*(uint *)(param_3 + 0x34) + param_3);

-          }

-          HsmDbgBreakOnStatus((int)pvVar19);

-          if ((int)pvVar19 < 0) {

-            pvVar20 = pvVar19;

-            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-            uVar18 = 0x20;

-          }

-          else {

-            if (param_2 != 4) {

-              if (param_2 != 5) {

-                pvVar20 = (void *)0xc0000010;

-                HsmDbgBreakOnStatus(-0x3ffffff0);

-                goto LAB_0;

-              }

-              if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0x17)) ||

-                   ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 200 ||

-                    (0x11 < *(ushort *)(param_3 + 0xc0))))) ||

-                  ((uVar4 = *(uint *)(param_3 + 0xc4), uVar4 != 0 &&

-                   ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4)))))) ||

-                 (((uVar7 < *(ushort *)(param_3 + 0xc2) ||

-                   (((uVar8 = *(ushort *)(param_3 + 0xc2) + uVar4, uVar8 < uVar4 || (uVar7 < uVar8))

-                    || (*(ushort *)(param_3 + 0xc0) != 6)))) || (*(short *)(param_3 + 0xc2) != 8))))

-              {

-                pvVar20 = (void *)0xc0000225;

-                if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-                uVar18 = 0x2d;

-                goto LAB_2;

-              }

-              lVar15 = *(longlong *)((ulonglong)*(uint *)(param_3 + 0xc4) + param_3);

-              FltAcquirePushLockExclusiveEx(&DAT_4,0);

-              uVar10 = Feature_4003440952__private_IsEnabledDeviceUsageNoInline();

-              if ((int)uVar10 != 0) {

-                lVar13 = param_1 + 0x90;

-                FltAcquirePushLockSharedEx(lVar13,0);

-                lVar16 = CldiPortLookupSyncRootNoLock(param_1,local_c0);

-                if ((lVar16 == 0) || (*(longlong *)(lVar16 + 0x18) != lVar15)) {

-                  pvVar20 = (void *)0xc000cf0b;

-                  HsmDbgBreakOnStatus(-0x3fff30f5);

-                  if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                     (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                    WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2e,

-                                &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,param_1);

-                  }

-                  FltReleasePushLockEx(lVar13,0);

-                  goto LAB_5;

-                }

-                FltReleasePushLockEx(lVar13,0);

-              }

-              uVar10 = Feature_2414246201__private_IsEnabledDeviceUsageNoInline();

-              if ((int)uVar10 == 0) {

-                uVar7 = CldSyncDisconnectRootDeprecated

-                                  ((longlong)local_b8,lVar15,local_c0,&local_98);

-              }

-              else {

-                uVar14 = CldSyncDisconnectRoot((longlong)local_b8,param_1,lVar15,local_c0,&local_98)

-                ;

-                uVar7 = (uint)uVar14;

-              }

-              pvVar20 = (void *)(ulonglong)uVar7;

-              HsmDbgBreakOnStatus(uVar7);

-              if ((int)uVar7 < 0) {

-                if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                   (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                  uVar18 = 0x2f;

-                  goto LAB_6;

-                }

-              }

-              else {

-                FltAcquirePushLockExclusiveEx(param_1 + 0x90,0);

-                RtlDeleteElementGenericTableAvl(param_1 + 0x98,&local_c0);

-                FltReleasePushLockEx(param_1 + 0x90,0);

-                piVar24 = (int *)(param_1 + 0x8c);

-                *piVar24 = *piVar24 + -1;

-                if (*piVar24 == 0) {

-                  lVar15 = IoGetCurrentProcess();

-                  HsmOsClearProcessAsSyncProvider(lVar15);

-                  CldReleaseProcessInfo((undefined8 *)(param_1 + 0x68));

-                }

-              }

-              goto LAB_5;

-            }

-            local_98 = (undefined8 *)0x0;

-            local_8c = 0;

-            local_90 = 0;

-            local_70 = local_70 & 0xffffffff00000000;

-            local_78 = 0;

-            uVar12 = HsmpCheckLegacyFilterAbsence();

-            pvVar20 = (void *)(uVar12 & 0xffffffff);

-            HsmDbgBreakOnStatus((int)uVar12);

-            if ((int)uVar12 < 0) {

-              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-              uVar18 = 0x21;

-            }

-            else {

-              uVar7 = HsmiQueryFullFilePath

-                                (*(undefined8 *)(local_b0 + 0x20),uVar10,local_a8,0x101,

-                                 (undefined4 *)local_58);

-              pvVar20 = (void *)(ulonglong)uVar7;

-              HsmDbgBreakOnStatus(uVar7);

-              pvVar19 = (void *)0x0;

-              if ((int)uVar7 < 0) {

-                if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                    ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                   ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-                uVar18 = 0x22;

-              }

-              else {

-                if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 6)) ||

-                     ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 0x40 ||

-                      (0x11 < *(ushort *)(param_3 + 0x38))))) ||

-                    ((uVar4 = *(uint *)(param_3 + 0x3c), uVar4 != 0 &&

-                     ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4))))))

-                   || ((uVar7 < *(ushort *)(param_3 + 0x3a) ||

-                       ((((uVar8 = *(ushort *)(param_3 + 0x3a) + uVar4, uVar8 < uVar4 ||

-                          (uVar7 < uVar8)) || (*(ushort *)(param_3 + 0x38) != 10)) ||

-                        (*(short *)(param_3 + 0x3a) != 4)))))) {

-                  pvVar19 = (void *)0xc0000225;

-                }

-                else {

-                  local_8c = *(uint *)((ulonglong)*(uint *)(param_3 + 0x3c) + param_3);

-                }

-                HsmDbgBreakOnStatus((int)pvVar19);

-                pvVar20 = (void *)0x0;

-                if ((int)pvVar19 < 0) {

-                  pvVar20 = pvVar19;

-                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                     ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-                  uVar18 = 0x23;

-                }

-                else {

-                  if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0xf)) ||

-                       ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 0x88 ||

-                        (0x11 < *(ushort *)(param_3 + 0x80))))) ||

-                      ((uVar4 = *(uint *)(param_3 + 0x84), uVar4 != 0 &&

-                       ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4))))))

-                     || (((uVar7 < *(ushort *)(param_3 + 0x82) ||

-                          (((uVar8 = *(ushort *)(param_3 + 0x82) + uVar4, uVar8 < uVar4 ||

-                            (uVar7 < uVar8)) || (*(ushort *)(param_3 + 0x80) != 10)))) ||

-                         (*(short *)(param_3 + 0x82) != 4)))) {

-                    pvVar20 = (void *)0xc0000225;

-                  }

-                  else {

-                    local_70 = CONCAT44(local_70._4_4_,

-                                        *(undefined4 *)

-                                         ((ulonglong)*(uint *)(param_3 + 0x84) + param_3));

-                  }

-                  HsmDbgBreakOnStatus((int)pvVar20);

-                  if ((int)pvVar20 < 0) {

-                    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-                    uVar18 = 0x24;

-                  }

-                  else {

-                    if ((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0xe)) ||

-                        ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 0x80 ||

-                         (0x11 < *(ushort *)(param_3 + 0x78))))) ||

-                       (((uVar4 = *(uint *)(param_3 + 0x7c), uVar4 != 0 &&

-                         ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4))))

-                        || (((uVar7 < *(ushort *)(param_3 + 0x7a) ||

-                             (((uVar8 = *(ushort *)(param_3 + 0x7a) + uVar4, uVar8 < uVar4 ||

-                               (uVar7 < uVar8)) || (*(ushort *)(param_3 + 0x78) != 10)))) ||

-                            (*(short *)(param_3 + 0x7a) != 4)))))) {

-                      pvVar19 = (void *)0xc0000225;

-                    }

-                    else {

-                      pvVar19 = (void *)0x0;

-                      local_90 = *(undefined4 *)((ulonglong)*(uint *)(param_3 + 0x7c) + param_3);

-                    }

-                    HsmDbgBreakOnStatus((int)pvVar19);

-                    pvVar20 = (void *)0x0;

-                    if ((int)pvVar19 < 0) {

-                      pvVar20 = pvVar19;

-                      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-                      uVar18 = 0x25;

-                    }

-                    else {

-                      if (((((param_4 < 0x18) || (*(ushort *)(param_3 + 0xe) < 0x17)) ||

-                           ((uVar7 = *(uint *)(param_3 + 8), uVar7 < 200 ||

-                            (0x11 < *(ushort *)(param_3 + 0xc0))))) ||

-                          ((uVar4 = *(uint *)(param_3 + 0xc4), uVar4 != 0 &&

-                           ((uVar4 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar7 < uVar4))

-                           )))) || ((uVar7 < *(ushort *)(param_3 + 0xc2) ||

-                                    ((((uVar8 = *(ushort *)(param_3 + 0xc2) + uVar4, uVar8 < uVar4

-                                       || (uVar7 < uVar8)) || (*(ushort *)(param_3 + 0xc0) != 6)) ||

-                                     (*(short *)(param_3 + 0xc2) != 8)))))) {

-                        pvVar20 = (void *)0xc0000225;

-                      }

-                      else {

-                        local_a0 = *(ulonglong *)((ulonglong)*(uint *)(param_3 + 0xc4) + param_3);

-                      }

-                      HsmDbgBreakOnStatus((int)pvVar20);

-                      if (-1 < (int)pvVar20) {

-                        uVar12 = Feature_2089703736__private_IsEnabledDeviceUsageNoInline();

-                        plVar11 = local_b8;

-                        uVar10 = local_a0;

-                        if ((int)uVar12 != 0) {

-                          uVar7 = FltQueryInformationFile

-                                            (*(undefined8 *)(local_b0 + 0x20),local_a8,&local_78,8,6

-                                             ,0);

-                          pvVar20 = (void *)(ulonglong)uVar7;

-                          HsmDbgBreakOnStatus(uVar7);

-                          uVar10 = local_a0;

-                          plVar11 = local_b8;

-                          if ((int)uVar7 < 0) {

-                            if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                               ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-                            uVar18 = 0x27;

-                            goto LAB_2;

-                          }

-                          if (local_78 != local_a0) {

-                            local_res10[0] = local_res10[0] & 0xffffff00;

-                            puVar22 = local_58;

-                            uVar12 = local_a0;

-                            iVar23 = CldSyncIsPathWithinSyncRootByFileId

-                                               ((longlong)local_b8,local_a0,puVar22,

-                                                (undefined1 *)local_res10);

-                            HsmDbgBreakOnStatus(iVar23);

-                            if ((iVar23 < 0) || ((char)local_res10[0] == '\0')) {

-                              pvVar20 = (void *)0xc000000d;

-                              HsmDbgBreakOnStatus(-0x3ffffff3);

-                              if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                                 (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0 &&

-                                  (1 < (byte)WPP_GLOBAL_Control[0x29])))) {

-                                WPP_SF_iiidd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar12,

-                                             puVar22,local_c8);

-                              }

-                              goto LAB_0;

-                            }

-                          }

-                        }

-                        FltAcquirePushLockExclusiveEx(&DAT_4,0);

-                        uVar7 = CldSyncConnectRoot(plVar11,param_1,uVar10,local_58,local_8c,local_90

-                                                   ,local_c0,(longlong *)&local_98);

-                        pvVar20 = (void *)(ulonglong)uVar7;

-                        HsmDbgBreakOnStatus(uVar7);

-                        if ((int)uVar7 < 0) {

-                          if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                             (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                            uVar18 = 0x2a;

-LAB_6:

-                            WPP_SF_id(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar18,

-                                      &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,local_c8);

-                          }

-                        }

-                        else {

-                          FltAcquirePushLockExclusiveEx(param_1 + 0x90,0);

-                          lVar15 = local_c0;

-                          uVar7 = CldiPortInsertSyncRootNoLock(param_1,local_98,local_c0,uVar10);

-                          uVar14 = 0;

-                          pvVar20 = (void *)(ulonglong)uVar7;

-                          FltReleasePushLockEx(param_1 + 0x90);

-                          if ((int)uVar7 < 0) {

-                            CldSyncDisconnectRootByObject(local_98,0xc0000002);

-                            if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                                ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-                               (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-                              uVar18 = 0x2b;

-                              goto LAB_6;

-                            }

-                          }

-                          else {

-                            plVar11 = (longlong *)(param_1 + 0x68);

-                            if ((*plVar11 == 0) ||

-                               (lVar13 = IoGetCurrentProcess(), *plVar11 == lVar13)) {

-                              uVar14 = IoGetCurrentProcess();

-                              CldCaptureProcessInfo(uVar14,plVar11);

-                              lVar15 = IoGetCurrentProcess();

-                              HsmOsSetProcessAsSyncProvider(lVar15);

-                              *(int *)(param_1 + 0x8c) = *(int *)(param_1 + 0x8c) + 1;

-                              *(undefined4 *)(param_1 + 0x104) = (undefined4)local_70;

-                            }

-                            else {

-                              pvVar20 = (void *)0xc000cf18;

-                              HsmDbgBreakOnStatus(-0x3fff30e8);

-                              puVar17 = WPP_GLOBAL_Control;

-                              if (((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-                                 (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0 &&

-                                  (1 < (byte)WPP_GLOBAL_Control[0x29])))) {

-                                puVar17 = *(undefined **)(WPP_GLOBAL_Control + 0x18);

-                                WPP_SF_qiqDZd(puVar17,uVar14,lVar15,param_1);

-                              }

-                              uVar9 = PsGetCurrentProcessId();

-                              MicrosoftTelemetryAssertTriggeredArgsMsgKM

-                                        (puVar17,*(undefined4 *)(param_1 + 0x80),uVar9,

-                                         "ConnectingPortContext\'s SyncProvider is already set");

-                            }

-                          }

-                        }

-LAB_5:

-                        FltReleasePushLockEx(&DAT_4,0);

-                        goto LAB_0;

-                      }

-                      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-                      uVar18 = 0x26;

-                    }

-                  }

-                }

-              }

-            }

-          }

+          memmove(_Dst,_Src,(ulonglong)uVar1);

         }

       }

-      goto LAB_2;

+      ExReleaseRundownProtection(param_1 + 0x58);

     }

-    piVar24 = (int *)0x0;

-    uVar4 = 0;

-    if (param_4 < 0x18) {

-      pvVar19 = (void *)0xc0000225;

-    }

-    else {

-      if (((((*(ushort *)(param_3 + 0xe) < 4) || (uVar4 = *(uint *)(param_3 + 8), uVar4 < 0x30)) ||

-           (0x11 < *(ushort *)(param_3 + 0x28))) ||

-          (((uVar8 = *(uint *)(param_3 + 0x2c), uVar8 != 0 &&

-            ((uVar8 < (uint)*(ushort *)(param_3 + 0xe) * 8 + 0x10 || (uVar4 < uVar8)))) ||

-           ((uVar4 < *(ushort *)(param_3 + 0x2a) ||

-            ((uVar3 = *(ushort *)(param_3 + 0x2a) + uVar8, uVar3 < uVar8 || (uVar4 < uVar3))))))))

-         || (*(ushort *)(param_3 + 0x28) != 0x11)) {

-        pvVar19 = (void *)0xc0000225;

-        uVar4 = 0;

-      }

-      else {

-        if ((*(uint *)(param_3 + 0x2c) != 0) && (*(ushort *)(param_3 + 0x2a) != 0)) {

-          piVar24 = (int *)(param_3 + (ulonglong)*(uint *)(param_3 + 0x2c));

-        }

-        pvVar19 = (void *)0x0;

-        uVar4 = (uint)*(ushort *)(param_3 + 0x2a);

-      }

-      if ((int)pvVar19 < 0) {

-        uVar4 = 0;

-      }

-    }

-    HsmDbgBreakOnStatus((int)pvVar19);

-    if ((int)pvVar19 < 0) {

-      pvVar20 = pvVar19;

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-         ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-      uVar18 = 0x17;

-      goto LAB_1;

-    }

-    if (piVar24 != (int *)0x0) {

-      iVar23 = 0;

-      if (((0x17 < uVar4) && (iVar23 = 1, *piVar24 == 0x6e497253)) &&

-         (((*(byte *)(piVar24 + 3) & 2) == 0 ||

-          (iVar5 = RtlComputeCrc32(0,piVar24 + 2,uVar4 - 8), iVar23 = 2, piVar24[1] == iVar5)))) {

-        uVar8 = piVar24[2];

-        iVar23 = 3;

-        if (uVar8 <= uVar4) {

-          uVar1 = *(ushort *)((longlong)piVar24 + 0xe);

-          uVar10 = 0;

-          iVar23 = 4;

-          if ((uVar1 != 0) && (iVar23 = 5, (uint)uVar1 * 8 + 0x10 < uVar8)) {

-            iVar23 = 0x10000;

-            while( true ) {

-              uVar3 = (uint)uVar1;

-              if (8 < uVar1) {

-                uVar3 = 9;

-              }

-              if (uVar3 <= (uint)uVar10) {

-                if (((((7 < *(ushort *)((longlong)piVar24 + 0xe)) && (0x4f < uVar8)) &&

-                     (*(ushort *)(piVar24 + 0x12) < 0x12)) &&

-                    ((uVar3 = piVar24[0x13], uVar3 == 0 ||

-                     (((uint)*(ushort *)((longlong)piVar24 + 0xe) * 8 + 0x10 <= uVar3 &&

-                      (uVar3 <= uVar8)))))) &&

-                   ((*(ushort *)((longlong)piVar24 + 0x4a) <= uVar8 &&

-                    (((uVar6 = *(ushort *)((longlong)piVar24 + 0x4a) + uVar3, uVar3 <= uVar6 &&

-                      (uVar6 <= uVar8)) &&

-                     ((*(ushort *)(piVar24 + 0x12) == 0x10 &&

-                      (*(short *)((longlong)piVar24 + 0x4a) == 0x10)))))))) {

-                  memmove((void *)(param_1 + 0x108),

-                          (void *)((ulonglong)(uint)piVar24[0x13] + (longlong)piVar24),0x10);

-                  uVar7 = 0;

-                }

-                HsmDbgBreakOnStatus(uVar7);

-                if ((int)uVar7 < 0) {

-                  pvVar19 = (void *)(ulonglong)uVar7;

-                  pvVar20 = pvVar19;

-                  if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-                      ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-                     ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-                  uVar18 = 0x1a;

-                  goto LAB_7;

-                }

-                uVar7 = HsmCldPersistSyncRootInfo(local_b0,local_a8,piVar24,uVar4);

-                pvVar20 = (void *)(ulonglong)uVar7;

-                HsmDbgBreakOnStatus(uVar7);

-                if (((-1 < (int)uVar7) || ((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control))

-                   || (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0 ||

-                       ((byte)WPP_GLOBAL_Control[0x29] < 2)))) goto LAB_0;

-                uVar18 = 0x1b;

-                goto LAB_2;

-              }

-              if ((((0x11 < *(ushort *)(piVar24 + uVar10 * 2 + 4)) ||

-                   ((uVar3 = piVar24[uVar10 * 2 + 5], uVar3 != 0 && (uVar3 < (uint)uVar1 * 8 + 0x10)

-                    ))) || (uVar8 < uVar3)) ||

-                 (((uVar2 = *(ushort *)((longlong)piVar24 + uVar10 * 8 + 0x12), uVar8 < uVar2 ||

-                   (uVar6 = uVar2 + uVar3, uVar6 < uVar3)) || (uVar8 < uVar6)))) break;

-              iVar23 = iVar23 + 1;

-              uVar10 = (ulonglong)((uint)uVar10 + 1);

-            }

-          }

-        }

-      }

-      pvVar20 = (void *)0xc000000d;

-      HsmDbgBreakOnStatus(-0x3ffffff3);

-      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

-         (1 < (byte)WPP_GLOBAL_Control[0x29])) {

-        WPP_SF_dd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x19,

-                  &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,iVar23);

-      }

-      goto LAB_0;

-    }

-    uVar7 = 0xc000cf0b;

-    pvVar19 = (void *)0xc000cf0b;

-    pvVar20 = (void *)0xc000cf0b;

-    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) == 0)) ||

-       ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_0;

-    uVar18 = 0x18;

   }

-LAB_7:

-  WPP_SF_d(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar18,

-           &WPP_4aa0d60a26dc3ba3efece7d301857a0a_Traceguids,uVar7);

-  pvVar20 = pvVar19;

-LAB_0:

-  if (lStack_50 != 0) {

-    ExFreePoolWithTag(lStack_50,0x73557348);

-  }

-  if (local_b0 != 0) {

-    FltReleaseContext();

-  }

-  if (local_80 != 0) {

-    FltObjectDereference();

-  }

-  if (local_88 != 0) {

-    FltObjectDereference();

-  }

-  if (local_a8 != 0) {

-    ObfDereferenceObject();

-  }

-  return pvVar20;

+  return _Dst;

 }
```

## `HsmpRecallTerminateProgressiveHydration`  (modified)

```diff
--- HsmpRecallTerminateProgressiveHydration
+++ HsmpAcquireFileNameLock
@@ -1,46 +1,46 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

-

-void HsmpRecallTerminateProgressiveHydration(longlong param_1)

+longlong HsmpAcquireFileNameLock(longlong param_1,longlong param_2,longlong param_3)

 

 {

-  ulonglong uVar1;

-  longlong lVar2;

-  ulonglong uVar3;

-  undefined *puVar4;

+  longlong lVar1;

+  int *piVar2;

+  int iVar3;

   

-  LOCK();

-  uVar1 = *(ulonglong *)(param_1 + 0x38);

-  if (uVar1 == 0) {

-    *(ulonglong *)(param_1 + 0x38) = 0;

-    uVar1 = 0;

+  if ((param_2 == 0) || ((*(uint *)(param_2 + 0x1c) & 1) == 0)) {

+    lVar1 = param_1 + 0x70;

+    FltAcquirePushLockExclusiveEx(lVar1,0);

+    KeClearEvent(param_1 + 0x78);

+    *(int *)(param_1 + 0xa8) = *(int *)(param_1 + 0xa8) + 1;

+    FltReleasePushLockEx(lVar1,0);

+    iVar3 = FltCancellableWaitForSingleObject(param_1 + 0x90,0,param_3);

+    HsmDbgBreakOnStatus(iVar3);

+    if (iVar3 < 0) {

+      FltAcquirePushLockExclusiveEx(lVar1,0);

+      piVar2 = (int *)(param_1 + 0xa8);

+      *piVar2 = *piVar2 + -1;

+      if (*piVar2 == 0) {

+        KeSetEvent(param_1 + 0x78,0,0);

+      }

+      FltReleasePushLockEx(lVar1,0);

+      *(int *)(param_3 + 0x18) = iVar3;

+      goto LAB_0;

+    }

+    if (param_1 == 0) {

+      return 0;

+    }

   }

-  UNLOCK();

-  do {

-    uVar3 = uVar1;

-    if ((uVar3 & 1) != 0) {

-      return;

+  else {

+    iVar3 = FltCancellableWaitForSingleObject(*(longlong *)(param_2 + 0x10) + 0x60,0);

+    HsmDbgBreakOnStatus(iVar3);

+    param_1 = param_2;

+    if (iVar3 < 0) {

+      *(int *)(param_3 + 0x18) = iVar3;

+LAB_0:

+      *(undefined8 *)(param_3 + 0x20) = 0;

+      return 0;

     }

-    LOCK();

-    uVar1 = *(ulonglong *)(param_1 + 0x38);

-    if (uVar3 == uVar1) {

-      *(ulonglong *)(param_1 + 0x38) = uVar3 | 1;

-      uVar1 = uVar3;

-    }

-    UNLOCK();

-  } while (uVar1 != uVar3);

-  if (uVar1 != 0) {

-    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

-    {

-      lVar2 = *(longlong *)(param_1 + 0x10);

-      puVar4 = WPP_GLOBAL_Control;

-      HsmpGetStreamSize(lVar2);

-      WPP_SF_iqLi(*(undefined8 *)(puVar4 + 0x18),uVar3,puVar4,

-                  *(undefined8 *)(*(longlong *)(lVar2 + 0x10) + 0x20));

-    }

-    (*DAT_0)(*(undefined8 *)(*(longlong *)(param_1 + 0x10) + 8),uVar1);

   }

-  return;

+  FltReferenceContext(param_1);

+  return param_1;

 }
```

## `HsmOsCheckAppCompatPolicy`  (modified)

```diff
--- HsmOsCheckAppCompatPolicy
+++ HsmiOsIsHydrationDisallowed
@@ -1,165 +1,94 @@
 

 /* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

 

-uint * HsmOsCheckAppCompatPolicy(undefined8 *param_1,int param_2,char *param_3)

+ulonglong HsmiOsIsHydrationDisallowed

+                    (longlong param_1,uint *param_2,uint *param_3,undefined8 param_4)

 

 {

   uint uVar1;

-  undefined8 uVar2;

-  longlong lVar3;

-  longlong lVar4;

-  ulonglong uVar5;

-  undefined8 *puVar6;

-  uint *puVar7;

-  uint *puVar8;

-  uint *puVar9;

-  bool bVar10;

-  undefined1 auStack_98 [32];

-  undefined8 local_78;

-  undefined8 uStack_70;

-  undefined8 local_68;

-  undefined8 local_60;

-  undefined8 uStack_58;

-  undefined8 local_50;

-  undefined8 uStack_48;

-  undefined8 local_40;

-  undefined8 uStack_38;

-  ulonglong local_30;

+  ulonglong uVar2;

+  ulonglong uVar3;

+  bool bVar4;

+  undefined1 auStackY_138 [32];

+  uint local_108;

+  uint local_104;

+  longlong local_100;

+  longlong local_f8;

+  undefined8 local_f0;

+  longlong local_e8;

+  wchar_t *local_e0;

+  uint *local_d8;

+  uint *local_d0;

+  undefined1 local_c8 [144];

+  ulonglong local_38;

   

-  local_30 = __security_cookie ^ (ulonglong)auStack_98;

-  puVar7 = (uint *)0x0;

-  bVar10 = false;

-  local_68 = 0;

-  *param_3 = '\0';

-  puVar6 = &local_78;

-  if (param_1 != (undefined8 *)0x0) {

-    puVar6 = param_1;

-  }

-  local_60 = 0;

-  uStack_58 = 0;

-  local_50 = 0;

-  uStack_48 = 0;

-  local_40 = 0;

-  uStack_38 = 0;

-  local_78 = 0;

-  uStack_70 = 0;

-  if (param_1 == (undefined8 *)0x0) {

-    uVar2 = PsGetCurrentProcess();

-    puVar6[2] = uVar2;

-  }

-  lVar4 = puVar6[1];

-  if (lVar4 == 0) {

-    if ((puVar6 == (undefined8 *)0x0) || (lVar4 = puVar6[2], lVar4 == 0)) {

-      lVar4 = PsGetCurrentProcess();

-    }

-    lVar3 = PsGetCurrentProcess();

-    bVar10 = lVar4 != lVar3;

-    if (bVar10) {

-      KeStackAttachProcess(lVar4,&local_60);

-    }

-    puVar8 = puVar7;

-    puVar9 = puVar7;

-    if ((puVar6 == (undefined8 *)0x0) || (puVar6[2] == 0)) {

-      uVar2 = PsGetCurrentProcess();

-      lVar4 = PsGetProcessWow64Process(uVar2);

-      if (lVar4 == 0) {

-        uVar2 = PsGetCurrentProcess();

-        lVar4 = PsGetProcessPeb(uVar2);

-        if (lVar4 != 0) {

-          uVar2 = PsGetCurrentProcess();

-          lVar4 = PsGetProcessPeb(uVar2);

-          puVar9 = (uint *)(lVar4 + 0x2c8);

-        }

-      }

-      else {

-        uVar2 = PsGetCurrentProcess();

-        lVar4 = PsGetProcessWow64Process(uVar2);

-        puVar9 = (uint *)(lVar4 + 0x1d8);

-      }

-      if (puVar6 != (undefined8 *)0x0) goto LAB_0;

-LAB_1:

-      uVar2 = PsGetCurrentProcess();

-      lVar4 = PsGetProcessWow64Process(uVar2);

-      if (lVar4 == 0) {

-        uVar2 = PsGetCurrentProcess();

-        lVar4 = PsGetProcessPeb(uVar2);

-        if (lVar4 != 0) {

-          uVar2 = PsGetCurrentProcess();

-          goto LAB_2;

-        }

-      }

-      else {

-        uVar2 = PsGetCurrentProcess();

-LAB_3:

-        lVar4 = PsGetProcessWow64Process(uVar2);

-        puVar8 = (uint *)(lVar4 + 0x460);

-      }

+  local_38 = __security_cookie ^ (ulonglong)auStackY_138;

+  uVar3 = 0;

+  local_e8 = 0x180016;

+  local_e0 = L"BlockedApps";

+  local_100 = 0;

+  local_104 = 0;

+  local_108 = 0;

+  if ((param_2 != (uint *)0x0) && (param_3 != (uint *)0x0)) {

+    bVar4 = (*param_2 & 0x2000000) != 0;

+    if (bVar4) {

+      local_104 = 1;

     }

     else {

-      lVar4 = PsGetProcessWow64Process();

-      if (lVar4 == 0) {

-        lVar4 = PsGetProcessPeb();

-        if (lVar4 != 0) {

-          lVar4 = PsGetProcessPeb(puVar6[2]);

-          puVar9 = (uint *)(lVar4 + 0x2c8);

-        }

+      local_104 = *param_3 & 1;

+    }

+    local_108 = (uint)bVar4;

+  }

+  local_f8 = param_1;

+  local_f0 = param_4;

+  local_d8 = param_2;

+  local_d0 = param_3;

+  if (local_104 == 0) {

+    uVar2 = HsmiOsGetAppIdentity(param_1,local_c8);

+    uVar3 = uVar2 & 0xffffffff;

+    if ((int)uVar2 < 0) goto LAB_0;

+    uVar1 = HsmiOsOpenAppPolicyKey(&local_e8,local_c8,'\x01','\0',&local_100);

+    if (-1 < (int)uVar1) {

+      uVar1 = HsmiOsGetAppPolicy(local_100,&local_108);

+    }

+    uVar3 = 0;

+    if (uVar1 != 0xc0000034) {

+      uVar3 = (ulonglong)uVar1;

+    }

+    if ((int)uVar3 < 0) goto LAB_0;

+    local_f8 = CONCAT44(local_f8._4_4_,(int)uVar3);

+    if (local_108 == 0) {

+      if (local_100 != 0) {

+        ZwClose();

+        local_100 = 0;

       }

-      else {

-        lVar4 = PsGetProcessWow64Process(puVar6[2]);

-        puVar9 = (uint *)(lVar4 + 0x1d8);

+      uVar1 = HsmiOsOpenAppPolicyKey(&local_e8,local_c8,'\0','\0',&local_100);

+      if (-1 < (int)uVar1) {

+        uVar1 = HsmiOsGetAppPolicy(local_100,&local_108);

       }

-LAB_0:

-      if (puVar6[2] == 0) goto LAB_1;

-      lVar4 = PsGetProcessWow64Process();

-      uVar2 = puVar6[2];

-      if (lVar4 != 0) goto LAB_3;

-      lVar4 = PsGetProcessPeb();

-      if (lVar4 == 0) goto LAB_4;

-      uVar2 = puVar6[2];

-LAB_2:

-      lVar4 = PsGetProcessPeb(uVar2);

-      puVar8 = (uint *)(lVar4 + 0x7a8);

+      uVar3 = 0;

+      if (uVar1 != 0xc0000034) {

+        uVar3 = (ulonglong)uVar1;

+      }

+      local_f8 = CONCAT44(local_f8._4_4_,(int)uVar3);

+      if ((int)uVar3 < 0) goto LAB_0;

+    }

+    if ((param_2 != (uint *)0x0) && (param_3 != (uint *)0x0)) {

+      if (local_108 != 0) {

+        LOCK();

+        *param_2 = *param_2 | 0x2000000;

+        UNLOCK();

+      }

+      LOCK();

+      *param_3 = *param_3 | 1;

+      UNLOCK();

     }

   }

-  else if (puVar6 == (undefined8 *)0x0) {

-    puVar9 = (uint *)&DAT_5;

-    puVar8 = (uint *)0x28;

+  *(bool *)param_4 = local_108 != 0;

+LAB_0:

+  if (local_100 != 0) {

+    ZwClose();

   }

-  else {

-    puVar9 = (uint *)(lVar4 + 0x20);

-    puVar8 = (uint *)(lVar4 + 0x28);

-  }

-LAB_4:

-  if (param_2 == 3) {

-    if (puVar6 != (undefined8 *)0x0) {

-      puVar7 = (uint *)puVar6[2];

-    }

-    uVar2 = HsmiOsIsForegroundHydrator((longlong)puVar7,puVar9,puVar8,param_3);

-    uVar1 = (uint)uVar2;

-  }

-  else {

-    if (param_2 != 0) {

-      if (param_2 == 1) {

-        uVar1 = HsmiOsIsFullHydrationEnabled(puVar9);

-        *param_3 = (char)uVar1;

-      }

-      else if (param_2 == 2) {

-        uVar1 = HsmiOsIsFullHydrationOnOpenEnabled(puVar9);

-        *param_3 = (char)uVar1;

-      }

-      else {

-        puVar7 = (uint *)0xc00000e5;

-      }

-      goto LAB_6;

-    }

-    uVar5 = HsmiOsIsHydrationDisallowed((longlong)puVar6,puVar9,puVar8,param_3);

-    uVar1 = (uint)uVar5;

-  }

-  puVar7 = (uint *)(ulonglong)uVar1;

-LAB_6:

-  if (bVar10) {

-    KeUnstackDetachProcess(&local_60);

-  }

-  return puVar7;

+  return uVar3;

 }
```

## `CldHsmGetSyncPolicy`  (modified)

```diff
--- CldHsmGetSyncPolicy
+++ CldHsmGetSyncPolicy
@@ -1,33 +1,68 @@
-

-/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

 

 uint CldHsmGetSyncPolicy(longlong param_1,int param_2)

 

 {

-  char *pcVar1;

+  longlong lVar1;

   uint uVar2;

-  char *pcVar3;

-  undefined4 in_register_00000014;

-  ulonglong unaff_RBX;

-  longlong unaff_RBP;

-  undefined *unaff_RSI;

-  longlong unaff_RDI;

-  ulonglong in_R8;

-  longlong unaff_R13;

-  ulonglong unaff_R14;

-  uint in_stack_00000030;

+  uint uVar3;

+  int iVar4;

   

-  pcVar3 = (char *)(unaff_RBX & 0xffffffff);

-  *pcVar3 = *pcVar3 + (char)pcVar3;

-  pcVar1 = (char *)(param_1 * 5 + 100);

-  *pcVar1 = *pcVar1 + (char)pcVar3;

-  uVar2 = CldiPortProcessAckData

-                    (unaff_R13,CONCAT44(in_register_00000014,param_2),in_R8,unaff_R14,unaff_RSI,

-                     unaff_RDI,in_stack_00000030);

-  HsmDbgBreakOnStatus(uVar2);

-  if ((-1 < (int)uVar2) && (*(char *)(unaff_RBP + 0x60) != '\0')) {

-    *(undefined8 *)(unaff_R13 + 0x40) = _DAT_0;

+  uVar3 = 0xf7844;

+  lVar1 = CldLookupSyncRoot(param_1);

+  iVar4 = 0;

+  if ((lVar1 == 0) || (*(longlong *)(lVar1 + 0x60) == 0)) {

+    iVar4 = -0x3fff30ff;

+    HsmDbgBreakOnStatus(-0x3fff30ff);

   }

-  return uVar2;

+  else {

+    uVar3 = *(uint *)(lVar1 + 0x28);

+  }

+  HsmDbgBreakOnStatus(iVar4);

+  if (iVar4 < 0) {

+    return uVar3;

+  }

+  if (param_2 == 0) {

+    uVar3 = uVar3 & 0xfffffff0;

+    goto LAB_0;

+  }

+  if (param_2 == 1) {

+    uVar2 = *(uint *)(param_1 + 0x28);

+LAB_1:

+    if (((byte)uVar2 & 0xf) <= ((byte)uVar3 & 0xf)) {

+      uVar2 = uVar3;

+    }

+    uVar3 = uVar3 ^ (uVar2 ^ uVar3) & 0xf;

+  }

+  else {

+    if (param_2 == 2) {

+      uVar2 = *(uint *)(param_1 + 0x28) >> 8;

+    }

+    else {

+      if (param_2 != 3) {

+        if (param_2 == 4) {

+          uVar2 = *(uint *)(param_1 + 0x28) >> 0x14;

+        }

+        else {

+          if ((param_2 == 6) || (param_2 == 7)) {

+            uVar3 = uVar3 & 0xfffffff3 | 3;

+            goto LAB_0;

+          }

+          if (param_2 != 9) {

+            if (param_2 != 10) goto LAB_0;

+            uVar2 = (uint)*(ushort *)(param_1 + 0x2a);

+            goto LAB_2;

+          }

+          uVar2 = *(uint *)(param_1 + 0x28) >> 4;

+        }

+        goto LAB_1;

+      }

+      uVar2 = *(uint *)(param_1 + 0x28) >> 0xc;

+    }

+LAB_2:

+    uVar3 = uVar3 ^ (uVar2 ^ uVar3) & 0xf;

+  }

+LAB_0:

+  uVar3 = uVar3 & (-(uint)(((byte)uVar3 & 0xf) < 3) & 0x200 | 0xfffffdff);

+  return uVar3 & (~(uVar3 * 2) | 0xfffffdff);

 }
```

## `HsmpCldGetSyncRootFileIdEx`  (modified)

```diff
--- HsmpCldGetSyncRootFileIdEx
+++ HsmpCldGetSyncRootFileIdEx
@@ -1,110 +1,33 @@
 

-/* WARNING: Variable defined which should be unmapped: param_5 */

+/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

 

 uint HsmpCldGetSyncRootFileIdEx

                (longlong param_1,longlong param_2,ulonglong param_3,ulonglong *param_4,int *param_5,

                undefined4 *param_6)

 

 {

-  int *piVar1;

-  uint uVar2;

-  uint uVar3;

-  longlong lVar4;

-  ulonglong uVar5;

-  undefined2 uVar6;

-  uint *unaff_RBX;

-  longlong unaff_RBP;

-  uint *unaff_RSI;

-  undefined4 unaff_EDI;

-  undefined *puVar7;

-  undefined4 unaff_R12D;

-  uint unaff_R13D;

-  longlong unaff_R14;

-  longlong unaff_R15;

-  uint *in_stack_00000040;

-  undefined4 uStack0000000000000048;

-  undefined8 uStack0000000000000050;

-  undefined8 uStack0000000000000058;

-  uint uStack0000000000000068;

+  uint uVar1;

+  ulonglong uVar2;

   

-  *(char *)(unaff_RBP + 0x7f) = (char)unaff_R12D;

-  uVar3 = HsmiOpPrepareOperation

-                    ((int *)unaff_RSI,-0x3fffffed,(uint)param_3,(int *)param_4,unaff_R15,

-                     (longlong)unaff_RBX,(longlong *)(unaff_RBP + -0x51),0x66,in_stack_00000040);

-  uVar5 = (ulonglong)uVar3;

-  HsmDbgBreakOnStatus(uVar3);

-  if (-1 < (int)uVar3) {

-    uVar3 = HsmFltProcessHydrate

-                      (uVar5,unaff_R14,*(undefined8 *)(unaff_RBP + -0x39),

-                       *(uint **)(unaff_RBP + 0x6f),unaff_RBX,unaff_RBX,

-                       *(undefined8 *)(unaff_RBP + -0x31),unaff_RSI,*(longlong *)(unaff_RBP + -0x41)

-                      );

-    HsmDbgBreakOnStatus(uVar3);

-  }

-  lVar4 = *(longlong *)(unaff_RBP + -0x51);

-  uVar2 = *(uint *)(unaff_RBP + -0x59);

-  *(longlong *)(unaff_RBP + 0x67) = lVar4;

-  if ((uVar2 & 1) != 0) {

-    FltAcquirePushLockExclusiveEx(unaff_R14 + 0x70,0);

-    piVar1 = (int *)(unaff_R14 + 0xac);

-    *piVar1 = *piVar1 + -1;

-    if (*piVar1 == 0) {

-      KeSetEvent(unaff_R14 + 0x90,0,0);

-    }

-    FltReleasePushLockEx(unaff_R14 + 0x70,0);

-    uVar2 = *(uint *)(unaff_RBP + -0x59);

-    lVar4 = *(longlong *)(unaff_RBP + 0x67);

-  }

-  if ((uVar2 & 2) != 0) {

-    KeSetEvent(lVar4 + 0x60,0,0);

-    uVar2 = *(uint *)(unaff_RBP + -0x59);

-  }

-  if ((uVar2 & 4) != 0) {

-    FltReleaseContext(*(undefined8 *)(unaff_RBP + 0x67));

-  }

-  FltReleaseContext();

-  if ((int)uVar3 < 0) {

-    puVar7 = WPP_GLOBAL_Control;

-    if (((uVar3 == 0x80000005) || (uVar3 == 0xc0000023)) ||

-       ((uVar3 == 0xc000cf13 && (*(char *)(unaff_RBP + 0x7f) == '\0')))) {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 3)

-         ) goto LAB_0;

-      lVar4 = *(longlong *)(unaff_RBP + 0x6f);

-      if (lVar4 != 0) {

-        unaff_R12D = *(undefined4 *)(lVar4 + 0x28);

-      }

-      if (unaff_RBX != (uint *)0x0) {

-        HsmpGetStreamSize((longlong)unaff_RBX);

-      }

-      uVar6 = 0xf2;

+  if (((param_2 != 0) && (param_5 == (int *)0x0)) && (param_6 == (undefined4 *)0x0)) {

+    if (DAT_0 == CldHsmGetSyncRootFileId) {

+      uVar2 = CldHsmGetSyncRootFileId(*(longlong *)(param_2 + 8));

     }

     else {

-      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

-         ) goto LAB_0;

-      lVar4 = *(longlong *)(unaff_RBP + 0x6f);

-      if (lVar4 != 0) {

-        unaff_R12D = *(undefined4 *)(lVar4 + 0x28);

-      }

-      if (unaff_RBX != (uint *)0x0) {

-        HsmpGetStreamSize((longlong)unaff_RBX);

-      }

-      uVar6 = 0xf1;

+      uVar2 = (*DAT_0)();

     }

-    uStack0000000000000058 = *(undefined8 *)(unaff_RBP + -0x39);

-    uStack0000000000000050 = *(undefined8 *)(unaff_RBP + -0x31);

-    uStack0000000000000048 = unaff_R12D;

-    uStack0000000000000068 = uVar3;

-    WPP_SF_lqqLiqLiqqd(*(undefined8 *)(puVar7 + 0x18),uVar6,lVar4,unaff_EDI);

+    *param_4 = uVar2;

+    if (uVar2 != 0) {

+      return 0;

+    }

   }

-  else if (uVar3 == 0x103) {

-    return 2;

+  uVar1 = HsmiCldGetSyncRootFileIdByFileObject(param_1,param_3,param_4,param_5,param_6);

+  HsmDbgBreakOnStatus(uVar1);

+  if ((((int)uVar1 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+     (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0 && (2 < (byte)WPP_GLOBAL_Control[0x29])))) {

+    WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x34,

+                &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

   }

-LAB_0:

-  if (unaff_R13D == 4) {

-    unaff_RSI[6] = uVar3;

-  }

-  return unaff_R13D;

+  return uVar1;

 }
```

## `HsmFltProcessQueryPlaceholder`  (modified)

```diff
--- HsmFltProcessQueryPlaceholder
+++ HsmpCldGetSyncRootProviderInfo
@@ -1,34 +1,314 @@
 

-/* WARNING: Variable defined which should be unmapped: param_5 */

-/* WARNING: Variable defined which should be unmapped: param_12 */

-

-ulonglong *

-HsmFltProcessQueryPlaceholder

-          (undefined8 param_1,longlong param_2,ulonglong param_3,undefined8 param_4,longlong param_5

-          ,longlong param_6,undefined8 param_7,undefined8 param_8,ulonglong *param_9,

-          undefined8 param_10,uint param_11,ulonglong *param_12)

+uint HsmpCldGetSyncRootProviderInfo

+               (longlong param_1,longlong param_2,undefined8 param_3,undefined4 *param_4,

+               uint param_5,uint *param_6)

 

 {

-  longlong unaff_RBX;

-  longlong unaff_RBP;

-  longlong unaff_RSI;

-  undefined4 unaff_EDI;

-  undefined8 uVar1;

-  undefined **in_R10;

-  uint unaff_R13D;

-  undefined4 unaff_R15D;

+  int iVar1;

+  uint uVar2;

+  char cVar3;

+  uint uVar4;

+  uint *puVar5;

+  undefined8 uVar6;

+  longlong lVar7;

+  uint uVar8;

+  undefined2 uVar9;

+  int iVar10;

+  int iVar11;

+  int iVar12;

+  undefined4 local_res10;

+  undefined4 uStackX_14;

+  ulonglong in_stack_ffffffffffffff38;

+  undefined8 in_stack_ffffffffffffff40;

+  undefined4 uVar13;

+  longlong lStack_98;

+  uint auStack_90 [2];

+  undefined8 uStack_88;

+  undefined8 uStack_80;

+  uint *puStack_78;

+  int iStack_70;

+  uint uStack_6c;

+  uint uStack_68;

+  undefined8 uStack_60;

+  undefined8 uStack_58;

+  uint *puStack_50;

+  longlong local_48;

+  longlong lStack_40;

   

-  if (((in_R10 != &WPP_GLOBAL_Control) && ((*(uint *)((longlong)in_R10 + 0x2c) & 1) != 0)) &&

-     (2 < *(byte *)((longlong)in_R10 + 0x29))) {

-    uVar1 = *(undefined8 *)(unaff_RBP + 0x6f);

-    if (unaff_RBX != 0) {

-      HsmpGetStreamSize(unaff_RBX);

-    }

-    WPP_SF_lqqLiqLiqqd(in_R10[3],0xf2,uVar1,unaff_EDI);

-  }

-  if (unaff_R13D == 4) {

-    *(undefined4 *)(unaff_RSI + 0x18) = unaff_R15D;

-  }

-  return (ulonglong *)(ulonglong)unaff_R13D;

+  uVar13 = (undefined4)((ulonglong)in_stack_ffffffffffffff40 >> 0x20);

+  uVar6 = *(undefined8 *)(param_2 + 0x20);

+  uStack_60 = 0;

+  uStack_88 = 0;

+  puStack_78 = (uint *)0x0;

+  lStack_98 = 0;

+  auStack_90[0] = 0;

+  iVar11 = 0;

+  iVar10 = 0;

+  uStack_80 = uVar6;

+  uStack_58 = uVar6;

+  lStack_40 = HsmpGetStreamHandleContext(param_1,*(longlong *)(param_2 + 0x18),uVar6);

+  if (lStack_40 != 0) {

+    lVar7 = *(longlong *)(*(longlong *)(lStack_40 + 0x10) + 0x10);

+    uStack_60 = *(undefined8 *)(lVar7 + 0x10);

+    uStack_88 = *(undefined8 *)(lVar7 + 0x20);

+  }

+  iVar1 = *(int *)(*(longlong *)(param_1 + 0x10) + 0x28);

+  iVar12 = 0;

+  if (iVar1 < 0x3d) {

+    if (iVar1 == 0x3c) {

+      iVar11 = 0x58;

+      iVar10 = 0x3c;

+      iVar12 = iVar11;

+    }

+    else {

+      if (iVar1 == 1) {

+        iVar11 = 0x40;

+      }

+      else {

+        if (iVar1 != 2) {

+          if (iVar1 == 3) {

+            iVar11 = 0x5e;

+          }

+          else {

+            if (iVar1 != 0x25) {

+              iVar10 = 0;

+              if (iVar1 == 0x26) goto LAB_0;

+              goto LAB_1;

+            }

+            iVar11 = 0x68;

+          }

+          iVar10 = 0x4f;

+          iVar12 = 0x6a;

+          goto LAB_1;

+        }

+        iVar11 = 0x44;

+      }

+      iVar10 = 0x4e;

+      iVar12 = 0x50;

+    }

+  }

+  else if (iVar1 == 0x3f) {

+    iVar11 = 0x72;

+    iVar10 = 0x3f;

+    iVar12 = iVar11;

+  }

+  else if (iVar1 == 0x4e) {

+LAB_0:

+    iVar11 = 0x50;

+    iVar10 = 0x4e;

+    iVar12 = 0x50;

+  }

+  else if (iVar1 == 0x4f) {

+    iVar11 = 0x6a;

+    iVar10 = 0x4f;

+    iVar12 = 0x6a;

+  }

+  else if (iVar1 == 0x50) {

+    iVar11 = 0x60;

+    iVar10 = 0x50;

+    iVar12 = iVar11;

+  }

+  else if (iVar1 == 0x51) {

+    iVar11 = 0x7a;

+    iVar10 = 0x51;

+    iVar12 = iVar11;

+  }

+LAB_1:

+  uVar4 = *(uint *)(*(longlong *)(param_1 + 0x10) + 0x18);

+  uVar8 = (iVar12 - iVar11) + uVar4;

+  iStack_70 = iVar1;

+  if (uVar8 < uVar4) {

+    uVar4 = 0xc000000d;

+    HsmDbgBreakOnStatus(-0x3ffffff3);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_qqqiDDd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),WPP_GLOBAL_Control,uVar6,param_1);

+    }

+    goto LAB_2;

+  }

+  if (0x100000 < uVar8) {

+    uVar8 = 0x100000;

+  }

+  puVar5 = (uint *)ExAllocatePool2(0x100,uVar8,0x64517348);

+  puStack_78 = puVar5;

+  puStack_50 = puVar5;

+  if (puVar5 == (uint *)0x0) {

+    uVar4 = 0xc000009a;

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2))

+    goto LAB_2;

+    uVar9 = 0xb;

+    uVar4 = 0xc000009a;

+  }

+  else {

+    uVar4 = FltAllocateCallbackDataEx

+                      (*(undefined8 *)(CONCAT44(uStackX_14,local_res10) + 0x18),

+                       *(undefined8 *)(CONCAT44(uStackX_14,local_res10) + 0x20),1,&lStack_98);

+    HsmDbgBreakOnStatus(uVar4);

+    if ((int)uVar4 < 0) {

+      if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) || ((byte)WPP_GLOBAL_Control[0x29] < 2)

+         ) goto LAB_2;

+      uVar9 = 0xc;

+    }

+    else {

+      uVar4 = FltPropagateIrpExtension(param_1,lStack_98,0);

+      HsmDbgBreakOnStatus(uVar4);

+      if ((int)uVar4 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+           ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+        uVar9 = 0xd;

+      }

+      else {

+        *(undefined1 *)(*(longlong *)(lStack_98 + 0x10) + 4) = 0xc;

+        *(undefined1 *)(*(longlong *)(lStack_98 + 0x10) + 5) = 1;

+        *(uint *)(*(longlong *)(lStack_98 + 0x10) + 0x18) = uVar8;

+        *(undefined8 *)(*(longlong *)(lStack_98 + 0x10) + 0x20) =

+             *(undefined8 *)(*(longlong *)(param_1 + 0x10) + 0x20);

+        *(int *)(*(longlong *)(lStack_98 + 0x10) + 0x28) = iVar10;

+        *(undefined4 *)(*(longlong *)(lStack_98 + 0x10) + 0x30) =

+             *(undefined4 *)(*(longlong *)(param_1 + 0x10) + 0x30);

+        *(uint **)(*(longlong *)(lStack_98 + 0x10) + 0x38) = puVar5;

+        *(undefined8 *)(*(longlong *)(lStack_98 + 0x10) + 0x40) = 0;

+        *(undefined1 *)(*(longlong *)(lStack_98 + 0x10) + 6) =

+             *(undefined1 *)(*(longlong *)(param_1 + 0x10) + 6);

+        FltPerformSynchronousIo(lStack_98);

+        uVar4 = *(uint *)(lStack_98 + 0x18);

+        HsmDbgBreakOnStatus(uVar4);

+        uVar8 = *(uint *)(lStack_98 + 0x20);

+        uStack_6c = uVar8;

+        FltFreeCallbackData();

+        lStack_98 = 0;

+        *(uint *)(param_1 + 0x18) = uVar4;

+        if ((int)uVar4 < 0) {

+          if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+              ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+             ((byte)WPP_GLOBAL_Control[0x29] < 4)) goto LAB_2;

+          uVar9 = 0x12;

+        }

+        else {

+          lVar7 = *(longlong *)(param_1 + 0x10);

+          uVar2 = *(uint *)(lVar7 + 0x18);

+          uStack_68 = uVar2;

+          if (*(longlong *)(lVar7 + 0x40) == 0) {

+            lVar7 = *(longlong *)(lVar7 + 0x38);

+            local_48 = lVar7;

+            if ((*(char *)(param_1 + 0x50) == '\0') ||

+               (ProbeForWrite(lVar7,uVar2,1), -1 < (int)uVar4)) {

+LAB_3:

+              cVar3 = HsmOsGetPlaceholderCompatMode(param_1);

+              if (iVar10 == 0x3c) {

+                uVar6 = HsmiMungeQueryDirectoryBufferForFileIdExtdDirectoryInformation

+                                  (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90);

+                uVar4 = (uint)uVar6;

+LAB_4:

+                HsmDbgBreakOnStatus(uVar4);

+              }

+              else {

+                if (iVar10 == 0x3f) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdExtdBothDirectoryInformation

+                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

+                  ;

+                  uVar4 = (uint)uVar6;

+                  goto LAB_4;

+                }

+                if (iVar10 == 0x4e) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferWithoutShortnameFileId64

+                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

+                  ;

+                  uVar4 = (uint)uVar6;

+                  goto LAB_4;

+                }

+                if (iVar10 == 0x4f) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferWithShortnameFileId64

+                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

+                  ;

+                  uVar4 = (uint)uVar6;

+                  goto LAB_4;

+                }

+                if (iVar10 == 0x50) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdAllExtdDirectoryInformation

+                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

+                  ;

+                  uVar4 = (uint)uVar6;

+                  goto LAB_4;

+                }

+                if (iVar10 == 0x51) {

+                  uVar6 = HsmiMungeQueryDirectoryBufferForFileIdAllExtdBothDirectoryInformation

+                                    (cVar3,iVar1,puStack_78,(ulonglong)uVar8,lVar7,uVar2,auStack_90)

+                  ;

+                  uVar4 = (uint)uVar6;

+                  goto LAB_4;

+                }

+              }

+              if (-1 < (int)uVar4) {

+                *(ulonglong *)(param_1 + 0x20) = (ulonglong)auStack_90[0];

+                goto LAB_2;

+              }

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+              uVar9 = 0x11;

+            }

+            else {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+              uVar9 = 0x10;

+            }

+          }

+          else {

+            uVar4 = FltLockUserBuffer(param_1);

+            HsmDbgBreakOnStatus(uVar4);

+            if ((int)uVar4 < 0) {

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+              uVar9 = 0xe;

+            }

+            else {

+              lVar7 = *(longlong *)(*(longlong *)(param_1 + 0x10) + 0x40);

+              if ((*(byte *)(lVar7 + 10) & 5) == 0) {

+                lVar7 = MmMapLockedPagesSpecifyCache

+                                  (lVar7,0,1,0,in_stack_ffffffffffffff38 & 0xffffffff00000000,

+                                   CONCAT44(uVar13,0x40000010));

+              }

+              else {

+                lVar7 = *(longlong *)(lVar7 + 0x18);

+              }

+              if (lVar7 != 0) goto LAB_3;

+              uVar4 = 0xc0000017;

+              HsmDbgBreakOnStatus(-0x3fffffe9);

+              if ((((undefined **)WPP_GLOBAL_Control == &WPP_GLOBAL_Control) ||

+                  ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) == 0)) ||

+                 ((byte)WPP_GLOBAL_Control[0x29] < 2)) goto LAB_2;

+              uVar9 = 0xf;

+              uVar4 = 0xc0000017;

+            }

+          }

+        }

+      }

+    }

+  }

+  WPP_SF_qqqid(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),uVar9,

+               &WPP_23c031617105374e664d37900f58dae3_Traceguids,param_1);

+LAB_2:

+  if ((int)uVar4 < 0) {

+    *(uint *)(param_1 + 0x18) = uVar4;

+    *(undefined8 *)(param_1 + 0x20) = 0;

+  }

+  if (lStack_98 != 0) {

+    FltFreeCallbackData();

+  }

+  if (puStack_78 != (uint *)0x0) {

+    ExFreePoolWithTag(puStack_78,0x64517348);

+  }

+  if (lStack_40 != 0) {

+    FltReleaseContext();

+  }

+  return uVar4;

 }
```

## `HsmiBitmapNORMALLookupMcbMapping`  (modified)

```diff
--- HsmiBitmapNORMALLookupMcbMapping
+++ HsmFltPreSET_INFORMATION
@@ -1,85 +1,10 @@
 

-undefined8

-HsmiBitmapNORMALLookupMcbMapping

-          (longlong param_1,ulonglong param_2,longlong param_3,longlong *param_4,undefined1 *param_5

-          )

+/* WARNING: Control flow encountered bad instruction data */

+

+uint HsmFltPreSET_INFORMATION(uint *param_1,longlong param_2,longlong *param_3)

 

 {

-  undefined8 *puVar1;

-  bool bVar2;

-  undefined8 uVar3;

-  longlong lVar4;

-  longlong lVar5;

-  longlong lVar6;

-  int iVar7;

-  char cVar8;

-  longlong lVar9;

-  char cVar10;

-  char local_res18 [8];

-  longlong local_res20;

-  

-  bVar2 = false;

-  cVar10 = '\x03';

-  *param_5 = 0;

-  lVar5 = *param_4;

-  lVar9 = lVar5 + param_3;

-  lVar6 = param_3;

-  cVar8 = '\x03';

-  if (param_3 < lVar9) {

-    do {

-      cVar8 = cVar10;

-      if (bVar2) break;

-      lVar9 = (lVar5 - lVar6) + param_3;

-      local_res20 = lVar9;

-      for (iVar7 = 0; iVar7 < 2; iVar7 = iVar7 + 1) {

-        local_res18[0] = '\0';

-        if (iVar7 == 0) {

-          if ((param_2 & 1) != 0) {

-            lVar5 = param_1 + 0x40;

-            lVar4 = 0x70;

-LAB_0:

-            puVar1 = (undefined8 *)(lVar4 + param_1);

-            if (((undefined8 *)*puVar1 == puVar1) ||

-               (uVar3 = HsmiBitmapNORMALLookupMcbGroupMapping

-                                  (puVar1,lVar5,lVar6,&local_res20,local_res18), lVar9 = local_res20

-               , (char)uVar3 == '\0')) {

-              if (iVar7 == 1) {

-                if (cVar10 == '\x03') {

-                  lVar6 = lVar6 + lVar9;

-                }

-                goto LAB_1;

-              }

-            }

-            else {

-              if (cVar10 == '\x03') {

-                cVar10 = local_res18[0] != '\0';

-              }

-              if ((bool)local_res18[0] != (cVar10 == '\x01')) {

-LAB_1:

-                bVar2 = true;

-                break;

-              }

-              lVar6 = lVar6 + local_res20;

-            }

-          }

-        }

-        else if ((param_2 & 2) != 0) {

-          lVar5 = 0;

-          lVar4 = 0x80;

-          goto LAB_0;

-        }

-      }

-      lVar5 = *param_4;

-      lVar9 = lVar5 + param_3;

-      cVar8 = cVar10;

-    } while (lVar6 < lVar9);

-  }

-  *param_5 = cVar8 == '\x01';

-  lVar5 = *param_4 + param_3;

-  if (lVar6 < *param_4 + param_3) {

-    lVar5 = lVar6;

-  }

-  *param_4 = lVar5 - param_3;

-  return CONCAT71((int7)((ulonglong)lVar9 >> 8),cVar8 != '\x03');

+                    /* WARNING: Bad instruction - Truncating control flow here */

+  halt_baddata();

 }
```

## `HsmiRecallPostProcessUserHydrationRequest`  (modified)

```diff
--- HsmiRecallPostProcessUserHydrationRequest
+++ HsmiRecallFreeHydrationContext
@@ -1,118 +1,76 @@
 

-uint HsmiRecallPostProcessUserHydrationRequest(longlong param_1,longlong param_2,int param_3)

+int HsmiRecallFreeHydrationContext(longlong param_1)

 

 {

-  byte bVar1;

-  char cVar2;

-  uint uVar3;

-  longlong in_RAX;

-  char *pcVar4;

-  uint uVar5;

-  uint unaff_EBX;

-  uint unaff_EBP;

-  uint unaff_ESI;

-  undefined4 in_register_00000084;

+  uint uVar1;

+  undefined8 uVar2;

+  longlong *plVar3;

+  longlong lVar4;

+  int in_EAX;

+  int iVar5;

   longlong lVar6;

-  ulonglong in_R9;

-  uint in_R10D;

-  short in_R11W;

-  ulonglong unaff_R13;

-  short unaff_R14W;

-  ulonglong unaff_R15;

-  byte in_CF;

-  bool bVar7;

+  ulonglong uVar7;

+  undefined8 in_R8;

+  undefined8 uVar8;

+  longlong lVar9;

+  undefined8 in_R9;

+  undefined8 uVar10;

+  undefined8 in_stack_ffffffffffffff00;

+  undefined8 in_stack_ffffffffffffff08;

+  undefined4 uVar12;

+  undefined8 uVar11;

+  longlong alStack_b0 [22];

   

-  lVar6 = CONCAT44(in_register_00000084,param_3);

-  bVar7 = CARRY1((byte)param_1,*(byte *)(in_RAX + -0x73)) ||

-          CARRY1((byte)param_1 + *(byte *)(in_RAX + -0x73),in_CF);

-  bVar1 = (byte)in_RAX - 0x33;

-  cVar2 = bVar1 + bVar7;

-  pcVar4 = (char *)CONCAT71((int7)((ulonglong)in_RAX >> 8),cVar2);

-  *pcVar4 = *pcVar4 + cVar2 + (0x32 < (byte)in_RAX || CARRY1(bVar1,bVar7));

-  *pcVar4 = *pcVar4 + cVar2;

-  if (((((ulonglong)param_2 <= in_R9) && (uVar3 = (uint)in_R9, uVar3 <= in_R10D)) &&

-      (*(ushort *)(lVar6 + 0x52) <= in_R10D)) &&

-     (((uVar5 = *(ushort *)(lVar6 + 0x52) + uVar3, uVar3 <= uVar5 && (uVar5 <= in_R10D)) &&

-      ((in_R11W == 10 && (*(short *)(lVar6 + 0x52) == (short)unaff_R13)))))) {

-    unaff_EBP = *(uint *)((ulonglong)*(uint *)(lVar6 + 0x54) + lVar6);

-  }

-  uVar3 = unaff_ESI & 0xffff;

-  if (uVar3 == 0) {

-    pcVar4 = (char *)0x1;

-  }

-  else if (uVar3 == 1) {

-    pcVar4 = (char *)0x2;

-  }

-  else if (uVar3 != 2) {

-    pcVar4 = (char *)(unaff_R13 & 0xffffffff);

-  }

-  uVar3 = (uint)pcVar4;

-  if ((unaff_ESI & 0x10000) != 0) {

-    uVar3 = uVar3 | 0x100;

-  }

-  if ((unaff_ESI & 0x20000) != 0) {

-    uVar3 = uVar3 | 0x200;

-  }

-  if ((unaff_ESI & 0x40000) != 0) {

-    uVar3 = uVar3 | 0x2000000;

-  }

-  if ((unaff_ESI & 0x80000) != 0) {

-    uVar3 = uVar3 | 0x4000000;

-  }

-  if (unaff_R14W == 0) {

-    uVar3 = uVar3 | 0x10;

-  }

-  else if (unaff_R14W == 2) {

-    uVar3 = uVar3 | 0x30;

+  uVar12 = (undefined4)((ulonglong)in_stack_ffffffffffffff08 >> 0x20);

+  uVar7 = (ulonglong)(in_EAX - 0x48);

+  lVar9 = *(longlong *)(param_1 + 0x10);

+  *(undefined8 *)(uVar7 + 0x50) = 0;

+  alStack_b0[0] = 0;

+  lVar6 = *(longlong *)(lVar9 + 0x10);

+  uVar2 = *(undefined8 *)(lVar9 + 0x20);

+  memset((void *)(uVar7 - 0x80),0,0x98);

+  uVar10 = 0x100080;

+  uVar11 = CONCAT44(uVar12,0x200000);

+  uVar8 = uVar2;

+  iVar5 = HsmpOpenFileByIdEx(lVar6,*(undefined8 *)(lVar6 + 0x20),uVar2,0x100080,

+                             in_stack_ffffffffffffff00,0x200000,'\0',alStack_b0,

+                             (longlong *)(uVar7 + 0x50));

+  HsmDbgBreakOnStatus(iVar5);

+  if (iVar5 < 0) {

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_iqqLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),

+                   (ulonglong)*(uint *)(WPP_GLOBAL_Control + 0x2c),uVar8,uVar2);

+    }

   }

   else {

-    uVar3 = uVar3 | 0x40;

+    lVar9 = *(longlong *)(uVar7 + 0x50);

+    *(undefined4 *)(uVar7 - 0x78) = *(undefined4 *)(uVar7 + 0x58);

+    plVar3 = *(longlong **)(uVar7 + 0x80);

+    uVar1 = *(uint *)(uVar7 + 0x78);

+    lVar4 = *(longlong *)(uVar7 + 0x70);

+    *(undefined4 *)(uVar7 - 0x80) = 0x9000001a;

+    *(undefined4 *)(uVar7 - 0x7c) = 0xc0000011;

+    *(undefined8 *)(uVar7 - 0x70) = in_R8;

+    *(undefined8 *)(uVar7 - 0x68) = in_R9;

+    iVar5 = HsmpProcessQueryRangeStateHelper

+                      (0,lVar6,lVar9,uVar10,param_1,uVar11,uVar2,0,uVar7 - 0x80,0x98,lVar4,uVar1,

+                       plVar3);

+    HsmDbgBreakOnStatus(iVar5);

+    if (((iVar5 < 0) && ((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control)) &&

+       (((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 8) != 0 && (1 < (byte)WPP_GLOBAL_Control[0x29]))))

+    {

+      WPP_SF_qiqqLd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),lVar6,lVar9,

+                    *(undefined8 *)(uVar7 + 0x50));

+    }

   }

-  if ((int)unaff_EBX < 0) {

-    uVar3 = uVar3 | 0x400;

+  if (alStack_b0[0] != 0) {

+    FltClose();

   }

-  if ((unaff_EBX & 0x10) != 0) {

-    uVar3 = uVar3 | 0x10000;

+  if (*(longlong *)(uVar7 + 0x50) != 0) {

+    ObfDereferenceObject(*(undefined8 *)(uVar7 + 0x50));

   }

-  if ((unaff_EBX & 0x20) != 0) {

-    uVar3 = uVar3 | 0x20000;

-  }

-  if ((unaff_EBX & 0x40) != 0) {

-    uVar3 = uVar3 | 0x40000;

-  }

-  if ((char)(byte)unaff_EBX < '\0') {

-    uVar3 = uVar3 | 0x80000;

-  }

-  if ((unaff_EBX & 0x200) != 0) {

-    uVar3 = uVar3 | 0x100000;

-  }

-  if ((unaff_EBX & 1) != 0) {

-    uVar3 = uVar3 | 0x800;

-  }

-  if ((unaff_EBX & 2) != 0) {

-    uVar3 = uVar3 | 0x1000;

-  }

-  if ((byte)((byte)unaff_R13 & (byte)unaff_EBX) != 0) {

-    uVar3 = uVar3 | 0x2000;

-  }

-  if ((unaff_EBX & 8) != 0) {

-    uVar3 = uVar3 | 0x4000;

-  }

-  if ((unaff_EBX >> 8 & 1) != 0) {

-    uVar3 = uVar3 | 0x8000;

-  }

-  if ((unaff_R15 & 1) != 0) {

-    uVar3 = uVar3 | 0x200000;

-  }

-  if ((unaff_EBP & 1) != 0) {

-    uVar3 = uVar3 | 0x8000000;

-  }

-  if ((unaff_EBP & 2) != 0) {

-    uVar3 = uVar3 | 0x10000000;

-  }

-  if ((byte)((byte)unaff_R13 & (byte)unaff_EBP) != 0) {

-    uVar3 = uVar3 | 0x20000000;

-  }

-  return uVar3;

+  return iVar5;

 }
```

## `HsmiCldGetSyncRootInfo`  (modified)

```diff
--- HsmiCldGetSyncRootInfo
+++ HsmFreeFileIdentity
@@ -1,37 +1,10 @@
 

-/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */

-

-uint HsmiCldGetSyncRootInfo(longlong param_1,longlong param_2,undefined8 param_3,longlong *param_4)

+void HsmFreeFileIdentity(longlong param_1)

 

 {

-  uint uVar1;

-  longlong lVar2;

-  longlong local_res10;

-  

-  uVar1 = 0;

-  local_res10 = 0;

-  *param_4 = 0;

-  if ((param_2 == 0) || (local_res10 = (*DAT_0)(), local_res10 == 0)) {

-    uVar1 = HsmiCldGetSyncRootInfoByFileObject(param_1,param_3,&local_res10);

-    HsmDbgBreakOnStatus(uVar1);

-    if ((int)uVar1 < 0) {

-      lVar2 = local_res10;

-      if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

-          ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (4 < (byte)WPP_GLOBAL_Control[0x29])

-         ) {

-        WPP_SF_qqqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x23,

-                    &WPP_3908498190613570cb26e49c321d2b2f_Traceguids,param_1);

-        lVar2 = local_res10;

-      }

-      goto LAB_1;

-    }

+  if (param_1 != 0) {

+    ExFreePoolWithTag(param_1,0x69467348);

   }

-  *param_4 = local_res10;

-  lVar2 = 0;

-LAB_1:

-  if (lVar2 != 0) {

-    ExFreePoolWithTag(lVar2,0);

-  }

-  return uVar1;

+  return;

 }
```

## `HsmIBitmapNORMALOpen`  (modified)

```diff
--- HsmIBitmapNORMALOpen
+++ HsmiBitmapNORMALOpenOnDisk
@@ -1,76 +1,54 @@
 

-/* WARNING: Function: __security_check_cookie replaced with injection: security_check_cookie */

-

-int HsmIBitmapNORMALOpen

-              (ulonglong param_1,undefined8 param_2,longlong param_3,undefined4 param_4,

-              longlong param_5,uint param_6,undefined8 *param_7)

+uint HsmiBitmapNORMALOpenOnDisk

+               (ulonglong *******param_1,uint param_2,ulonglong *******param_3,

+               ulonglong *******param_4)

 

 {

   uint uVar1;

-  int iVar2;

-  longlong lVar3;

-  undefined8 uVar4;

-  undefined8 *unaff_RBX;

-  ulonglong unaff_RSI;

-  int unaff_EDI;

-  uint uVar5;

-  ulonglong uVar6;

-  byte unaff_R14B;

-  undefined **unaff_R15;

-  uint in_stack_00000070;

-  longlong in_stack_00000090;

-  int in_stack_000000a0;

+  void *in_RAX;

+  uint unaff_EBX;

+  longlong unaff_RBP;

+  undefined8 *unaff_RSI;

+  undefined8 *unaff_RDI;

+  undefined8 unaff_R12;

+  undefined8 unaff_R13;

+  ulonglong unaff_R14;

+  void *unaff_R15;

+  undefined8 uStack0000000000000038;

+  undefined4 uStack0000000000000040;

   

-  uVar4 = *(undefined8 *)(param_1 + 0x18);

-  WPP_SF_qisdil(uVar4,(undefined2)param_2,param_3,unaff_RBX,*unaff_RBX,(char *)param_3);

-  iVar2 = HsmiBitmapTranslateIOStatus(uVar4,unaff_EDI);

-  HsmDbgBreakOnStatus(iVar2);

-  if (in_stack_00000090 != 0) {

-    FltClose();

+  *(int *)(unaff_RDI + 7) = (int)in_RAX;

+  if (in_RAX == (void *)0x0) {

+    unaff_EBX = 0xc000009a;

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_iisd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x66,param_3,unaff_R13,unaff_R12,

+                  (char *)(unaff_RBP + 0x67));

+    }

+    HsmpBitmapRelease((longlong)unaff_RDI);

   }

-  if (in_stack_000000a0 != (int)unaff_RSI) {

-    HsmIBitmapNORMALUnpinBlock((int *)&stack0x000000d0);

+  else {

+    memmove(in_RAX,unaff_R15,unaff_R14 & 0xffffffff);

+    uVar1 = *(uint *)(unaff_RDI + 2);

+    *(undefined8 *)(unaff_RBP + 7) = 0;

+    *(undefined8 **)(unaff_RBP + -0x11) = unaff_RDI;

+    *(uint *)(unaff_RBP + -9) = uVar1 >> 0xc & 7;

+    uVar1 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RDI);

+    *(uint *)(unaff_RBP + -5) = uVar1;

+    *(undefined8 *)(unaff_RBP + -1) = unaff_R12;

+    HsmExpandKernelStackAndCallout(HsmiBitmapNORMALOpenOnDiskCallout,(int *)(unaff_RBP + 7));

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      uStack0000000000000038 = unaff_RDI[0x12];

+      uStack0000000000000040 = *(undefined4 *)(unaff_RDI + 3);

+      WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x67,*unaff_RDI,unaff_RDI,*unaff_RDI,

+                    (char *)(unaff_RDI + 4));

+    }

+    *unaff_RSI = unaff_RDI;

   }

-  if (iVar2 < 0) {

-    lVar3 = unaff_RBX[0x14];

-    if (lVar3 != 0) {

-      do {

-        if (in_stack_00000070 != 0) break;

-        if (*(longlong *)(lVar3 + 8) != 0) {

-          HsmFileCacheCloseFileObject(*(longlong *)(lVar3 + 8));

-          *(ulonglong *)(unaff_RBX[0x14] + 8) = unaff_RSI;

-        }

-        if (*(longlong *)unaff_RBX[0x14] != 0) {

-          ObfDereferenceObject();

-          *(ulonglong *)unaff_RBX[0x14] = unaff_RSI;

-        }

-        uVar6 = unaff_RSI & 0xffffffff;

-        uVar1 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RBX);

-        if (uVar1 != 0) {

-          do {

-            if (*(longlong *)(unaff_RBX[0x14] + 0x10 + uVar6 * 8) != 0) {

-              ObfDereferenceObject();

-              *(ulonglong *)(unaff_RBX[0x14] + 0x10 + uVar6 * 8) = unaff_RSI;

-            }

-            uVar5 = (int)uVar6 + 1;

-            uVar6 = (ulonglong)uVar5;

-            uVar1 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RBX);

-          } while (uVar5 < uVar1);

-        }

-        in_stack_00000070 = 1;

-        lVar3 = unaff_RBX[0x14];

-      } while (lVar3 != 0);

-      unaff_R15 = &WPP_GLOBAL_Control;

-    }

-    if ((((undefined **)WPP_GLOBAL_Control != unaff_R15) &&

-        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) &&

-       (unaff_R14B <= (byte)WPP_GLOBAL_Control[0x29])) {

-      WPP_SF_qisdd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x55,(ulonglong)in_stack_00000070,

-                   unaff_RBX,*unaff_RBX,(char *)(unaff_RBX + 4));

-    }

-  }

-  *(int *)(unaff_RBX + 3) = iVar2;

-  FltReleasePushLockEx(unaff_RBX + 6,0);

-  return iVar2;

+  return unaff_EBX;

 }
```

## `HsmiCtxGetOrCreateFileContext`  (modified)

```diff
--- HsmiCtxGetOrCreateFileContext
+++ HsmiBitmapNORMALOpenOnDisk
@@ -1,46 +1,54 @@
 

-int HsmiCtxGetOrCreateFileContext

-              (longlong param_1,longlong param_2,undefined8 param_3,longlong *param_4)

+uint HsmiBitmapNORMALOpenOnDisk

+               (ulonglong *******param_1,uint param_2,ulonglong *******param_3,

+               ulonglong *******param_4)

 

 {

-  undefined2 uVar1;

-  int iVar2;

-  undefined2 *puVar3;

-  longlong lVar4;

-  undefined8 uStack0000000000000028;

-  longlong lStack0000000000000030;

-  int in_stack_00000040;

-  undefined8 in_stack_00000090;

+  uint uVar1;

+  void *in_RAX;

+  uint unaff_EBX;

+  longlong unaff_RBP;

+  undefined8 *unaff_RSI;

+  undefined8 *unaff_RDI;

+  undefined8 unaff_R12;

+  undefined8 unaff_R13;

+  ulonglong unaff_R14;

+  void *unaff_R15;

+  undefined8 uStack0000000000000038;

+  undefined4 uStack0000000000000040;

   

-  lVar4 = 0;

-  puVar3 = (undefined2 *)func_0x00014005d614();

-  if (puVar3 == (undefined2 *)0x0) {

-    iVar2 = -0x3ffffda1;

-LAB_0:

-    HsmDbgBreakOnStatus(iVar2);

+  *(int *)(unaff_RDI + 7) = (int)in_RAX;

+  if (in_RAX == (void *)0x0) {

+    unaff_EBX = 0xc000009a;

+    HsmDbgBreakOnStatus(-0x3fffff66);

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (1 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      WPP_SF_iisd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x66,param_3,unaff_R13,unaff_R12,

+                  (char *)(unaff_RBP + 0x67));

+    }

+    HsmpBitmapRelease((longlong)unaff_RDI);

   }

   else {

-    uVar1 = *puVar3;

-    if (*(char *)((longlong)puVar3 + 3) != '\0') {

-      iVar2 = RtlGetCompressionWorkSpaceSize(uVar1,&stack0x00000044,&stack0x00000040);

-      HsmDbgBreakOnStatus(iVar2);

-      if (iVar2 < 0) {

-        return iVar2;

-      }

-      if ((in_stack_00000040 != 0) &&

-         (lVar4 = ExAllocatePool2(0x100,in_stack_00000040,0x72507348), lVar4 == 0)) {

-        iVar2 = -0x3fffff66;

-        goto LAB_0;

-      }

+    memmove(in_RAX,unaff_R15,unaff_R14 & 0xffffffff);

+    uVar1 = *(uint *)(unaff_RDI + 2);

+    *(undefined8 *)(unaff_RBP + 7) = 0;

+    *(undefined8 **)(unaff_RBP + -0x11) = unaff_RDI;

+    *(uint *)(unaff_RBP + -9) = uVar1 >> 0xc & 7;

+    uVar1 = HsmiBitmapNORMALGetNumberOfPlexCopies((longlong)unaff_RDI);

+    *(uint *)(unaff_RBP + -5) = uVar1;

+    *(undefined8 *)(unaff_RBP + -1) = unaff_R12;

+    HsmExpandKernelStackAndCallout(HsmiBitmapNORMALOpenOnDiskCallout,(int *)(unaff_RBP + 7));

+    if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+        ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 1) != 0)) && (3 < (byte)WPP_GLOBAL_Control[0x29]))

+    {

+      uStack0000000000000038 = unaff_RDI[0x12];

+      uStack0000000000000040 = *(undefined4 *)(unaff_RDI + 3);

+      WPP_SF_qisdil(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x67,*unaff_RDI,unaff_RDI,*unaff_RDI,

+                    (char *)(unaff_RDI + 4));

     }

-    uStack0000000000000028 = in_stack_00000090;

-    lStack0000000000000030 = lVar4;

-    iVar2 = RtlDecompressBufferEx(uVar1);

-    HsmDbgBreakOnStatus(iVar2);

-    if (lVar4 != 0) {

-      ExFreePoolWithTag(lVar4,0x72507348);

-    }

+    *unaff_RSI = unaff_RDI;

   }

-  return iVar2;

+  return unaff_EBX;

 }
```

## `CldHsmNotifyPostOperation`  (modified)

```diff
--- CldHsmNotifyPostOperation
+++ CldHsmNotifyPostOperation
@@ -1,2 +1,56 @@
-Failed to decompile cldflt.sys - .ProgramDB CldHsmNotifyPostOperation : Error: Decompile error: 
-Low-level Error: DuplicateFunctionError, but could not recover original symbol+

+void CldHsmNotifyPostOperation

+               (undefined4 param_1,longlong param_2,longlong *param_3,longlong param_4,

+               undefined4 param_5,undefined8 param_6,void *param_7,void *param_8)

+

+{

+  undefined8 *puVar1;

+  ulonglong uVar2;

+  undefined8 uVar3;

+  void **ppvVar4;

+  uint uVar5;

+  uint *puVar6;

+  void *pvVar7;

+  uint local_res18 [2];

+  void *local_28 [2];

+  

+  local_28[0] = (void *)0x0;

+  local_res18[0] = 0;

+  puVar1 = (undefined8 *)param_3[4];

+  if ((DAT_0 != '\0') && (puVar1 != (undefined8 *)0x0)) {

+    uVar2 = Feature_3667029304__private_IsEnabledDeviceUsageNoInline();

+    if ((int)uVar2 == 0) {

+      pvVar7 = *(void **)(*(longlong *)*puVar1 + 0x30);

+      uVar5 = *(uint *)(*(longlong *)*puVar1 + 0x38);

+    }

+    else {

+      puVar6 = local_res18;

+      ppvVar4 = local_28;

+      uVar3 = HsmCaptureFileIdentity(*param_3,ppvVar4,puVar6);

+      HsmDbgBreakOnStatus((int)uVar3);

+      pvVar7 = local_28[0];

+      uVar5 = local_res18[0];

+      if ((int)uVar3 < 0) {

+        if ((((undefined **)WPP_GLOBAL_Control != &WPP_GLOBAL_Control) &&

+            ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) &&

+           (1 < (byte)WPP_GLOBAL_Control[0x29])) {

+          WPP_SF_dqd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),ppvVar4,puVar6,param_1);

+        }

+        goto LAB_1;

+      }

+    }

+    uVar3 = HsmpGetStreamSize(*param_3);

+    CldSyncSendPostNotification

+              (*(undefined8 **)(param_3[2] + 0x20),

+               *(undefined8 *)(*(longlong *)(*(longlong *)*puVar1 + 0x10) + 0x20),param_4,param_1,

+               *(undefined8 *)(*(longlong *)*puVar1 + 0x28),pvVar7,uVar5,uVar3,param_5,

+               *(undefined4 *)(param_2 + 0x18),param_6,param_7,param_8);

+  }

+LAB_1:

+  uVar2 = Feature_3667029304__private_IsEnabledDeviceUsageNoInline();

+  if ((int)uVar2 != 0) {

+    HsmFreeFileIdentity((longlong)local_28[0]);

+  }

+  return;

+}

+
```

## `FLTMGR.SYS::FltReleaseContext`  (modified)

```diff
--- FLTMGR.SYS::FltReleaseContext calling
+++ FLTMGR.SYS::FltReleaseContext calling
@@ -20,0 +21 @@
+HsmFltPrePREPARE_MDL_WRITE
```

## `FLTMGR.SYS::FltAcquirePushLockSharedEx`  (modified)

```diff
--- FLTMGR.SYS::FltAcquirePushLockSharedEx calling
+++ FLTMGR.SYS::FltAcquirePushLockSharedEx calling
@@ -4,0 +5 @@
+CldStreamQueryProgress
@@ -6,0 +8 @@
+CldSyncIsPathWithinSyncRootByFileId
@@ -20,0 +23 @@
+HsmCaptureFileIdentity
```

## `NTOSKRNL.EXE::KeClearEvent`  (modified)

```diff
--- NTOSKRNL.EXE::KeClearEvent calling
+++ NTOSKRNL.EXE::KeClearEvent calling
@@ -3,0 +4 @@
+HsmFltPreSetDispositionInformation
```

## `NTOSKRNL.EXE::FsRtlUninitializeBaseMcb`  (modified)

```diff
--- NTOSKRNL.EXE::FsRtlUninitializeBaseMcb calling
+++ NTOSKRNL.EXE::FsRtlUninitializeBaseMcb calling
@@ -8 +7,0 @@
-HsmpCtxCreateStreamContext
```

## `NTOSKRNL.EXE::KeEnterCriticalRegion`  (modified)

```diff
--- NTOSKRNL.EXE::KeEnterCriticalRegion calling
+++ NTOSKRNL.EXE::KeEnterCriticalRegion calling
@@ -5,0 +6 @@
+CldiStreamCdqTRYACQUIRE
@@ -17 +17,0 @@
-HsmFltProcessRetrieveProperties
```

## `NTOSKRNL.EXE::ExReleaseResourceLite`  (modified)

```diff
--- NTOSKRNL.EXE::ExReleaseResourceLite calling
+++ NTOSKRNL.EXE::KeEnterCriticalRegion calling
@@ -3,0 +4 @@
+CldiStreamCdqACQUIRE
@@ -5 +5,0 @@
-CldiStreamCdqRELEASE
@@ -9,0 +10,4 @@
+HsmFileCacheCloseFileObject
+HsmFileCacheCreateFileObject
+HsmFileCacheMapData
+HsmFileCacheUnpinData
@@ -14 +17,0 @@
-HsmFltProcessStoreProperties
@@ -20,0 +24,2 @@
+HsmpFileCacheFlush
+HsmpFileCachePreparePinWrite
```

## `NTOSKRNL.EXE::KeLeaveCriticalRegion`  (modified)

```diff
--- NTOSKRNL.EXE::KeLeaveCriticalRegion calling
+++ NTOSKRNL.EXE::KeLeaveCriticalRegion calling
@@ -5,0 +6 @@
+CldiStreamCdqTRYACQUIRE
```

## `FLTMGR.SYS::FltAcquirePushLockExclusiveEx`  (modified)

```diff
--- FLTMGR.SYS::FltAcquirePushLockExclusiveEx calling
+++ FLTMGR.SYS::FltAcquirePushLockExclusiveEx calling
@@ -31,0 +32 @@
+HsmFltPreSetDispositionInformation
```

## `NTOSKRNL.EXE::ExAcquireResourceExclusiveLite`  (modified)

```diff
--- NTOSKRNL.EXE::ExAcquireResourceExclusiveLite calling
+++ NTOSKRNL.EXE::ExAcquireResourceExclusiveLite calling
@@ -5,0 +6 @@
+CldiStreamCdqTRYACQUIRE
@@ -13 +13,0 @@
-HsmFltProcessRetrieveProperties
```

## `NTOSKRNL.EXE::RtlPrefixUnicodeString`  (modified)

```diff
--- NTOSKRNL.EXE::RtlPrefixUnicodeString calling
+++ NTOSKRNL.EXE::RtlPrefixUnicodeString calling
@@ -0,0 +1 @@
+CldiSyncIsPathAtOrUnderPath
```

## `NTOSKRNL.EXE::RtlLookupElementGenericTableAvl`  (modified)

```diff
--- NTOSKRNL.EXE::RtlLookupElementGenericTableAvl calling
+++ NTOSKRNL.EXE::RtlLookupElementGenericTableAvl calling
@@ -5,0 +6 @@
+CldSyncIsPathWithinSyncRootByFileId
```

## `FLTMGR.SYS::FltReleasePushLockEx`  (modified)

```diff
--- FLTMGR.SYS::FltReleasePushLockEx calling
+++ FLTMGR.SYS::FltReleasePushLockEx calling
@@ -17,0 +18 @@
+CldSyncIsPathWithinSyncRootByFileId
@@ -46,0 +48 @@
+HsmCaptureFileIdentity
@@ -49,0 +52 @@
+HsmFltPreSetDispositionInformation
```

## `NTOSKRNL.EXE::KeSetEvent`  (modified)

```diff
--- NTOSKRNL.EXE::KeSetEvent calling
+++ NTOSKRNL.EXE::KeLeaveCriticalRegion calling
@@ -1,4 +1,17 @@
-CldSyncDisconnectRootByObject
-CldiStreamRestartCountdownTimer
-CldiStreamSignalEvents
-CldiStreamStopCountdownTimer
+CldHsmAddCrossContainerNotificationEvent
+CldStreamQueryProgress
+CldiStreamBuildProviderRequest
+CldiStreamCdqINSERT_IO
+CldiStreamCdqRELEASE
+CldiStreamCompleteRequest
+CldiStreamPrepareRequestForMoreProcessing
+CldiStreamScheduleRequestForMoreProcessing
+CldiStreamStartCountdownTimer
+HsmFileCacheCloseFileObject
+HsmFileCacheCloseFileObject$fin$0
+HsmFileCacheCreateFileObject
+HsmFileCacheCreateFileObject$fin$2
+HsmFileCacheMapData
+HsmFileCacheMapData$fin$1
+HsmFileCacheUnpinData
+HsmFileCacheUnpinData$fin$0
@@ -7,12 +20,15 @@
-HsmiCompleteLockCallbackDataRoutine
-HsmiInfoRenameNotificationCallback
-HsmiOpCompleteOperation
-HsmiOpPrepareOperation
-HsmiProcessPropertyLockRequestList
-HsmiRecallInitiateHydration
-HsmiRecallPopulationCompletionCallback
-HsmiRecallPostProcessUserHydrationRequest
-HsmpAcquireFileNameLock
-HsmpEnableSyncOp
-HsmpReInitializeUserRequestRundownProtection
-HsmpReleaseFileNameLock
+HsmFltProcessLockProperties
+HsmFltProcessRetrieveProperties
+HsmFltProcessStoreProperties
+HsmiFltPostECPCREATE
+HsmiFltPreECPCREATE
+HsmiPropertyLockWait
+HsmpCldIsHydrationDisallowed
+HsmpCtxCreateStreamHandleContext
+HsmpDeletePropertyStream
+HsmpFileCacheFlush
+HsmpFileCacheFlush$fin$1
+HsmpFileCachePreparePinWrite
+HsmpFileCachePreparePinWrite$fin$1
+HsmpGetPropertyStreamSize
+HsmpLoadPropertyStream
@@ -20 +36 @@
-TlgAggregateInternalFlushWorkItemRoutineKernelMode
+HsmpUnloadPropertyStream
```

## `NTOSKRNL.EXE::ExFreePoolWithTag`  (modified)

```diff
--- NTOSKRNL.EXE::ExFreePoolWithTag calling
+++ NTOSKRNL.EXE::ExFreePoolWithTag calling
@@ -53,0 +54 @@
+HsmFreeFileIdentity
@@ -76,0 +78 @@
+HsmiDecompressBuffer
@@ -125 +126,0 @@
-HsmpCtxCreateStreamContext
@@ -140 +140,0 @@
-HsmpRpiDecompressBuffer
```

## `FLTMGR.SYS::FltReferenceContext`  (modified)

```diff
--- FLTMGR.SYS::FltReferenceContext calling
+++ FLTMGR.SYS::FltReferenceContext calling
@@ -5,0 +6 @@
+HsmFltPreSetDispositionInformation
```

## `NTOSKRNL.EXE::ExAllocatePool2`  (modified)

```diff
--- NTOSKRNL.EXE::ExAllocatePool2 calling
+++ NTOSKRNL.EXE::ExAllocatePool2 calling
@@ -28,0 +29 @@
+HsmCaptureFileIdentity
@@ -54,0 +56 @@
+HsmiDecompressBuffer
@@ -101 +102,0 @@
-HsmpRpiDecompressBuffer
```

## `FLTMGR.SYS::FltQueryInformationFile`  (modified)

```diff
--- FLTMGR.SYS::FltQueryInformationFile calling
+++ FLTMGR.SYS::FltQueryInformationFile calling
@@ -0,0 +1 @@
+CldiPortProcessServiceCommands
```
