# CVE-2026-105509 — refs.sys patch diff

`refs.sys` 10.0.26100.9818 -> 10.0.26100.9974 (ghidriff).

## `ContinueEnumeration`  (modified)

```diff
--- ContinueEnumeration
+++ ContinueEnumeration
@@ -1,172 +1,208 @@
 

-void ContinueEnumeration(int param_1,uint param_2,ulonglong *param_3,ulonglong *param_4,

-                        undefined8 param_5,undefined8 *param_6,undefined8 *param_7)

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

+

+ulonglong ContinueEnumeration(_IRP_CONTEXT *param_1,longlong param_2,_SCB *param_3,

+                             _DIR_INDEX_ENTRY **param_4,uchar param_5)

 

 {

-  CmsPinCache *this;

-  ulonglong uVar1;

-  longlong lVar2;

-  SmsPage *pSVar3;

-  CmsBPlusTable *this_00;

-  undefined8 *puVar4;

-  uchar uVar5;

-  bool bVar6;

-  short sVar7;

-  uint in_EAX;

-  longlong lVar8;

-  CmsCachedPin *this_01;

-  ushort uVar9;

-  int *unaff_RBX;

-  CmsPinCache *pCVar10;

-  CmsBPlusTable *unaff_RBP;

-  longlong unaff_RSI;

-  int unaff_EDI;

-  ulonglong uVar11;

-  _LIST_ENTRY **pp_Var12;

-  int in_R11D;

-  uint uVar13;

-  uint *unaff_R12;

-  ulonglong unaff_R13;

-  SmsLookupStack *unaff_R14;

-  CmsPinCache *pCVar14;

-  uint uVar15;

-  CmsTransactionContext *unaff_R15;

-  CmsBPlusTable *in_stack_00000090;

-  CmsTransactionContext *in_stack_00000098;

-  SmsLookupStack *in_stack_000000a8;

-  uint in_stack_000000b0;

-  undefined8 *in_stack_000000b8;

+  short sVar1;

+  uint uVar2;

+  byte bVar3;

+  long lVar4;

+  undefined8 *puVar5;

+  ulonglong uVar6;

+  ulong uVar7;

+  _SmsTableCursorContext *p_Var8;

+  undefined1 auStackY_128 [32];

+  byte local_f8 [4];

+  ulong local_f4;

+  uint local_f0 [2];

+  short *psStack_e8;

+  undefined4 local_e0;

+  undefined8 local_d8;

+  undefined8 local_c8;

+  undefined8 uStack_c0;

+  undefined8 local_b8;

+  undefined8 uStack_b0;

+  undefined8 local_a8;

+  undefined8 uStack_a0;

+  undefined8 local_98;

+  undefined8 uStack_90;

+  undefined8 local_88;

+  undefined8 uStack_80;

+  undefined4 local_78;

+  undefined4 uStack_74;

+  undefined4 uStack_70;

+  ushort uStack_6c;

+  undefined2 uStack_6a;

+  undefined4 local_68;

+  ulonglong local_58;

   

-  if (in_EAX < param_2) {

-    param_2 = in_R11D + 7U & 0xfff8;

+  local_58 = __security_cookie ^ (ulonglong)auStackY_128;

+  local_e0 = 0;

+  local_f0[0] = 0;

+  local_f0[1] = 0;

+  psStack_e8 = (short *)0x0;

+  local_d8 = 0;

+  local_f8[0] = 0;

+  while( true ) {

+    p_Var8 = (_SmsTableCursorContext *)(param_2 + 0x88);

+    lVar4 = EnumerateDirectoryCursor(param_1,param_3,p_Var8,param_5,(_CmsRow *)local_f0,local_f8);

+    bVar3 = local_f8[0];

+    uVar7 = (ulong)p_Var8;

+    if (((lVar4 + 0x80000000U & 0x80000000) == 0) && (lVar4 != -0x3ffffddb)) {

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x12,

+                 &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,lVar4);

+        uVar6 = FUN_1401c6226();

+        return uVar6;

+      }

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

+        uVar7 = 0x401d4cd0;

+        RefsStatusDebug(lVar4,param_1,"ProtogonIndex.c",0x2ea);

+      }

+                    /* WARNING: Subroutine does not return */

+      RefsRaiseStatusInternal(param_1,lVar4,uVar7);

+    }

+    if (local_f8[0] == 0) break;

+    if (local_f0[0] < 4) {

+      lVar4 = RefsQueueTriageForDeadFcb(param_1,*(_FCB **)(param_3 + 0x88));

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

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

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

+        uVar7 = 0x401d4ce0;

+        WPP_SF_qd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x13,

+                  &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,*(undefined8 *)(param_3 + 0x88));

+      }

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

+        uVar7 = 0x401d4cd0;

+        RefsStatusDebug(lVar4,param_1,"ProtogonIndex.c",0x2f8);

+      }

+                    /* WARNING: Subroutine does not return */

+      RefsRaiseStatusInternal(param_1,lVar4,uVar7);

+    }

+    sVar1 = *psStack_e8;

+    if (sVar1 == 0x30) {

+      if (param_2 == 0) {

+        local_f4 = 0;

+        lVar4 = ReallocateAndCopyIndexEntryIntoBuffer

+                          (param_1,(_CmsRow *)local_f0,param_3,param_4,&local_f4);

+        uVar7 = (ulong)param_3;

+        if (-1 < lVar4) goto LAB_0;

+        goto LAB_1;

+      }

+      local_c8 = 0;

+      uStack_c0 = 0;

+      local_68 = 0;

+      local_b8 = 0;

+      uStack_b0 = 0;

+      local_a8 = 0;

+      uStack_a0 = 0;

+      local_98 = 0;

+      uStack_90 = 0;

+      local_88 = 0;

+      uStack_80 = 0;

+      local_78 = 0;

+      uStack_74 = 0;

+      uStack_70 = 0;

+      uStack_6c = 0;

+      uStack_6a = 0;

+      lVar4 = ComposeDirIndexEntry

+                        (param_1,(_CmsRow *)local_f0,param_3,(_DIR_INDEX_ENTRY *)&local_c8,

+                         (__uint64 *)0x0);

+      uVar7 = (ulong)param_3;

+      if (lVar4 < 0) goto LAB_1;

+      uVar6 = (ulonglong)uStack_6c;

+      puVar5 = *(undefined8 **)(param_2 + 0x1d8);

+      uVar2 = (uint)uStack_6c;

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

+LAB_2:

+        uVar7 = 0x496f7250;

+        puVar5 = (undefined8 *)ExAllocatePoolWithTag(1);

+        *(undefined8 **)(param_2 + 0x1d8) = puVar5;

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

+          lVar4 = -0x3fffff66;

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

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

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

+            WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xe,

+                     &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,0xc000009a);

+            uVar6 = FUN_1401c6253();

+            return uVar6;

+          }

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

+            uVar7 = 0x401d4cd0;

+            RefsStatusDebug(-0x3fffff66,(_IRP_CONTEXT *)0x0,"ProtogonIndex.c",0x1ff);

+          }

+LAB_1:

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

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

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

+            WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x15,

+                     &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,lVar4);

+            uVar6 = FUN_1401c627e();

+            return uVar6;

+          }

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

+            uVar7 = 0x401d4cd0;

+            RefsStatusDebug(lVar4,param_1,"ProtogonIndex.c",0x337);

+          }

+                    /* WARNING: Subroutine does not return */

+          RefsRaiseStatusInternal(param_1,lVar4,uVar7);

+        }

+        *(uint *)(param_2 + 0x1d0) = uVar2 + 0x7e;

+      }

+      else if (*(uint *)(param_2 + 0x1d0) < uVar2 + 0x68) {

+        ExFreePoolWithTag(puVar5,0);

+        *(undefined8 *)(param_2 + 0x1d8) = 0;

+        *(undefined4 *)(param_2 + 0x1d0) = 0;

+        goto LAB_2;

+      }

+      *puVar5 = local_c8;

+      puVar5[1] = uStack_c0;

+      puVar5[2] = local_b8;

+      puVar5[3] = uStack_b0;

+      puVar5[4] = local_a8;

+      puVar5[5] = uStack_a0;

+      puVar5[6] = local_98;

+      puVar5[7] = uStack_90;

+      puVar5[8] = local_88;

+      puVar5[9] = uStack_80;

+      puVar5[10] = CONCAT44(uStack_74,local_78);

+      puVar5[0xb] = CONCAT26(uStack_6a,CONCAT24(uStack_6c,uStack_70));

+      *(undefined4 *)(puVar5 + 0xc) = local_68;

+      *(longlong *)(*(longlong *)(param_2 + 0x1d8) + 0x54) = *(longlong *)(param_2 + 0x1d8) + 0x68;

+      memmove(*(void **)(*(longlong *)(param_2 + 0x1d8) + 0x54),

+              (void *)CONCAT44(uStack_70,uStack_74),uVar6);

+      *param_4 = *(_DIR_INDEX_ENTRY **)(param_2 + 0x1d8);

+      goto LAB_3;

+    }

+    if (((sVar1 != 0x10) && (sVar1 != 0x20)) && (sVar1 != 0x40)) {

+      lVar4 = RefsQueueTriageForDeadFcb(param_1,*(_FCB **)(param_3 + 0x88));

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

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

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

+        uVar7 = 0x401d4ce0;

+        WPP_SF_qd(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x14,

+                  &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,*(undefined8 *)(param_3 + 0x88));

+      }

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

+        uVar7 = 0x401d4cd0;

+        RefsStatusDebug(lVar4,param_1,"ProtogonIndex.c",0x316);

+      }

+                    /* WARNING: Subroutine does not return */

+      RefsRaiseStatusInternal(param_1,lVar4,uVar7);

+    }

+    param_5 = '\x01';

   }

-  else {

-    param_2 = param_2 - unaff_EDI;

+  if (param_2 == 0) goto LAB_0;

+LAB_3:

+  if (bVar3 == 0) {

+    *(uint *)(param_2 + 4) = *(uint *)(param_2 + 4) | 4;

   }

-  *(undefined2 *)(unaff_RBX + 1) = 0x10;

-  *unaff_RBX = (param_1 + 7U & 0xfffffff8) + 0x10 + (param_2 & 0xffff);

-  *(short *)((longlong)unaff_RBX + 6) = (short)*unaff_R12;

-  unaff_RBX[2] = 0x100000;

-  unaff_RBX[3] = unaff_R12[4];

-  uVar13 = unaff_R12[4];

-  if (uVar13 != 0) {

-    uVar11 = *param_4;

-    uVar1 = *param_3;

-    if ((uVar1 <= uVar11) && (uVar11 <= uVar1 + uVar13)) {

-      *(short *)(unaff_RBX + 1) = ((short)uVar11 - (short)uVar1) + 0x10;

-      goto LAB_0;

-    }

-  }

-  uVar15 = *unaff_R12;

-  if ((uVar15 == 0) || (uVar13 == 0)) {

-LAB_1:

-    uVar9 = (short)uVar15 + 7U & 0xfff8;

-  }

-  else {

-    uVar1 = *param_3;

-    uVar11 = *param_4 + (ulonglong)uVar15;

-    if ((uVar11 < uVar1) || (uVar1 + uVar13 < uVar11)) goto LAB_1;

-    uVar9 = (short)uVar1 - (short)*param_4;

-  }

-  *(ushort *)((longlong)unaff_RBX + 10) = uVar9 + 0x10;

-  if (*unaff_R12 != 0) {

-    *(ulonglong *)((((ulonglong)*unaff_R12 + 0x17 & 0xfffffffffffffff8) - 8) + (longlong)unaff_RBX)

-         = unaff_R13;

-  }

-  memmove(unaff_RBX + 4,(void *)*param_4,(ulonglong)*unaff_R12);

 LAB_0:

-  uVar13 = in_stack_000000b0;

-  uVar11 = (ulonglong)in_stack_000000b0;

-  memmove((void *)((ulonglong)*(ushort *)((longlong)unaff_RBX + 10) + (longlong)unaff_RBX),

-          *(void **)(unaff_R12 + 6),(ulonglong)(unaff_R12[4] - in_stack_000000b0));

-  if (uVar13 != 0) {

-    memset((void *)((ulonglong)((*(ushort *)((longlong)unaff_RBX + 10) - uVar13) + unaff_R12[4]) +

-                   (longlong)unaff_RBX),0,uVar11);

-  }

-  puVar4 = in_stack_000000b8;

-  *(ushort *)(unaff_RBX + 2) = *(ushort *)(unaff_RBX + 2) | (ushort)unaff_R12[1] & 3;

-  uVar13 = *(uint *)(unaff_R14 + 0x18);

-  lVar8 = (ulonglong)*(uint *)(unaff_RSI + 0x10) + unaff_RSI;

-  lVar2 = *(longlong *)(unaff_RBP + 0x18);

-  *(short *)(lVar8 + (ulonglong)uVar13 * 4) = (short)unaff_RBX - (short)unaff_RSI;

-  pp_Var12 = (_LIST_ENTRY **)(lVar8 + (ulonglong)uVar13 * 4);

-  if (((*(uint *)(lVar2 + 0x2c) & 2) == 0) ||

-     (uVar9 = *(ushort *)(unaff_RBX + 2),

-     (*(byte *)(unaff_RSI + 0xd) >> 3 & (uVar9 >> 1 & 1) == 0) == 0)) {

-    sVar7 = -1;

-  }

-  else {

-    if ((uVar9 & 0x40) == 0) {

-      if ((uVar9 & 2) == 0) {

-        sVar7 = (short)*(undefined8 *)((ulonglong)*(ushort *)(unaff_RBX + 1) + (longlong)unaff_RBX);

-      }

-      else {

-        sVar7 = -1;

-      }

-    }

-    else {

-      sVar7 = (short)*(undefined8 *)(unaff_RBX + 3);

-    }

-    sVar7 = sVar7 - *(short *)(unaff_RSI + 0x18);

-  }

-  *(short *)((longlong)pp_Var12 + 2) = sVar7;

-  LOCK();

-  *(int *)(*(longlong *)unaff_R14 + 0x154) = *(int *)(*(longlong *)unaff_R14 + 0x154) + 1;

-  UNLOCK();

-  *(int **)(unaff_R14 + 0x10) = unaff_RBX;

-  if (in_stack_000000b8 != (undefined8 *)0x0) {

-    *in_stack_000000b8 = unaff_RBX;

-    param_7 = &param_6;

-    this = (CmsPinCache *)(unaff_R15 + 0x3a8);

-    param_6 = &param_6;

-    uVar11 = unaff_R13 & 0xffffffff;

-    *(undefined4 *)(in_stack_000000b8 + 3) = *(undefined4 *)(unaff_R14 + 0x18);

-    *(undefined4 *)((longlong)in_stack_000000b8 + 0x1c) =

-         *(undefined4 *)(*(longlong *)unaff_R14 + 0x154);

-    lVar2 = *(longlong *)unaff_R14;

-    uVar13 = (uint)DAT_2;

-    if ((*(char *)(lVar2 + 0x168) == '\0') ||

-       ((*(char *)(lVar2 + 0x168) == -8 &&

-        (*(CmsCachedPin *)(*(longlong *)(lVar2 + 0x60) + 0xd4) == SUB81(unaff_R13,0))))) {

-      pCVar10 = *(CmsPinCache **)this;

-      pCVar14 = this;

-    }

-    else {

-      pCVar10 = *(CmsPinCache **)(unaff_R15 + 0x3b8);

-      pCVar14 = (CmsPinCache *)(unaff_R15 + 0x3b8);

-      uVar13 = (uint)DAT_3;

-    }

-    do {

-      while( true ) {

-        if ((pCVar10 == pCVar14) ||

-           (uVar15 = (uint)uVar11, uVar11 = (ulonglong)(uVar15 + 1), uVar13 <= uVar15))

-        goto LAB_4;

-        this_01 = (CmsCachedPin *)(pCVar10 + -0x10);

-        pCVar10 = *(CmsPinCache **)pCVar10;

-        bVar6 = CmsCachedPin::ShouldDoomCachedPin(this_01);

-        if (!bVar6) break;

-        CmsPinCache::DoomCachedPin(this,this_01,(_LIST_ENTRY *)&param_6,pp_Var12);

-      }

-    } while (*(longlong *)(this_01 + 0x20) != lVar2);

-    if ((this_01 != (CmsCachedPin *)0x0) && (this_01[0x90] == SUB81(unaff_R13,0))) {

-      unaff_R13 = *(ulonglong *)(this_01 + 0x50);

-    }

-LAB_4:

-    unaff_R15 = in_stack_00000098;

-    puVar4[2] = unaff_R13;

-    CmsPinCache::DeleteDoomedCachedPins(in_stack_00000098,(_LIST_ENTRY *)&param_6);

-    unaff_RBP = in_stack_00000090;

-    unaff_R14 = in_stack_000000a8;

-  }

-  if ((char)unaff_RBP[0xf] < '\0') {

-    pSVar3 = *(SmsPage **)unaff_R14;

-    this_00 = *(CmsBPlusTable **)(pSVar3 + 0x60);

-    if ((((this_00 == unaff_RBP) && (pSVar3[0x168] == (SmsPage)0x0)) &&

-        (pSVar3[0x1ea] == (SmsPage)0x0)) &&

-       (uVar5 = CmsStream::CanPageBeOptimized(unaff_R14), uVar5 != '\0')) {

-      CmsBPlusTable::AddPageToDelayedProcessList(this_00,unaff_R15,pSVar3,true);

-    }

-  }

-  return;

+  return (ulonglong)bVar3;

 }
```

## `CheckIndexHeaderRecurse`  (modified)

```diff
--- CheckIndexHeaderRecurse
+++ CheckIndexHeaderRecurse
@@ -1,22 +1,952 @@
 

-void CheckIndexHeaderRecurse(void)

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

+

+undefined8

+CheckIndexHeaderRecurse

+          (_SmsIndexHeader *param_1,uint param_2,_SmsPropertyDef *param_3,longlong *param_4)

 

 {

-  int in_EAX;

-  undefined4 in_register_00000004;

-  longlong unaff_RBX;

-  undefined8 unaff_RSI;

-  longlong unaff_RDI;

+  void *_Dst;

+  ulonglong *puVar1;

+  undefined1 uVar2;

+  undefined1 uVar3;

+  undefined1 uVar4;

+  undefined1 uVar5;

+  _SmsIndexHeader _Var6;

+  uint uVar7;

+  undefined4 uVar8;

+  undefined4 uVar9;

+  CmsVolume *this;

+  longlong lVar10;

+  longlong lVar11;

+  longlong lVar12;

+  ulonglong uVar13;

+  uint *puVar14;

+  longlong lVar15;

+  longlong lVar16;

+  longlong lVar17;

+  longlong lVar18;

+  char cVar19;

+  bool bVar20;

+  byte bVar21;

+  short sVar22;

+  short sVar23;

+  ushort uVar24;

+  int iVar25;

+  uint uVar26;

+  int iVar27;

+  uint uVar28;

+  SmsInternalPropertyDef *pSVar29;

+  undefined8 uVar30;

+  int iVar31;

+  ulonglong uVar32;

+  CmsVolume *pCVar33;

+  uint uVar34;

+  _SmsIndexEntry *this_00;

+  uint uVar36;

+  SmsRunHeader *pSVar37;

+  ulonglong uVar38;

+  longlong lVar39;

+  uint *puVar40;

+  code *pcVar41;

+  undefined8 *puVar42;

+  ushort uVar43;

+  uint uVar44;

+  _SmsIndexHeader *p_Var45;

+  _SmsIndexHeader *p_Var46;

+  bool bVar47;

+  int local_d4;

+  longlong local_d0;

+  uint local_c4;

+  int local_c0;

+  ulonglong uVar35;

   

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + (char)in_EAX;

-  if (-1 < in_EAX) {

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

-    *(undefined8 *)(unaff_RDI + 0x18) = unaff_RSI;

-    LOCK();

-    *(int *)(unaff_RBX + 8) = *(int *)(unaff_RBX + 8) + 1;

-    UNLOCK();

-  }

-  return;

+  uVar36 = *(uint *)param_1;

+  if (uVar36 < 0x28) {

+    return 0xc0000518;

+  }

+  uVar7 = *(uint *)(param_1 + 4);

+  if (uVar7 < uVar36) {

+    return 0xc0000518;

+  }

+  uVar28 = *(uint *)(param_1 + 0x10);

+  if (uVar28 < uVar7) {

+    return 0xc0000518;

+  }

+  uVar34 = *(uint *)(param_1 + 0x20);

+  if (uVar34 < uVar28) {

+    return 0xc0000518;

+  }

+  if ((ulonglong)(uVar34 - uVar28) < (ulonglong)*(uint *)(param_1 + 0x14) << 2) {

+    return 0xc0000518;

+  }

+  if (param_2 < uVar34) {

+    return 0xc0000518;

+  }

+  this = (CmsVolume *)param_4[9];

+  if (((byte)param_1[0xd] & 1) == 0) {

+    if (param_1[0xc] != (_SmsIndexHeader)0x0) {

+      return 0xc0000518;

+    }

+  }

+  else if (0xf6 < (byte)((char)param_1[0xc] - 1U)) {

+    return 0xc0000518;

+  }

+  if (*(uint *)(this + 0xcf4) < uVar7) {

+    return 0xc0000518;

+  }

+  if ((uVar36 & 7) != 0) {

+    return 0xc0000518;

+  }

+  lVar15 = param_4[3];

+  iVar31 = (int)param_1 - (int)param_4[2];

+  uVar8 = *(undefined4 *)((longlong)param_4 + 0x1c);

+  lVar16 = param_4[4];

+  uVar2 = *(undefined1 *)((longlong)param_4 + 0x23);

+  uVar3 = *(undefined1 *)((longlong)param_4 + 0x24);

+  uVar4 = *(undefined1 *)((longlong)param_4 + 0x25);

+  lVar10 = param_4[5];

+  lVar17 = param_4[6];

+  uVar9 = *(undefined4 *)((longlong)param_4 + 0x34);

+  lVar11 = param_4[7];

+  lVar18 = param_4[8];

+  *(int *)(param_4 + 3) = iVar31;

+  uVar5 = *(undefined1 *)((longlong)param_4 + 0x44);

+  *(int *)((longlong)param_4 + 0x1c) = iVar31 + *(int *)(param_1 + 4);

+  if (param_1[0xc] == (_SmsIndexHeader)0x0) {

+    *(undefined2 *)(param_4 + 4) = 0xfffa;

+    if ((*(uint *)(param_3 + 0x2c) & 1) != 0) {

+      *(undefined1 *)((longlong)param_4 + 0x24) = 1;

+    }

+    if ((CONCAT11(this[0x846],this[0x847]) < 0x30a) && (*(short *)(param_3 + 4) == 9)) {

+      *(undefined1 *)((longlong)param_4 + 0x25) = 1;

+    }

+  }

+  else if (CONCAT11(this[0x846],this[0x847]) < 0x30a) {

+    *(undefined1 *)((longlong)param_4 + 0x23) = 1;

+    *(undefined2 *)(param_4 + 4) = 0xfff8;

+  }

+  else {

+    *(undefined2 *)(param_4 + 4) = 0xfff9;

+  }

+  *(char *)((longlong)param_4 + 0x22) = *(char *)((longlong)param_4 + 0x22) + '\x01';

+  cVar19 = `anonymous_namespace'::IndexEntryChecker::CheckAlignment(param_4,uVar7);

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

+    return 0xc0000518;

+  }

+  local_d0 = 0;

+  iVar31 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar31 != 0) && (*(char *)((longlong)param_4 + 0x23) != '\0')) {

+    uVar36 = uVar7 - *(int *)param_1 >> 4;

+    if (uVar36 != 0) {

+      local_d0 = ExAllocatePoolWithTag(1,uVar36 * 5,0x6f76534d);

+      if (local_d0 == 0) {

+        return 0xc000009a;

+      }

+      _Dst = (void *)(local_d0 + (ulonglong)uVar36 * 4);

+      memset(_Dst,0,(ulonglong)uVar36);

+      param_4[5] = local_d0;

+      param_4[7] = (longlong)_Dst;

+      *(uint *)(param_4 + 6) = uVar36;

+      *(undefined4 *)((longlong)param_4 + 0x34) = 0;

+    }

+  }

+  iVar31 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar31 != 0) && (((byte)param_1[0xd] & 2) == 0)) {

+    iVar31 = *(int *)(param_1 + 0x14);

+    if (param_1[0xc] == (_SmsIndexHeader)0x0) {

+LAB_0:

+      if (iVar31 != 0) goto LAB_1;

+    }

+    else if (iVar31 != 0) {

+      iVar31 = iVar31 + -1;

+      goto LAB_0;

+    }

+    if ((ulonglong)*(uint *)(param_1 + 4) + 4 <= (ulonglong)*(uint *)(param_1 + 0x10)) {

+      *(uint *)(param_4 + 8) =

+           (uint)*(ushort *)(param_1 + ((ulonglong)*(uint *)(param_1 + 0x10) - 4));

+      *(undefined1 *)((longlong)param_4 + 0x44) = 0;

+    }

+  }

+LAB_1:

+  iVar31 = Feature_ReFS_Batch_Apr_Fixes__private_IsEnabledDeviceUsageNoInline();

+  if (iVar31 == 0) {

+    uVar36 = *(uint *)(param_1 + 4);

+    _Var6 = param_1[0xc];

+    uVar28 = *(int *)(param_1 + 0x10) - uVar36;

+    bVar20 = _SmsIndexHeader::UseStreamIndexEntry(param_1,param_3);

+    if (bVar20) {

+      if (uVar28 <= *(uint *)(param_1 + 8)) {

+        uVar32 = (ulonglong)*(uint *)param_1;

+        p_Var45 = param_1 + uVar32;

+        if (*(uint *)param_1 < uVar36) {

+          while (iVar31 = (int)uVar32, uVar32 + 0x10 <= (ulonglong)uVar36) {

+            iVar27 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+            if ((iVar27 != 0) && (iVar31 == (int)param_4[8])) {

+              *(undefined1 *)((longlong)param_4 + 0x44) = 1;

+            }

+            uVar24 = *(ushort *)(p_Var45 + 8);

+            if ((uVar24 & 0x40) == 0) {

+              if (((uVar24 & 4) != 0) || (((byte)param_1[0xd] & 2) == 0)) break;

+              uVar28 = *(uint *)p_Var45;

+              uVar38 = (ulonglong)uVar28;

+              if (((*(char *)((longlong)param_4 + 0x23) == '\0') && ((uVar28 & 7) != 0)) ||

+                 ((uVar28 < 0x10 || ((ulonglong)uVar36 < uVar32 + uVar38)))) break;

+              uVar24 = *(ushort *)(p_Var45 + 4);

+              uVar34 = (uint)*(ushort *)(p_Var45 + 6) + (uint)uVar24;

+              if (uVar28 < uVar34) break;

+              uVar43 = *(ushort *)(p_Var45 + 10);

+              uVar32 = (ulonglong)*(uint *)(p_Var45 + 0xc) + (ulonglong)uVar43;

+              if (uVar38 < uVar32) break;

+              if (*(char *)((longlong)param_4 + 0x24) != '\0') {

+                uVar24 = uVar24 + 8;

+              }

+              if (uVar24 < uVar43) {

+                bVar20 = uVar34 < uVar43;

+                bVar47 = uVar34 == uVar43;

+              }

+              else {

+                bVar20 = uVar34 < uVar32;

+                bVar47 = uVar34 == uVar32;

+              }

+              if ((!bVar20 && !bVar47) ||

+                 ((*(ushort *)(param_4 + 4) & *(ushort *)(p_Var45 + 8)) != 0)) break;

+              if ((*(ushort *)(p_Var45 + 8) & 4) == 0) {

+                iVar27 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+                if ((((iVar27 != 0) && (*(char *)((longlong)param_4 + 0x23) != '\0')) &&

+                    (param_4[5] != 0)) &&

+                   (*(uint *)((longlong)param_4 + 0x34) < *(uint *)(param_4 + 6))) {

+                  *(int *)(param_4[5] + (ulonglong)*(uint *)((longlong)param_4 + 0x34) * 4) = iVar31

+                  ;

+                  *(int *)((longlong)param_4 + 0x34) = *(int *)((longlong)param_4 + 0x34) + 1;

+                }

+                iVar27 = Feature_2024795448__private_IsEnabledDeviceUsageNoInline();

+                if (((iVar27 != 0) && (_Var6 == (_SmsIndexHeader)0x0)) &&

+                   (lVar39 = param_4[9], *(short *)(param_3 + 4) == 10)) {

+                  if (*(ushort *)(p_Var45 + 6) < 0x10) break;

+                  if (*(int *)(p_Var45 + (ulonglong)*(ushort *)(p_Var45 + 4) + 0xc) == 1) {

+                    if (*(uint *)(p_Var45 + 0xc) < 0x50) break;

+                    uVar24 = *(ushort *)(p_Var45 + 10);

+                    if ((3 < *(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) - 1U) ||

+                       (((*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x14) & 8) == 0 &&

+                        (*(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) != 1)))) break;

+                    bVar21 = *(byte *)(lVar39 + 0x58);

+                    if (bVar21 == 2) {

+                      bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+                    }

+                    iVar27 = (**(code **)(**(longlong **)(lVar39 + 0xdd8 + (ulonglong)bVar21 * 8) +

+                                         0x50))();

+                    if (*(uint *)(p_Var45 + 0xc) <

+                        (uint)((*(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) + 5 + iVar27) * 0x10))

+                    break;

+                    bVar21 = *(byte *)(lVar39 + 0x58);

+                    if (bVar21 == 2) {

+                      bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+                    }

+                    iVar27 = (**(code **)(**(longlong **)(lVar39 + 0xdd8 + (ulonglong)bVar21 * 8) +

+                                         0x50))();

+                    uVar28 = *(uint *)(lVar39 + 0x54);

+                    uVar32 = (ulonglong)uVar28;

+                    uVar34 = iVar27 << 4;

+                    if (uVar28 != 0) {

+                      uVar26 = 0;

+                      if (*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x4c) != 0) {

+                        pSVar37 = (SmsRunHeader *)

+                                  (p_Var45 + (ulonglong)uVar34 + 0x50 + (ulonglong)uVar24);

+                        do {

+                          uVar35 = *(ulonglong *)(pSVar37 + 8);

+                          if ((((uVar35 == 0) || (uVar32 < uVar35)) ||

+                              (uVar13 = *(ulonglong *)pSVar37, ~uVar13 < uVar35)) ||

+                             (uVar13 / uVar32 != ((uVar35 - 1) + uVar13) / uVar32))

+                          goto LAB_2;

+                          uVar26 = uVar26 + 1;

+                          pSVar37 = pSVar37 + 0x10;

+                        } while (uVar26 < *(uint *)(p_Var45 + (ulonglong)uVar24 + 0x4c));

+                      }

+                      if (((*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x14) & 8) == 0) &&

+                         (((*(uint *)(p_Var45 + (ulonglong)uVar34 + 0x50 + (ulonglong)uVar24) &

+                           uVar28 - 1) != 0 ||

+                          (*(ulonglong *)(p_Var45 + (ulonglong)uVar34 + 0x58 + (ulonglong)uVar24) !=

+                           uVar32)))) break;

+                    }

+                  }

+                }

+                if (*(char *)((longlong)param_4 + 0x23) == '\0') {

+                  uVar28 = (int)param_4[3] + iVar31;

+                  puVar1 = (ulonglong *)(*param_4 + (ulonglong)(uVar28 >> 9) * 8);

+                  *puVar1 = *puVar1 | 1L << (uVar28 >> 3 & 0x3f);

+                }

+                if ((((byte)*(SmsRunHeader *)(p_Var45 + 8) & 1) == 0) ||

+                   (param_1[0xc] != (_SmsIndexHeader)0x0)) {

+LAB_3:

+                  if (_Var6 != (_SmsIndexHeader)0x0) {

+                    if (0x20 < *(uint *)(p_Var45 + 0xc) - 0x28) break;

+                    uVar32 = (ulonglong)*(ushort *)(p_Var45 + 10);

+                    if (((((ulonglong)*(uint *)(p_Var45 + 0xc) <

+                           (ulonglong)*(uint *)(p_Var45 + uVar32 + 0x24) + 0x20 +

+                           (ulonglong)(byte)*(SmsRunHeader *)(p_Var45 + uVar32 + 0x23)) ||

+                         (*(SmsRunHeader *)(p_Var45 + uVar32 + 0x23) != (SmsRunHeader)0x8)) ||

+                        (*(SmsRunHeader *)(p_Var45 + uVar32 + 0x22) !=

+                         *(SmsRunHeader *)(param_4[9] + 0x58))) ||

+                       (*(uint *)(p_Var45 + uVar32 + 0x24) != *(uint *)(param_4[9] + 0xe08))) break;

+                  }

+                }

+                else {

+                  if ((*(char *)((longlong)param_4 + 0x25) != '\0') &&

+                     (5 < *(ushort *)(p_Var45 + 6))) {

+                    sVar22 = *(short *)(p_Var45 + *(ushort *)(p_Var45 + 4));

+                    if (((sVar22 != 0x40) && (sVar22 != 0x10)) &&

+                       ((sVar22 != 0x30 ||

+                        (((byte)*(SmsRunHeader *)(p_Var45 + (ulonglong)*(ushort *)(p_Var45 + 4) + 2)

+                         & 1) == 0)))) goto LAB_3;

+                  }

+                  uVar24 = *(ushort *)(p_Var45 + 10);

+                  if ((((((uVar24 & 7) != 0) ||

+                        (uVar28 = *(uint *)(p_Var45 + 0xc), (uVar28 & 7) != 0)) ||

+                       ((uVar28 < 0x28 ||

+                        (pSVar29 = CmsSchemaTable::GetPropertyDef

+                                             (*(CmsSchemaTable **)(param_4[9] + 0xd28),

+                                              *(ulong *)((SmsRunHeader *)(p_Var45 + uVar24) + 0xc)),

+                        pSVar29 == (SmsInternalPropertyDef *)0x0)))) ||

+                      ((uVar28 < *(uint *)(pSVar29 + 0x18) &&

+                       ((*(uint *)(pSVar29 + 0x2c) & 0x1000) == 0)))) ||

+                     (iVar27 = CheckIndexRootRecurse

+                                         ((SmsRunHeader *)(p_Var45 + uVar24),uVar28,pSVar29,param_4)

+                     , iVar27 < 0)) break;

+                }

+              }

+            }

+            else {

+              uVar28 = *(ushort *)(p_Var45 + 10) + 7 & 0xfffffff8;

+              uVar38 = (ulonglong)uVar28;

+              if (uVar36 < uVar28 + iVar31) break;

+              if ((uVar24 & 4) == 0) {

+                iVar27 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+                if (iVar27 == 0) {

+LAB_4:

+                  if (*(char *)((longlong)param_4 + 0x23) == '\0') goto LAB_5;

+                }

+                else {

+                  if (*(char *)((longlong)param_4 + 0x23) != '\0') {

+                    if ((param_4[5] != 0) &&

+                       (*(uint *)((longlong)param_4 + 0x34) < *(uint *)(param_4 + 6))) {

+                      *(int *)(param_4[5] + (ulonglong)*(uint *)((longlong)param_4 + 0x34) * 4) =

+                           iVar31;

+                      *(int *)((longlong)param_4 + 0x34) = *(int *)((longlong)param_4 + 0x34) + 1;

+                    }

+                    goto LAB_4;

+                  }

+LAB_5:

+                  uVar34 = (int)param_4[3] + iVar31;

+                  puVar1 = (ulonglong *)(*param_4 + (ulonglong)(uVar34 >> 9) * 8);

+                  *puVar1 = *puVar1 | 1L << (uVar34 >> 3 & 0x3f);

+                }

+                uVar24 = *(ushort *)(p_Var45 + 8);

+                if ((uVar24 & 0xf007) != 0) break;

+                if ((uVar24 & 0x180) == 0) {

+                  bVar20 = uVar28 < 0x18;

+                }

+                else {

+                  uVar43 = SmsRunHeader::GetChecksumSizeInBytes

+                                     ((SmsRunHeader *)p_Var45,(CmsVolume *)param_4[9]);

+                  bVar20 = uVar28 < uVar43;

+                }

+                if (bVar20) break;

+                if ((uVar24 & 0x200) != 0) {

+                  pCVar33 = (CmsVolume *)param_4[9];

+                  uVar24 = SmsRunHeader::GetChecksumSizeInBytes((SmsRunHeader *)p_Var45,pCVar33);

+                  uVar32 = (ulonglong)(ushort)(uVar24 + 0x38);

+                  if ((uVar38 < uVar32) ||

+                     (uVar35 = uVar38,

+                     uVar24 = SmsRunHeader::GetChecksumSizeInBytes((SmsRunHeader *)p_Var45,pCVar33),

+                     uVar35 < *(uint *)(p_Var45 + (ulonglong)(ushort)(uVar24 + 0x18) + 0x18) +

+                              uVar32)) break;

+                }

+              }

+            }

+            uVar28 = iVar31 + (int)uVar38;

+            uVar32 = (ulonglong)uVar28;

+            p_Var45 = p_Var45 + uVar38;

+            if (uVar36 <= uVar28) break;

+          }

+        }

+      }

+    }

+    else if (uVar28 <= *(uint *)(param_1 + 8)) {

+      uVar32 = (ulonglong)*(uint *)param_1;

+      p_Var45 = param_1 + uVar32;

+      if (*(uint *)param_1 < uVar36) {

+        while (iVar31 = (int)uVar32, uVar32 + 0x10 <= (ulonglong)uVar36) {

+          iVar27 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+          if ((iVar27 != 0) && (iVar31 == (int)param_4[8])) {

+            *(undefined1 *)((longlong)param_4 + 0x44) = 1;

+          }

+          if (((byte)p_Var45[8] & 0x40) != 0) break;

+          uVar28 = *(uint *)p_Var45;

+          uVar38 = (ulonglong)uVar28;

+          if ((((*(char *)((longlong)param_4 + 0x23) == '\0') && ((uVar28 & 7) != 0)) ||

+              (uVar28 < 0x10)) || ((ulonglong)uVar36 < uVar32 + uVar38)) break;

+          uVar24 = *(ushort *)(p_Var45 + 4);

+          uVar34 = (uint)*(ushort *)(p_Var45 + 6) + (uint)uVar24;

+          if (uVar28 < uVar34) break;

+          uVar43 = *(ushort *)(p_Var45 + 10);

+          uVar32 = (ulonglong)*(uint *)(p_Var45 + 0xc) + (ulonglong)uVar43;

+          if (uVar38 < uVar32) break;

+          if (*(char *)((longlong)param_4 + 0x24) != '\0') {

+            uVar24 = uVar24 + 8;

+          }

+          if (uVar24 < uVar43) {

+            bVar20 = uVar34 < uVar43;

+            bVar47 = uVar34 == uVar43;

+          }

+          else {

+            bVar20 = uVar34 < uVar32;

+            bVar47 = uVar34 == uVar32;

+          }

+          if ((!bVar20 && !bVar47) || ((*(ushort *)(param_4 + 4) & *(ushort *)(p_Var45 + 8)) != 0))

+          break;

+          if ((*(ushort *)(p_Var45 + 8) & 4) == 0) {

+            iVar27 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+            if (((iVar27 != 0) && (*(char *)((longlong)param_4 + 0x23) != '\0')) &&

+               ((param_4[5] != 0 && (*(uint *)((longlong)param_4 + 0x34) < *(uint *)(param_4 + 6))))

+               ) {

+              *(int *)(param_4[5] + (ulonglong)*(uint *)((longlong)param_4 + 0x34) * 4) = iVar31;

+              *(int *)((longlong)param_4 + 0x34) = *(int *)((longlong)param_4 + 0x34) + 1;

+            }

+            iVar27 = Feature_2024795448__private_IsEnabledDeviceUsageNoInline();

+            if (((iVar27 != 0) && (_Var6 == (_SmsIndexHeader)0x0)) &&

+               (lVar39 = param_4[9], *(short *)(param_3 + 4) == 10)) {

+              if (*(ushort *)(p_Var45 + 6) < 0x10) break;

+              if (*(int *)(p_Var45 + (ulonglong)*(ushort *)(p_Var45 + 4) + 0xc) == 1) {

+                if (*(uint *)(p_Var45 + 0xc) < 0x50) break;

+                uVar24 = *(ushort *)(p_Var45 + 10);

+                if ((3 < *(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) - 1U) ||

+                   (((*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x14) & 8) == 0 &&

+                    (*(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) != 1)))) break;

+                bVar21 = *(byte *)(lVar39 + 0x58);

+                if (bVar21 == 2) {

+                  bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+                }

+                iVar27 = (**(code **)(**(longlong **)(lVar39 + 0xdd8 + (ulonglong)bVar21 * 8) + 0x50

+                                     ))();

+                if (*(uint *)(p_Var45 + 0xc) <

+                    (uint)((*(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) + 5 + iVar27) * 0x10))

+                break;

+                bVar21 = *(byte *)(lVar39 + 0x58);

+                if (bVar21 == 2) {

+                  bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+                }

+                iVar27 = (**(code **)(**(longlong **)(lVar39 + 0xdd8 + (ulonglong)bVar21 * 8) + 0x50

+                                     ))();

+                uVar34 = *(uint *)(lVar39 + 0x54);

+                uVar32 = (ulonglong)uVar34;

+                uVar26 = iVar27 << 4;

+                if (uVar34 != 0) {

+                  uVar44 = 0;

+                  if (*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x4c) != 0) {

+                    p_Var46 = p_Var45 + (ulonglong)uVar26 + 0x50 + (ulonglong)uVar24;

+                    do {

+                      uVar35 = *(ulonglong *)(p_Var46 + 8);

+                      if (((uVar35 == 0) || (uVar32 < uVar35)) ||

+                         ((uVar13 = *(ulonglong *)p_Var46, ~uVar13 < uVar35 ||

+                          (uVar13 / uVar32 != ((uVar35 - 1) + uVar13) / uVar32))))

+                      goto LAB_2;

+                      uVar44 = uVar44 + 1;

+                      p_Var46 = p_Var46 + 0x10;

+                    } while (uVar44 < *(uint *)(p_Var45 + (ulonglong)uVar24 + 0x4c));

+                  }

+                  if (((*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x14) & 8) == 0) &&

+                     (((*(uint *)(p_Var45 + (ulonglong)uVar26 + 0x50 + (ulonglong)uVar24) &

+                       uVar34 - 1) != 0 ||

+                      (*(ulonglong *)(p_Var45 + (ulonglong)uVar26 + 0x58 + (ulonglong)uVar24) !=

+                       uVar32)))) break;

+                }

+              }

+            }

+            if (*(char *)((longlong)param_4 + 0x23) == '\0') {

+              uVar34 = (int)param_4[3] + iVar31;

+              puVar1 = (ulonglong *)(*param_4 + (ulonglong)(uVar34 >> 9) * 8);

+              *puVar1 = *puVar1 | 1L << (uVar34 >> 3 & 0x3f);

+            }

+            if ((((byte)p_Var45[8] & 1) == 0) || (param_1[0xc] != (_SmsIndexHeader)0x0)) {

+LAB_6:

+              if (_Var6 != (_SmsIndexHeader)0x0) {

+                if (0x20 < *(uint *)(p_Var45 + 0xc) - 0x28) break;

+                uVar32 = (ulonglong)*(ushort *)(p_Var45 + 10);

+                if (((((ulonglong)*(uint *)(p_Var45 + 0xc) <

+                       (ulonglong)*(uint *)(p_Var45 + uVar32 + 0x24) + 0x20 +

+                       (ulonglong)(byte)p_Var45[uVar32 + 0x23]) ||

+                     (p_Var45[uVar32 + 0x23] != (_SmsIndexHeader)0x8)) ||

+                    (p_Var45[uVar32 + 0x22] != *(_SmsIndexHeader *)(param_4[9] + 0x58))) ||

+                   (*(uint *)(p_Var45 + uVar32 + 0x24) != *(uint *)(param_4[9] + 0xe08))) break;

+              }

+            }

+            else {

+              if ((*(char *)((longlong)param_4 + 0x25) != '\0') && (5 < *(ushort *)(p_Var45 + 6))) {

+                sVar22 = *(short *)(p_Var45 + *(ushort *)(p_Var45 + 4));

+                if (((sVar22 != 0x40) && (sVar22 != 0x10)) &&

+                   ((sVar22 != 0x30 ||

+                    (((byte)p_Var45[(ulonglong)*(ushort *)(p_Var45 + 4) + 2] & 1) == 0))))

+                goto LAB_6;

+              }

+              uVar24 = *(ushort *)(p_Var45 + 10);

+              if ((((((uVar24 & 7) != 0) || (uVar34 = *(uint *)(p_Var45 + 0xc), (uVar34 & 7) != 0))

+                   || ((uVar34 < 0x28 ||

+                       (pSVar29 = CmsSchemaTable::GetPropertyDef

+                                            (*(CmsSchemaTable **)(param_4[9] + 0xd28),

+                                             *(ulong *)(p_Var45 + uVar24 + 0xc)),

+                       pSVar29 == (SmsInternalPropertyDef *)0x0)))) ||

+                  ((uVar34 < *(uint *)(pSVar29 + 0x18) &&

+                   ((*(uint *)(pSVar29 + 0x2c) & 0x1000) == 0)))) ||

+                 (iVar27 = CheckIndexRootRecurse(p_Var45 + uVar24,uVar34,pSVar29,param_4),

+                 iVar27 < 0)) break;

+            }

+          }

+          uVar32 = (ulonglong)(iVar31 + uVar28);

+          p_Var45 = p_Var45 + uVar38;

+          if (uVar36 <= iVar31 + uVar28) break;

+        }

+      }

+    }

+  }

+  else {

+    uVar36 = *(uint *)(param_1 + 4);

+    uVar32 = (ulonglong)uVar36;

+    local_c4 = *(int *)(param_1 + 0x10) - uVar36;

+    uVar28 = local_c4;

+    bVar20 = _SmsIndexHeader::UseStreamIndexEntry(param_1,param_3);

+    if (bVar20) {

+      if (*(uint *)(param_1 + 8) < uVar28) goto LAB_7;

+      uVar34 = *(uint *)param_1;

+      uVar38 = (ulonglong)uVar34;

+      iVar31 = 0;

+      p_Var45 = param_1 + uVar38;

+      while (uVar34 < uVar36) {

+        iVar27 = (int)uVar38;

+        if (uVar32 < uVar38 + 0x10) goto LAB_7;

+        iVar25 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+        if ((iVar25 != 0) && (iVar27 == (int)param_4[8])) {

+          *(undefined1 *)((longlong)param_4 + 0x44) = 1;

+        }

+        if ((*(ushort *)(p_Var45 + 8) & 0x40) == 0) {

+          uVar34 = *(uint *)p_Var45;

+        }

+        else {

+          uVar34 = *(ushort *)(p_Var45 + 10) + 7 & 0xfffffff8;

+        }

+        uVar35 = (ulonglong)uVar34;

+        if ((*(ushort *)(p_Var45 + 8) & 4) == 0) {

+          iVar25 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+          if ((((iVar25 != 0) && (*(char *)((longlong)param_4 + 0x23) != '\0')) && (param_4[5] != 0)

+              ) && (*(uint *)((longlong)param_4 + 0x34) < *(uint *)(param_4 + 6))) {

+            *(int *)(param_4[5] + (ulonglong)*(uint *)((longlong)param_4 + 0x34) * 4) = iVar27;

+            *(int *)((longlong)param_4 + 0x34) = *(int *)((longlong)param_4 + 0x34) + 1;

+          }

+          if ((((byte)p_Var45[8] & 0x40) == 0) || (uVar36 < uVar34 + iVar27)) goto LAB_7;

+          if (*(char *)((longlong)param_4 + 0x23) == '\0') {

+            uVar28 = (int)param_4[3] + iVar27;

+            puVar1 = (ulonglong *)(*param_4 + (ulonglong)(uVar28 >> 9) * 8);

+            *puVar1 = *puVar1 | 1L << (uVar28 >> 3 & 0x3f);

+          }

+          uVar24 = *(ushort *)(p_Var45 + 8);

+          if ((uVar24 & 0xf007) != 0) goto LAB_7;

+          uVar43 = uVar24 & 0x180;

+          if (uVar43 == 0) {

+            bVar20 = uVar34 < 0x18;

+          }

+          else {

+            lVar39 = param_4[9];

+            bVar21 = *(byte *)(lVar39 + 0x58);

+            if (bVar21 == 2) {

+              bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+            }

+            lVar12 = *(longlong *)(lVar39 + 0xdd8 + (ulonglong)bVar21 * 8);

+            if (*(short *)(lVar12 + 8) == 0) {

+              bVar20 = false;

+            }

+            else {

+              bVar20 = uVar34 < ((uint)(((ulonglong)*(uint *)(p_Var45 + 0x14) <<

+                                        ((byte)*(int *)(lVar39 + 0x40) & 0x3f)) >>

+                                       ((char)*(undefined2 *)(lVar12 + 0x14) -

+                                        (char)*(undefined4 *)(lVar12 + 0xc) & 0x3fU)) & 0xffff);

+            }

+          }

+          if (bVar20) goto LAB_7;

+          if ((uVar24 >> 9 & 1) != 0) {

+            lVar39 = param_4[9];

+            if (uVar43 == 0) {

+              uVar38 = 0;

+            }

+            else {

+              bVar21 = *(byte *)(lVar39 + 0x58);

+              if (bVar21 == 2) {

+                bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+              }

+              uVar38 = (ulonglong)bVar21;

+            }

+            lVar12 = *(longlong *)(lVar39 + 0xdd8 + uVar38 * 8);

+            if (*(short *)(lVar12 + 8) == 0) {

+              sVar22 = 0;

+            }

+            else {

+              sVar22 = (short)(((ulonglong)*(uint *)(p_Var45 + 0x14) <<

+                               ((byte)*(undefined4 *)(lVar39 + 0x40) & 0x3f)) >>

+                              ((char)*(undefined2 *)(lVar12 + 0x14) -

+                               (char)*(undefined4 *)(lVar12 + 0xc) & 0x3fU));

+            }

+            if ((ushort)(sVar22 + 0x38) <= uVar35) {

+              if (uVar43 == 0) {

+                uVar38 = 0;

+              }

+              else {

+                bVar21 = *(byte *)(lVar39 + 0x58);

+                if (bVar21 == 2) {

+                  bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+                }

+                uVar38 = (ulonglong)bVar21;

+              }

+              lVar12 = *(longlong *)(lVar39 + 0xdd8 + uVar38 * 8);

+              if (*(short *)(lVar12 + 8) == 0) {

+                sVar23 = 0;

+              }

+              else {

+                sVar23 = (short)(((ulonglong)*(uint *)(p_Var45 + 0x14) <<

+                                 ((byte)*(undefined4 *)(lVar39 + 0x40) & 0x3f)) >>

+                                ((char)*(undefined2 *)(lVar12 + 0x14) -

+                                 (char)*(undefined4 *)(lVar12 + 0xc) & 0x3fU));

+              }

+              uVar38 = (ulonglong)*(uint *)(p_Var45 + (ulonglong)(ushort)(sVar23 + 0x18) + 0x18) +

+                       (ulonglong)(ushort)(sVar22 + 0x38);

+              bVar20 = uVar38 < uVar35;

+              bVar47 = uVar38 == uVar35;

+              goto LAB_8;

+            }

+            goto LAB_7;

+          }

+        }

+        else {

+          bVar20 = uVar35 + uVar38 < uVar32;

+          bVar47 = uVar35 + uVar38 == uVar32;

+LAB_8:

+          if (!bVar20 && !bVar47) goto LAB_7;

+        }

+        if (((byte)p_Var45[8] & 4) == 0) {

+          iVar31 = iVar31 + 1;

+        }

+        else {

+          local_c4 = local_c4 + uVar34;

+        }

+        uVar34 = iVar27 + uVar34;

+        uVar38 = (ulonglong)uVar34;

+        p_Var45 = p_Var45 + uVar35;

+        uVar28 = local_c4;

+      }

+      if ((param_1[0xc] != (_SmsIndexHeader)0x0) || (*(uint *)(param_1 + 8) != uVar28))

+      goto LAB_7;

+      bVar20 = *(int *)(param_1 + 0x14) == iVar31;

+    }

+    else {

+      _Var6 = param_1[0xc];

+      if (*(uint *)(param_1 + 8) < uVar28) goto LAB_7;

+      uVar34 = *(uint *)param_1;

+      uVar32 = (ulonglong)uVar34;

+      local_d4 = 0;

+      iVar31 = 0;

+      local_c0 = 0;

+      p_Var45 = param_1 + uVar32;

+      while (uVar34 < uVar36) {

+        uVar38 = (ulonglong)uVar36;

+        iVar27 = (int)uVar32;

+        if (uVar38 < uVar32 + 0x10) goto LAB_7;

+        iVar25 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+        if ((iVar25 != 0) && (iVar27 == (int)param_4[8])) {

+          *(undefined1 *)((longlong)param_4 + 0x44) = 1;

+        }

+        if ((*(ushort *)(p_Var45 + 8) & 0x40) == 0) {

+          uVar28 = *(uint *)p_Var45;

+        }

+        else {

+          uVar28 = *(ushort *)(p_Var45 + 10) + 7 & 0xfffffff8;

+        }

+        if ((*(ushort *)(p_Var45 + 8) & 4) == 0) {

+          iVar25 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+          if ((((iVar25 != 0) && (*(char *)((longlong)param_4 + 0x23) != '\0')) && (param_4[5] != 0)

+              ) && (*(uint *)((longlong)param_4 + 0x34) < *(uint *)(param_4 + 6))) {

+            *(int *)(param_4[5] + (ulonglong)*(uint *)((longlong)param_4 + 0x34) * 4) = iVar27;

+            *(int *)((longlong)param_4 + 0x34) = *(int *)((longlong)param_4 + 0x34) + 1;

+          }

+          if ((((((byte)p_Var45[8] & 0x40) != 0) ||

+               ((*(char *)((longlong)param_4 + 0x23) == '\0' && ((uVar28 & 7) != 0)))) ||

+              (uVar28 < 0x10)) || (uVar38 < uVar32 + uVar28)) goto LAB_7;

+          uVar24 = *(ushort *)(p_Var45 + 4);

+          uVar34 = (uint)*(ushort *)(p_Var45 + 6) + (uint)uVar24;

+          if (uVar28 < uVar34) goto LAB_7;

+          uVar43 = *(ushort *)(p_Var45 + 10);

+          uVar32 = (ulonglong)*(uint *)(p_Var45 + 0xc) + (ulonglong)uVar43;

+          if (uVar28 < uVar32) goto LAB_7;

+          if (*(char *)((longlong)param_4 + 0x24) != '\0') {

+            uVar24 = uVar24 + 8;

+          }

+          if (uVar24 < uVar43) {

+            bVar20 = uVar34 < uVar43;

+            bVar47 = uVar34 == uVar43;

+          }

+          else {

+            bVar20 = uVar34 < uVar32;

+            bVar47 = uVar34 == uVar32;

+          }

+          if ((!bVar20 && !bVar47) || ((*(ushort *)(param_4 + 4) & *(ushort *)(p_Var45 + 8)) != 0))

+          goto LAB_7;

+          iVar25 = Feature_2024795448__private_IsEnabledDeviceUsageNoInline();

+          if ((iVar25 != 0) &&

+             ((_Var6 == (_SmsIndexHeader)0x0 && (lVar39 = param_4[9], *(short *)(param_3 + 4) == 10)

+              ))) {

+            if (*(ushort *)(p_Var45 + 6) < 0x10) goto LAB_7;

+            if (*(int *)(p_Var45 + (ulonglong)*(ushort *)(p_Var45 + 4) + 0xc) == 1) {

+              if (*(uint *)(p_Var45 + 0xc) < 0x50) goto LAB_7;

+              uVar24 = *(ushort *)(p_Var45 + 10);

+              if ((3 < *(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) - 1U) ||

+                 (((*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x14) & 8) == 0 &&

+                  (*(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) != 1)))) goto LAB_7;

+              bVar21 = *(byte *)(lVar39 + 0x58);

+              if (bVar21 == 2) {

+                bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+              }

+              iVar31 = (**(code **)(**(longlong **)(lVar39 + 0xdd8 + (ulonglong)bVar21 * 8) + 0x50))

+                                 ();

+              if (*(uint *)(p_Var45 + 0xc) <

+                  (uint)((*(int *)(p_Var45 + (ulonglong)uVar24 + 0x4c) + 5 + iVar31) * 0x10))

+              goto LAB_7;

+              bVar21 = *(byte *)(lVar39 + 0x58);

+              if (bVar21 == 2) {

+                bVar21 = (*(int *)(lVar39 + 0x40) != 0xc) + 1;

+              }

+              iVar31 = (**(code **)(**(longlong **)(lVar39 + 0xdd8 + (ulonglong)bVar21 * 8) + 0x50))

+                                 ();

+              uVar34 = *(uint *)(lVar39 + 0x54);

+              uVar32 = (ulonglong)uVar34;

+              uVar26 = iVar31 << 4;

+              iVar31 = local_c0;

+              if (uVar34 != 0) {

+                uVar44 = 0;

+                if (*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x4c) != 0) {

+                  p_Var46 = p_Var45 + (ulonglong)uVar26 + 0x50 + (ulonglong)uVar24;

+                  do {

+                    uVar38 = *(ulonglong *)(p_Var46 + 8);

+                    if ((((uVar38 == 0) || (uVar32 < uVar38)) ||

+                        (uVar35 = *(ulonglong *)p_Var46, ~uVar35 < uVar38)) ||

+                       (uVar35 / uVar32 != ((uVar38 - 1) + uVar35) / uVar32)) goto LAB_7;

+                    uVar44 = uVar44 + 1;

+                    p_Var46 = p_Var46 + 0x10;

+                  } while (uVar44 < *(uint *)(p_Var45 + (ulonglong)uVar24 + 0x4c));

+                }

+                if (((*(uint *)(p_Var45 + (ulonglong)uVar24 + 0x14) & 8) == 0) &&

+                   (((*(uint *)(p_Var45 + (ulonglong)uVar26 + 0x50 + (ulonglong)uVar24) & uVar34 - 1

+                     ) != 0 ||

+                    (*(ulonglong *)(p_Var45 + (ulonglong)uVar26 + 0x58 + (ulonglong)uVar24) !=

+                     uVar32)))) goto LAB_7;

+              }

+            }

+          }

+          if (((byte)p_Var45[8] & 2) != 0) {

+            local_d4 = local_d4 + 1;

+          }

+          if (*(char *)((longlong)param_4 + 0x23) == '\0') {

+            uVar34 = (int)param_4[3] + iVar27;

+            puVar1 = (ulonglong *)(*param_4 + (ulonglong)(uVar34 >> 9) * 8);

+            *puVar1 = *puVar1 | 1L << (uVar34 >> 3 & 0x3f);

+          }

+          if ((((byte)p_Var45[8] & 1) == 0) || (param_1[0xc] != (_SmsIndexHeader)0x0)) {

+LAB_9:

+            if (_Var6 != (_SmsIndexHeader)0x0) {

+              if (0x20 < *(uint *)(p_Var45 + 0xc) - 0x28) goto LAB_7;

+              uVar32 = (ulonglong)*(ushort *)(p_Var45 + 10);

+              if (((((ulonglong)*(uint *)(p_Var45 + 0xc) <

+                     (ulonglong)*(uint *)(p_Var45 + uVar32 + 0x24) + 0x20 +

+                     (ulonglong)(byte)p_Var45[uVar32 + 0x23]) ||

+                   (p_Var45[uVar32 + 0x23] != (_SmsIndexHeader)0x8)) ||

+                  (p_Var45[uVar32 + 0x22] != *(_SmsIndexHeader *)(param_4[9] + 0x58))) ||

+                 (*(uint *)(p_Var45 + uVar32 + 0x24) != *(uint *)(param_4[9] + 0xe08)))

+              goto LAB_7;

+            }

+          }

+          else {

+            if ((*(char *)((longlong)param_4 + 0x25) != '\0') && (5 < *(ushort *)(p_Var45 + 6))) {

+              sVar22 = *(short *)(p_Var45 + *(ushort *)(p_Var45 + 4));

+              if (((sVar22 != 0x40) && (sVar22 != 0x10)) &&

+                 ((sVar22 != 0x30 ||

+                  (((byte)p_Var45[(ulonglong)*(ushort *)(p_Var45 + 4) + 2] & 1) == 0))))

+              goto LAB_9;

+            }

+            uVar24 = *(ushort *)(p_Var45 + 10);

+            if (((((uVar24 & 7) != 0) || (uVar34 = *(uint *)(p_Var45 + 0xc), (uVar34 & 7) != 0)) ||

+                ((uVar34 < 0x28 ||

+                 (pSVar29 = CmsSchemaTable::GetPropertyDef

+                                      (*(CmsSchemaTable **)(param_4[9] + 0xd28),

+                                       *(ulong *)(p_Var45 + uVar24 + 0xc)),

+                 pSVar29 == (SmsInternalPropertyDef *)0x0)))) ||

+               (((uVar34 < *(uint *)(pSVar29 + 0x18) && ((*(uint *)(pSVar29 + 0x2c) & 0x1000) == 0))

+                || (iVar25 = CheckIndexRootRecurse(p_Var45 + uVar24,uVar34,pSVar29,param_4),

+                   iVar25 < 0)))) goto LAB_7;

+          }

+        }

+        else if (uVar38 < uVar32 + uVar28) goto LAB_7;

+        if (((byte)p_Var45[8] & 4) == 0) {

+          iVar31 = iVar31 + 1;

+          local_c0 = iVar31;

+        }

+        else {

+          local_c4 = local_c4 + uVar28;

+        }

+        uVar34 = iVar27 + uVar28;

+        uVar32 = (ulonglong)uVar34;

+        p_Var45 = p_Var45 + uVar28;

+        uVar28 = local_c4;

+      }

+      if (param_1[0xc] == (_SmsIndexHeader)0x0) {

+        if (local_d4 != 0) goto LAB_7;

+      }

+      else if (local_d4 != 1) goto LAB_7;

+      if (*(uint *)(param_1 + 8) != uVar28) goto LAB_7;

+      bVar20 = *(int *)(param_1 + 0x14) == iVar31;

+    }

+    if (!bVar20) goto LAB_7;

+  }

+LAB_2:

+  uVar36 = *(uint *)(param_1 + 0x14);

+  p_Var46 = param_1 + *(uint *)(param_1 + 0x10);

+  for (p_Var45 = p_Var46; p_Var45 != p_Var46 + (ulonglong)uVar36 * 4; p_Var45 = p_Var45 + 4) {

+    uVar24 = *(ushort *)p_Var45;

+    if ((((uint)uVar24 < *(uint *)param_1) || (uVar7 <= uVar24)) ||

+       ((*(char *)((longlong)param_4 + 0x23) == '\0' &&

+        (((uVar24 & 7) != 0 ||

+         (uVar28 = (uint)uVar24 + (int)param_4[3], uVar38 = 1L << ((byte)(uVar28 >> 3) & 0x3f),

+         puVar1 = (ulonglong *)(*param_4 + (ulonglong)(uVar28 >> 9) * 8), uVar32 = *puVar1,

+         *puVar1 = ~uVar38 & uVar32, (uVar38 & uVar32) == 0)))))) goto LAB_7;

+    iVar31 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+    if ((iVar31 != 0) && (*(char *)((longlong)param_4 + 0x23) != '\0')) {

+      puVar14 = (uint *)param_4[5];

+      if (puVar14 == (uint *)0x0) goto LAB_7;

+      uVar28 = *(uint *)((longlong)param_4 + 0x34);

+      if (uVar28 == 0) goto LAB_7;

+      uVar32 = (ulonglong)uVar28;

+      puVar40 = puVar14;

+      do {

+        uVar38 = (longlong)uVar32 / 2;

+        if (puVar40[uVar38] < (uint)*(ushort *)p_Var45) {

+          puVar40 = puVar40 + uVar38 + 1;

+          uVar38 = uVar32 + (-1 - uVar38);

+        }

+        uVar32 = uVar38;

+      } while (0 < (longlong)uVar38);

+      if ((puVar40 == puVar14 + uVar28) || (*puVar40 != (uint)*(ushort *)p_Var45))

+      goto LAB_7;

+      uVar32 = (longlong)puVar40 - (longlong)puVar14 >> 2 & 0xffffffff;

+      if (*(char *)(uVar32 + param_4[7]) != '\0') goto LAB_7;

+      *(undefined1 *)(uVar32 + param_4[7]) = 1;

+    }

+  }

+  uVar36 = *(uint *)(param_1 + 0x14);

+  uVar32 = (ulonglong)uVar36;

+  if ((param_1[0xc] != (_SmsIndexHeader)0x0) &&

+     ((uVar36 == 0 ||

+      (uVar32 = (ulonglong)(uVar36 - 1),

+      ((byte)param_1[(ulonglong)

+                     *(ushort *)(param_1 + uVar32 * 4 + (ulonglong)*(uint *)(param_1 + 0x10)) + 8] &

+      2) == 0)))) goto LAB_7;

+  if ((((byte)param_1[0xd] & 2) == 0) && ((int)uVar32 == 0)) {

+    uVar38 = (ulonglong)*(uint *)(param_1 + 0x10);

+    if (((((uVar38 < (ulonglong)*(uint *)(param_1 + 4) + 4) ||

+          ((uint)*(ushort *)(param_1 + (uVar38 - 4)) < *(uint *)param_1)) ||

+         ((*(char *)((longlong)param_4 + 0x23) == (char)uVar32 &&

+          ((*(ushort *)(param_1 + (uVar38 - 4)) & 7) != 0)))) ||

+        ((iVar31 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline(), iVar31 != 0 &&

+         (*(uint *)(param_1 + 0x10) < *(ushort *)(param_1 + (uVar38 - 4)) + 0x10)))) ||

+       ((iVar31 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline(), iVar31 != 0 &&

+        ((*(char *)((longlong)param_4 + 0x44) == '\0' &&

+         ((uint)*(ushort *)(param_1 + (uVar38 - 4)) != *(uint *)(param_1 + 4)))))))

+    goto LAB_7;

+    this_00 = (_SmsIndexEntry *)(param_1 + *(ushort *)(param_1 + (uVar38 - 4)));

+    iVar31 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+    if ((iVar31 != 0) && (((byte)this_00[8] & 4) == 0)) goto LAB_7;

+    iVar31 = Feature_2436788537__private_IsEnabledDeviceUsageNoInline();

+    if (iVar31 != 0) {

+      if ((*(ushort *)(this_00 + 8) & 0x40) == 0) {

+        uVar24 = *(ushort *)(this_00 + 6);

+        uVar43 = *(ushort *)(this_00 + 4);

+        uVar36 = *(uint *)this_00;

+      }

+      else {

+        uVar24 = 0xc;

+        uVar43 = 0xc;

+        uVar36 = *(ushort *)(this_00 + 10) + 7 & 0xfffffff8;

+      }

+      if (uVar36 < (uint)uVar24 + (uint)uVar43) goto LAB_7;

+      if ((*(ushort *)(this_00 + 8) & 0x40) == 0) {

+        uVar36 = *(uint *)this_00;

+      }

+      else {

+        uVar36 = *(ushort *)(this_00 + 10) + 7 & 0xfffffff8;

+      }

+      if ((ulonglong)*(uint *)(param_1 + 0x10) <

+          (ulonglong)*(ushort *)(param_1 + (uVar38 - 4)) + (ulonglong)uVar36) goto LAB_7;

+    }

+    puVar42 = *(undefined8 **)(param_3 + 0x38);

+    pcVar41 = *(code **)*puVar42;

+    uVar30 = _SmsIndexEntry::ToKey(this_00);

+    cVar19 = (*pcVar41)(puVar42,param_3,uVar30);

+    if (cVar19 == '\0') goto LAB_7;

+  }

+  if (((*(uint *)(param_3 + 0x2c) & 2) != 0) && (((byte)param_1[0xd] & 8) != 0)) {

+    for (p_Var45 = p_Var46; p_Var45 != p_Var46 + uVar32 * 4; p_Var45 = p_Var45 + 4) {

+      uVar24 = *(ushort *)p_Var45;

+      if ((*(ushort *)(param_1 + (ulonglong)uVar24 + 8) & 0x40) == 0) {

+        if ((*(ushort *)(param_1 + (ulonglong)uVar24 + 8) & 2) == 0) {

+          lVar39 = *(longlong *)

+                    (param_1 +

+                    (ulonglong)*(ushort *)(param_1 + (ulonglong)uVar24 + 4) + (ulonglong)uVar24);

+        }

+        else {

+          lVar39 = -1;

+        }

+      }

+      else {

+        lVar39 = *(longlong *)(param_1 + (ulonglong)uVar24 + 0xc);

+      }

+      if ((ulonglong)*(ushort *)(p_Var45 + 2) + *(longlong *)(param_1 + 0x18) != lVar39)

+      goto LAB_7;

+    }

+    if ((param_1[0xc] != (_SmsIndexHeader)0x0) && (*(short *)(p_Var46 + uVar32 * 4 + 2) != -1))

+    goto LAB_7;

+  }

+  if ((((*(uint *)(param_3 + 0x2c) & 2) == 0) ||

+      (((((byte)param_1[0xd] & 8) != 0 ||

+        (bVar20 = CmsVolume::FormattedSinceVersion(this,0x30f), !bVar20)) ||

+       (*(longlong *)(param_1 + 0x18) == 0)))) &&

+     (iVar31 = (**(code **)(**(longlong **)(param_3 + 0x38) + 0x18))

+                         (*(longlong **)(param_3 + 0x38),param_1,param_3), -1 < iVar31)) {

+    *(char *)((longlong)param_4 + 0x22) = *(char *)((longlong)param_4 + 0x22) + -1;

+    *(int *)(param_4 + 3) = (int)lVar15;

+    *(undefined4 *)((longlong)param_4 + 0x1c) = uVar8;

+    *(short *)(param_4 + 4) = (short)lVar16;

+    *(undefined1 *)((longlong)param_4 + 0x23) = uVar2;

+    *(undefined1 *)((longlong)param_4 + 0x24) = uVar3;

+    *(undefined1 *)((longlong)param_4 + 0x25) = uVar4;

+    param_4[5] = lVar10;

+    *(int *)(param_4 + 6) = (int)lVar17;

+    *(undefined4 *)((longlong)param_4 + 0x34) = uVar9;

+    param_4[7] = lVar11;

+    *(int *)(param_4 + 8) = (int)lVar18;

+    *(undefined1 *)((longlong)param_4 + 0x44) = uVar5;

+    if (local_d0 != 0) {

+      ExFreePoolWithTag(local_d0,0);

+    }

+    return 0;

+  }

+LAB_7:

+  if (local_d0 != 0) {

+    ExFreePoolWithTag(local_d0,0);

+  }

+  return 0xc0000518;

 }
```

## `LogCoreScanDataRecord`  (modified)

```diff
--- LogCoreScanDataRecord
+++ LogCoreScanDataRecord
@@ -1,25 +1,200 @@
 

-ulonglong LogCoreScanDataRecord

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

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

+

+int LogCoreScanDataRecord

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

+              undefined8 param_5,ulonglong param_6,longlong *param_7,uint *param_8,

+              undefined8 param_9,undefined8 *param_10)

 

 {

-  ulonglong uVar1;

-  ulonglong in_R10;

-  ulonglong in_R11;

-  ulonglong uVar2;

+  uint *puVar1;

+  uint uVar2;

+  void *pvVar3;

+  int iVar4;

+  uint uVar5;

+  int iVar6;

+  uint uVar7;

+  void *pvVar8;

+  undefined8 uVar9;

+  ulonglong uVar10;

+  ulonglong uVar11;

+  longlong lVar12;

+  undefined8 *puVar13;

+  uint uVar14;

+  size_t _Size;

+  int local_res20;

+  undefined8 in_stack_ffffffffffffff88;

+  undefined4 uVar15;

+  void **ppvVar16;

+  undefined1 *puVar17;

+  void *local_58;

+  void *local_50;

+  undefined8 local_48;

   

-  while( true ) {

-    uVar2 = in_R11 ^ param_1;

-    in_R10 = in_R10 >> 1;

-    if (in_R10 == 0) break;

-    param_1 = uVar2 * 2;

-    uVar1 = param_4 ^ uVar2;

-    if ((in_R10 & 1) == 0) {

-      uVar1 = param_4;

-    }

-    in_R11 = (ulonglong)((uint)((longlong)uVar2 >> 0x3f) & 0x1b);

-    param_4 = uVar1;

-  }

-  return param_4;

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

+  pvVar8 = (void *)0x0;

+  uVar14 = 0;

+  puVar17 = (undefined1 *)&param_9;

+  local_58 = (void *)0x0;

+  ppvVar16 = &local_58;

+  local_50 = (void *)0x0;

+  param_9._0_4_ = 0;

+  uVar11 = param_6;

+  iVar4 = LogCoreFetchDataRecord(param_1);

+  pvVar3 = local_58;

+  if (iVar4 < 0) {

+    return iVar4;

+  }

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

+  uVar11 = uVar11 & 0xffffffffffffff00;

+  uVar10 = CONCAT44(uVar15,uVar7);

+  iVar4 = LogValidateEntryHeader

+                    (param_1,param_3,*(undefined8 *)(param_1 + 0xe80),local_58,uVar10,uVar11,

+                     ppvVar16,puVar17);

+  uVar2 = (uint)param_9;

+  if (iVar4 == -0x3fc2fdff) {

+    uVar5 = *(int *)((longlong)pvVar3 + 0x3c) * *(int *)(param_1 + 0xe50);

+    uVar7 = (uint)param_9;

+    if (uVar5 < (uint)param_9) {

+      uVar7 = uVar5;

+    }

+    uVar10 = (ulonglong)uVar7;

+    iVar4 = LogValidateEntryHeader

+                      (param_1,param_3,*(undefined8 *)(param_1 + 0xe80),pvVar3,uVar10,

+                       uVar11 & 0xffffffffffffff00,ppvVar16,puVar17);

+  }

+  _Size = (size_t)uVar7;

+  if ((iVar4 < 0) || (iVar4 = LogVerifyChecksumEntryHeader(param_1,_Size,pvVar3), iVar4 < 0)) {

+    local_res20 = (int)param_4;

+    uVar10 = (*(longlong *)(param_1 + 8) + (param_3 & 0xffffffff)) *

+             (ulonglong)*(uint *)(param_1 + 0xe50);

+    iVar6 = LogRepairEntryHeader

+                      (param_1,param_2,pvVar3,(local_res20 - (int)pvVar3) + 0x1000000,uVar10,param_3

+                       ,(ulonglong)ppvVar16 & 0xffffffffffffff00);

+    if (-1 < iVar6) {

+      iVar4 = 0;

+      uVar7 = *(int *)((longlong)pvVar3 + 0x3c) * *(int *)(param_1 + 0xe50);

+      _Size = (size_t)uVar2;

+      if (uVar7 < uVar2) {

+        _Size = (size_t)uVar7;

+      }

+    }

+  }

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

+LAB_0:

+    if (-1 < iVar4) goto LAB_1;

+LAB_2:

+    if ((ulonglong)*(uint *)(param_1 + 0xe70) <=

+        (ulonglong)

+        (uint)(*(int *)(param_1 + 0x2fec) + 0xaf + *(int *)(param_1 + 0xe50) &

+              -*(int *)(param_1 + 0xe50)) + (param_3 & 0xffffffff)) {

+      local_48 = (void *)CONCAT44((int)((ulonglong)*(undefined8 *)(param_1 + 0x18) >> 0x20) + 1,

+                                  (int)*(undefined8 *)(param_1 + 0x18));

+      local_50 = (void *)((ulonglong)((int)(param_3 >> 0x20) + 1) << 0x20);

+      pvVar3 = local_50;

+      if (((local_50 < local_48) &&

+          (iVar6 = LogCoreFetchDataRecord

+                             (param_1,param_2,local_50,param_4,uVar10,param_6,&local_58,&param_9),

+          -1 < iVar6)) &&

+         ((iVar6 = LogValidateEntryHeader

+                             (param_1,pvVar3,*(undefined8 *)(param_1 + 0xe80),param_4,

+                              *(undefined4 *)(param_1 + 0xe50),1),

+          (iVar6 + 0x80000000U & 0x80000000) != 0 ||

+          (((iVar6 == -0x3fc2fdff ||

+            (iVar6 = LogRepairEntryHeader

+                               (param_1,param_2,local_58,(ulonglong)*(uint *)(param_1 + 0xe50),

+                                (ulonglong)*(uint *)(param_1 + 0xe50) * *(longlong *)(param_1 + 8),

+                                pvVar3,1), (iVar6 + 0x80000000U & 0x80000000) != 0)) ||

+           (iVar6 == -0x3fc2fdff)))))) {

+        LOCK();

+        puVar1 = (uint *)(param_1 + 0x2e48);

+        uVar14 = *puVar1;

+        *puVar1 = *puVar1 + 1;

+        UNLOCK();

+        iVar4 = 0x105;

+        uVar11 = (ulonglong)(uVar14 + 1);

+        if (0x1f < uVar14) {

+          uVar11 = 0x20;

+        }

+        *param_10 = pvVar3;

+        *(int *)(param_1 + 0x2e48 + uVar11 * 4) = (int)param_3;

+        *(ulonglong *)(param_1 + 0xe78) = param_3;

+      }

+    }

+  }

+  else {

+    if (iVar4 < 0) goto LAB_2;

+    uVar14 = (*(int *)((longlong)pvVar3 + 0x38) - *(int *)((longlong)pvVar3 + 0x3c)) *

+             *(int *)(param_1 + 0xe50);

+    if (uVar14 != 0) {

+      if (uVar2 < uVar14 + (int)_Size) {

+        pvVar8 = (void *)ExAllocatePoolWithTag(0x200,uVar14,0x6c6c534d);

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

+          return -0x3fffff66;

+        }

+        lVar12 = (*(longlong *)(param_1 + 8) + (param_3 & 0xffffffff)) *

+                 (ulonglong)*(uint *)(param_1 + 0xe50);

+        local_50 = pvVar8;

+        iVar4 = (*DAT_3)(param_2,CONCAT71((int7)((ulonglong)lVar12 >> 8),3),pvVar8,uVar14,

+                                 _Size + lVar12);

+        if (iVar4 < 0) goto LAB_4;

+      }

+      else {

+        local_50 = (void *)(_Size + (longlong)pvVar3);

+      }

+      uVar10 = (ulonglong)uVar14;

+      iVar4 = LogValidateEntryPayload(param_1);

+      goto LAB_0;

+    }

+LAB_1:

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

+      uVar7 = (int)param_3 * *(int *)(param_1 + 0xe50);

+      memmove((void *)((ulonglong)uVar7 + *(longlong *)(param_1 + 0x2fd8)),pvVar3,_Size);

+      if (uVar14 != 0) {

+        memmove((void *)((ulonglong)((int)_Size + uVar7) + *(longlong *)(param_1 + 0x2fd8)),local_50

+                ,(ulonglong)uVar14);

+      }

+    }

+    uVar14 = *(uint *)((longlong)pvVar3 + 0x54);

+    if (*(int *)((longlong)pvVar3 + (ulonglong)uVar14 + 0x30) == 2) {

+      iVar6 = Feature_1644420408__private_IsEnabledDeviceUsageNoInline();

+      if ((iVar6 != 0) && (iVar4 = LogValidateEntryMetadata(pvVar3,_Size), iVar4 < 0))

+      goto LAB_5;

+      uVar7 = *(uint *)((longlong)pvVar3 + (ulonglong)uVar14 + 0x20);

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

+        *param_8 = uVar7;

+        *param_7 = (longlong)pvVar3 +

+                   (ulonglong)*(uint *)((longlong)pvVar3 + (ulonglong)uVar14 + 0x28) +

+                   (ulonglong)uVar14;

+      }

+      else {

+        if (*param_8 < uVar7) {

+          iVar4 = -0x3fffffdd;

+          goto LAB_5;

+        }

+        memmove((void *)*param_7,

+                (void *)((longlong)pvVar3 +

+                        (ulonglong)*(uint *)((longlong)pvVar3 + (ulonglong)uVar14 + 0x28) +

+                        (ulonglong)uVar14),(ulonglong)uVar7);

+      }

+    }

+    else {

+      iVar4 = 0x105;

+    }

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

+      puVar13 = param_10;

+      uVar9 = LogGetNextRecordLsn(param_1,*(undefined8 *)((longlong)pvVar3 + 0x28),

+                                  *(undefined4 *)((longlong)pvVar3 + 0x38));

+      *puVar13 = uVar9;

+    }

+    *(ulonglong *)(param_1 + 0xe80) = param_3;

+  }

+LAB_5:

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

+    return iVar4;

+  }

+LAB_4:

+  ExFreePoolWithTag(pvVar8,0);

+  return iVar4;

 }
```

## `LogReadControlRecord`  (modified)

```diff
--- LogReadControlRecord
+++ LogReadControlRecord
@@ -1,223 +1,136 @@
 

-undefined4 LogReadControlRecord(int param_1)

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

+

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

 

 {

-  int *piVar1;

-  int iVar2;

-  __uint64 _Var3;

-  CmsTransactionContext *pCVar4;

-  code *pcVar5;

-  long lVar6;

-  ulonglong in_RAX;

-  longlong lVar7;

-  __int64 _Var8;

-  longlong *plVar9;

-  ulonglong uVar10;

-  longlong lVar11;

-  uint uVar12;

-  int iVar13;

-  _VCB *this;

-  longlong unaff_RBP;

-  undefined4 unaff_ESI;

-  CmsVolumeContainer *unaff_RDI;

-  longlong *plVar14;

-  undefined8 uVar15;

-  undefined1 unaff_R12B;

-  int unaff_R13D;

-  char unaff_R14B;

-  char unaff_R15B;

-  undefined1 local_res8 [24];

-  int iStack0000000000000040;

-  int iStack0000000000000044;

-  int iStack0000000000000048;

-  int iStack000000000000004c;

-  int iStack0000000000000050;

-  longlong in_stack_00000058;

+  uint uVar1;

+  bool bVar2;

+  int iVar3;

+  int iVar4;

+  int iVar5;

+  int iVar6;

+  void *_Dst;

+  int iVar7;

+  uint uVar8;

+  uint uVar9;

+  longlong lVar10;

+  uint uVar11;

+  longlong lVar12;

+  bool bVar13;

+  ulonglong in_stack_ffffffffffffff80;

+  uint local_64;

+  uint local_60;

+  longlong local_58 [3];

   

-  *(byte *)(in_RAX - 0x75) = *(byte *)(in_RAX - 0x75) | (byte)param_1;

-  uVar12 = param_1 + *(int *)(in_RAX + 0x2b);

-  *(ulonglong *)(unaff_RBP + -0x69) = in_RAX & 0xffffffffffffff58;

-  *(ulonglong *)(unaff_RBP + -0x61) = (ulonglong)uVar12;

-  iStack0000000000000048 = (int)(in_RAX & 0xffffffffffffff58);

-  _iStack0000000000000050 = CONCAT44(uVar12,iStack0000000000000048);

-  iStack000000000000004c = unaff_R13D;

-  lVar7 = KeQueryPerformanceCounter(0);

-  do {

-    lVar11 = *(longlong *)(unaff_RBP + 0x67);

-    if ((*(byte *)(lVar11 + 0x19) & 2) != 0) {

-      unaff_ESI = 0xc00001b1;

-LAB_0:

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

-LAB_1:

-        *(undefined8 *)((longlong)register0x00000020 + -8) = 0x140099816;

-        KeReleaseSpinLock(lVar11 + 0x48,unaff_R12B);

-        lVar11 = *(longlong *)(unaff_RBP + 0x67);

+  local_60 = 0;

+  local_64 = 0;

+  iVar6 = 0;

+  bVar2 = false;

+  local_58[0] = 0;

+  uVar8 = 0xffffffff;

+  uVar9 = 0xffffffff;

+  uVar1 = *(uint *)(param_1 + 0x3050);

+  if ((*(byte *)(param_1 + 0x3c) & 1) == 0) {

+    uVar1 = 1;

+  }

+  _Dst = (void *)ExAllocatePoolWithTag(0x200,uVar1 << 0xc,0x6c6c534d);

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

+    iVar5 = -0x3fffff66;

+    goto LAB_0;

+  }

+  memset(_Dst,0,(ulonglong)(uVar1 << 0xc));

+  iVar7 = *(uint *)(param_1 + 0xe50) * *(int *)(param_1 + 0xe54);

+  param_3 = (ulonglong)*(uint *)(param_1 + 0xe50) * param_3;

+  iVar5 = 0;

+  if (((uVar1 < 2) || (iVar5 = (*DAT_1)(param_2,param_3,iVar7,local_58), -1 < iVar5)) ||

+     (local_58[0] != 0)) {

+    uVar11 = 0;

+    iVar3 = 0;

+    if (uVar1 != 0) {

+      do {

+        lVar12 = (ulonglong)(uVar11 << 0xc) + (longlong)_Dst;

+        if (uVar1 < 2) {

+          iVar5 = (*DAT_2)(param_2,3,lVar12,iVar7,param_3);

+        }

+        else {

+          iVar5 = (*DAT_3)(param_2,lVar12,iVar7,param_3,uVar11);

+        }

+        if (iVar5 < 0) {

+          local_60 = local_60 + 1;

+          iVar4 = iVar5;

+          if (iVar3 < 0) {

+            iVar4 = iVar3;

+          }

+LAB_4:

+          iVar6 = iVar4;

+        }

+        else {

+          in_stack_ffffffffffffff80 = in_stack_ffffffffffffff80 & 0xffffffffffffff00;

+          iVar4 = LogValidateEntryHeader(param_1,0,0,lVar12,0x1000,in_stack_ffffffffffffff80);

+          iVar6 = iVar3;

+          if (iVar4 < 0) {

+            if (-1 < iVar3) goto LAB_4;

+          }

+          else {

+            iVar3 = LogVerifyChecksumEntryHeader(param_1,0x1000,lVar12);

+            if (-1 < iVar3) {

+              local_64 = local_64 + 1;

+              if (iVar5 != 0x40000035) {

+                bVar2 = true;

+              }

+              bVar13 = uVar9 == 0xffffffff;

+              uVar9 = uVar8;

+              if (bVar13) {

+                uVar9 = uVar11;

+                uVar8 = uVar11;

+              }

+            }

+          }

+        }

+        uVar11 = uVar11 + 1;

+        iVar3 = iVar6;

+      } while (uVar11 < uVar1);

+    }

+    if (((local_60 == uVar1) && (iVar3 = (*DAT_2)(param_2,3,_Dst,iVar7,param_3), -1 < iVar3)

+        ) && (iVar3 = LogVerifyChecksumEntryHeader(param_1,0x1000,_Dst), -1 < iVar3)) {

+      uVar9 = 0;

+      bVar2 = true;

+      local_64 = 1;

+    }

+    else if (uVar9 == 0xffffffff) {

+      if ((-1 < iVar5) && (iVar5 = -0x3ffffb90, iVar6 < 0)) {

+        iVar5 = iVar6;

       }

-      if (lVar11 != 0) {

-        _Var3 = *(__uint64 *)(lVar11 + 0x250);

-        pCVar4 = *(CmsTransactionContext **)(unaff_RBP + 0x5f);

-        *(undefined8 *)((longlong)register0x00000020 + -8) = 0x14009983a;

-        CmsVolumeContainer::UnpinContainer

-                  (unaff_RDI,pCVar4,_Var3,(_SmsContainerOverflowPinList *)0x0);

-      }

-      return unaff_ESI;

+      goto LAB_5;

     }

-    plVar9 = (longlong *)(*(longlong *)(unaff_RBP + 0x67) + 0x30);

-    LOCK();

-    lVar11 = *plVar9;

-    if (CONCAT44(iStack000000000000004c,iStack0000000000000048) == lVar11) {

-      *plVar9 = _iStack0000000000000050;

-      lVar11 = CONCAT44(iStack000000000000004c,iStack0000000000000048);

+    lVar12 = (ulonglong)(uVar9 << 0xc) + (longlong)_Dst;

+    if ((local_64 != uVar1) && (!bVar2)) {

+      in_stack_ffffffffffffff80 = 0;

+      (*DAT_6)(param_2,param_3,iVar7,uVar9,uVar1,0);

     }

-    UNLOCK();

-    if (lVar11 == CONCAT44(iStack000000000000004c,iStack0000000000000048)) {

-      **(undefined8 **)(unaff_RBP + 0x77) = *(undefined8 *)(unaff_RBP + 0x67);

-      **(longlong **)(unaff_RBP + 0x7f) = _iStack0000000000000050;

-      lVar11 = KeQueryPerformanceCounter(0);

-      lVar11 = lVar11 - lVar7;

-      LOCK();

-      *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9a0) =

-           *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9a0) + 1;

-      UNLOCK();

-      LOCK();

-      *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9a8) =

-           *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9a8) + lVar11;

-      UNLOCK();

-      if (*(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9b0) < lVar11) {

-        LOCK();

-        *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9b0) = lVar11;

-        UNLOCK();

-      }

-      if (unaff_R13D != 0) {

-        LOCK();

-        *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9b8) =

-             *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9b8) + 1;

-        UNLOCK();

-        LOCK();

-        *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9c0) =

-             *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x9c0) + lVar11;

-        UNLOCK();

-      }

-LAB_2:

-      lVar11 = *(longlong *)(unaff_RBP + 0x67);

-      goto LAB_0;

-    }

-    iStack0000000000000040 = (int)lVar11;

-    if ((iStack0000000000000050 < iStack0000000000000040) ||

-       ((iStack0000000000000044 = (int)((ulonglong)lVar11 >> 0x20),

-        iStack0000000000000040 == iStack0000000000000050 && (iStack0000000000000044 != 0)))) {

-      _Var8 = CmsVolume::GetCurrentCheckpointVirtualClock(*(CmsVolume **)(unaff_RDI + 8));

-      lVar7 = *(longlong *)(unaff_RBP + 0x67);

-      LOCK();

-      piVar1 = (int *)(lVar7 + 0xb0);

-      iVar13 = *piVar1;

-      *piVar1 = *piVar1 + 1;

-      UNLOCK();

-      unaff_ESI = 0xc00000d8;

-      uVar10 = (ulonglong)(iVar13 + 1U & 0xf);

-      *(undefined4 *)(lVar7 + 0xb8 + uVar10 * 0x18) = 0xd;

-      *(__int64 *)(lVar7 + 0xc0 + uVar10 * 0x18) = _Var8;

-      *(longlong *)(lVar7 + 200 + uVar10 * 0x18) =

-           (longlong)iStack0000000000000048 | (longlong)iStack0000000000000040 << 0x20;

-      LOCK();

-      *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x998) =

-           *(longlong *)(*(longlong *)(unaff_RDI + 8) + 0x998) + 1;

-      UNLOCK();

-      goto LAB_2;

-    }

-    if (*(char *)(unaff_RBP + 0x6f) == '\0') {

-LAB_3:

-      unaff_ESI = 0xc00000d8;

-      goto LAB_2;

-    }

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

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

-        unaff_R12B = KeAcquireSpinLockRaiseToDpc(*(longlong *)(unaff_RBP + 0x67) + 0x48);

-        unaff_R14B = '\x01';

+    iVar5 = LogValidateEntryHeader

+                      (param_1,0,0,lVar12,0x1000,in_stack_ffffffffffffff80 & 0xffffffffffffff00);

+    if (-1 < iVar5) {

+      lVar10 = (ulonglong)*(uint *)(lVar12 + 0x54) + lVar12;

+      if (*(int *)(lVar10 + 0x20) == 0xe48) {

+        iVar6 = Feature_1644420408__private_IsEnabledDeviceUsageNoInline();

+        if ((iVar6 == 0) || (iVar5 = LogValidateEntryMetadata(lVar12,0x1000), -1 < iVar5)) {

+          memmove(param_4,(void *)((ulonglong)*(uint *)(lVar10 + 0x28) + lVar10),

+                  (ulonglong)*(uint *)(lVar10 + 0x20));

+        }

       }

       else {

-        iVar13 = iStack0000000000000048 - iStack0000000000000040;

-        *(longlong *)(unaff_RBP + -0x29) = iStack0000000000000040 + in_stack_00000058;

-        *(longlong *)(unaff_RBP + -0x21) = (longlong)iVar13;

-        lVar6 = CmsVolumeContainer::AcquireContainerWriteHead();

-        if (-1 < lVar6) {

-          uVar15 = *(undefined8 *)(*(longlong *)(unaff_RBP + 0x67) + 0x30);

-          _Var8 = CmsVolume::GetCurrentCheckpointVirtualClock(*(CmsVolume **)(unaff_RDI + 8));

-          lVar11 = *(longlong *)(unaff_RBP + 0x67);

-          LOCK();

-          piVar1 = (int *)(lVar11 + 0xb0);

-          iVar2 = *piVar1;

-          *piVar1 = *piVar1 + 1;

-          UNLOCK();

-          uVar10 = (ulonglong)(iVar2 + 1U & 0xf);

-          *(undefined4 *)(lVar11 + 0xb8 + uVar10 * 0x18) = 0xe;

-          this = (_VCB *)(uVar10 * 3);

-          *(__int64 *)(lVar11 + 0xc0 + uVar10 * 0x18) = _Var8;

-          *(undefined8 *)(lVar11 + 200 + uVar10 * 0x18) = uVar15;

-          if (((*(byte *)(*(longlong *)(unaff_RBP + 0x67) + 0x19) & 1) != 0) ||

-             (DAT_4 != '\0')) {

-            this = *(_VCB **)(*(longlong *)(unaff_RDI + 8) + 0x30);

-            MsKmeZeroSMRRegion(this,iStack0000000000000040 + in_stack_00000058,(longlong)iVar13);

-          }

-          CmsVolumeContainer::ReleaseContainerWriteHead

-                    ((CmsVolumeContainer *)this,(SmsContainer *)0x0,0);

-        }

-        unaff_R13D = *(int *)(unaff_RBP + 0x57);

+        iVar5 = -0x3fc2fdfe;

       }

-      unaff_R15B = '\0';

     }

-    else {

-      lVar11 = *(longlong *)(unaff_RBP + 0x67);

-      if ((DAT_5 != '\0') &&

-         (*(longlong *)(lVar11 + 0x250) !=

-          *(longlong *)

-           (*(longlong *)(*(longlong *)(*(longlong *)(unaff_RDI + 8) + 0xa28) + 0x48) + 0x18))) {

-        unaff_ESI = 0xc0000474;

-        goto LAB_1;

-      }

-      plVar14 = (longlong *)(lVar11 + 0x38);

-      plVar9 = (longlong *)*plVar14;

-      if (plVar9 != plVar14) {

-        do {

-          if (*(ulonglong *)(unaff_RBP + -0x69) < (ulonglong)plVar9[2]) break;

-          plVar9 = (longlong *)*plVar9;

-        } while (plVar9 != plVar14);

-      }

-      plVar9 = (longlong *)plVar9[1];

-      lVar11 = *plVar9;

-      if (*(longlong **)(lVar11 + 8) != plVar9) {

-LAB_6:

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

-        (*pcVar5)(3);

-        register0x00000020 = (BADSPACEBASE *)local_res8;

-        goto LAB_3;

-      }

-      *(longlong **)(unaff_RBP + -0x71) = plVar9;

-      *(longlong *)(unaff_RBP + -0x79) = lVar11;

-      *(longlong *)(lVar11 + 8) = unaff_RBP + -0x79;

-      *plVar9 = unaff_RBP + -0x79;

-      KeReleaseSpinLock(*(longlong *)(unaff_RBP + 0x67) + 0x48,

-                        CONCAT71((int7)((ulonglong)(unaff_RBP + -0x79) >> 8),unaff_R12B));

-      *(undefined8 *)(unaff_RBP + -0x41) = 0xfffffffffeced300;

-      do {

-        unaff_ESI = KeWaitForSingleObject(unaff_RBP + -0x59,0,0,0,unaff_RBP + -0x41);

-        lVar11 = *(longlong *)(unaff_RBP + 0x67);

-        if (*(longlong *)(lVar11 + 0x38) == unaff_RBP + -0x79) break;

-      } while ((*(byte *)(lVar11 + 0x19) & 2) == 0);

-      unaff_R12B = KeAcquireSpinLockRaiseToDpc(lVar11 + 0x48);

-      lVar11 = *(longlong *)(unaff_RBP + -0x79);

-      plVar9 = *(longlong **)(unaff_RBP + -0x71);

-      if ((*(longlong *)(lVar11 + 8) != unaff_RBP + -0x79) || (*plVar9 != unaff_RBP + -0x79))

-      goto LAB_6;

-      *plVar9 = lVar11;

-      *(longlong **)(lVar11 + 8) = plVar9;

-      KeReleaseSpinLock(*(longlong *)(unaff_RBP + 0x67) + 0x48,

-                        CONCAT71((int7)((ulonglong)(unaff_RBP + -0x79) >> 8),unaff_R12B));

-      unaff_R14B = '\0';

-      unaff_R15B = '\x01';

-      unaff_R13D = unaff_R13D + 1;

-      *(int *)(unaff_RBP + 0x57) = unaff_R13D;

-    }

-  } while( true );

+  }

+LAB_5:

+  ExFreePoolWithTag(_Dst,0);

+LAB_0:

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

+    (*DAT_7)(param_2);

+  }

+  return iVar5;

 }
```

## `RefsFindIndexEntry`  (modified)

```diff
--- RefsFindIndexEntry
+++ RefsFindIndexEntry
@@ -1,52 +1,70 @@
 

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

+/* unsigned char __cdecl RefsFindIndexEntry(struct _IRP_CONTEXT * __ptr64,struct _SCB *

+   __ptr64,struct _FILE_NAME const & __ptr64,unsigned char,struct _DIR_INDEX_ENTRY * __ptr64 *

+   __ptr64) */

 

 uchar __cdecl

 RefsFindIndexEntry(_IRP_CONTEXT *param_1,_SCB *param_2,_FILE_NAME *param_3,uchar param_4,

                   _DIR_INDEX_ENTRY **param_5)

 

 {

-  int *piVar1;

-  uint uVar2;

-  longlong lVar3;

-  uchar uVar4;

-  long lVar5;

-  longlong unaff_RBX;

-  longlong unaff_RSI;

-  longlong unaff_RDI;

-  undefined8 uStack0000000000000058;

+  uchar uVar1;

+  long lVar2;

+  ulong uVar3;

+  _FILE_NAME *p_Var4;

+  _CmsKey *p_Var5;

   

-  uVar2 = *(uint *)(*(longlong *)(unaff_RSI + 0x88) + 8);

-  lVar5 = RefsBindMinstoreTransactionNoRaise((_IRP_CONTEXT *)param_1);

-  if (-1 < lVar5) {

-    uStack0000000000000058 =

-         *(undefined8 *)(*(longlong *)(*(longlong *)(unaff_RSI + 0x88) + 0x58) + 0x100);

-    if ((uVar2 & 0x200000) == 0) {

-      lVar5 = MsCreateDurableTableObject

-                        (unaff_RSI + 0x1b0,*(undefined8 *)(unaff_RDI + 0x18),&stack0x00000050,

-                         *(undefined8 *)(*(longlong *)(unaff_RDI + 0x40) + 0x70));

+  *param_5 = (_DIR_INDEX_ENTRY *)0x0;

+  p_Var4 = param_3;

+  lVar2 = RefsBindMinstoreTransactionNoRaise(param_1);

+  uVar3 = (ulong)p_Var4;

+  if (lVar2 < 0) {

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

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

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

+      uVar3 = 0x401cf2e0;

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

+               &WPP_b03ee32cc23f38d8621876c651aaccc5_Traceguids,lVar2);

+    }

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

+      uVar3 = 0x401d4c90;

+      RefsStatusDebug(lVar2,param_1,"ProtogonOjectTable.c",0xe3);

+    }

+                    /* WARNING: Subroutine does not return */

+    RefsRaiseStatusInternal(param_1,lVar2,uVar3);

+  }

+  if (*(longlong *)(param_2 + 0x1b0) != 0) {

+    if (*(longlong *)(param_2 + 0x1b8) == 0) {

+      RefsUpdateIndexScbFromAttribute(param_1,param_2,(_REFS_STANDARD_INFORMATION *)0x0);

+    }

+    p_Var5 = (_CmsKey *)(param_3 + 0x14);

+    lVar2 = RefsFindIndexEntryByRow(param_1,param_2,p_Var5,param_4,param_5);

+    uVar3 = (ulong)p_Var5;

+    if (lVar2 == -0x3fffffcc) {

+      uVar1 = '\0';

     }

     else {

-      lVar5 = MsCreateVirtualBTableObject(unaff_RSI + 0x1b0,*(undefined8 *)(unaff_RDI + 0x18));

+      if (lVar2 < 0) {

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

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

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

+          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x16,

+                   &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,lVar2);

+          uVar1 = FUN_1401c2f5a();

+          return uVar1;

+        }

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

+          uVar3 = 0x401d4cd0;

+          RefsStatusDebug(lVar2,param_1,"ProtogonIndex.c",0x49f);

+        }

+                    /* WARNING: Subroutine does not return */

+        RefsRaiseStatusInternal(param_1,lVar2,uVar3);

+      }

+      uVar1 = '\x01';

     }

-    if (-1 < lVar5) {

-      lVar3 = *(longlong *)(unaff_RSI + 0x1b0);

-      *(short *)(unaff_RSI + 0x102) = (short)*(char *)(lVar3 + 0xd0);

-      *(short *)(unaff_RSI + 0x104) = (short)*(char *)(lVar3 + 0xd2);

-      if ((*(byte *)(lVar3 + 0xf) & 4) != 0) {

-        *(uint *)(unaff_RSI + 300) = *(uint *)(unaff_RSI + 300) | 1;

-        uVar4 = func_0x00014001060a();

-        return uVar4;

-      }

-      *(uint *)(unaff_RSI + 300) = *(uint *)(unaff_RSI + 300) & 0xfffffffe;

-      uVar4 = func_0x00014001060a();

-      return uVar4;

-    }

+    return uVar1;

   }

-  LOCK();

-  piVar1 = (int *)(*(longlong *)(unaff_RBX + 0x148) + 0xa4);

-  *piVar1 = *piVar1 + -1;

-  UNLOCK();

-  return (uchar)lVar5;

+                    /* WARNING: Subroutine does not return */

+  KeBugCheckEx(0x149,0x7500ff,0,0,0);

 }
```

## `RefsFindIndexEntryByRow`  (modified)

```diff
--- RefsFindIndexEntryByRow
+++ RefsFindIndexEntryByRow
@@ -1,188 +1,68 @@
 

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

+/* long __cdecl RefsFindIndexEntryByRow(struct _IRP_CONTEXT * __ptr64,struct _SCB * __ptr64,struct

+   _CmsKey const & __ptr64,unsigned char,struct _DIR_INDEX_ENTRY * __ptr64 * __ptr64) */

 

 long __cdecl

 RefsFindIndexEntryByRow

           (_IRP_CONTEXT *param_1,_SCB *param_2,_CmsKey *param_3,uchar param_4,

           _DIR_INDEX_ENTRY **param_5)

 

 {

-  CmsBPlusTable CVar1;

-  CmsVolume *this;

-  code *pcVar2;

-  long lVar3;

-  CmsTransactionContext *unaff_RBX;

-  uint uVar4;

-  uint unaff_ESI;

-  undefined7 in_register_00000089;

-  undefined2 unaff_R12W;

-  CmsBPlusTable *this_00;

-  SmsInternalPropertyDef *unaff_R13;

-  ulong unaff_R15D;

-  CmsTransactionContext CStack0000000000000042;

-  CmsTransactionContext CStack0000000000000043;

-  int iStack0000000000000048;

-  CmsBPlusTable *in_stack_00000058;

-  char cStack0000000000000081;

-  CmsTransactionContext in_stack_00000082;

-  CmsTransactionContext in_stack_00000083;

-  _SCB *p_Stack0000000000000088;

-  undefined4 in_stack_00000090;

-  _LCN_TUPLE *in_stack_000000a0;

-  SmsBigIdentifier *in_stack_000000b8;

-  longlong in_stack_000000c8;

-  CmsVolume *in_stack_000000d0;

-  undefined8 in_stack_000000d8;

-  longlong in_stack_000000e0;

-  undefined8 in_stack_000000f8;

-  SmsTableInitializationParameters in_stack_00000100;

-  undefined4 in_stack_00000101;

-  undefined2 in_stack_00000105;

-  undefined1 in_stack_00000107;

-  undefined8 in_stack_00000108;

-  undefined8 *in_stack_00000110;

-  undefined8 in_stack_00000118;

-  undefined8 in_stack_00000120;

-  undefined8 in_stack_00000128;

-  undefined8 in_stack_00000130;

-  undefined8 in_stack_00000138;

-  undefined8 in_stack_00000140;

-  undefined8 in_stack_00000148;

-  LcnWithChecksum *pLStack0000000000000168;

-  _MS_CREATE_DISPOSITION in_stack_000002b8;

-  byte in_stack_000002c0;

+  int iVar1;

+  ulong local_res8 [2];

+  char local_res20 [8];

+  undefined4 local_68;

+  ushort uStack_64;

+  undefined2 uStack_62;

+  undefined4 uStack_60;

+  undefined4 uStack_5c;

+  undefined8 local_58;

+  undefined8 uStack_50;

+  undefined4 local_48;

+  undefined8 local_40;

+  undefined8 local_38;

+  undefined8 uStack_30;

+  undefined8 local_28;

+  undefined8 uStack_20;

+  undefined8 local_18;

   

-  *(ulonglong *)unaff_RBX = (ulonglong)param_2 & 0xffffefffffffffff;

-  cStack0000000000000081 = '\0';

-  while (CStack0000000000000042 = SUB81(param_1,0), (byte)CStack0000000000000042 < 0xd) {

-    if (*(longlong *)(unaff_RBX + ((ulonglong)param_1 & 0xff) * 8 + 0x2a0) == 0) {

-      unaff_RBX[0x83] = CStack0000000000000042;

-      break;

-    }

-    param_1 = (_IRP_CONTEXT *)(ulonglong)(byte)((char)CStack0000000000000042 + 1);

+  local_48 = 0;

+  local_res8[0] = 0;

+  local_38 = 0;

+  uStack_30 = 0;

+  local_28 = 0;

+  uStack_20 = 0;

+  local_18 = 0;

+  local_58 = 0;

+  uStack_50 = 0;

+  local_40 = 0;

+  local_68 = *(undefined4 *)param_3;

+  uStack_60 = *(undefined4 *)(param_3 + 8);

+  uStack_5c = *(undefined4 *)(param_3 + 0xc);

+  uStack_64 = (ushort)*(undefined4 *)(param_3 + 4);

+  uStack_62 = (undefined2)((uint)*(undefined4 *)(param_3 + 4) >> 0x10);

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

+    uStack_64 = (ushort)((uint6)*(undefined6 *)param_3 >> 0x20) | 0x20;

   }

-  for (CStack0000000000000043 = unaff_RBX[0x84]; (byte)CStack0000000000000043 < 0xd;

-      CStack0000000000000043 = (CmsTransactionContext)((char)CStack0000000000000043 + 1)) {

-    if (*(longlong *)(unaff_RBX + (ulonglong)(byte)CStack0000000000000043 * 8 + 0x218) == 0) {

-      unaff_RBX[0x84] = CStack0000000000000043;

-      break;

-    }

-  }

-  p_Stack0000000000000088 = param_2;

-  if (((byte)unaff_RBX[0x83] < (byte)unaff_RBX[0x82]) && (*KdDebuggerEnabled_exref != (code)0x0)) {

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

-    lVar3 = (*pcVar2)((ulonglong)(byte)CStack0000000000000043,

-                      (ulonglong)param_2 & 0xffffefffffffffff,param_3,

-                      CONCAT71(in_register_00000089,param_4));

-    return lVar3;

-  }

-  unaff_RBX[0x82] = unaff_RBX[0x83];

-  pLStack0000000000000168 = (LcnWithChecksum *)&stack0x000001e0;

-  uVar4 = unaff_ESI & 0x80;

-  if ((in_stack_000002c0 & 0x40) == 0) {

-    lVar3 = CmsTableFactory::ProduceBTableObject

-                      (unaff_RBX,unaff_R13,pLStack0000000000000168,in_stack_000000a0,unaff_R15D,

-                       uVar4 == 0,&stack0x00000058);

-  }

-  else {

-    lVar3 = CmsTableFactory::ProduceAutoTriageBTableObject

-                      (unaff_RBX,unaff_R13,pLStack0000000000000168,in_stack_000000a0,unaff_R15D,

-                       uVar4 == 0,&stack0x00000058);

-  }

-  this_00 = in_stack_00000058;

-  iStack0000000000000048 = lVar3;

-  if (-1 < lVar3) {

-    *(undefined2 *)(in_stack_00000058 + 0xd2) = unaff_R12W;

-    if ((char)*(undefined4 *)(unaff_R13 + 0x2c) < '\0') {

-      CmsVolume::AddUserTableToCheckpoint(*(CmsVolume **)(unaff_RBX + 8),in_stack_00000058);

-    }

-    if (uVar4 != 0) {

-      CVar1 = this_00[0xe];

-      this_00[0xe] = (CmsBPlusTable)((byte)CVar1 | 0x40);

-      this_00[0xe] = (CmsBPlusTable)((byte)CVar1 | 0xc0);

-    }

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

-      this_00[0xf] = (CmsBPlusTable)((byte)this_00[0xf] | 0x40);

-    }

-    in_stack_00000100 = (SmsTableInitializationParameters)0x0;

-    in_stack_00000101 = 0;

-    in_stack_00000105 = 0;

-    in_stack_00000107 = 0;

-    in_stack_00000108 = in_stack_000000f8;

-    in_stack_00000110 = &stack0x000000d8;

-    in_stack_00000118 = 0;

-    in_stack_00000120 = 0;

-    in_stack_00000128 = 0;

-    in_stack_00000130 = 0;

-    in_stack_00000138 = 0;

-    in_stack_00000140 = 0;

-    in_stack_00000148 = 0;

-    lVar3 = CmsBPlusTable::InitializeTable

-                      (this_00,unaff_RBX,in_stack_000002b8,in_stack_000000b8,&stack0x00000100);

-    iStack0000000000000048 = lVar3;

-    if (lVar3 < 0) {

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

-        if ((char)*(undefined4 *)(unaff_R13 + 0x2c) < '\0') {

-          CmsVolume::RemoveUserTableFromCheckpoint(*(CmsVolume **)(unaff_RBX + 8),this_00);

+  iVar1 = MsPinRow(*(undefined8 *)(param_1 + 0x18),*(undefined8 *)(param_2 + 0x1b0),&local_68,0,

+                   &local_58,&local_38);

+  if (-1 < iVar1) {

+    iVar1 = Feature_2008279355__private_IsEnabledDeviceUsageNoInline();

+    if (iVar1 != 0) {

+      local_res20[0] = '\x01';

+      iVar1 = ValidateCmsRowForDirIndex(param_1,param_2,&local_58,local_res20);

+      if (local_res20[0] == '\0') {

+        if (-1 < iVar1) {

+          iVar1 = -0x3ffffefe;

         }

-        CmsBPlusTable::DiscardAllPages(this_00,unaff_RBX);

+        goto LAB_0;

       }

     }

-    else {

-      *(CmsBPlusTable **)in_stack_000000d0 = this_00;

-      this_00 = (CmsBPlusTable *)0x0;

-      in_stack_00000058 = (CmsBPlusTable *)0x0;

-    }

-  }

-  if (in_stack_000000c8 != 0) {

-    ExReleaseResourceLite();

-  }

-  this = *(CmsVolume **)(unaff_RBX + 8);

-  if (lVar3 < 0) {

-    CmsVolume::AbortTopLevelAction(this,unaff_RBX,(_SmsTopLevelAction *)&stack0x00000068);

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

-      if (this_00 == (CmsBPlusTable *)0x0) goto LAB_0;

-      CmsBPlusTable::UninitializeCaching(this_00,'\0','\x01',(CmsBPlusTable *)0x0,unaff_RBX);

-    }

-  }

-  else {

-    in_stack_00000090 = 0;

-    *(int *)(unaff_RBX + 0xd4) = *(int *)(unaff_RBX + 0xd4) + -1;

-    in_stack_000000d0 = this;

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

-      if (*(longlong *)*(CmsTxMemLog **)(unaff_RBX + 0x210) == 0) {

-        CmsTxMemLog::DiscardPendingRecords

-                  (*(CmsTxMemLog **)(unaff_RBX + 0x210),(CmsDurableLog *)(this + 0xaf0));

-      }

-      else {

-        CmsTxMemLog::MergeTxLog

-                  ((CmsTxMemLog *)this,(CmsTxMemLog *)&stack0x00000098,

-                   (CmsDurableLog *)(this + 0xaf0));

-      }

-      if (((ulonglong)p_Stack0000000000000088 & 0x80000000000) != 0) {

-        *(undefined8 *)(unaff_RBX + 0x70) = in_stack_000000d8;

-        *(ulonglong *)unaff_RBX = *(ulonglong *)unaff_RBX | 0x80000000000;

-      }

-      *(CmsVolume **)(unaff_RBX + 0x210) = in_stack_000000d0;

-    }

-    *(ulonglong *)unaff_RBX =

-         *(ulonglong *)unaff_RBX | (ulonglong)p_Stack0000000000000088 & 0x100000000000;

-    if ((unaff_RBX[0x83] != unaff_RBX[0x82]) && (*KdDebuggerEnabled_exref != (code)0x0)) {

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

-      lVar3 = (*pcVar2)();

-      return lVar3;

-    }

-    unaff_RBX[0x83] = in_stack_00000082;

-    unaff_RBX[0x84] = in_stack_00000083;

-    unaff_RBX[0x82] = in_stack_00000082;

-  }

-  if (this_00 != (CmsBPlusTable *)0x0) {

-    CmsReferenced::Release((CmsReferenced *)this_00);

+    iVar1 = ReallocateAndCopyIndexEntryIntoBuffer

+                      (param_1,(_CmsRow *)&local_58,param_2,param_5,local_res8);

   }

 LAB_0:

-  if (in_stack_000000e0 != 0) {

-    ExFreePoolWithTag(in_stack_000000e0,0);

-  }

-  return lVar3;

+  MsUnpinDataOrRow(*(undefined8 *)(param_1 + 0x18));

+  return iVar1;

 }
```

## `InitializeDevice`  (modified)

```diff
--- InitializeDevice
+++ InitializeDevice
@@ -1,14 +1,189 @@
 

-void InitializeDevice(void)

+ulonglong InitializeDevice(_IRP_CONTEXT *param_1,_VPB *param_2,_DEVICE_OBJECT *param_3,

+                          undefined1 *param_4,longlong *param_5)

 

 {

-  undefined4 in_EAX;

-  undefined4 in_register_00000004;

-  longlong unaff_RDI;

+  undefined1 auVar1 [16];

+  char cVar2;

+  bool bVar3;

+  long lVar4;

+  int iVar5;

+  uint uVar6;

+  long lVar7;

+  ulonglong uVar8;

+  longlong lVar9;

+  ulong uVar10;

+  ulong *puVar11;

+  longlong lVar12;

+  _IRP_CONTEXT *p_Var13;

+  ulong local_res20 [2];

+  ulonglong in_stack_ffffffffffffff98;

+  uint in_stack_ffffffffffffffa0;

+  longlong local_38 [2];

   

-  *(char *)CONCAT44(in_register_00000004,in_EAX) =

-       *(char *)CONCAT44(in_register_00000004,in_EAX) + (char)in_EAX;

-  *(undefined4 *)(unaff_RDI + 4) = in_EAX;

-  return;

+  *param_4 = 0;

+  local_res20[0] = 0;

+  uVar8 = IoCreateDevice(DAT_0,0x3430,0,8,in_stack_ffffffffffffff98 & 0xffffffff00000000,

+                         in_stack_ffffffffffffffa0 & 0xffffff00,param_5);

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

+    if (*(uint *)(*param_5 + 0x98) < *(uint *)(param_3 + 0x98)) {

+      *(uint *)(*param_5 + 0x98) = *(uint *)(param_3 + 0x98);

+    }

+    lVar9 = *param_5;

+    *(_VCB **)(param_1 + 0x40) = (_VCB *)(lVar9 + 0x180);

+    RefsInitializeVcb(param_1,(_VCB *)(lVar9 + 0x180),param_3,param_2);

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

+    uVar8 = 0x20000000000;

+    lVar12 = *(longlong *)(param_1 + 0x40);

+    if ((*(ulonglong *)(lVar9 + 8) & 0x20000000000) == 0) {

+      MsInitializeFastResourceOwnerEntry(lVar9 + 0xa0);

+      *(ulonglong *)(lVar9 + 8) = *(ulonglong *)(lVar9 + 8) | uVar8;

+    }

+    uVar10 = (ulong)((byte)param_1[8] & 1);

+    cVar2 = MsAcquireFastResourceExclusive(lVar12 + 0x520,lVar9 + 0xa0);

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

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),10,

+                 &WPP_55d806d780f131821f520433aa76d261_Traceguids,0xc00000d8);

+        uVar8 = FUN_140309532();

+        return uVar8;

+      }

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

+        uVar10 = 0x401cef60;

+        RefsStatusDebug(-0x3fffff28,param_1,"ResrcSup.c",0x1a8);

+      }

+                    /* WARNING: Subroutine does not return */

+      RefsRaiseStatusInternal(param_1,-0x3fffff28,uVar10);

+    }

+    *param_4 = 1;

+    *(char *)(*param_5 + 0x4c) = (char)param_3[0x4c] + '\x01';

+    if ((DAT_1 & 0x200) != 0) {

+      *(char *)(*param_5 + 0x4c) = *(char *)(*param_5 + 0x4c) + '\x01';

+      *(uint *)(*(longlong *)(param_1 + 0x40) + 0x1c) =

+           *(uint *)(*(longlong *)(param_1 + 0x40) + 0x1c) | 2;

+    }

+    *(longlong *)(param_2 + 8) = *param_5;

+    *(uint *)(*param_5 + 0x30) = *(uint *)(*param_5 + 0x30) | 0x8020000;

+    bVar3 = _VCB::IsFakeTxFEnabled(*(_VCB **)(param_1 + 0x40));

+    if (bVar3) {

+      *(uint *)(*param_5 + 0x30) = *(uint *)(*param_5 + 0x30) | 0x40000;

+    }

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

+    uVar10 = 0x70024;

+    lVar4 = RefsDeviceIoControl(param_1,param_3,0x70024,'\0',(void *)0x0,0,(void *)0x0,0,

+                                (__uint64 *)0x0);

+    if (lVar4 == -0x3fffff5e) {

+      IoSetDeviceToVerify(SystemReserved1[0xf],0);

+    }

+    p_Var13 = param_1 + 0x40;

+    iVar5 = FsRtlGetSectorSizeInformation(param_3,lVar9 + 0x114);

+    if (iVar5 < 0) {

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4e,

+                 &WPP_7186299d9e5533fc2e8b294ba8286bfb_Traceguids,iVar5);

+        uVar8 = FUN_140309565();

+        return uVar8;

+      }

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

+        uVar10 = 0x401d08a8;

+        RefsStatusDebug(iVar5,param_1,"mount.c",0x12cb);

+      }

+                    /* WARNING: Subroutine does not return */

+      RefsRaiseStatusInternal(param_1,iVar5,uVar10);

+    }

+    uVar10 = 0x7405c;

+    local_38[0] = 0;

+    lVar7 = RefsDeviceIoControl(param_1,param_3,0x7405c,'\x02',(void *)0x0,0,local_38,8,

+                                (__uint64 *)0x0);

+    if (lVar7 < 0) {

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

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

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

+        uVar10 = 0x401d0978;

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4f,

+                 &WPP_7186299d9e5533fc2e8b294ba8286bfb_Traceguids,lVar7);

+      }

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

+        uVar10 = 0x401d08a8;

+        RefsStatusDebug(lVar7,param_1,"mount.c",0x12dd);

+      }

+                    /* WARNING: Subroutine does not return */

+      RefsRaiseStatusInternal(param_1,lVar7,uVar10);

+    }

+    if (lVar4 == -0x3fffff5e) {

+      *(uint *)(*(longlong *)p_Var13 + 0x18) = *(uint *)(*(longlong *)p_Var13 + 0x18) | 0x2000000;

+    }

+    uVar6 = *(uint *)(*(longlong *)p_Var13 + 0x118);

+    if (0x1000 < uVar6) {

+      uVar6 = 0x1000;

+    }

+    *(uint *)(*(longlong *)p_Var13 + 0x120) = uVar6;

+    InitializeRemovableDevice(param_1,*(longlong *)p_Var13,param_3);

+    GetDiskProperties(param_1,param_3);

+    *(undefined4 *)(*(longlong *)p_Var13 + 0x110) = *(undefined4 *)(*(longlong *)p_Var13 + 0x114);

+    *(longlong *)(*(longlong *)p_Var13 + 0x1e8) =

+         local_38[0] / (longlong)(ulonglong)*(uint *)(*(longlong *)p_Var13 + 0x114);

+    uVar8 = CONCAT44(0,*(uint *)(*(longlong *)p_Var13 + 0x114));

+    auVar1._8_8_ = 0;

+    auVar1._0_8_ = uVar8;

+    *(longlong *)(*(longlong *)p_Var13 + 0x1f0) =

+         local_38[0] / (longlong)uVar8 &

+         -SUB168((ZEXT816(0) << 0x40 | ZEXT816(0x4000000)) / auVar1,0);

+    if ((*(ulonglong *)(*(longlong *)p_Var13 + 0x1f0) < 0x11) ||

+       (0x1000 < *(uint *)(*(longlong *)p_Var13 + 0x114))) {

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4a,

+                 &WPP_7186299d9e5533fc2e8b294ba8286bfb_Traceguids,0xc000014f);

+        uVar8 = FUN_14030963d();

+        return uVar8;

+      }

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

+        RefsStatusDebug(-0x3ffffeb1,(_IRP_CONTEXT *)0x0,"mount.c",0x115c);

+      }

+    }

+    *(int *)(*(longlong *)(param_1 + 0x40) + 0x220) =

+         *(int *)(*(longlong *)(param_1 + 0x40) + 0x110) + -1;

+    *(uint *)(*(longlong *)(param_1 + 0x40) + 0x224) =

+         ~*(uint *)(*(longlong *)(param_1 + 0x40) + 0x220);

+    *(undefined4 *)(*(longlong *)(param_1 + 0x40) + 0x228) = 0;

+    for (uVar6 = *(uint *)(*(longlong *)(param_1 + 0x40) + 0x110); 1 < uVar6; uVar6 = uVar6 >> 1) {

+      *(int *)(*(longlong *)(param_1 + 0x40) + 0x228) =

+           *(int *)(*(longlong *)(param_1 + 0x40) + 0x228) + 1;

+    }

+    puVar11 = local_res20;

+    *(int *)(*(longlong *)(param_1 + 0x40) + 0x1cc) =

+         0x1000 >> ((byte)*(undefined4 *)(*(longlong *)(param_1 + 0x40) + 0x228) & 0x1f);

+    *(undefined2 *)(*param_5 + 0x130) = *(undefined2 *)(*(longlong *)(param_1 + 0x40) + 0x114);

+    RefsDetermineVirtualDisk

+              (param_1,(byte)((uint)*(undefined4 *)(*(longlong *)(param_2 + 0x10) + 0x30) >> 8) & 1,

+               puVar11);

+    uVar10 = (ulong)puVar11;

+    uVar6 = RefsApplyVirtualDiskPolicy(param_1,local_res20[0]);

+    if ((int)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_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x4b,

+                 &WPP_7186299d9e5533fc2e8b294ba8286bfb_Traceguids,uVar6);

+        uVar8 = FUN_14030966b();

+        return uVar8;

+      }

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

+        uVar10 = 0x401d08a8;

+        RefsStatusDebug(uVar6,param_1,"mount.c",0x117a);

+      }

+                    /* WARNING: Subroutine does not return */

+      RefsRaiseStatusInternal(param_1,uVar6,uVar10);

+    }

+    *(uint *)(*param_5 + 0x30) = *(uint *)(*param_5 + 0x30) & 0xffffff7f;

+    uVar8 = (ulonglong)uVar6;

+  }

+  return uVar8;

 }
```

## `LogValidateEntryHeader`  (modified)

```diff
--- LogValidateEntryHeader
+++ LogValidateEntryHeader
@@ -1,7 +1,57 @@
 

-void LogValidateEntryHeader(void)

+undefined8

+LogValidateEntryHeader

+          (longlong param_1,longlong param_2,longlong param_3,int *param_4,uint param_5,char param_6

+          )

 

 {

-  return;

+  uint uVar1;

+  int iVar2;

+  

+  if (((((0x77 < param_5) && (*param_4 == *(int *)(param_1 + 0x2fe4))) &&

+       (param_4[1] == *(int *)(param_1 + 0x2fe8))) &&

+      ((iVar2 = *(int *)(param_1 + 0xe50), param_4[3] == iVar2 && (0x77 < (uint)param_4[0x15])))) &&

+     (((uint)param_4[0x15] <= (uint)(param_4[0xe] * iVar2) &&

+      ((uint)param_4[0xf] <= (uint)param_4[0xe])))) {

+    if (*(int *)(param_1 + 0xe48) - 4U < 3) {

+      if (param_4[4] != *(int *)(param_1 + 0x28)) {

+        return 0xc03d0202;

+      }

+      if (param_4[5] != *(int *)(param_1 + 0x2c)) {

+        return 0xc03d0202;

+      }

+      if (param_4[6] != *(int *)(param_1 + 0x30)) {

+        return 0xc03d0202;

+      }

+      if (param_4[7] != *(int *)(param_1 + 0x34)) {

+        return 0xc03d0202;

+      }

+      if (*(longlong *)(param_4 + 10) != param_2) {

+        return 0xc03d0202;

+      }

+      if ((param_3 != 0) && (*(longlong *)(param_4 + 0xc) != param_3)) {

+        return 0xc03d0202;

+      }

+      if (*(int *)(param_1 + 0xe48) == 5) {

+        uVar1 = param_4[8];

+        if (*(uint *)(param_1 + 0xe4c) < uVar1) {

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

+            *(uint *)(param_1 + 0xe4c) = uVar1;

+          }

+        }

+        else if (uVar1 < *(uint *)(param_1 + 0xe4c)) {

+          return 0xc03d0202;

+        }

+      }

+    }

+    if (param_5 < (uint)(iVar2 * param_4[0xf])) {

+      return 0xc03d0201;

+    }

+    iVar2 = Feature_2887233850__private_IsEnabledDeviceUsageNoInline();

+    if (((uint)param_4[0x15] <= param_5) && ((iVar2 == 0 || (0x37 < param_5 - param_4[0x15])))) {

+      return 0;

+    }

+  }

+  return 0xc03d0202;

 }
```

## `EnumerateDirectoryCursor`  (modified)

```diff
--- EnumerateDirectoryCursor
+++ EnumerateDirectoryCursor
@@ -1,387 +1,67 @@
 

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

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

+/* long __cdecl EnumerateDirectoryCursor(struct _IRP_CONTEXT * __ptr64,struct _SCB * __ptr64,union

+   _SmsTableCursorContext * __ptr64,unsigned char,struct _CmsRow * __ptr64,unsigned char * __ptr64)

+    */

 

 long __cdecl

 EnumerateDirectoryCursor

           (_IRP_CONTEXT *param_1,_SCB *param_2,_SmsTableCursorContext *param_3,uchar param_4,

           _CmsRow *param_5,uchar *param_6)

 

 {

-  _SmsIndexHeader *p_Var1;

-  _IRP_CONTEXT *p_Var2;

-  undefined4 uVar3;

+  long lVar1;

+  uint uVar2;

+  int iVar3;

   ulonglong uVar4;

-  undefined4 *puVar5;

-  _SmsIndexHeader *this;

-  _IRP_CONTEXT *p_Var6;

-  SmsPage *pSVar7;

-  CmsBPlusTable *this_00;

-  undefined8 *puVar8;

-  uchar uVar9;

-  short sVar10;

-  uint uVar11;

-  int iVar12;

-  ulonglong uVar13;

-  _SmsIndexEntry *_Dst;

-  __uint64 _Var14;

-  ushort uVar15;

-  uint uVar16;

-  _SmsIndexHeader *_Dst_00;

-  _SmsIndexHeader *_Src;

-  uint *puVar17;

-  longlong lVar18;

-  ulong uVar19;

-  uint uVar20;

-  uint *unaff_RBX;

-  longlong unaff_RBP;

-  undefined4 unaff_ESI;

-  int *unaff_RDI;

-  undefined2 in_R10W;

-  undefined8 in_R11;

-  CmsBPlusTable *unaff_R12;

-  SmsLookupStack *unaff_R13;

-  uint unaff_R14D;

-  uint uVar21;

-  long in_stack_00000050;

-  ulong uStack0000000000000054;

-  uint uStack0000000000000058;

-  uint uStack000000000000005c;

+  undefined8 uVar5;

+  bool bVar6;

+  char local_18 [16];

   

-  if ((*(_IRP_CONTEXT **)(unaff_RBX + 2) < *(_IRP_CONTEXT **)(unaff_RBX + 6)) ||

-     (*(_IRP_CONTEXT **)(unaff_RBX + 6) + (longlong)param_1 < *(_IRP_CONTEXT **)(unaff_RBX + 2))) {

-    uVar11 = *unaff_RBX;

-    p_Var6 = *(_IRP_CONTEXT **)(unaff_RBX + 6);

-    if ((uVar11 == 0) || ((int)param_1 == 0)) {

-LAB_0:

-      uVar11 = uVar11 + 7 & unaff_R14D;

+  lVar1 = RefsBindMinstoreTransactionNoRaise(param_1);

+  if (-1 < lVar1) {

+    uVar5 = 5;

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

+      uVar5 = 1;

     }

-    else {

-      p_Var2 = (_IRP_CONTEXT *)(*(longlong *)(unaff_RBX + 2) + (ulonglong)uVar11);

-      if ((p_Var2 < p_Var6) || (param_1 + (longlong)p_Var6 < p_Var2)) {

-        in_R10W = 0x10;

-        goto LAB_0;

-      }

-      uVar11 = (int)p_Var6 - (int)*(longlong *)(unaff_RBX + 2);

-      in_R10W = 0x10;

+    uVar2 = MsEnumerateWithPin(*(undefined8 *)(param_1 + 0x18),*(undefined8 *)(param_2 + 0x1b0),

+                               param_3,uVar5,param_5);

+    if (uVar2 == 0xc0000273) {

+      uVar2 = 0xc0000225;

     }

-    uVar11 = uVar11 & 0xffff;

-  }

-  else {

-    uVar11 = (uint)in_R11;

-  }

-  *(undefined2 *)(unaff_RDI + 1) = in_R10W;

-  *unaff_RDI = ((int)param_1 + 7U & 0xfffffff8) + 0x10 + uVar11;

-  *(short *)((longlong)unaff_RDI + 6) = (short)*unaff_RBX;

-  unaff_RDI[2] = 0x100000;

-  unaff_RDI[3] = unaff_RBX[4];

-  uVar11 = unaff_RBX[4];

-  if (uVar11 != 0) {

-    uVar13 = *(ulonglong *)(unaff_RBX + 2);

-    uVar4 = *(ulonglong *)(unaff_RBX + 6);

-    if ((uVar4 <= uVar13) && (uVar13 <= uVar4 + uVar11)) {

-      *(short *)(unaff_RDI + 1) = ((short)uVar13 - (short)uVar4) + 0x10;

-      goto LAB_1;

-    }

-  }

-  uVar20 = *unaff_RBX;

-  uVar13 = *(ulonglong *)(unaff_RBX + 6);

-  if ((uVar20 == 0) || (uVar11 == 0)) {

-LAB_2:

-    uVar15 = (short)uVar20 + 7U & (ushort)unaff_R14D;

-  }

-  else {

-    uVar4 = *(longlong *)(unaff_RBX + 2) + (ulonglong)uVar20;

-    if ((uVar4 < uVar13) || (uVar11 + uVar13 < uVar4)) goto LAB_2;

-    uVar15 = (short)uVar13 - (short)*(longlong *)(unaff_RBX + 2);

-  }

-  *(ushort *)((longlong)unaff_RDI + 10) = uVar15 + 0x10;

-  if (*unaff_RBX != 0) {

-    *(undefined8 *)((((ulonglong)*unaff_RBX + 0x17 & 0xfffffffffffffff8) - 8) + (longlong)unaff_RDI)

-         = in_R11;

-  }

-  memmove(unaff_RDI + 4,*(void **)(unaff_RBX + 2),(ulonglong)*unaff_RBX);

-LAB_1:

-  memmove((void *)((ulonglong)*(ushort *)((longlong)unaff_RDI + 10) + (longlong)unaff_RDI),

-          *(void **)(unaff_RBX + 6),(ulonglong)unaff_RBX[4]);

-  lVar18 = *(longlong *)(unaff_R13 + 8);

-  if ((*(byte *)(lVar18 + 0xd) & 8) != 0) {

-    _Var14 = _SmsIndexEntry::StartValueFromRangeIndexEntry(*(_SmsIndexEntry **)(unaff_R13 + 0x10));

-    *(short *)(lVar18 + (ulonglong)*(uint *)(lVar18 + 0x10) + 2 +

-              (ulonglong)*(uint *)(unaff_R13 + 0x18) * 4) =

-         (short)_Var14 - *(short *)(lVar18 + 0x18);

-  }

-  puVar17 = *(uint **)(unaff_R13 + 0x10);

-  if ((puVar17[2] & 0x40) == 0) {

-    uVar11 = *puVar17;

-  }

-  else {

-    uVar11 = *(ushort *)((longlong)puVar17 + 10) + 7 & 0xfffffff8;

-  }

-  memmove(*(void **)(unaff_RBP + 0x20),puVar17,(ulonglong)uVar11);

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

-  if ((*(byte *)(puVar5 + 2) & 0x40) == 0) {

-    *puVar5 = unaff_ESI;

-  }

-  else {

-    *(short *)((longlong)puVar5 + 10) = (short)unaff_ESI;

-  }

-  uVar13 = 0;

-  uStack000000000000005c = 0;

-  uVar11 = 1;

-  uStack0000000000000058 = 1;

-  do {

-    uVar20 = (uint)uVar13;

-    puVar17 = *(uint **)(unaff_RBP + uVar13 * 0x10);

-    *(uint **)(unaff_RBP + -0x38) = puVar17;

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

-      *(int *)(unaff_R13 + 0x18) =

-           *(int *)(unaff_R13 + 0x18) + *(int *)(unaff_RBP + 8 + uVar13 * 0x10);

-      this = *(_SmsIndexHeader **)(unaff_R13 + 8);

-      if (((*(uint *)(*(longlong *)(unaff_R12 + 0x18) + 0x2c) & 4) == 0) ||

-         (this[0xc] != (_SmsIndexHeader)0x0)) {

-        uVar21 = puVar17[4];

-        if (uVar21 == 0) {

-LAB_3:

-          uVar16 = *puVar17;

-          if ((uVar16 == 0) || (uVar21 == 0)) {

-LAB_4:

-            uVar16 = uVar16 + 7 & 0xfff8;

+    uVar4 = (ulonglong)uVar2;

+    iVar3 = Feature_2008279355__private_IsEnabledDeviceUsageNoInline();

+    if ((iVar3 != 0) && (-1 < (int)uVar2)) {

+      local_18[0] = '\x01';

+      uVar2 = ValidateCmsRowForDirIndex(param_1,param_2,param_5,local_18);

+      uVar4 = (ulonglong)uVar2;

+      if (local_18[0] == '\0') {

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

+          uVar4 = 0xc0000102;

+        }

+        iVar3 = (int)uVar4;

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

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

+          if (iVar3 < 0) {

+            bVar6 = (byte)WPP_GLOBAL_Control[0x29] < 4;

           }

           else {

-            uVar4 = *(ulonglong *)(puVar17 + 6);

-            uVar13 = *(longlong *)(puVar17 + 2) + (ulonglong)uVar16;

-            if ((uVar13 < uVar4) || (uVar4 + uVar21 < uVar13)) goto LAB_4;

-            uVar16 = (int)uVar4 - (int)*(longlong *)(puVar17 + 2);

+            bVar6 = (byte)WPP_GLOBAL_Control[0x29] < 5;

           }

-          uVar16 = uVar16 & 0xffff;

-        }

-        else {

-          if ((*(ulonglong *)(puVar17 + 2) < *(ulonglong *)(puVar17 + 6)) ||

-             (*(ulonglong *)(puVar17 + 6) + (ulonglong)uVar21 < *(ulonglong *)(puVar17 + 2)))

-          goto LAB_3;

-          uVar16 = 0;

-        }

-        uVar19 = uVar16 + 0x10 + (uVar21 + 7 & 0xfffffff8);

-      }

-      else {

-        uVar19 = puVar17[4] + 7 & 0xfffffff8;

-      }

-      uStack0000000000000054 = uVar19;

-      if (*(uint *)(this + 8) < uVar19 + 4) {

-                    /* WARNING: Subroutine does not return */

-        MsUnsupportedOperationBugCheck

-                  ("Attempting to InsertSimple into a bucket without enough free space!");

-      }

-      uVar21 = *(uint *)(this + 4);

-      if (*(int *)(this + 0x10) - uVar21 < uVar19 + 4) {

-        _Dst_00 = this + *(uint *)this;

-        iVar12 = (int)this;

-        _Src = _Dst_00;

-        if ((uint)((int)_Dst_00 - iVar12) < uVar21) {

-          do {

-            if ((*(ushort *)(_Src + 8) & 0x40) == 0) {

-              uVar11 = *(uint *)_Src;

-            }

-            else {

-              uVar11 = *(ushort *)(_Src + 10) + 7 & 0xfffffff8;

-            }

-            p_Var1 = _Src + uVar11;

-            if ((*(ushort *)(_Src + 8) & 4) == 0) {

-              uVar20 = (int)_Src - iVar12;

-              uVar21 = (int)_Dst_00 - iVar12;

-              if (_Dst_00 != _Src) {

-                memmove(_Dst_00,_Src,(ulonglong)uVar11);

-              }

-              uVar13 = 0;

-              if (uVar21 != uVar20) {

-                for (; (uint)uVar13 < *(uint *)(this + 0x14); uVar13 = (ulonglong)((uint)uVar13 + 1)

-                    ) {

-                  if (*(ushort *)(this + uVar13 * 4 + (ulonglong)*(uint *)(this + 0x10)) == uVar20)

-                  {

-                    *(short *)(this + uVar13 * 4 + (ulonglong)*(uint *)(this + 0x10)) =

-                         (short)uVar21;

-                    break;

-                  }

-                }

-              }

-              _Dst_00 = _Dst_00 + uVar11;

-            }

-            uVar21 = *(uint *)(this + 4);

-            _Src = p_Var1;

-          } while ((uint)((int)p_Var1 - iVar12) < uVar21);

-          puVar17 = *(uint **)(unaff_RBP + -0x38);

-          unaff_R12 = *(CmsBPlusTable **)(unaff_RBP + -0x30);

-          uVar20 = uStack000000000000005c;

-        }

-        uVar19 = uStack0000000000000054;

-        iVar12 = (int)_Dst_00 - iVar12;

-        *(int *)(this + 4) = iVar12;

-        memset(_Dst_00,0,(ulonglong)(uVar21 - iVar12));

-        uVar11 = uStack0000000000000058;

-      }

-      if ((*(uint *)(*(longlong *)(unaff_R12 + 0x18) + 0x2c) & 2) != 0) {

-        UpdateBucketRangeInsert

-                  (*(undefined8 *)(unaff_RBP + -0x68),*(longlong *)(unaff_R12 + 0x18),this,puVar17,

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

-      }

-      _Dst = _SmsIndexHeader::AllocateNextIndexEntry(this,uVar19);

-      iVar12 = *(int *)(this + 0x10);

-      uVar21 = *(uint *)(unaff_R13 + 0x18);

-      *(int *)(this + 8) = *(int *)(this + 8) + -4;

-      *(int *)(this + 0x14) = *(int *)(this + 0x14) + 1;

-      *(uint *)(this + 0x10) = iVar12 - 4U;

-      if (uVar21 != 0) {

-        memmove(this + (iVar12 - 4U),this + (iVar12 - 4U) + 4,(ulonglong)uVar21 << 2);

-      }

-      if (((*(uint *)(*(longlong *)(unaff_R12 + 0x18) + 0x2c) & 4) == 0) ||

-         (*(char *)(*(longlong *)(unaff_R13 + 8) + 0xc) != '\0')) {

-        uVar21 = puVar17[4];

-        if (uVar21 == 0) {

-LAB_5:

-          uVar16 = *puVar17;

-          if ((uVar16 == 0) || (uVar21 == 0)) {

-LAB_6:

-            uVar16 = uVar16 + 7 & 0xfff8;

-          }

-          else {

-            uVar4 = *(ulonglong *)(puVar17 + 6);

-            uVar13 = *(longlong *)(puVar17 + 2) + (ulonglong)uVar16;

-            if ((uVar13 < uVar4) || (uVar4 + uVar21 < uVar13)) goto LAB_6;

-            uVar16 = (int)uVar4 - (int)*(longlong *)(puVar17 + 2);

-          }

-          uVar16 = uVar16 & 0xffff;

-        }

-        else {

-          if ((*(ulonglong *)(puVar17 + 2) < *(ulonglong *)(puVar17 + 6)) ||

-             (*(ulonglong *)(puVar17 + 6) + (ulonglong)uVar21 < *(ulonglong *)(puVar17 + 2)))

-          goto LAB_5;

-          uVar16 = 0;

-        }

-        *(undefined2 *)(_Dst + 4) = 0x10;

-        *(uint *)_Dst = (uVar21 + 7 & 0xfffffff8) + uVar16 + 0x10;

-        *(short *)(_Dst + 6) = (short)*puVar17;

-        *(undefined4 *)(_Dst + 8) = 0x100000;

-        *(uint *)(_Dst + 0xc) = puVar17[4];

-        uVar21 = puVar17[4];

-        if (uVar21 == 0) {

-LAB_7:

-          uVar16 = *puVar17;

-          if ((uVar16 == 0) || (uVar21 == 0)) {

-LAB_8:

-            uVar15 = (short)uVar16 + 7U & 0xfff8;

-          }

-          else {

-            uVar4 = *(ulonglong *)(puVar17 + 6);

-            uVar13 = *(longlong *)(puVar17 + 2) + (ulonglong)uVar16;

-            if ((uVar13 < uVar4) || (uVar4 + uVar21 < uVar13)) goto LAB_8;

-            uVar15 = (short)uVar4 - (short)*(longlong *)(puVar17 + 2);

-          }

-          *(ushort *)(_Dst + 10) = uVar15 + 0x10;

-          if (*puVar17 != 0) {

-            *(undefined8 *)(_Dst + (((ulonglong)*puVar17 + 0x17 & 0xfffffffffffffff8) - 8)) = 0;

-          }

-          memmove(_Dst + 0x10,*(void **)(puVar17 + 2),(ulonglong)*puVar17);

-        }

-        else {

-          uVar13 = *(ulonglong *)(puVar17 + 2);

-          uVar4 = *(ulonglong *)(puVar17 + 6);

-          if ((uVar13 < uVar4) || (uVar4 + uVar21 < uVar13)) goto LAB_7;

-          *(short *)(_Dst + 4) = ((short)uVar13 - (short)uVar4) + 0x10;

-        }

-        memmove(_Dst + *(ushort *)(_Dst + 10),*(void **)(puVar17 + 6),(ulonglong)puVar17[4]);

-      }

-      else {

-        if (puVar17[4] == 0) {

-          *(undefined2 *)(_Dst + 10) = 0x18;

-          puVar8 = *(undefined8 **)(puVar17 + 2);

-          if (*puVar17 == 0xc) {

-            *(undefined8 *)(_Dst + 0xc) = *puVar8;

-            *(undefined4 *)(_Dst + 0x14) = *(undefined4 *)(puVar8 + 1);

-          }

-          else {

-            uVar3 = *(undefined4 *)(puVar8 + 1);

-            *(undefined8 *)(_Dst + 0xc) = *puVar8;

-            *(undefined4 *)(_Dst + 0x14) = uVar3;

+          if (!bVar6) {

+            WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x11,

+                     &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,uVar4);

           }

         }

-        else {

-          memmove(_Dst,*(void **)(puVar17 + 6),(ulonglong)puVar17[4]);

-          *(short *)(_Dst + 10) = (short)puVar17[4];

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

+          return iVar3;

         }

-        *(ushort *)(_Dst + 8) = *(ushort *)(_Dst + 8) & 0xff8;

-        *(ushort *)(_Dst + 8) = *(ushort *)(_Dst + 8) | 0x40;

+        RefsStatusDebug(iVar3,(_IRP_CONTEXT *)0x0,"ProtogonIndex.c",0x2c3);

+        return iVar3;

       }

-      *(ushort *)(_Dst + 8) = *(ushort *)(_Dst + 8) | (ushort)puVar17[1] & 3;

-      uVar21 = *(uint *)(this + 0x10);

-      uVar16 = *(uint *)(unaff_R13 + 0x18);

-      lVar18 = *(longlong *)(unaff_R12 + 0x18);

-      *(short *)(this + (ulonglong)uVar16 * 4 + (ulonglong)uVar21) = (short)_Dst - (short)this;

-      if (((*(uint *)(lVar18 + 0x2c) & 2) == 0) ||

-         (uVar15 = *(ushort *)(_Dst + 8), ((byte)this[0xd] >> 3 & (uVar15 >> 1 & 1) == 0) == 0)) {

-        sVar10 = -1;

-      }

-      else {

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

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

-            sVar10 = (short)*(undefined8 *)(_Dst + *(ushort *)(_Dst + 4));

-          }

-          else {

-            sVar10 = -1;

-          }

-        }

-        else {

-          sVar10 = (short)*(undefined8 *)(_Dst + 0xc);

-        }

-        sVar10 = sVar10 - *(short *)(this + 0x18);

-      }

-      *(short *)(this + (ulonglong)uVar16 * 4 + (ulonglong)uVar21 + 2) = sVar10;

-      LOCK();

-      *(int *)(*(longlong *)unaff_R13 + 0x154) = *(int *)(*(longlong *)unaff_R13 + 0x154) + 1;

-      UNLOCK();

-      *(_SmsIndexEntry **)(unaff_R13 + 0x10) = _Dst;

-      if ((char)unaff_R12[0xf] < '\0') {

-        pSVar7 = *(SmsPage **)unaff_R13;

-        this_00 = *(CmsBPlusTable **)(pSVar7 + 0x60);

-        if (((this_00 == unaff_R12) && (pSVar7[0x168] == (SmsPage)0x0)) &&

-           (pSVar7[0x1ea] == (SmsPage)0x0)) {

-          uVar9 = CmsStream::CanPageBeOptimized(unaff_R13);

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

-            CmsBPlusTable::AddPageToDelayedProcessList

-                      (this_00,*(CmsTransactionContext **)(unaff_RBP + -0x68),pSVar7,true);

-          }

-        }

-      }

-      LOCK();

-      *(longlong *)(unaff_R12 + 0x30) = *(longlong *)(unaff_R12 + 0x30) + 1;

-      UNLOCK();

-      lVar18 = *(longlong *)(unaff_R13 + 8);

-      puVar17 = (uint *)((ulonglong)

-                         *(ushort *)

-                          ((ulonglong)*(uint *)(lVar18 + 0x10) + lVar18 +

-                          (ulonglong)*(uint *)(unaff_R13 + 0x18) * 4) + lVar18);

-      if ((puVar17[2] & 0x40) == 0) {

-        uVar21 = *puVar17;

-      }

-      else {

-        uVar21 = *(ushort *)((longlong)puVar17 + 10) + 7 & 0xfffffff8;

-      }

-      memmove(*(void **)(unaff_RBP + 0x20 + (ulonglong)uVar11 * 8),puVar17,(ulonglong)uVar21);

-      uVar11 = uVar11 + 1;

-      uStack0000000000000058 = uVar11;

     }

-    uStack000000000000005c = uVar20 + 1;

-    uVar13 = (ulonglong)uStack000000000000005c;

-    if (1 < uStack000000000000005c) {

-      *(uint *)(unaff_R13 + 0x18) = *(uint *)(unaff_RBP + -0x78);

-      lVar18 = *(longlong *)(unaff_R13 + 8);

-      *(ulonglong *)(unaff_R13 + 0x10) =

-           (ulonglong)

-           *(ushort *)

-            ((ulonglong)*(uint *)(lVar18 + 0x10) + lVar18 +

-            (ulonglong)*(uint *)(unaff_R13 + 0x18) * 4) + lVar18;

-      return in_stack_00000050;

-    }

-  } while( true );

+    lVar1 = (long)uVar4;

+    *param_6 = (byte)(uVar4 >> 0x1f) ^ 1;

+  }

+  return lVar1;

 }
```

## `RefsSetEndOfFileInfo`  (modified)

```diff
--- RefsSetEndOfFileInfo
+++ RefsSetEndOfFileInfo
@@ -1,21 +1,344 @@
 

-void RefsSetEndOfFileInfo(longlong param_1,undefined2 param_2)

+/* WARNING: Removing unreachable block (ram,0x0001402f8ee5) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8efd) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8f06) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8f0c) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8f24) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8f2e) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8f45) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8e7a) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8e92) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8e9b) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8ea1) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8eb9) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8ec3) */

+/* WARNING: Removing unreachable block (ram,0x0001402f8eda) */

+

+undefined8

+RefsSetEndOfFileInfo

+          (_IRP_CONTEXT *param_1,_FILE_OBJECT *param_2,_IRP *param_3,_SCB *param_4,_CCB *param_5,

+          uchar param_6)

 

 {

-  char *pcVar1;

-  char in_AL;

-  byte bVar2;

-  undefined7 in_register_00000001;

-  longlong unaff_RBP;

-  undefined1 *unaff_RSI;

-  char in_CF;

+  byte bVar1;

+  longlong lVar2;

+  bool bVar3;

+  bool bVar4;

+  bool bVar5;

+  char cVar6;

+  int iVar7;

+  ulonglong uVar8;

+  undefined8 uVar9;

+  ulonglong uVar10;

+  ulonglong uVar11;

+  longlong *plVar12;

+  uchar uVar13;

+  ulong uVar14;

+  _SCB *p_Var15;

+  longlong lVar16;

+  _FCB *p_Var17;

+  longlong lVar18;

+  uchar in_stack_ffffffffffffff38;

+  ulonglong local_90;

+  _FCB *local_88;

+  undefined8 local_80;

+  undefined8 local_78;

+  longlong local_68 [3];

+  undefined8 local_50;

+  longlong local_48;

+  longlong local_40;

   

-  bVar2 = (in_AL - *(char *)(param_1 + -0x47)) - in_CF;

-  out(*unaff_RSI,param_2);

-  *(byte *)CONCAT71(in_register_00000001,bVar2) =

-       *(byte *)CONCAT71(in_register_00000001,bVar2) | bVar2;

-  pcVar1 = (char *)(unaff_RBP + 5 + param_1 * 4);

-  *pcVar1 = *pcVar1 + (char)param_1;

-  return;

+  p_Var17 = *(_FCB **)(param_4 + 0x88);

+  uVar8 = *(ulonglong *)(param_4 + 0x20);

+  bVar3 = true;

+  bVar4 = false;

+  bVar5 = false;

+  p_Var15 = param_4;

+  local_90 = uVar8;

+  local_88 = p_Var17;

+  if ((*(uint *)(param_4 + 0x98) & 0x20) == 0) {

+    RefsUpdateScbFromAttribute(param_1,param_4,(RefsAttributeManager *)0x0);

+  }

+  uVar13 = (uchar)p_Var15;

+  if ((char)*(undefined4 *)(param_4 + 0x98) < '\0') {

+    uVar9 = 0xc00004be;

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

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

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

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x91,

+               &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc00004be);

+    }

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

+      return 0xc00004be;

+    }

+    uVar14 = 0x25e3;

+LAB_0:

+    RefsStatusDebug((long)uVar9,(_IRP_CONTEXT *)0x0,"FileInfo.c",uVar14);

+    return uVar9;

+  }

+  lVar2 = **(longlong **)(param_3 + 0x18);

+  if ((*(uint *)(param_4 + 300) & 0x40) != 0) {

+    return 0;

+  }

+  RefsSnapshotScb(param_1,param_4,0);

+  if (*(char *)(*(longlong *)(param_3 + 0xb8) + 0x21) != '\0') {

+    uVar9 = 0xc00000bb;

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

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

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

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x92,

+               &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc00000bb);

+    }

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

+      return 0xc00000bb;

+    }

+    uVar14 = 0x25fe;

+    goto LAB_0;

+  }

+  if (param_5 != (_CCB *)0x0) {

+    *(undefined4 *)(param_1 + 0x278) = *(undefined4 *)(param_5 + 0x54);

+  }

+  if ((*(longlong *)(*(longlong *)(param_4 + 0x90) + 0x1e0) < lVar2) || (lVar2 < 0)) {

+    uVar9 = 0xc000000d;

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

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

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

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x93,

+               &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc000000d);

+    }

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

+      return 0xc000000d;

+    }

+    uVar14 = 0x2609;

+    goto LAB_0;

+  }

+  if (*(longlong *)(param_4 + 0x20) == lVar2) goto LAB_1;

+  bVar4 = true;

+  if ((lVar2 < *(longlong *)(param_4 + 0x20)) &&

+     (uVar9 = RefsPrepareToShrinkFileSize(param_1,param_2,param_4), (int)uVar9 != 0)) {

+    return uVar9;

+  }

+  uVar14 = 2;

+  if (lVar2 <= *(longlong *)(param_4 + 0x20)) {

+    uVar14 = 4;

+  }

+  RefsPostUsnChange(param_1,param_4,uVar14,(_FILE_NAME *)0x0);

+  if (*(longlong *)(*(longlong *)(param_4 + 0xf8) + 8) != 0) {

+    if ((*(longlong *)(param_2 + 0x28) == 0) ||

+       (*(longlong *)(*(longlong *)(param_2 + 0x28) + 8) == 0)) {

+      bVar5 = false;

+      if ((((byte)p_Var17[8] & 4) != 0) || ((*(uint *)(param_3 + 0x10) & 2) != 0))

+      goto LAB_2;

+      uVar14 = 0;

+      RefsCreateInternalAttributeStream(param_1,param_4,'\0',(_UNICODE_STRING *)&DAT_3);

+    }

+    bVar5 = true;

+  }

+LAB_2:

+  if ((((0x30a < CONCAT11(*(undefined1 *)(*(longlong *)(param_4 + 0x90) + 0x318),

+                          *(undefined1 *)(*(longlong *)(param_4 + 0x90) + 0x319))) &&

+       ((*(uint *)(param_4 + 0x98) & 8) != 0)) && ((*(uint *)(param_4 + 0x98) & 0x40) == 0)) &&

+     (0x7ff < lVar2)) {

+    RefsConvertToNonResident(param_1,param_4);

+  }

+  if (((*(uint *)(param_4 + 0x98) & 8) == 0) || ((*(uint *)(param_4 + 0x98) & 0x40) != 0)) {

+    local_80 = 0;

+    local_78 = 0;

+    if (((*(uint *)(*(longlong *)(param_4 + 0x90) + 0x220) & (uint)uVar8) != 0) &&

+       ((longlong)uVar8 < lVar2)) {

+      local_68[0] = (longlong)uVar8 >> (*(byte *)(*(longlong *)(param_4 + 0x90) + 0x228) & 0x3f);

+      local_68[1] = 1;

+      in_stack_ffffffffffffff38 = (uchar)&local_80;

+      RefsLookupAllocation(param_1,param_4,local_68,4);

+    }

+    if (((*(uint *)(*(longlong *)(param_4 + 0x90) + 0x220) & (uint)lVar2) != 0) &&

+       (lVar2 < (longlong)uVar8)) {

+      local_68[2] = lVar2 >> (*(byte *)(*(longlong *)(param_4 + 0x90) + 0x228) & 0x3f);

+      local_50 = 1;

+      in_stack_ffffffffffffff38 = (uchar)&local_80;

+      RefsLookupAllocation(param_1,param_4,local_68 + 2,4);

+    }

+    lVar16 = *(longlong *)(param_4 + 0x90);

+    p_Var15 = param_4 + 0x18;

+    uVar8 = *(ulonglong *)p_Var15;

+    uVar11 = (ulonglong)*(uint *)(lVar16 + 0x220);

+    if ((longlong)uVar8 < lVar2) {

+      uVar10 = uVar11 + lVar2 & (longlong)*(int *)(lVar16 + 0x224);

+      if (*(short *)(param_4 + 0x100) < 0) {

+        *(ulonglong *)p_Var15 = uVar10;

+        if (*(short *)param_4 == 0x805) {

+          *(ulonglong *)(param_4 + 0x1a8) = uVar10;

+        }

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

+          CcSetFileSizesEx(&stack0xffffffffffffff40,p_Var15);

+        }

+      }

+      else {

+        in_stack_ffffffffffffff38 = '\0';

+        p_Var15 = (_SCB *)((longlong)((*(uint *)(lVar16 + 0x220) - uVar8) + uVar10) >>

+                          (*(byte *)(lVar16 + 0x228) & 0x3f));

+        RefsAddAllocation(param_1,param_4,

+                          (longlong)(uVar8 + uVar11) >> (*(byte *)(lVar16 + 0x228) & 0x3f),

+                          (__int64)p_Var15,0,(_CCB *)0x0);

+      }

+    }

+    else {

+      uVar11 = lVar2 + uVar11 & (longlong)*(int *)(lVar16 + 0x224);

+      if (((*(short *)(param_4 + 0x100) < 0) && (lVar2 < *(longlong *)(param_4 + 0x20))) &&

+         ((longlong)uVar11 < (longlong)uVar8)) {

+        p_Var15 = (_SCB *)(((longlong)uVar8 >> (*(byte *)(lVar16 + 0x228) & 0x3f)) + -1);

+        in_stack_ffffffffffffff38 = '\0';

+        RefsDeleteAllocation

+                  (param_1,param_4,(longlong)uVar11 >> (*(byte *)(lVar16 + 0x228) & 0x3f),

+                   (__int64)p_Var15,'\0');

+      }

+      if ((*(uint *)(param_4 + 0x98) & 1) == 0) {

+        LOCK();

+        *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 1;

+        UNLOCK();

+      }

+    }

+    if (((byte)p_Var17[8] & 4) != 0) {

+      RefsPrepareForCriticalIo(param_1,param_3,param_4,(ulong)p_Var15);

+      FsRtlTagFileForStorageNotification(param_1,param_3,param_4,1);

+    }

+    if (((*(uint *)(param_4 + 0x98) & 0x10) == 0) && ((*(uint *)(param_4 + 0x98) & 0x4000) == 0)) {

+      LOCK();

+      *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 0x4000;

+      UNLOCK();

+    }

+    uVar8 = (ulonglong)*(uint *)(*(longlong *)(param_4 + 0x90) + 0x220);

+    bVar1 = *(byte *)(*(longlong *)(param_4 + 0x90) + 0x228);

+    lVar18 = (longlong)(*(longlong *)(param_4 + 0x20) + uVar8) >> (bVar1 & 0x3f);

+    lVar16 = (longlong)(uVar8 + lVar2) >> (bVar1 & 0x3f);

+    if ((lVar18 < lVar16) && (((byte)local_88[8] & 4) == 0)) {

+      RefsBindMinstoreTransaction(param_1);

+      plVar12 = &local_48;

+      local_40 = lVar16 - lVar18;

+      local_48 = lVar18;

+      iVar7 = MsSetRangeValidState

+                        (*(undefined8 *)(param_1 + 0x18),*(undefined8 *)(param_4 + 0x1b0),plVar12,0)

+      ;

+      uVar14 = (ulong)plVar12;

+      if (iVar7 < 0) {

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

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

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

+          uVar14 = 0x401d0658;

+          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x97,

+                   &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,iVar7);

+        }

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

+          uVar14 = 0x401cee20;

+          RefsStatusDebug(iVar7,param_1,"FileInfo.c",0x271a);

+        }

+                    /* WARNING: Subroutine does not return */

+        RefsRaiseStatusInternal(param_1,iVar7,uVar14);

+      }

+    }

+    *(longlong *)(param_4 + 0x20) = lVar2;

+    *(longlong *)(param_4 + 0x28) = lVar2;

+    if ((*(short *)param_4 == 0x805) && (*(longlong *)(param_4 + 0x1a8) < lVar2)) {

+      *(longlong *)(param_4 + 0x1a8) = lVar2;

+    }

+    uVar13 = '\x03';

+    RefsWriteFileSizes(param_1,param_4,(_CC_FILE_SIZES *)0x0,3,in_stack_ffffffffffffff38);

+    p_Var17 = local_88;

+    uVar8 = local_90;

+  }

+  else {

+    if (0x20000 < lVar2) {

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

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

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

+        uVar14 = 0x401d0658;

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x94,

+                 &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc0000427);

+      }

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

+        uVar14 = 0x401cee20;

+        RefsStatusDebug(-0x3ffffbd9,param_1,"FileInfo.c",0x264f);

+      }

+                    /* WARNING: Subroutine does not return */

+      RefsRaiseStatusInternal(param_1,-0x3ffffbd9,uVar14);

+    }

+    if (*(longlong *)(param_4 + 0x18) < lVar2) {

+      *(longlong *)(param_4 + 0x18) = lVar2;

+      if (*(short *)param_4 == 0x805) {

+        *(longlong *)(param_4 + 0x1a8) = lVar2;

+      }

+    }

+    else if ((*(uint *)(param_4 + 0x98) & 1) == 0) {

+      LOCK();

+      *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 1;

+      UNLOCK();

+    }

+    if (((*(uint *)(param_4 + 0x98) & 0x10) == 0) && ((*(uint *)(param_4 + 0x98) & 0x4000) == 0)) {

+      LOCK();

+      *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 0x4000;

+      UNLOCK();

+    }

+    *(longlong *)(param_4 + 0x20) = lVar2;

+    *(longlong *)(param_4 + 0x28) = lVar2;

+    if ((*(short *)param_4 == 0x805) && (*(longlong *)(param_4 + 0x1a8) < lVar2)) {

+      *(longlong *)(param_4 + 0x1a8) = lVar2;

+    }

+    uVar13 = '\x03';

+    RefsWriteFileSizes(param_1,param_4,(_CC_FILE_SIZES *)0x0,3,in_stack_ffffffffffffff38);

+    bVar3 = false;

+  }

+LAB_1:

+  RefsUpdateFileTimestampsForModification(param_2,p_Var17,param_5,uVar13);

+  if ((*(uint *)(param_3 + 0x10) & 2) != 0) {

+    *(ulonglong *)(p_Var17 + 8) = *(ulonglong *)(p_Var17 + 8) | 0x40000;

+  }

+  RefsUpdateScbFromFileObject(param_2,param_4,param_6);

+  if ((((byte)p_Var17[8] & 0x10) != 0) &&

+     (RefsUpdateStandardInformation(param_1,p_Var17), (*(uint *)(param_3 + 0x10) & 2) == 0)) {

+    *(uint *)(param_5 + 4) = *(uint *)(param_5 + 4) | 0x10000;

+  }

+  *(ulonglong *)(p_Var17 + 8) = *(ulonglong *)(p_Var17 + 8) & 0xffffffffffffffef;

+  if ((bVar4) && ((*(uint *)(param_4 + 0x98) & 4) != 0)) {

+    LOCK();

+    *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) & 0xfffffffb;

+    UNLOCK();

+  }

+  if (bVar5) {

+    if (*(longlong *)(param_4 + 0x20) < (longlong)uVar8) {

+      RefsCheckpointCurrentTransaction(param_1);

+    }

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

+      CcSetFileSizesEx(&stack0xfffffffffffffff8,param_4 + 0x18);

+    }

+    if (*(longlong *)(param_4 + 0x20) < (longlong)uVar8) {

+      local_90 = *(longlong *)(param_4 + 0x20) + 0xfffU & 0xfffffffffffff000;

+      uVar13 = '\0';

+      cVar6 = CcPurgeCacheSection(*(longlong *)(param_4 + 0xf8) + 8,&local_90);

+      if ((cVar6 == '\0') && ((*(uint *)(param_4 + 0x98) & 0x40000000) == 0)) {

+        LOCK();

+        *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 0x40000000;

+        UNLOCK();

+      }

+    }

+  }

+  RefsCheckpointCurrentTransaction(param_1);

+  uVar11 = *(ulonglong *)(param_4 + 0x20);

+  if ((((*(uint *)(*(longlong *)(param_4 + 0x90) + 0x220) + uVar11 &

+        (longlong)*(int *)(*(longlong *)(param_4 + 0x90) + 0x224)) != uVar11) &&

+      ((longlong)uVar11 < (longlong)uVar8)) && (bVar3)) {

+    RefsZeroEndOfClusterStraddlingEof(param_1,param_4,param_3);

+  }

+  RefsCheckpointCurrentTransaction(param_1);

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

+    RefsUpdateFileDupInfo(param_1,p_Var17);

+  }

+  if (*(int *)(param_4 + 0xa0) != 0) {

+    return 0;

+  }

+  if (*(longlong *)(param_4 + 0xf0) == 0) {

+    return 0;

+  }

+  RefsDeleteInternalAttributeStream(param_1,param_4,0,uVar13);

+  return 0;

 }
```

## `RefsSetAllocationInfo`  (modified)

```diff
--- RefsSetAllocationInfo
+++ RefsSetAllocationInfo
@@ -1,126 +1,278 @@
 

-long RefsSetAllocationInfo(undefined8 param_1,undefined8 param_2,ulong param_3)

+undefined8

+RefsSetAllocationInfo

+          (_IRP_CONTEXT *param_1,_FILE_OBJECT *param_2,_IRP *param_3,_SCB *param_4,_CCB *param_5)

 

 {

-  long lVar1;

-  uchar uVar2;

-  int iVar3;

-  undefined *unaff_RSI;

-  _IRP_CONTEXT *unaff_RDI;

-  _IRP *p_Var4;

-  int iVar5;

-  void *unaff_R15;

-  bool bVar6;

-  char in_stack_00000040;

-  int iStack0000000000000044;

-  char in_stack_00000048;

-  void *in_stack_00000050;

-  int in_stack_00000060;

-  void *in_stack_00000068;

-  _IRP *in_stack_000000c8;

-  _VCB *in_stack_000000d8;

+  byte bVar1;

+  uint uVar2;

+  _FCB *p_Var3;

+  _SCB *p_Var4;

+  longlong lVar5;

+  ulonglong uVar6;

+  bool bVar7;

+  bool bVar8;

+  bool bVar9;

+  bool bVar10;

+  bool bVar11;

+  char cVar12;

+  undefined8 uVar13;

+  longlong lVar14;

+  ulong uVar15;

+  _SCB *p_Var16;

+  uchar uVar17;

+  _SCB *p_Var18;

+  uchar in_stack_ffffffffffffff88;

+  ulonglong local_58;

+  longlong local_50;

+  longlong local_48;

+  longlong local_40;

   

-  if ((int)unaff_RSI == 1) {

-    p_Var4 = in_stack_000000c8;

-    iStack0000000000000044 = RefsSetEndOfFileInfo();

-    param_3 = (ulong)p_Var4;

+  p_Var3 = *(_FCB **)(param_4 + 0x88);

+  bVar10 = false;

+  bVar9 = false;

+  bVar8 = false;

+  bVar11 = false;

+  local_50 = *(longlong *)(param_4 + 0x20);

+  if ((*(uint *)(param_4 + 300) & 0x40) == 0) {

+    p_Var18 = param_4;

+    if ((*(uint *)(param_4 + 0x98) & 0x20) == 0) {

+      RefsUpdateScbFromAttribute(param_1,param_4,(RefsAttributeManager *)0x0);

+    }

+    if ((char)*(undefined4 *)(param_4 + 0x98) < '\0') {

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8e,

+                 &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc00004be);

+      }

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

+        RefsStatusDebug(-0x3ffffb42,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x23d0);

+      }

+      return 0xc00004be;

+    }

+    if (param_5 != (_CCB *)0x0) {

+      *(undefined4 *)(param_1 + 0x278) = *(undefined4 *)(param_5 + 0x54);

+    }

+    uVar15 = 0;

+    RefsSnapshotScb(param_1,param_4,0);

+    p_Var4 = (_SCB *)**(undefined8 **)(param_3 + 0x18);

+    if ((*(longlong *)(*(longlong *)(param_4 + 0x90) + 0x1e0) < (longlong)p_Var4) ||

+       ((longlong)p_Var4 < 0)) {

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x8f,

+                 &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc000000d);

+      }

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

+        RefsStatusDebug(-0x3ffffff3,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x23fa);

+      }

+      return 0xc000000d;

+    }

+    if ((longlong)p_Var4 < *(longlong *)(param_4 + 0x20)) {

+      p_Var16 = param_4;

+      p_Var18 = p_Var4;

+      uVar13 = RefsPrepareToShrinkFileSize(param_1,param_2);

+      uVar15 = (ulong)p_Var16;

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

+        return uVar13;

+      }

+      bVar11 = true;

+    }

+    if (*(longlong *)(*(longlong *)(param_4 + 0xf8) + 8) != 0) {

+      if ((*(longlong *)(param_2 + 0x28) == 0) ||

+         (*(longlong *)(*(longlong *)(param_2 + 0x28) + 8) == 0)) {

+        bVar9 = false;

+      }

+      else {

+        bVar9 = true;

+      }

+      if ((((!bVar9) && (p_Var4 != *(_SCB **)(param_4 + 0x18))) && (((byte)p_Var3[8] & 4) == 0)) &&

+         ((*(uint *)(param_3 + 0x10) & 2) == 0)) {

+        p_Var18 = (_SCB *)&DAT_0;

+        uVar15 = 0;

+        RefsCreateInternalAttributeStream(param_1,param_4,'\0',(_UNICODE_STRING *)&DAT_0);

+        bVar9 = true;

+      }

+    }

+    if (0x30a < CONCAT11(*(undefined1 *)(*(longlong *)(param_4 + 0x90) + 0x318),

+                         *(undefined1 *)(*(longlong *)(param_4 + 0x90) + 0x319))) {

+      if (((*(uint *)(param_4 + 0x98) & 8) == 0) || ((*(uint *)(param_4 + 0x98) & 0x40) != 0)) {

+        bVar7 = false;

+      }

+      else {

+        bVar7 = true;

+      }

+      if ((bVar7) && (0x7ff < (longlong)p_Var4)) {

+        RefsConvertToNonResident(param_1,param_4);

+      }

+    }

+    if (((*(uint *)(param_4 + 0x98) & 8) == 0) || ((*(uint *)(param_4 + 0x98) & 0x40) != 0)) {

+      bVar7 = false;

+    }

+    else {

+      bVar7 = true;

+    }

+    if (bVar7) {

+      if (0x20000 < (longlong)p_Var4) {

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

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

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

+          uVar15 = 0x401d0658;

+          WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x90,

+                   &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc0000427);

+        }

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

+          uVar15 = 0x401cee20;

+          RefsStatusDebug(-0x3ffffbd9,param_1,"FileInfo.c",0x244d);

+        }

+                    /* WARNING: Subroutine does not return */

+        RefsRaiseStatusInternal(param_1,-0x3ffffbd9,uVar15);

+      }

+      if (p_Var4 != *(_SCB **)(param_4 + 0x18)) {

+        if ((longlong)p_Var4 < *(longlong *)(param_4 + 0x20)) {

+          RefsPostUsnChange(param_1,param_4,4,(_FILE_NAME *)0x0);

+        }

+        *(_SCB **)(param_4 + 0x18) = p_Var4;

+        if (*(short *)param_4 == 0x805) {

+          *(_SCB **)(param_4 + 0x1a8) = p_Var4;

+        }

+        if ((*(uint *)(param_4 + 0x98) & 1) == 0) {

+          LOCK();

+          *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 1;

+          UNLOCK();

+        }

+        if ((longlong)p_Var4 < *(longlong *)(param_4 + 0x20)) {

+          *(_SCB **)(param_4 + 0x20) = p_Var4;

+          *(_SCB **)(param_4 + 0x28) = p_Var4;

+          if ((*(short *)param_4 == 0x805) && (*(longlong *)(param_4 + 0x1a8) < (longlong)p_Var4)) {

+            *(_SCB **)(param_4 + 0x1a8) = p_Var4;

+          }

+          if (((*(uint *)(param_4 + 0x98) & 0x10) == 0) &&

+             ((*(uint *)(param_4 + 0x98) >> 0xe & 1) == 0)) {

+            LOCK();

+            *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 0x4000;

+            UNLOCK();

+          }

+        }

+        p_Var18 = (_SCB *)0x3;

+        RefsWriteFileSizes(param_1,param_4,(_CC_FILE_SIZES *)0x0,3,in_stack_ffffffffffffff88);

+        bVar8 = true;

+      }

+    }

+    else {

+      bVar10 = true;

+    }

+    if (bVar10) {

+      uVar2 = *(uint *)(*(longlong *)(param_4 + 0x90) + 0x220);

+      bVar1 = *(byte *)(*(longlong *)(param_4 + 0x90) + 0x228);

+      lVar14 = ((longlong)(p_Var4 + uVar2) >> (bVar1 & 0x3f)) << (bVar1 & 0x3f);

+      lVar5 = *(longlong *)(param_4 + 0x18);

+      if (lVar5 < lVar14) {

+        if (*(short *)(param_4 + 0x100) < 0) {

+          *(longlong *)(param_4 + 0x18) = lVar14;

+          if (*(short *)param_4 == 0x805) {

+            *(longlong *)(param_4 + 0x1a8) = lVar14;

+          }

+        }

+        else {

+          in_stack_ffffffffffffff88 = '\0';

+          RefsAddAllocation(param_1,param_4,(longlong)((ulonglong)uVar2 + lVar5) >> (bVar1 & 0x3f),

+                            (longlong)(((ulonglong)uVar2 - lVar5) + lVar14) >> (bVar1 & 0x3f),0,

+                            (_CCB *)0x0);

+        }

+        if ((*(uint *)(param_4 + 0x98) & 1) == 0) {

+          LOCK();

+          *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 1;

+          UNLOCK();

+        }

+      }

+      else if (lVar14 < lVar5) {

+        if (lVar14 < *(longlong *)(param_4 + 0x20)) {

+          RefsPostUsnChange(param_1,param_4,4,(_FILE_NAME *)0x0);

+          *(longlong *)(param_4 + 0x20) = lVar14;

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

+          if ((*(short *)param_4 == 0x805) && (*(longlong *)(param_4 + 0x1a8) < lVar14)) {

+            *(longlong *)(param_4 + 0x1a8) = lVar14;

+          }

+          if (((*(uint *)(param_4 + 0x98) & 0x10) == 0) &&

+             ((*(uint *)(param_4 + 0x98) >> 0xe & 1) == 0)) {

+            LOCK();

+            *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 0x4000;

+            UNLOCK();

+          }

+        }

+        in_stack_ffffffffffffff88 = '\x01';

+        RefsDeleteAllocation

+                  (param_1,param_4,

+                   (longlong)((ulonglong)*(uint *)(*(longlong *)(param_4 + 0x90) + 0x220) + lVar14)

+                   >> (*(byte *)(*(longlong *)(param_4 + 0x90) + 0x228) & 0x3f),0x7fffffffffffffff,

+                   '\x01');

+      }

+      p_Var18 = (_SCB *)0x3;

+      RefsWriteFileSizes(param_1,param_4,(_CC_FILE_SIZES *)0x0,3,in_stack_ffffffffffffff88);

+      bVar8 = true;

+      if (((byte)p_Var3[8] & 4) != 0) {

+        RefsPrepareForCriticalIo(param_1,param_3,param_4,(ulong)p_Var18);

+        p_Var18 = (_SCB *)&DAT_1;

+        FsRtlTagFileForStorageNotification(param_1,param_3,param_4,1);

+      }

+    }

+    uVar17 = (uchar)p_Var18;

+    if (bVar11) {

+      RefsUpdateFileTimestampsForModification(param_2,p_Var3,param_5,uVar17);

+    }

+    else {

+      uVar17 = '\x01';

+      RefsUpdateFileTimestampsForChange(p_Var3,param_5,0x400000,'\x01');

+    }

+    RefsUpdateScbFromFileObject(param_2,param_4,'\x01');

+    if (((byte)p_Var3[8] & 0x10) != 0) {

+      RefsUpdateStandardInformation(param_1,p_Var3);

+    }

+    lVar5 = local_50;

+    *(ulonglong *)(p_Var3 + 8) = *(ulonglong *)(p_Var3 + 8) & 0xffffffffffffffef;

+    if ((bVar8) && ((*(uint *)(param_4 + 0x98) & 4) != 0)) {

+      LOCK();

+      *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) & 0xfffffffb;

+      UNLOCK();

+    }

+    if (bVar9) {

+      local_58 = 0;

+      if (*(longlong *)(param_4 + 0x20) < local_50) {

+        RefsCheckpointCurrentTransaction(param_1);

+      }

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

+        local_50 = *(longlong *)(param_4 + 0xf8) + 8;

+        local_48 = local_50;

+        CcSetFileSizesEx(&stack0xffffffffffffff88,param_4 + 0x18);

+      }

+      if (*(longlong *)(param_4 + 0x20) < lVar5) {

+        local_58 = *(longlong *)(param_4 + 0x20) + 0xfffU & 0xfffffffffffff000;

+        local_40 = *(longlong *)(param_4 + 0xf8) + 8;

+        uVar17 = '\0';

+        cVar12 = CcPurgeCacheSection(local_40,&local_58,0);

+        if ((cVar12 == '\0') && ((*(uint *)(param_4 + 0x98) & 0x40000000) == 0)) {

+          LOCK();

+          *(uint *)(param_4 + 0x98) = *(uint *)(param_4 + 0x98) | 0x40000000;

+          UNLOCK();

+        }

+      }

+    }

+    RefsCheckpointCurrentTransaction(param_1);

+    uVar6 = *(ulonglong *)(param_4 + 0x20);

+    if ((((*(uint *)(*(longlong *)(param_4 + 0x90) + 0x220) + uVar6 &

+          (longlong)*(int *)(*(longlong *)(param_4 + 0x90) + 0x224)) != uVar6) &&

+        ((longlong)uVar6 < lVar5)) && (bVar10)) {

+      RefsZeroEndOfClusterStraddlingEof(param_1,param_4,param_3);

+    }

+    RefsCheckpointCurrentTransaction(param_1);

+    RefsUpdateFileDupInfo(param_1,p_Var3);

+    if ((*(int *)(param_4 + 0xa0) == 0) && (*(longlong *)(param_4 + 0xf0) != 0)) {

+      RefsDeleteInternalAttributeStream(param_1,param_4,0,uVar17);

+    }

   }

-  else {

-    if (((WPP_GLOBAL_Control != unaff_RSI) && ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0)

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

-      param_3 = 0x401d0658;

-      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2c,

-               &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc000000d);

-    }

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

-      param_3 = 0x401cee20;

-      RefsStatusDebug(-0x3ffffff3,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x904);

-    }

-    iStack0000000000000044 = -0x3ffffff3;

-    unaff_R15 = in_stack_00000050;

-  }

-  if ((iStack0000000000000044 == 0) && (in_stack_00000060 != 0)) {

-    if ((WPP_GLOBAL_Control != unaff_RSI) && ((*(uint *)(WPP_GLOBAL_Control + 0x2c) >> 8 & 1) != 0))

-    {

-      if (in_stack_00000060 < 0) {

-        bVar6 = (byte)WPP_GLOBAL_Control[0x29] < 4;

-      }

-      else {

-        bVar6 = (byte)WPP_GLOBAL_Control[0x29] < 5;

-      }

-      if (!bVar6) {

-        param_3 = 0x401d0658;

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

-      }

-    }

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

-      param_3 = 0x401cee20;

-      RefsStatusDebug(in_stack_00000060,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x911);

-    }

-    iStack0000000000000044 = in_stack_00000060;

-    unaff_R15 = in_stack_00000050;

-  }

-  iVar3 = iStack0000000000000044;

-  if (iStack0000000000000044 == 0x103) goto LAB_0;

-  iVar5 = *(int *)(*(_IRP_CONTEXT **)(unaff_RDI + 0x68) + 0x10);

-  if ((-1 < iVar5) &&

-     ((-1 < iStack0000000000000044 ||

-      (uVar2 = RefsIsTransactionActive(*(_IRP_CONTEXT **)(unaff_RDI + 0x68)), iVar5 = iVar3,

-      uVar2 == '\0')))) {

-    RefsCheckpointCurrentTransaction(unaff_RDI);

-    iVar5 = 0;

-  }

-  if (WPP_GLOBAL_Control == unaff_RSI) {

-LAB_1:

-    if (iVar5 < 0) {

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

-        param_3 = 0x401cee20;

-        RefsStatusDebug(iVar5,unaff_RDI,"FileInfo.c",0x91a);

-      }

-                    /* WARNING: Subroutine does not return */

-      RefsRaiseStatusInternal(unaff_RDI,iVar5,param_3);

-    }

-  }

-  else if (iVar5 < 0) {

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

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

-      param_3 = 0x401d0658;

-      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2e,

-               &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,iVar5);

-    }

-    goto LAB_1;

-  }

-  RefsFlushForWriteThrough(unaff_RDI,in_stack_00000068,0);

-LAB_0:

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

-    RefsReleasePagingResource(unaff_RDI,unaff_R15);

-  }

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

-    RefsReleaseVcb(unaff_RDI,in_stack_000000d8);

-  }

-  lVar1 = iStack0000000000000044;

-  if ((iVar3 != 0x103) && (iVar3 != 0x367)) {

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

-      RefsStatusDebug(iStack0000000000000044,unaff_RDI,"FileInfo.c",0x93b);

-    }

-    RefsExtendedCompleteRequestInternal(unaff_RDI,in_stack_000000c8,lVar1);

-    iVar3 = lVar1;

-  }

-  if ((WPP_GLOBAL_Control != unaff_RSI) && ((*(uint *)(WPP_GLOBAL_Control + 0x2c) & 0x100) != 0)) {

-    if (iVar3 < 0) {

-      bVar6 = (byte)WPP_GLOBAL_Control[0x29] < 4;

-    }

-    else {

-      bVar6 = (byte)WPP_GLOBAL_Control[0x29] < 5;

-    }

-    if (!bVar6) {

-      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x2f,

-               &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,iVar3);

-    }

-  }

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

-    RefsStatusDebug(iStack0000000000000044,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x93e);

-  }

-  return iStack0000000000000044;

+  return 0;

 }
```

## `RefsSetPositionInfo`  (modified)

```diff
--- RefsSetPositionInfo
+++ RefsSetPositionInfo
@@ -1,10 +1,25 @@
 

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

-

-void RefsSetPositionInfo(void)

+undefined8 RefsSetPositionInfo(longlong param_1,longlong param_2)

 

 {

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

-  halt_baddata();

+  undefined8 uVar1;

+  

+  if (**(longlong **)(param_2 + 0x18) < 0) {

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

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

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

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0x89,

+               &WPP_513e27a4d3cc3ae5a78a0743d1eaf7ea_Traceguids,0xc000000d);

+    }

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

+      RefsStatusDebug(-0x3ffffff3,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x22f5);

+    }

+    uVar1 = 0xc000000d;

+  }

+  else {

+    *(longlong *)(param_1 + 0x68) = **(longlong **)(param_2 + 0x18);

+    uVar1 = 0;

+  }

+  return uVar1;

 }
```

## `FUN_1401c2236`  (modified)

```diff
--- FUN_1401c2236
+++ ValidateCmsRowForDirIndex
@@ -1,15 +1,66 @@
 

-void FUN_1401c2236(longlong param_1,longlong param_2)

+long ValidateCmsRowForDirIndex

+               (_IRP_CONTEXT *param_1,longlong param_2,uint *param_3,undefined1 *param_4)

 

 {

-  char *pcVar1;

-  longlong in_RAX;

-  int unaff_EBP;

+  _FCB *p_Var1;

+  short *psVar2;

+  long lVar3;

+  ulong uVar4;

+  bool bVar5;

+  uint uVar6;

   

-  *(char *)(in_RAX + 0x387d8348) = *(char *)(in_RAX + 0x387d8348) + (char)param_2;

-  pcVar1 = (char *)(param_2 + 0x48 + param_1);

-  *pcVar1 = *pcVar1 + (char)((ulonglong)param_2 >> 8);

-  MsDeleteTrashTableFileTableEntry(unaff_EBP + 0x38);

-  return;

+  uVar6 = *param_3;

+  psVar2 = *(short **)(param_3 + 2);

+  *param_4 = 1;

+  if (uVar6 < 4) {

+    p_Var1 = *(_FCB **)(param_2 + 0x88);

+    *param_4 = 0;

+    lVar3 = RefsQueueTriageForDeadFcb(param_1,p_Var1);

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

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

+      if (lVar3 < 0) {

+        bVar5 = (byte)WPP_GLOBAL_Control[0x29] < 4;

+      }

+      else {

+        bVar5 = (byte)WPP_GLOBAL_Control[0x29] < 5;

+      }

+      if (!bVar5) {

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

+                 &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,lVar3,uVar6);

+      }

+    }

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

+      return lVar3;

+    }

+    uVar4 = 0x27e;

+  }

+  else {

+    if (((*psVar2 != 0x30) || ((*(byte *)(psVar2 + 1) & 2) == 0)) || (param_3[4] - 0x48 < 0xd)) {

+      return 0;

+    }

+    p_Var1 = *(_FCB **)(param_2 + 0x88);

+    *param_4 = 0;

+    lVar3 = RefsQueueTriageForDeadFcb(param_1,p_Var1);

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

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

+      if (lVar3 < 0) {

+        bVar5 = (byte)WPP_GLOBAL_Control[0x29] < 4;

+      }

+      else {

+        bVar5 = (byte)WPP_GLOBAL_Control[0x29] < 5;

+      }

+      if (!bVar5) {

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

+                 &WPP_984329e093e93cfed4c685a99ce57110_Traceguids,lVar3,uVar6);

+      }

+    }

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

+      return lVar3;

+    }

+    uVar4 = 0x293;

+  }

+  RefsStatusDebug(lVar3,(_IRP_CONTEXT *)0x0,"ProtogonIndex.c",uVar4);

+  return lVar3;

 }
```

## `LogValidateEntryHeader`  (modified)

```diff
--- LogValidateEntryHeader
+++ LogValidateEntryMetadata
@@ -1,7 +1,16 @@
 

-void LogValidateEntryHeader(void)

+uint LogValidateEntryMetadata(longlong param_1,int param_2)

 

 {

-  return;

+  uint uVar1;

+  uint uVar2;

+  

+  uVar1 = *(uint *)(param_1 + 0x54);

+  uVar2 = *(uint *)((ulonglong)uVar1 + 0x28 + param_1);

+  if ((0x37 < uVar2) && (uVar2 <= param_2 - uVar1)) {

+    return -(uint)((param_2 - uVar1) - uVar2 < *(uint *)((ulonglong)uVar1 + 0x20 + param_1)) &

+           0xc03d0202;

+  }

+  return 0xc03d0202;

 }
```

## `FUN_1401c2262`  (modified)

```diff
--- FUN_1401c2262
+++ FUN_1401c2f5a
@@ -1,15 +1,17 @@
 

-void FUN_1401c2262(void)

+/* PDB: Separated code (from the compiler): 1401c2f5a - 1401c2f86 for parent address: 140010e40 */

+

+void FUN_1401c2f5a(undefined8 param_1,undefined8 param_2,ulong param_3)

 

 {

-  uint *puVar1;

-  longlong in_RAX;

-  longlong unaff_RBX;

-  int unaff_EBP;

+  long unaff_EBX;

+  _IRP_CONTEXT *unaff_RDI;

   

-  puVar1 = (uint *)(in_RAX + -0x75);

-  *puVar1 = *puVar1 >> 1 | (uint)((*puVar1 & 1) != 0) << 0x1f;

-  *(int *)(unaff_RBX + 0x4890ffeb) = *(int *)(unaff_RBX + 0x4890ffeb) + unaff_EBP;

-  return;

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

+    param_3 = 0x401d4cd0;

+    RefsStatusDebug(unaff_EBX,unaff_RDI,"ProtogonIndex.c",0x49f);

+  }

+                    /* WARNING: Subroutine does not return */

+  RefsRaiseStatusInternal(unaff_RDI,unaff_EBX,param_3);

 }
```

## `CmsBPlusTable::CheckPage`  (modified)

```diff
--- CmsBPlusTable::CheckPage
+++ CmsBPlusTable::CheckPage
@@ -1,2 +1,142 @@
-Failed to decompile refs.sys - .ProgramDB CmsBPlusTable::CheckPage : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* WARNING: Function: __chkstk replaced with injection: alloca_probe */

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

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

+/* public: long __cdecl CmsBPlusTable::CheckPage(struct SmsPage & __ptr64,bool) __ptr64 */

+

+long __thiscall CmsBPlusTable::CheckPage(CmsBPlusTable *this,SmsPage *param_1,bool param_2)

+

+{

+  undefined8 *puVar1;

+  ushort uVar2;

+  int iVar3;

+  ulong uVar4;

+  int *piVar5;

+  longlong *plVar6;

+  code *pcVar7;

+  CmsSchemaTable *this_00;

+  longlong lVar8;

+  char cVar9;

+  int iVar10;

+  long lVar11;

+  ulonglong uVar12;

+  undefined8 *puVar13;

+  SmsInternalPropertyDef *pSVar14;

+  uint uVar15;

+  uint uVar16;

+  longlong lVar17;

+  uint *puVar18;

+  undefined1 *puVar19;

+  undefined8 uStack_a0;

+  undefined1 auStack_98 [32];

+  undefined8 *local_78;

+  ulonglong local_70;

+  int *local_68;

+  undefined4 local_60;

+  int local_5c;

+  undefined4 local_58;

+  undefined2 local_54;

+  undefined8 local_50;

+  undefined8 local_48;

+  undefined8 local_40;

+  undefined4 local_38;

+  undefined1 local_34;

+  longlong local_30;

+  ulonglong local_28;

+  

+  puVar19 = auStack_98;

+  local_28 = __security_cookie ^ (ulonglong)&local_78;

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

+    lVar11 = 0;

+    goto LAB_1;

+  }

+  piVar5 = *(int **)(param_1 + 0x68);

+  iVar3 = *(int *)(param_1 + 0x120);

+  uStack_a0 = 0x14007d726;

+  iVar10 = memcmp(piVar5 + 8,param_1,0x20);

+  puVar19 = auStack_98;

+  if ((((iVar10 == 0) && (puVar19 = auStack_98, (char)piVar5[1] == '\x02')) &&

+      (puVar19 = auStack_98, *piVar5 == 0x2b42534d)) &&

+     (local_30 = *(longlong *)(*(longlong *)(this + 0x18) + 0x48), puVar19 = auStack_98,

+     piVar5[3] == *(int *)(local_30 + 0xcf0))) {

+    uVar15 = (iVar3 + 7U >> 6) + 7;

+    uVar16 = uVar15 & 0xfffffff8;

+    uVar12 = (ulonglong)uVar16 + 0xf;

+    if (uVar12 <= uVar16) {

+      uVar12 = 0xffffffffffffff0;

+    }

+    uStack_a0 = 0x14007d786;

+    local_70 = (ulonglong)(uVar15 >> 3);

+    lVar8 = -(uVar12 & 0xfffffffffffffff0);

+    local_5c = uVar16 << 6;

+    local_38 = 0xffffffff;

+    puVar13 = (undefined8 *)((longlong)&local_78 + lVar8);

+    puVar1 = puVar13 + local_70;

+    local_60 = 0;

+    local_58 = 0;

+    local_54 = 0;

+    local_50 = 0;

+    local_48 = 0;

+    local_40 = 0;

+    local_34 = 0;

+    local_78 = puVar13;

+    local_68 = piVar5;

+    for (; puVar13 != puVar1; puVar13 = puVar13 + 1) {

+      *puVar13 = 0;

+    }

+    plVar6 = *(longlong **)(this + 0x70);

+    uVar15 = iVar3 - 0x50;

+    puVar18 = (uint *)(piVar5 + 0x14);

+    pcVar7 = *(code **)(*plVar6 + 0x28);

+    *(undefined8 *)(auStack_98 + lVar8 + -8) = 0x14007d7f5;

+    cVar9 = (*pcVar7)(plVar6,param_1);

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

+      uVar16 = *puVar18;

+      puVar19 = auStack_98 + lVar8;

+      if ((7 < uVar16) &&

+         (lVar17 = (longlong)puVar18 + (ulonglong)uVar16, puVar19 = auStack_98 + lVar8,

+         (*(byte *)(lVar17 + 0xd) & 2) == 0)) {

+        pSVar14 = *(SmsInternalPropertyDef **)(this + 0x18);

+LAB_2:

+        *(undefined8 *)(auStack_98 + lVar8 + -8) = 0x14007d852;

+        lVar11 = CheckIndexHeaderRecurse(lVar17,uVar15 - uVar16,pSVar14,&local_78);

+        puVar19 = auStack_98 + lVar8;

+        goto LAB_1;

+      }

+    }

+    else {

+      pSVar14 = *(SmsInternalPropertyDef **)(this + 0x18);

+      puVar19 = auStack_98 + lVar8;

+      if (local_58._2_1_ < 3) {

+        uVar2 = *(ushort *)(piVar5 + 0x15);

+        puVar19 = auStack_98 + lVar8;

+        if (0x27 < uVar2) {

+          uVar16 = *puVar18;

+          puVar19 = auStack_98 + lVar8;

+          if (((uVar2 < uVar16) &&

+              (puVar19 = auStack_98 + lVar8, *(uint *)(pSVar14 + 0x1c) <= uVar16 - uVar2)) &&

+             (puVar19 = auStack_98 + lVar8, (ulonglong)uVar16 + 0x28 < (ulonglong)uVar15)) {

+            uVar4 = piVar5[0x17];

+            if ((uVar4 != *(ulong *)(pSVar14 + 0x10)) || (piVar5[0x18] != *(int *)(pSVar14 + 0xc)))

+            {

+              this_00 = *(CmsSchemaTable **)(local_30 + 0xd28);

+              *(undefined8 *)(auStack_98 + lVar8 + -8) = 0x14007d8b2;

+              pSVar14 = CmsSchemaTable::GetPropertyDef(this_00,uVar4);

+              puVar19 = auStack_98 + lVar8;

+              if (pSVar14 == (SmsInternalPropertyDef *)0x0) goto LAB_3;

+            }

+            lVar17 = (ulonglong)uVar16 + (longlong)puVar18;

+            puVar19 = auStack_98 + lVar8;

+            if ((*(byte *)(lVar17 + 0xd) & 2) != 0) goto LAB_2;

+          }

+        }

+      }

+    }

+  }

+LAB_3:

+  lVar11 = -0x3ffffae8;

+LAB_1:

+  *(undefined8 *)(puVar19 + -8) = 0x14007d86c;

+  return lVar11;

+}

+
```

## `CmsVolume::ReadLatestCheckpoint`  (modified)

```diff
--- CmsVolume::ReadLatestCheckpoint
+++ CmsVolume::ReadLatestCheckpoint
@@ -1,2 +1,280 @@
-Failed to decompile refs.sys - .ProgramDB CmsVolume::ReadLatestCheckpoint : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* public: long __cdecl CmsVolume::ReadLatestCheckpoint(class CmsTransactionContext * __ptr64)

+   __ptr64 */

+

+long __thiscall CmsVolume::ReadLatestCheckpoint(CmsVolume *this,CmsTransactionContext *param_1)

+

+{

+  ulonglong uVar1;

+  undefined1 auVar2 [16];

+  char cVar3;

+  bool bVar4;

+  long lVar5;

+  int iVar6;

+  int iVar7;

+  unique_ptr<struct_SmsPersistentRollbackProtectionInformation,struct_tlx::generic_delete<struct_SmsPersistentRollbackProtectionInformation,struct_tlx::operator_delete_deallocate>_>

+  *puVar8;

+  LcnWithChecksum *pLVar9;

+  __uint64 _Var10;

+  void *_Dst;

+  SmsCheckpointRecord *pSVar11;

+  ushort uVar12;

+  nothrow_t *pnVar13;

+  uint uVar14;

+  ulonglong uVar15;

+  uint uVar16;

+  ulong uVar17;

+  ushort uVar18;

+  SmsCheckpointRecord *pSVar19;

+  uchar uVar20;

+  void *_Dst_00;

+  unique_ptr<SmsPersistentRollbackProtectionInformation,tlx::generic_delete<SmsPersistentRollbackProtectionInformation,tlx::operator_delete_deallocate>_>

+  *puVar21;

+  uchar *puVar22;

+  uint uVar23;

+  ulong uVar24;

+  CmsVolume *pCVar25;

+  undefined1 auStackY_128 [32];

+  uchar in_stack_ffffffffffffff40;

+  char local_a8 [4];

+  uchar local_a4 [4];

+  _MS_TELEMETRY_DATA *local_a0;

+  unique_ptr<SmsPersistentRollbackProtectionInformation,tlx::generic_delete<SmsPersistentRollbackProtectionInformation,tlx::operator_delete_deallocate>_>

+  local_98 [16];

+  CmsTransactionContext *local_88;

+  nothrow_t *local_80;

+  __uint64 local_78;

+  char local_70;

+  longlong local_68;

+  longlong lStack_60;

+  longlong local_58;

+  longlong lStack_50;

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStackY_128;

+  local_88 = param_1;

+  _vector_constructor_iterator_

+            (local_98,8,2,

+             utl::unique_ptr<CmsChecksum,utl::default_delete<CmsChecksum>_>::

+             unique_ptr<CmsChecksum,utl::default_delete<CmsChecksum>_>);

+  puVar21 = local_98;

+  local_a8[0] = '\x01';

+  uVar16 = 0xffffffff;

+  uVar15 = 0;

+  local_a4[0] = '\0';

+  local_a4[1] = '\0';

+  local_68 = 0;

+  lStack_60 = 0;

+  local_58 = 0;

+  lStack_50 = 0;

+  do {

+    puVar8 = (unique_ptr<struct_SmsPersistentRollbackProtectionInformation,struct_tlx::generic_delete<struct_SmsPersistentRollbackProtectionInformation,struct_tlx::operator_delete_deallocate>_>

+              *)tlx::make_unique_oversize<SmsCheckpointRecord,0>((__uint64)&local_a0);

+    utl::

+    unique_ptr<SmsPersistentRollbackProtectionInformation,tlx::generic_delete<SmsPersistentRollbackProtectionInformation,tlx::operator_delete_deallocate>_>

+    ::operator=(local_98 + uVar15 * 8,puVar8);

+    utl::unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>::

+    ~unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>

+              ((unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_> *)

+               &local_a0);

+    if (*(longlong *)puVar21 == 0) goto LAB_0;

+    uVar14 = (int)uVar15 + 1;

+    uVar15 = (ulonglong)uVar14;

+    puVar21 = puVar21 + 8;

+  } while (uVar14 < 2);

+  while( true ) {

+    uVar15 = 0;

+    pCVar25 = this + 0x6e0;

+    puVar22 = local_a4;

+    puVar21 = local_98;

+    do {

+      local_68 = *(longlong *)(pCVar25 + -8);

+      uVar14 = *(uint *)pCVar25;

+      if (uVar14 < 2) {

+        lStack_50 = 0;

+        lStack_60 = 0;

+        local_58 = 0;

+      }

+      else {

+        lStack_60 = local_68 + 1;

+        local_58 = local_68 + 2;

+        lStack_50 = local_68 + 3;

+      }

+      uVar23 = (uint)uVar15;

+      lVar5 = ReadAndRepairSelfChecksumBlock

+                        (this,local_88,(void *)(ulonglong)uVar14,(SmsBigIdentifier *)0x0,

+                         (_LCN_TUPLE *)&local_68,uVar14,*(void **)puVar21,

+                         ValidateCheckpointRecordCallback,ChooseCheckpointRecord<0>,

+                         local_a4 + uVar15,(_SmsScrubIoOutput *)0x0,(_SCRUB_PARITY_EXTENT_DATA *)0x0

+                         ,local_a8,in_stack_ffffffffffffff40,'\0');

+      iVar6 = 0;

+      uVar14 = uVar16;

+      if (lVar5 < 0) {

+        cVar3 = FsRtlIsTotalDeviceFailure(lVar5);

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

+      }

+      else if ((*puVar22 != '\0') && (uVar14 = uVar23, uVar16 != 0xffffffff)) {

+        uVar14 = uVar16;

+        if ((*(longlong *)(local_98 + (ulonglong)uVar16 * 8) != *(longlong *)puVar21) &&

+           (*(uint *)pCVar25 != 0)) {

+          uVar15 = *(ulonglong *)(*(longlong *)(local_98 + (ulonglong)uVar16 * 8) + 0x60);

+          uVar1 = *(ulonglong *)(*(longlong *)puVar21 + 0x60);

+          if (uVar1 < uVar15) {

+            iVar6 = 1;

+          }

+          else if (uVar15 == uVar1) {

+            iVar6 = 2;

+          }

+          if (iVar6 == 0) {

+            uVar14 = uVar23;

+          }

+        }

+      }

+      uVar16 = uVar14;

+      uVar15 = (ulonglong)(uVar23 + 1);

+      puVar22 = puVar22 + 1;

+      puVar21 = puVar21 + 8;

+      pCVar25 = pCVar25 + 0x68;

+    } while (uVar23 + 1 < 2);

+    if (uVar16 != 0xffffffff) {

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

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

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

+        WPP_SF_Dq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xb,

+                  &WPP_2c4621e30498338a815405359d03a445_Traceguids,*(undefined4 *)(this + 0xcf0));

+      }

+      memmove(*(void **)(this + 0x6c8),*(void **)(local_98 + (ulonglong)uVar16 * 8),

+              (ulonglong)*(uint *)(this + 0xcf4));

+      _Dst_00 = *(void **)(this + 0x6c8);

+      uVar15 = (ulonglong)(uVar16 - 1 & 1);

+      *(CmsVolume **)(this + 0x7a8) = this + uVar15 * 0x68 + 0x6d8;

+      *(CmsVolume **)(this + 0x6a8) = this + uVar15 * 0xc0 + 0x528;

+      uVar12 = *(ushort *)((longlong)_Dst_00 + 0x50);

+      this[0x846] = SUB21(uVar12,0);

+      if ((uVar12 & 0xff) == uVar12) {

+        uVar12 = *(ushort *)((longlong)_Dst_00 + 0x52);

+        this[0x847] = SUB21(uVar12,0);

+        if (((uVar12 & 0xff) == uVar12) &&

+           ((uVar12 = *(ushort *)(this + 0x846) >> 8 | *(ushort *)(this + 0x846) << 8,

+            uVar18 = *(ushort *)(this + 0x844) >> 8 | *(ushort *)(this + 0x844) << 8,

+            uVar12 < uVar18 || (uVar12 == uVar18)))) {

+          memmove(_Dst_00,*(void **)(local_98 + (ulonglong)uVar16 * 8),

+                  (ulonglong)*(uint *)(this + 0xcf4));

+          pSVar19 = *(SmsCheckpointRecord **)(this + 0x6c8);

+          pnVar13 = (nothrow_t *)&local_80;

+          *(undefined8 *)(this + 0x7f0) = *(undefined8 *)(pSVar19 + 0x60);

+          *(undefined8 *)(this + 0x7f8) = *(undefined8 *)(pSVar19 + 0x68);

+          *(undefined8 *)(this + 0x810) = *(undefined8 *)(pSVar19 + 0x70);

+          *(uint *)(this + 0xd34) = *(uint *)(this + 0xd34) | 0x40000000;

+          SmsCheckpointRecord::GetUserPayload(pSVar19,(ulong)pnVar13);

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

+            *(uint *)(this + 0xd34) = *(uint *)(this + 0xd34) & 0xbfffffff;

+            bVar4 = utl::vector<utl::byte,utl::allocator<utl::byte>_>::_Resize<0>

+                              ((vector<utl::byte,utl::allocator<utl::byte>_> *)(this + 0x818),

+                               local_78);

+            if (!bVar4) goto LAB_0;

+            memmove(*(void **)(this + 0x818),local_80,local_78);

+            pnVar13 = local_80;

+          }

+          local_a0 = ::operator_new(0x100,pnVar13);

+          if (local_a0 == (_MS_TELEMETRY_DATA *)0x0) {

+            local_a0 = (_MS_TELEMETRY_DATA *)0x0;

+          }

+          else {

+            memset(local_a0,0,0x100);

+            *(undefined4 *)local_a0 = 0xc;

+            *(undefined8 *)(local_a0 + 8) = *(undefined8 *)(this + 0x30);

+            *(undefined4 *)(local_a0 + 0x10) = 0;

+            *(undefined8 *)(local_a0 + 0x18) = *(undefined8 *)(this + 0x810);

+            *(undefined8 *)(local_a0 + 0x20) = *(undefined8 *)(this + 0x7f0);

+            *(undefined8 *)(local_a0 + 0x28) =

+                 *(undefined8 *)(*(longlong *)(local_98 + uVar15 * 8) + 0x70);

+            *(undefined8 *)(local_a0 + 0x30) =

+                 *(undefined8 *)(*(longlong *)(local_98 + uVar15 * 8) + 0x60);

+            MsKmeTelemetry(local_a0,'\x01');

+          }

+          utl::unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>::

+          ~unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>

+                    ((unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_> *)

+                     &local_a0);

+          pSVar19 = *(SmsCheckpointRecord **)(this + 0x6c8);

+          lVar5 = CmsRollbackProtection::ValidateAndAttestMountMeasurements

+                            (*(CmsRollbackProtection **)(this + 0x4b0),this,pSVar19);

+          uVar20 = (uchar)_Dst_00;

+          if (lVar5 < 0) goto LAB_1;

+          pSVar11 = *(SmsCheckpointRecord **)(this + 0x6c8);

+          uVar17 = 0xd;

+          if (*(uint *)(pSVar11 + 0x90) < 0xe) goto LAB_2;

+          uVar24 = 0xd;

+          uVar16 = 0;

+          goto LAB_3;

+        }

+      }

+      lVar5 = -0x3ffffeb1;

+      goto LAB_1;

+    }

+    if (local_a8[0] == '\0') break;

+    local_a8[0] = '\0';

+  }

+LAB_4:

+  lVar5 = -0x3fffffce;

+  goto LAB_1;

+  while( true ) {

+    pSVar11 = *(SmsCheckpointRecord **)(this + 0x6c8);

+    uVar24 = uVar24 + 1;

+    uVar16 = uVar14;

+    if (*(uint *)(pSVar11 + 0x90) <= uVar24) break;

+LAB_3:

+    pLVar9 = SmsCheckpointRecord::GetGlobalTableRoot(pSVar11,uVar24,(ulong)pSVar19);

+    iVar7 = Feature_808440122__private_IsEnabledDeviceUsageNoInline();

+    iVar6 = *(int *)(pLVar9 + 0x24);

+    if (iVar7 == 0) {

+      uVar14 = uVar16 + (iVar6 + 0x2fU & 0xfffffff8);

+    }

+    else if (((iVar6 + 0x28U < 0x28) ||

+             (uVar14 = iVar6 + 0x2fU & 0xfffffff8, uVar14 < iVar6 + 0x28U)) ||

+            (uVar14 = uVar14 + uVar16, uVar14 < uVar16)) goto LAB_4;

+  }

+  auVar2 = ZEXT816(8) * ZEXT416(uVar14 >> 3);

+  pnVar13 = auVar2._8_8_;

+  _Var10 = auVar2._0_8_;

+  if (pnVar13 != (nothrow_t *)0x0) {

+    _Var10 = 0xffffffffffffffff;

+  }

+  _Dst = ::operator_new(_Var10,pnVar13);

+  uVar20 = (uchar)_Dst_00;

+  *(void **)(this + 0x838) = _Dst;

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

+LAB_0:

+    lVar5 = -0x3fffff66;

+  }

+  else {

+    pSVar11 = *(SmsCheckpointRecord **)(this + 0x6c8);

+    *(int *)(this + 0x840) = *(int *)(pSVar11 + 0x90) + -0xd;

+    if (0xd < *(uint *)(pSVar11 + 0x90)) {

+      do {

+        pLVar9 = SmsCheckpointRecord::GetGlobalTableRoot(pSVar11,uVar17,(ulong)pSVar19);

+        pSVar19 = (SmsCheckpointRecord *)((ulonglong)*(uint *)(pLVar9 + 0x24) + 0x28);

+        memmove(_Dst,pLVar9,(size_t)pSVar19);

+        uVar20 = (uchar)_Dst_00;

+        uVar17 = uVar17 + 1;

+        pSVar11 = *(SmsCheckpointRecord **)(this + 0x6c8);

+        _Dst = (void *)((longlong)_Dst +

+                       ((ulonglong)*(uint *)(pLVar9 + 0x24) + 0x2f & 0xfffffffffffffff8));

+      } while (uVar17 < *(uint *)(pSVar11 + 0x90));

+    }

+LAB_2:

+    lVar5 = RewriteCheckpointRecord(this,local_88,(uchar)pSVar19,uVar20);

+    if (-1 < lVar5) {

+      lVar5 = 0;

+    }

+  }

+LAB_1:

+  _vector_destructor_iterator_

+            (local_98,8,2,

+             utl::unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>::

+             ~unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>);

+  return lVar5;

+}

+
```

## `RefsStreamRename`  (modified)

```diff
--- RefsStreamRename
+++ RefsStreamRename
@@ -1,2 +1,242 @@
-Failed to decompile refs.sys - .ProgramDB RefsStreamRename : Error: Decompile error: 
-Low-level Error: DuplicateFunctionError, but could not recover original symbol+

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

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

+

+long RefsStreamRename(_IRP_CONTEXT *param_1,_FCB *param_2,_SCB *param_3,longlong param_4,

+                     char param_5,undefined4 *param_6)

+

+{

+  _SCB *p_Var1;

+  uchar uVar2;

+  char cVar3;

+  _REFS_ATTRIBUTE_TYPE_CODE _Var4;

+  int iVar5;

+  _SCB *p_Var6;

+  ulong uVar7;

+  undefined1 auStackY_378 [32];

+  uint in_stack_fffffffffffffcb0;

+  uchar local_308;

+  long local_304;

+  _SCB *local_2f8;

+  int local_2f0;

+  undefined8 local_2e8;

+  undefined8 local_2e0;

+  _IRP_CONTEXT *local_2d8;

+  ulonglong local_2d0 [5];

+  undefined4 uStack_2a8;

+  undefined2 uStack_2a4;

+  undefined2 uStack_2a2;

+  uint local_298 [6];

+  _UNICODE_STRING local_280 [16];

+  ushort local_270 [12];

+  undefined4 local_258;

+  undefined4 uStack_254;

+  undefined4 uStack_250;

+  undefined4 uStack_24c;

+  RefsAttributeManager local_248 [120];

+  undefined2 local_1d0;

+  undefined8 local_50;

+  ulonglong local_48;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStackY_378;

+  local_2d8 = param_1;

+  memset(local_298,0,0x40);

+  local_2f8 = (_SCB *)0x0;

+  local_50 = 0;

+  local_1d0 = 0;

+  RefsAttributeManager::Initialize(local_248);

+  local_2d0[0] = 0;

+  local_2d0[1] = 0;

+  local_2d0[2] = 0;

+  local_2d0[3] = 0;

+  local_2d0[4] = 0;

+  _uStack_2a8 = 0;

+  local_308 = '\x01';

+  if (param_4 != 0) {

+    *(undefined4 *)(param_1 + 0x278) = *(undefined4 *)(param_4 + 0x54);

+  }

+  local_258 = *param_6;

+  uStack_254 = param_6[1];

+  uStack_250 = param_6[2];

+  uStack_24c = param_6[3];

+  uVar2 = RefsParseName(&local_258);

+  if ((((uVar2 == '\0') || ((local_298[0] & 1) != 0)) || ((local_298[0] & 6) == 0)) ||

+     (0x1fe < local_270[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_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+    }

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

+      uVar7 = 0x2e5c;

+      goto LAB_0;

+    }

+  }

+  else {

+    if (((local_298[0] & 2) != 0) &&

+       (_Var4 = RefsGetAttributeTypeCode(*(_VCB **)(param_1 + 0x40),local_280),

+       (short)_Var4 != *(short *)(param_3 + 0xd8))) {

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+      }

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

+        uVar7 = 0x2e67;

+LAB_1:

+        RefsStatusDebug(-0x3fffff45,(_IRP_CONTEXT *)0x0,"FileInfo.c",uVar7);

+      }

+LAB_2:

+      local_304 = -0x3fffff45;

+      goto LAB_3;

+    }

+    if (*(short *)(param_3 + 0xd8) == 0xb0) {

+      if (local_270[0] == 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_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+        }

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

+          uVar7 = 0x2e7d;

+          goto LAB_1;

+        }

+        goto LAB_2;

+      }

+      cVar3 = FsRtlAreNamesEqual(param_3 + 0xe0,local_270);

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

+        local_304 = 0;

+        goto LAB_3;

+      }

+      uVar7 = in_stack_fffffffffffffcb0 & 0xffffff00;

+      _Var4 = (_REFS_ATTRIBUTE_TYPE_CODE)*(ushort *)(param_3 + 0xd8);

+      local_308 = RefsAttributeManager::LookupAttribute

+                            (local_248,param_1,param_2,(uint)*(ushort *)(param_3 + 0xd8),

+                             (_UNICODE_STRING *)local_270,'\0','\x01');

+      _uStack_2a8 = CONCAT26(*(undefined2 *)(param_3 + 0x104),

+                             CONCAT24(*(undefined2 *)(param_3 + 0x102),uStack_2a8));

+      if ((*(uint *)(param_3 + 300) & 1) != 0) {

+        local_2d0[0] = local_2d0[0] | 0x100000000;

+      }

+      local_304 = RefsCreateAttributeWithValueEx

+                            (param_1,param_2,(_UNICODE_STRING *)local_270,_Var4,local_2d0,uVar7,

+                             (uint)(param_5 != '\0'),&local_2f8);

+      p_Var1 = local_2f8;

+      if (local_304 < 0) goto LAB_3;

+      if (*(int *)(local_2f8 + 0xa0) == 0) {

+        local_2e8 = 0;

+        cVar3 = MmCanFileBeTruncated(*(longlong *)(local_2f8 + 0xf8) + 8);

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

+          if (*(longlong *)(p_Var1 + 0x20) == 0) {

+            if (((*(short *)(param_3 + 0xd8) == 0x80) || (*(short *)(param_3 + 0xd8) == 0xb0)) &&

+               (((*(uint *)(param_3 + 0x98) & 0x6000000) != 0 ||

+                (*(longlong *)(param_3 + 0x1f0) == -1)))) {

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

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

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

+                RefsPackFileId((_REFS_FILE_REFERENCE *)

+                               (*(longlong *)(*(longlong *)(param_3 + 0x88) + 0x58) + 0xf8));

+                WPP_SF_qqZqiqDZDi(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+              }

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

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

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

+                WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+              }

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

+                RefsStatusDebug(-0x3fffffde,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x2ee9);

+              }

+              local_304 = -0x3fffffde;

+              goto LAB_3;

+            }

+            if ((((*(ushort *)(local_2f8 + 0x100) >> 0xe & 1) != 0) &&

+                ((*(short *)(local_2f8 + 0xd8) == 0x80 || (*(short *)(local_2f8 + 0xd8) == 0xb0))))

+               && (DAT_4 != (code *)0x0)) {

+              local_2e0 = 0;

+              local_2f0 = 0;

+              iVar5 = (*DAT_4)(param_1);

+              if ((-1 < iVar5) && (local_2f0 == 1 || local_2f0 == 2)) {

+                if (DAT_5 == (code *)0x0) {

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

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

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

+                    WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+                  }

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

+                    RefsStatusDebug(-0x3ffffff0,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x2f10);

+                  }

+                  local_304 = -0x3ffffff0;

+                  goto LAB_3;

+                }

+                local_304 = (*DAT_5)(param_1);

+                if (local_304 < 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_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+                  }

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

+                    RefsStatusDebug(local_304,(_IRP_CONTEXT *)0x0,"FileInfo.c",0x2f0a);

+                  }

+                  goto LAB_3;

+                }

+              }

+            }

+            RefsSnapshotScb(param_1,param_3,0);

+            RefsSnapshotScb(param_1,local_2f8,0);

+            RefsRenameAttributePriv(param_1,param_3,local_2f8);

+            RefsPostUsnChange(param_1,param_2,0x200000,(_FILE_NAME *)0x0);

+            RefsCheckpointCurrentTransaction(param_1);

+            RefsUpdateFcbTimestamps(*(_FCB **)(param_3 + 0x88),(_CCB *)0x0,0xa0000010);

+            local_308 = '\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])) {

+            WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+          }

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

+            uVar7 = 0x2ecd;

+            goto LAB_0;

+          }

+          goto LAB_6;

+        }

+      }

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+      }

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

+        uVar7 = 0x2ec3;

+        goto LAB_0;

+      }

+    }

+    else {

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

+      }

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

+        uVar7 = 0x2e74;

+LAB_0:

+        RefsStatusDebug(-0x3ffffff3,(_IRP_CONTEXT *)0x0,"FileInfo.c",uVar7);

+      }

+    }

+  }

+LAB_6:

+  local_304 = -0x3ffffff3;

+LAB_3:

+  RefsAttributeManager::Cleanup(local_248,param_1);

+  p_Var1 = local_2f8;

+  if ((local_2f8 != (_SCB *)0x0) &&

+     (p_Var6 = local_2f8, RefsDecrementCloseCounts(param_1,local_2f8,(_LCB *)0x0,'\0','\0',1),

+     local_308 == '\0')) {

+    RefsMarkScbAsDeleted(p_Var1,(DeletedScbMayBeMorgue)p_Var6);

+    RefsTeardownStructures(param_1,p_Var1,(_LCB *)0x0);

+  }

+  return local_304;

+}

+
```

## ``CmsVolume::ValidateCheckpointRecord'::__l2::<lambda_1>::operator()`  (modified)

```diff
--- `CmsVolume::ValidateCheckpointRecord'::__l2::<lambda_1>::operator()
+++ `CmsVolume::ValidateCheckpointRecord'::__l2::<lambda_1>::operator()
@@ -1,169 +1,170 @@
 

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

 /* WARNING: Removing unreachable block (ram,0x000140105580) */

 

-long `MsExpandStackAndCallout<`CmsVolume::ReadPage'::__l2::<lambda_1>_>'::operator()

-               (longlong param_1)

+long `CmsVolume::ValidateCheckpointRecord'::__l2::<lambda_1>::operator()(undefined8 *param_1)

 

 {

   byte bVar1;

   uint uVar2;

+  SmsCheckpointRecord *this;

   CmsVolume *pCVar3;

   undefined8 *puVar4;

-  longlong lVar5;

-  undefined8 uVar6;

-  bool bVar7;

-  long lVar8;

-  int iVar9;

-  undefined8 *in_RAX;

-  ulong *puVar10;

-  ulong *puVar11;

-  LcnWithChecksum *pLVar12;

-  _LCN_TUPLE *p_Var13;

-  ulonglong *puVar14;

+  bool bVar5;

+  long lVar6;

+  int iVar7;

+  ulong *puVar8;

+  ulong *puVar9;

+  LcnWithChecksum *pLVar10;

+  _LCN_TUPLE *p_Var11;

+  longlong *plVar12;

+  ulong uVar13;

+  void *pvVar14;

   ulong uVar15;

-  void *unaff_RBX;

-  longlong unaff_RBP;

-  ulong uVar16;

-  SmsCheckpointRecord *unaff_RDI;

-  char *pcVar17;

-  ulonglong uVar18;

-  SmsBigIdentifier *pSVar19;

-  uint uVar20;

-  longlong unaff_R15;

-  uchar in_stack_00000068;

+  char *pcVar16;

+  ulonglong uVar17;

+  SmsBigIdentifier *pSVar18;

+  uint uVar19;

+  undefined1 auStackY_e8 [32];

+  uchar in_stack_ffffffffffffff80;

+  uchar local_68;

+  uchar local_67 [3];

+  ulong local_64;

+  void *local_60;

+  unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_> local_58 [16];

+  SmsBigIdentifier *local_48;

+  ulong local_40 [4];

+  ulonglong local_30;

   

-  pCVar3 = (CmsVolume *)*in_RAX;

-  uVar20 = **(int **)(param_1 + 8) << ((byte)*(undefined4 *)(pCVar3 + 0x40) & 0x1f);

-  *(undefined1 *)(unaff_RBP + -8) = *(undefined1 *)**(undefined8 **)(unaff_R15 + 0x18);

-  if (uVar20 != 0) {

-    puVar4 = *(undefined8 **)(unaff_R15 + 0x28);

-    pcVar17 = (char *)unaff_RDI;

-    lVar8 = CmsVolume::ComputeOrVerifySelfChecksumBlock<SmsCheckpointRecord>(pCVar3);

-    if (lVar8 < 0) {

-      DbgPrintEx((int)unaff_RBX + 0x65,0,

-                 "Checkpoint at LCN=0x%llx failed checksum validation, status=0x%x\n",

-                 *(undefined8 *)*puVar4,lVar8);

+  local_30 = __security_cookie ^ (ulonglong)auStackY_e8;

+  pvVar14 = (void *)0x0;

+  local_40[0] = 0xc;

+  local_60 = (void *)0x0;

+  local_68 = '\0';

+  this = *(SmsCheckpointRecord **)*param_1;

+  local_40[1] = 7;

+  local_40[2] = 8;

+  pCVar3 = *(CmsVolume **)param_1[2];

+  uVar19 = *(int *)param_1[1] << ((byte)*(undefined4 *)(pCVar3 + 0x40) & 0x1f);

+  local_67[0] = **(uchar **)param_1[3];

+  if (uVar19 != 0) {

+    puVar4 = (undefined8 *)param_1[5];

+    pcVar16 = (char *)this;

+    lVar6 = CmsVolume::ComputeOrVerifySelfChecksumBlock<SmsCheckpointRecord>

+                      (pCVar3,pCVar3,this,uVar19);

+    if (lVar6 < 0) {

+      DbgPrintEx(0x65,0,"Checkpoint at LCN=0x%llx failed checksum validation, status=0x%x\n",

+                 *(undefined8 *)*puVar4);

       utl::unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>::

       ~unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>

                 ((unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_> *)

-                 (unaff_RBP + -1));

-      return lVar8;

+                 &local_60);

+      return lVar6;

     }

-    uVar2 = *(uint *)(unaff_RDI + 0x90);

-    uVar18 = (ulonglong)uVar2;

-    if ((((uVar2 <= uVar20 >> 2) && (4 < uVar2)) &&

-        (((*(uint *)(unaff_RDI + 0x78) & 0x200) == 0 ||

-         ((((bVar7 = CmsVolume::VersionCheck(*(CmsVolume **)(unaff_R15 + 0x30),0x30b), bVar7 &&

-            (uVar2 = *(uint *)(unaff_RDI + 0x98), *(int *)(unaff_RDI + 0x94) + uVar2 <= uVar20)) &&

-           (3 < uVar2)) && ((uVar18 & 0xffffffff) << 2 <= (ulonglong)uVar2)))))) &&

-       ((iVar9 = Feature_2834018616__private_IsEnabledDeviceUsageNoInline(), iVar9 == 0 ||

-        (*(uint *)(unaff_RDI + 0x90) < 0x1b)))) {

-      uVar16 = 0;

-      uVar2 = *(int *)(unaff_RDI + 0x90) * 4 + 0xa8;

-      if (*(int *)(unaff_RDI + 0x90) != 0) {

+    uVar2 = *(uint *)(this + 0x90);

+    uVar17 = (ulonglong)uVar2;

+    if ((((uVar2 <= uVar19 >> 2) && (4 < uVar2)) &&

+        (((*(uint *)(this + 0x78) & 0x200) == 0 ||

+         ((((bVar5 = CmsVolume::VersionCheck((CmsVolume *)param_1[6],0x30b), bVar5 &&

+            (uVar2 = *(uint *)(this + 0x98), *(int *)(this + 0x94) + uVar2 <= uVar19)) &&

+           (3 < uVar2)) && ((uVar17 & 0xffffffff) << 2 <= (ulonglong)uVar2)))))) &&

+       ((iVar7 = Feature_2834018616__private_IsEnabledDeviceUsageNoInline(), iVar7 == 0 ||

+        (*(uint *)(this + 0x90) < 0x1b)))) {

+      uVar15 = 0;

+      uVar2 = *(int *)(this + 0x90) * 4 + 0xa8;

+      if (*(int *)(this + 0x90) != 0) {

         do {

-          uVar15 = uVar16;

-          puVar10 = SmsCheckpointRecord::GetGlobalTableOffset(unaff_RDI,uVar16,(ulong)pcVar17);

-          if (((*puVar10 < uVar2) ||

-              (puVar10 = SmsCheckpointRecord::GetGlobalTableOffset(unaff_RDI,uVar15,(ulong)pcVar17),

-              uVar20 < *puVar10)) ||

-             (puVar10 = SmsCheckpointRecord::GetGlobalTableOffset(unaff_RDI,uVar15,(ulong)pcVar17),

-             (ulonglong)uVar20 < (ulonglong)*puVar10 + 0x28)) goto LAB_0;

-          puVar10 = SmsCheckpointRecord::GetGlobalTableOffset(unaff_RDI,uVar15,(ulong)pcVar17);

-          puVar11 = SmsCheckpointRecord::GetGlobalTableOffset(unaff_RDI,uVar15,(ulong)pcVar17);

-          if ((((*puVar10 + 7 & 0xfffffff8) != *puVar11) ||

-              (pLVar12 = SmsCheckpointRecord::GetGlobalTableRoot(unaff_RDI,uVar15,(ulong)pcVar17),

-              uVar20 < *(uint *)(pLVar12 + 0x24))) ||

-             (((iVar9 = Feature_1069541689__private_IsEnabledDeviceUsageNoInline(), iVar9 != 0 &&

-               (0x20 < *(uint *)(pLVar12 + 0x24))) ||

-              (puVar10 = SmsCheckpointRecord::GetGlobalTableOffset(unaff_RDI,uVar16,(ulong)pcVar17),

-              (ulonglong)uVar20 < (ulonglong)*(uint *)(pLVar12 + 0x24) + 0x28 + (ulonglong)*puVar10)

-              ))) goto LAB_0;

+          uVar13 = uVar15;

+          puVar8 = SmsCheckpointRecord::GetGlobalTableOffset(this,uVar15,(ulong)pcVar16);

+          if (((*puVar8 < uVar2) ||

+              (puVar8 = SmsCheckpointRecord::GetGlobalTableOffset(this,uVar13,(ulong)pcVar16),

+              uVar19 < *puVar8)) ||

+             (puVar8 = SmsCheckpointRecord::GetGlobalTableOffset(this,uVar13,(ulong)pcVar16),

+             (ulonglong)uVar19 < (ulonglong)*puVar8 + 0x28)) goto LAB_0;

+          puVar8 = SmsCheckpointRecord::GetGlobalTableOffset(this,uVar13,(ulong)pcVar16);

+          puVar9 = SmsCheckpointRecord::GetGlobalTableOffset(this,uVar13,(ulong)pcVar16);

+          if ((((*puVar8 + 7 & 0xfffffff8) != *puVar9) ||

+              (pLVar10 = SmsCheckpointRecord::GetGlobalTableRoot(this,uVar13,(ulong)pcVar16),

+              uVar19 < *(uint *)(pLVar10 + 0x24))) ||

+             (((iVar7 = Feature_1069541689__private_IsEnabledDeviceUsageNoInline(), iVar7 != 0 &&

+               (0x20 < *(uint *)(pLVar10 + 0x24))) ||

+              (puVar8 = SmsCheckpointRecord::GetGlobalTableOffset(this,uVar15,(ulong)pcVar16),

+              (ulonglong)uVar19 < (ulonglong)*(uint *)(pLVar10 + 0x24) + 0x28 + (ulonglong)*puVar8))

+             )) goto LAB_0;

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

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

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

-            pcVar17 = &WPP_2c4621e30498338a815405359d03a445_Traceguids;

+            pcVar16 = &WPP_2c4621e30498338a815405359d03a445_Traceguids;

             WPP_SF_Dq(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xd,

-                      &WPP_2c4621e30498338a815405359d03a445_Traceguids,uVar16,*(undefined8 *)pLVar12

-                     );

+                      &WPP_2c4621e30498338a815405359d03a445_Traceguids,uVar15);

           }

-          uVar16 = uVar16 + 1;

-        } while (uVar16 < *(uint *)(unaff_RDI + 0x90));

+          uVar15 = uVar15 + 1;

+        } while (uVar15 < *(uint *)(this + 0x90));

       }

-      if ((*(int *)(unaff_RDI + 0x8c) == 0) ||

-         ((uVar2 <= *(uint *)(unaff_RDI + 0x88) &&

-          (*(int *)(unaff_RDI + 0x8c) + *(uint *)(unaff_RDI + 0x88) <= uVar20)))) {

-        if (*(char *)(unaff_RBP + -8) != (char)unaff_RBX) {

-          pSVar19 = *(SmsBigIdentifier **)(unaff_R15 + 0x10);

-          puVar10 = (ulong *)(unaff_RBP + 0x1f);

-          *(SmsBigIdentifier **)(unaff_RBP + 0x17) = pSVar19;

-          uVar20 = 0;

-          uVar18 = (ulonglong)unaff_RBX & 0xff;

+      if ((*(int *)(this + 0x8c) == 0) ||

+         ((uVar2 <= *(uint *)(this + 0x88) &&

+          (*(int *)(this + 0x8c) + *(uint *)(this + 0x88) <= uVar19)))) {

+        if (local_67[0] != '\0') {

+          local_48 = (SmsBigIdentifier *)param_1[2];

+          puVar8 = local_40;

+          uVar19 = 0;

           do {

-            if ((char)uVar18 != '\0') goto LAB_0;

-            uVar16 = *puVar10;

-            *(ulong *)(unaff_RBP + -5) = uVar16;

-            p_Var13 = (_LCN_TUPLE *)

-                      SmsCheckpointRecord::GetGlobalTableRoot(unaff_RDI,uVar16,(ulong)pcVar17);

-            lVar5 = *(longlong *)pSVar19;

-            *(undefined1 *)(unaff_RBP + -8) = 0;

-            bVar1 = *(byte *)(lVar5 + 0x48);

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

-              puVar14 = (ulonglong *)utl::make_unique<enum_utl::byte_[0],0>(unaff_RBP + 7);

-              unaff_RBX = (void *)*puVar14;

-              *puVar14 = 0;

-              *(void **)(unaff_RBP + -1) = unaff_RBX;

+            if (local_68 != '\0') goto LAB_0;

+            local_64 = *puVar8;

+            pSVar18 = local_48;

+            p_Var11 = (_LCN_TUPLE *)

+                      SmsCheckpointRecord::GetGlobalTableRoot(this,local_64,(ulong)pcVar16);

+            bVar1 = *(byte *)(*(longlong *)pSVar18 + 0x48);

+            local_67[0] = local_68;

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

+              plVar12 = (longlong *)utl::make_unique<enum_utl::byte_[0],0>((__uint64)local_58);

+              pvVar14 = (void *)*plVar12;

+              *plVar12 = 0;

+              local_60 = pvVar14;

               utl::unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>::

-              ~unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>

-                        ((unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>

-                          *)(unaff_RBP + 7));

-              if (unaff_RBX != (void *)0x0) goto LAB_1;

-LAB_2:

-              uVar18 = (ulonglong)*(byte *)(unaff_RBP + -9);

+              ~unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>(local_58)

+              ;

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

             }

             else {

 LAB_1:

-              lVar8 = CmsVolume::ReadAndRepairSelfChecksumBlock

-                                (*(CmsVolume **)(unaff_R15 + 0x30),

-                                 (CmsTransactionContext *)**(undefined8 **)(unaff_R15 + 0x20),

-                                 pcVar17,pSVar19,p_Var13,1 << (bVar1 & 0x1f),unaff_RBX,

-                                 ValidateGlobalTableRootBlock,ChooseGlobalTableRootBlock,

-                                 (uchar *)(unaff_RBP + -8),(_SmsScrubIoOutput *)0x0,

-                                 (_SCRUB_PARITY_EXTENT_DATA *)0x0,p_Var13,in_stack_00000068,'\0');

-              if ((-1 < lVar8) && (*(char *)(unaff_RBP + -8) != '\0')) goto LAB_2;

-              pcVar17 = "GlobalTable[%u] at LCN=0x%llx failed checksum validation, status=0x%x\n";

-              uVar6 = *(undefined8 *)p_Var13;

-              uVar18 = 1;

-              *(undefined1 *)(unaff_RBP + -9) = 1;

-              DbgPrintEx(0x65,0,

-                         "GlobalTable[%u] at LCN=0x%llx failed checksum validation, status=0x%x\n",

-                         *(undefined4 *)(unaff_RBP + -5),uVar6);

+              lVar6 = CmsVolume::ReadAndRepairSelfChecksumBlock

+                                ((CmsVolume *)param_1[6],*(CmsTransactionContext **)param_1[4],

+                                 pcVar16,pSVar18,p_Var11,1 << (bVar1 & 0x1f),pvVar14,

+                                 ValidateGlobalTableRootBlock,ChooseGlobalTableRootBlock,local_67,

+                                 (_SmsScrubIoOutput *)0x0,(_SCRUB_PARITY_EXTENT_DATA *)0x0,p_Var11,

+                                 in_stack_ffffffffffffff80,'\0');

+              if ((lVar6 < 0) || (local_67[0] == '\0')) {

+                pcVar16 = "GlobalTable[%u] at LCN=0x%llx failed checksum validation, status=0x%x\n";

+                local_68 = '\x01';

+                DbgPrintEx(0x65,0,

+                           "GlobalTable[%u] at LCN=0x%llx failed checksum validation, status=0x%x\n"

+                           ,local_64);

+              }

             }

-            pSVar19 = *(SmsBigIdentifier **)(unaff_RBP + 0x17);

-            uVar20 = uVar20 + 1;

-            puVar10 = puVar10 + 1;

-          } while (uVar20 < 3);

-          if ((char)uVar18 != '\0') goto LAB_0;

+            uVar19 = uVar19 + 1;

+            puVar8 = puVar8 + 1;

+          } while (uVar19 < 3);

+          if (local_68 != '\0') goto LAB_0;

         }

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

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

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

           WPP_SF_Diiii(*(undefined8 *)(WPP_GLOBAL_Control + 0x18));

         }

         utl::unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>::

         ~unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>

                   ((unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_> *)

-                   (unaff_RBP + -1));

+                   &local_60);

         return 0;

       }

     }

   }

 LAB_0:

   utl::unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>::

   ~unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_>

             ((unique_ptr<void,tlx::generic_delete<void,tlx::operator_delete_deallocate>_> *)

-             (unaff_RBP + -1));

+             &local_60);

   return -0x3ffffae8;

 }
```

## `CmsVolume::ReadAndRepairSelfChecksumBlock`  (modified)

```diff
--- CmsVolume::ReadAndRepairSelfChecksumBlock
+++ CmsVolume::ReadAndRepairSelfChecksumBlock
@@ -1,2 +1,371 @@
-Failed to decompile refs.sys - .ProgramDB CmsVolume::ReadAndRepairSelfChecksumBlock : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

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

+/* private: long __cdecl CmsVolume::ReadAndRepairSelfChecksumBlock(class CmsTransactionContext *

+   __ptr64,void * __ptr64,union SmsBigIdentifier * __ptr64,union _LCN_TUPLE const * __ptr64,unsigned

+   long,void * __ptr64,unsigned char (__cdecl*)(class CmsTransactionContext * __ptr64,class

+   CmsVolume * __ptr64,void * __ptr64,union _LCN_TUPLE const * __ptr64,unsigned long,void *

+   __ptr64),enum _RTL_GENERIC_COMPARE_RESULTS (__cdecl*)(void * __ptr64,void * __ptr64,unsigned

+   long),unsigned char * __ptr64,struct _SmsScrubIoOutput * __ptr64,struct _SCRUB_PARITY_EXTENT_DATA

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

+

+long __thiscall

+CmsVolume::ReadAndRepairSelfChecksumBlock

+          (CmsVolume *this,CmsTransactionContext *param_1,void *param_2,SmsBigIdentifier *param_3,

+          _LCN_TUPLE *param_4,ulong param_5,void *param_6,

+          _func_uchar_CmsTransactionContext_ptr_CmsVolume_ptr_void_ptr__LCN_TUPLE_ptr_ulong_void_ptr

+          *param_7,_func__RTL_GENERIC_COMPARE_RESULTS_void_ptr_void_ptr_ulong *param_8,

+          uchar *param_9,_SmsScrubIoOutput *param_10,_SCRUB_PARITY_EXTENT_DATA *param_11,

+          void *param_12,uchar param_13,uchar param_14)

+

+{

+  undefined4 uVar1;

+  bool bVar2;

+  _LCN_TUPLE *p_Var3;

+  _SmsReadCopyContext *p_Var4;

+  bool bVar5;

+  uchar uVar6;

+  char cVar7;

+  int iVar8;

+  long lVar9;

+  _RTL_GENERIC_COMPARE_RESULTS _Var10;

+  long lVar11;

+  uint *puVar12;

+  uint *puVar13;

+  longlong lVar14;

+  ushort uVar15;

+  ulong uVar16;

+  longlong *plVar17;

+  ulonglong uVar18;

+  uchar *puVar19;

+  ushort uVar20;

+  ulong uVar21;

+  ulonglong uVar22;

+  uint uVar23;

+  uint uVar24;

+  uint uVar25;

+  undefined1 auStackY_158 [32];

+  uint local_114;

+  ulong local_110;

+  uint local_10c;

+  uint local_108;

+  long local_104;

+  undefined8 local_100;

+  _LCN_TUPLE *local_f8;

+  uchar *local_f0;

+  uint local_e8;

+  uint local_e4;

+  undefined4 uStack_e0;

+  uint local_dc;

+  undefined4 uStack_d8;

+  void *local_d0;

+  CmsTransactionContext *local_c8;

+  _func_uchar_CmsTransactionContext_ptr_CmsVolume_ptr_void_ptr__LCN_TUPLE_ptr_ulong_void_ptr

+  *local_c0;

+  _SmsScrubIoOutput *local_b8;

+  _SmsTopologyIds *local_b0;

+  void *local_a8;

+  undefined8 local_a0;

+  undefined8 uStack_98;

+  _func__RTL_GENERIC_COMPARE_RESULTS_void_ptr_void_ptr_ulong *local_90;

+  uint *local_88;

+  _SCRUB_PARITY_EXTENT_DATA *local_80;

+  undefined8 local_78;

+  longlong local_70 [4];

+  uint local_50 [4];

+  ulonglong local_40;

+  

+  local_40 = __security_cookie ^ (ulonglong)auStackY_158;

+  local_a8 = param_6;

+  local_c0 = param_7;

+  local_90 = param_8;

+  local_f0 = param_9;

+  local_80 = param_11;

+  uVar25 = param_5 << ((byte)*(undefined4 *)(this + 0x40) & 0x1f);

+  local_d0 = param_12;

+  local_f8 = param_4;

+  local_b8 = param_10;

+  local_e8 = uVar25;

+  local_c8 = param_1;

+  iVar8 = Feature_808440122__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar8 != 0) && (*(uint *)(this + 0xcf4) < uVar25)) {

+    return -0x3fffffce;

+  }

+  plVar17 = local_70;

+  local_110 = *(ulong *)(this + 0xc60);

+  uVar1 = *(undefined4 *)(this + 0x40);

+  uVar24 = 1;

+  local_100 = 0;

+  puVar12 = local_50;

+  uVar23 = 0;

+  local_10c = 0;

+  local_104 = 0;

+  bVar2 = false;

+  local_108 = 0;

+  local_70[0] = 0;

+  local_70[1] = 0;

+  local_70[2] = 0;

+  local_70[3] = 0;

+  local_50[0] = 0;

+  local_50[1] = 0;

+  local_50[2] = 0;

+  local_50[3] = 0;

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

+    local_70[0] = *(longlong *)param_4;

+    local_50[0] = 1;

+    local_50[1] = 0;

+    uVar23 = 1;

+    do {

+      param_4 = param_4 + 8;

+      lVar14 = *(longlong *)param_4;

+      if (lVar14 == 0) break;

+      if (lVar14 == (ulonglong)*puVar12 + *plVar17) {

+        *puVar12 = *puVar12 + 1;

+      }

+      else {

+        plVar17 = plVar17 + 1;

+        puVar12 = puVar12 + 1;

+        uVar24 = uVar24 + 1;

+        *plVar17 = lVar14;

+        *puVar12 = 1;

+      }

+      uVar23 = uVar23 + 1;

+    } while (uVar23 < 4);

+    uVar23 = uVar24;

+    if (uVar24 != 0) {

+      puVar12 = local_50;

+      uVar22 = (ulonglong)uVar24;

+      plVar17 = local_70;

+      do {

+        *plVar17 = *plVar17 << ((byte)uVar1 & 0x3f);

+        plVar17 = plVar17 + 1;

+        *puVar12 = *puVar12 << ((byte)uVar1 & 0x1f);

+        puVar12 = puVar12 + 1;

+        uVar22 = uVar22 - 1;

+      } while (uVar22 != 0);

+    }

+  }

+  local_b0 = (_SmsTopologyIds *)0x0;

+  local_78 = (_SmsReadCopyContext *)0x0;

+  local_a0 = 0;

+  uStack_98 = 0;

+  bVar5 = false;

+  uVar24 = uVar25;

+  lVar9 = MspInitializeReadCopyContext(local_110,uVar25,(_SmsReadCopyContext **)&local_78);

+  p_Var4 = local_78;

+  if (lVar9 < 0) {

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

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

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

+      WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xc,

+               &WPP_5644838e49f539873aba235bc5b02841_Traceguids,lVar9);

+    }

+LAB_0:

+    bVar2 = bVar5;

+    *local_f0 = '\0';

+LAB_1:

+    memset(local_a8,-0x21524111,(ulonglong)uVar25);

+    if (!bVar2) goto LAB_2;

+  }

+  else {

+    lVar9 = MspInitializeTopologyIds((_SmsTopologyIds *)&local_a0,uVar24);

+    if (lVar9 < 0) {

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

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

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

+        WPP_SF_D(*(undefined8 *)(WPP_GLOBAL_Control + 0x18),0xd,

+                 &WPP_5644838e49f539873aba235bc5b02841_Traceguids,lVar9);

+      }

+      bVar5 = true;

+      bVar2 = true;

+    }

+    else {

+      bVar5 = false;

+    }

+    uVar21 = local_110;

+    puVar12 = (uint *)&DAT_3;

+    *local_f0 = '\0';

+    if (param_10 != (_SmsScrubIoOutput *)0x0) {

+      *(undefined8 *)param_10 = 0;

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

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

+      *(undefined8 *)(param_10 + 0x18) = 0;

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

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

+      *(undefined8 *)(param_10 + 0x30) = 0;

+    }

+    if ((local_110 < 2) || (bVar5)) {

+LAB_4:

+      local_114 = 0;

+      if (uVar21 != 0) goto LAB_5;

+      uVar23 = (uint)local_100;

+    }

+    else {

+      puVar12 = (uint *)0x0;

+      lVar9 = MspQueryTopologyId(*(_VCB **)(this + 0x30),(void *)0x0,(SmsBigIdentifier *)0x0,

+                                 (_LBO_RUN_TUPLE *)local_70,uVar23,0,uVar25,

+                                 (_SmsTopologyIds *)&local_a0);

+      if (lVar9 < 0) goto LAB_4;

+      local_b0 = (_SmsTopologyIds *)&local_a0;

+LAB_5:

+      local_114 = 0;

+      puVar13 = (uint *)0x0;

+      uVar16 = -(uint)(param_10 != (_SmsScrubIoOutput *)0x0) & 2;

+      local_78 = (_SmsReadCopyContext *)

+                 (CONCAT44(local_78._4_4_,-(uint)(param_10 != (_SmsScrubIoOutput *)0x0)) &

+                 0xffffffff00000002);

+      uVar23 = (uint)local_100;

+      local_88 = &local_114;

+      if (uVar21 < 2) {

+        local_88 = puVar13;

+      }

+      do {

+        lVar9 = ReadLcnTuple(this,local_88,(SmsBigIdentifier *)0x0,local_f8,uVar25,

+                             *(void **)(p_Var4 + (longlong)puVar13 * 0x10 + 8),local_88,uVar16);

+        uVar22 = (ulonglong)local_114;

+        *(long *)(p_Var4 + uVar22 * 0x10) = lVar9;

+        if (lVar9 < 0) {

+          if (-1 < local_104) {

+            local_104 = lVar9;

+          }

+          local_108 = local_108 + 1;

+          FsRtlIsTotalDeviceFailure(lVar9);

+        }

+        else {

+          uVar6 = (*local_c0)(local_c8,this,*(void **)(p_Var4 + uVar22 * 0x10 + 8),local_f8,param_5,

+                              local_d0);

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

+            *(undefined4 *)(p_Var4 + uVar22 * 0x10) = 0xc0000470;

+          }

+          else {

+            if ((lVar9 != 0x40000035) && (param_14 == '\0')) {

+              bVar2 = true;

+            }

+            *local_f0 = '\x01';

+            if (local_100._4_1_ == '\0') {

+              local_e4 = local_114;

+              uStack_e0 = CONCAT31(uStack_e0._1_3_,1);

+              local_100 = CONCAT44(uStack_e0,local_114);

+            }

+            else {

+              _Var10 = (*local_90)(*(void **)(p_Var4 + (ulonglong)uVar23 * 0x10 + 8),

+                                   *(void **)(p_Var4 + uVar22 * 0x10 + 8),param_5);

+              if (_Var10 != 0) {

+                if (_Var10 == 2) {

+                  local_10c = local_10c + 1;

+                }

+                goto LAB_6;

+              }

+              local_dc = local_114;

+              uStack_d8 = CONCAT31(uStack_d8._1_3_,1);

+              local_100 = CONCAT44(uStack_d8,local_114);

+              local_10c = 0;

+            }

+            uVar23 = (uint)local_100;

+          }

+        }

+LAB_6:

+        local_114 = local_114 + 1;

+        puVar13 = (uint *)(ulonglong)local_114;

+        puVar12 = local_88;

+        param_10 = local_b8;

+        uVar21 = local_110;

+        uVar16 = (ulong)local_78;

+      } while (local_114 < local_110);

+    }

+    if ((((param_10 == (_SmsScrubIoOutput *)0x0) && (local_108 == uVar21)) &&

+        (lVar9 = ReadLcnTuple(this,puVar12,(SmsBigIdentifier *)0x0,local_f8,uVar25,

+                              *(void **)(p_Var4 + 8),(ulong *)0x0,0), -1 < lVar9)) &&

+       (uVar6 = (*local_c0)(local_c8,this,*(void **)(p_Var4 + 8),local_f8,param_5,local_d0),

+       uVar6 != '\0')) {

+      bVar2 = true;

+      uVar23 = 0;

+      *local_f0 = '\x01';

+    }

+    if (*local_f0 != '\0') {

+      if (bVar2) {

+        if (param_10 != (_SmsScrubIoOutput *)0x0) {

+          uVar18 = (ulonglong)uVar25;

+          *(int *)param_10 = -0x3ffffb96;

+          *(ulonglong *)(param_10 + 0x10) = uVar18;

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

+          lVar14 = *(longlong *)local_f8;

+LAB_7:

+          *(longlong *)(param_10 + 0x28) = lVar14 << ((byte)*(undefined4 *)(this + 0x40) & 0x3f);

+          *(ulonglong *)(param_10 + 0x18) = uVar18;

+          *(ulonglong *)(param_10 + 0x30) = uVar18;

+        }

+      }

+      else if (local_10c < uVar21 - 1) {

+        uVar15 = 0;

+        local_78 = (_SmsReadCopyContext *)((ulonglong)(ushort)uVar23 << 0x10);

+        puVar19 = local_f0;

+        if (local_110 != 0) {

+          puVar19 = (uchar *)(ulonglong)local_110;

+          uVar20 = uVar15;

+          do {

+            param_10 = local_b8;

+            uVar25 = local_e8;

+            if (1 < uVar15) break;

+            if (uVar20 != (ushort)uVar23) {

+              cVar7 = FsRtlIsTotalDeviceFailure(*(undefined4 *)(p_Var4 + (ulonglong)uVar20 * 0x10));

+              puVar19 = (uchar *)(ulonglong)local_110;

+              uVar15 = (ushort)local_78;

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

+                *(ushort *)((longlong)local_70 + ((ulonglong)local_78 & 0xffff) * 2 + -4) = uVar20;

+                uVar15 = (ushort)local_78 + 1;

+                local_78 = (_SmsReadCopyContext *)CONCAT62(local_78._2_6_,uVar15);

+              }

+            }

+            uVar20 = uVar20 + 1;

+            param_10 = local_b8;

+            uVar25 = local_e8;

+          } while ((uint)uVar20 < (uint)puVar19);

+        }

+        p_Var3 = local_f8;

+        if (uVar15 == 0) {

+          lVar11 = -0x3fffff40;

+        }

+        else {

+          lVar11 = RepairFromCopyLcnTuple

+                             (this,puVar19,(SmsBigIdentifier *)0x0,local_f8,uVar25,

+                              (_SmsRepairParameters *)&local_78,local_b0,local_80);

+        }

+        if (param_10 != (_SmsScrubIoOutput *)0x0) {

+          uVar18 = (ulonglong)uVar25;

+          uVar22 = 0;

+          if (lVar11 < 0) {

+            uVar22 = uVar18;

+          }

+          *(ulonglong *)(param_10 + 0x10) = uVar22;

+          uVar22 = (ulonglong)uVar25;

+          if (lVar11 < 0) {

+            uVar22 = 0;

+          }

+          *(ulonglong *)(param_10 + 8) = uVar22;

+          *(long *)param_10 = lVar11;

+          lVar14 = *(longlong *)p_Var3;

+          goto LAB_7;

+        }

+      }

+    }

+    if (*local_f0 == '\0') {

+      bVar2 = true;

+      bVar5 = true;

+      if (lVar9 < 0) goto LAB_0;

+      if (local_104 < 0) {

+        lVar9 = local_104;

+      }

+      goto LAB_1;

+    }

+    lVar9 = 0;

+    memmove(local_a8,*(void **)(p_Var4 + (ulonglong)uVar23 * 0x10 + 8),(ulonglong)uVar25);

+  }

+  MspCleanupTopologyIds((_SmsTopologyIds *)&local_a0);

+LAB_2:

+  if (p_Var4 != (_SmsReadCopyContext *)0x0) {

+    ExFreePoolWithTag(p_Var4,0);

+  }

+  return lVar9;

+}

+
```

## `CmsStream::GhostExtents`  (modified)

```diff
--- CmsStream::GhostExtents
+++ CmsStream::GhostExtents
@@ -1,2 +1,120 @@
-Failed to decompile refs.sys - .ProgramDB CmsStream::GhostExtents : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

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

+/* public: long __cdecl CmsStream::GhostExtents(class CmsTransactionContext *

+   __ptr64,__int64,__int64,struct _GUID,unsigned long,void * __ptr64) __ptr64 */

+

+long __thiscall

+CmsStream::GhostExtents

+          (CmsStream *this,CmsTransactionContext *param_1,__int64 param_2,__int64 param_3,

+          _GUID *param_4,ulong param_5,void *param_6)

+

+{

+  ulonglong uVar1;

+  undefined4 uVar2;

+  undefined2 uVar3;

+  undefined2 uVar5;

+  int iVar6;

+  long lVar7;

+  undefined4 uVar8;

+  uchar auVar9 [8];

+  uchar auVar10 [8];

+  __int64 _Var11;

+  undefined1 auStackY_178 [32];

+  _GUID local_128;

+  void *local_118;

+  __int64 local_108;

+  uchar auStack_100 [8];

+  undefined4 local_f8;

+  undefined4 uStack_f4;

+  undefined4 uStack_f0;

+  undefined4 uStack_ec;

+  undefined4 uStack_e8;

+  undefined4 uStack_e4;

+  ulong uStack_e0;

+  undefined4 local_dc;

+  SmsTableSetLookupStack local_d8 [144];

+  ulonglong local_48;

+  undefined4 uVar4;

+  

+  local_48 = __security_cookie ^ (ulonglong)auStackY_178;

+  local_f8 = 0;

+  local_118 = param_6;

+  uStack_e4 = 0;

+  uStack_e0 = 0;

+  local_dc = 0;

+  uStack_f4 = 0;

+  uStack_f0 = 0;

+  uStack_ec = 0;

+  uStack_e8 = 0;

+  local_108 = param_2;

+  auStack_100 = (uchar  [8])param_3;

+  iVar6 = Feature_612880697__private_IsEnabledDeviceUsageNoInline();

+  if ((iVar6 == 0) || (param_5 < 0xffc8)) {

+    CmsTransactionContext::FreeRunCopies(param_1);

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

+      *(ulonglong *)param_1 = *(ulonglong *)param_1 & 0xfffffe7fffffffff;

+    }

+    CmsTableSetBase::EnterTree(*(CmsTableSetBase **)(this + 0x10),param_1);

+    uVar1 = *(ulonglong *)param_1;

+    *(ulonglong *)param_1 = uVar1 | 0x2000000000;

+    SmsTableSetLookupStack::SmsTableSetLookupStack(local_d8);

+    lVar7 = DeleteAllocation(this,param_1,(_RANGE *)&local_108,0,local_d8);

+    SmsTableSetLookupStack::~SmsTableSetLookupStack(local_d8);

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

+      *(ulonglong *)param_1 = *(ulonglong *)param_1 & 0xffffffdfffffffff;

+    }

+    if (-1 < lVar7) {

+      uStack_e8 = 0xffffffff;

+      uStack_e4 = 0xffffffff;

+      uVar2 = param_4->Data1;

+      uVar3 = param_4->Data2;

+      uVar5 = param_4->Data3;

+      uVar4 = CONCAT22(uVar5,uVar3);

+      uStack_f0 = (undefined4)*(undefined8 *)param_4->Data4;

+      uStack_ec = (undefined4)((ulonglong)*(undefined8 *)param_4->Data4 >> 0x20);

+      local_128.Data4 = auStack_100;

+      uStack_e0 = param_5;

+      _Var11 = local_108;

+      auVar10 = auStack_100;

+      local_f8 = uVar2;

+      uStack_f4 = uVar4;

+      while (auVar10 != (uchar  [8])0x0) {

+        auVar9 = auVar10;

+        if (0xffffffff < (ulonglong)auVar10) {

+          auVar9[0] = 0xff;

+          auVar9[1] = 0xff;

+          auVar9[2] = 0xff;

+          auVar9[3] = 0xff;

+          auVar9[4] = '\0';

+          auVar9[5] = '\0';

+          auVar9[6] = '\0';

+          auVar9[7] = '\0';

+        }

+        uVar8 = auVar9._0_4_;

+        local_128.Data4[0] = (char)uVar8;

+        local_128.Data4[1] = (char)((uint)uVar8 >> 8);

+        local_128.Data4[2] = (char)((uint)uVar8 >> 0x10);

+        local_128.Data4[3] = (char)((uint)uVar8 >> 0x18);

+        local_128._0_8_ = _Var11;

+        lVar7 = AddRun(this,param_1,(_SRANGE *)&local_128,_Var11,0x280,(SmsRun *)0x0,0,

+                       (_SmsRecallMetadataHeader *)&local_f8,local_118);

+        if (lVar7 < 0) {

+          return lVar7;

+        }

+        _Var11 = _Var11 + ((ulonglong)local_128.Data4 & 0xffffffff);

+        auVar10 = (uchar  [8])((longlong)auVar10 - ((ulonglong)local_128.Data4 & 0xffffffff));

+      }

+      local_128.Data1 = param_4->Data1;

+      local_128.Data2 = param_4->Data2;

+      local_128.Data3 = param_4->Data3;

+      local_128.Data4 = *&param_4->Data4;

+      lVar7 = LogRedoForGhostExtents

+                        (this,param_1,local_108,(__int64)auStack_100,&local_128,param_5,local_118);

+    }

+  }

+  else {

+    lVar7 = -0x3ffff6fc;

+  }

+  return lVar7;

+}

+
```

## ``anonymous_namespace'::IndexEntryChecker::IndexEntryChecker`  (modified)

```diff
--- `anonymous_namespace'::IndexEntryChecker::IndexEntryChecker
+++ `anonymous_namespace'::IndexEntryChecker::IndexEntryChecker
@@ -1,69 +1,29 @@
 

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

-

-long `anonymous_namespace'::CmsRulesRANGE::IndexEntryChecker

-               (uint *param_1,int param_2,undefined8 param_3,longlong *param_4)

+undefined8 *

+`anonymous_namespace'::IndexEntryChecker::IndexEntryChecker

+          (undefined8 *param_1,undefined8 *param_2,uint param_3,undefined8 param_4,

+          undefined8 param_5)

 

 {

-  longlong lVar1;

-  uint uVar2;

-  byte bVar3;

-  longlong *plVar4;

-  uint unaff_EBX;

-  longlong unaff_RBP;

-  uint unaff_ESI;

-  long unaff_EDI;

-  uint in_R10D;

-  int *piVar5;

-  uint uVar6;

-  uint uVar7;

-  uint uStack0000000000000040;

-  void *in_stack_00000048;

-  longlong in_stack_00000050;

+  undefined8 *puVar1;

   

-  plVar4 = (longlong *)(ulonglong)(param_2 + unaff_EBX);

-  while ((param_4 = param_4 + 1, in_R10D < 4 && (lVar1 = *param_4, lVar1 != 0))) {

-    if (lVar1 == (ulonglong)*param_1 + *plVar4) {

-      *param_1 = *param_1 + 1;

-    }

-    else {

-      plVar4 = plVar4 + 1;

-      param_1 = param_1 + 1;

-      unaff_ESI = unaff_ESI + unaff_EBX;

-      *plVar4 = lVar1;

-      *param_1 = unaff_EBX;

-    }

-    in_R10D = in_R10D + unaff_EBX;

+  *param_1 = param_2;

+  param_1[1] = (ulonglong)(param_3 >> 3);

+  param_1[2] = param_4;

+  *(undefined4 *)(param_1 + 8) = 0xffffffff;

+  param_1[9] = param_5;

+  puVar1 = param_2 + (param_3 >> 3);

+  *(undefined4 *)(param_1 + 3) = 0;

+  *(undefined4 *)(param_1 + 4) = 0;

+  *(undefined2 *)((longlong)param_1 + 0x24) = 0;

+  param_1[5] = 0;

+  param_1[6] = 0;

+  param_1[7] = 0;

+  *(undefined1 *)((longlong)param_1 + 0x44) = 0;

+  *(uint *)((longlong)param_1 + 0x1c) = param_3 << 6;

+  for (; param_2 != puVar1; param_2 = param_2 + 1) {

+    *param_2 = 0;

   }

-  uVar6 = 0;

-  if (unaff_ESI != 0) {

-    uVar7 = *(uint *)(unaff_RBP + 0x67);

-    plVar4 = (longlong *)(unaff_RBP + -0x51);

-    piVar5 = (int *)(unaff_RBP + -0x31);

-    do {

-      bVar3 = (byte)*(undefined4 *)(in_stack_00000050 + 0x40);

-      uVar2 = *piVar5 << (bVar3 & 0x1f);

-      uStack0000000000000040 = uVar7;

-      if (uVar2 < uVar7) {

-        uStack0000000000000040 = uVar2;

-      }

-      unaff_EDI = MsKmeSynchronousRead

-                            (*(_VCB **)(in_stack_00000050 + 0x30),(void *)0x0,

-                             (SmsBigIdentifier *)0x0,*plVar4 << (bVar3 & 0x3f),

-                             uStack0000000000000040,in_stack_00000048,0);

-      if (unaff_EDI < 0) {

-        return unaff_EDI;

-      }

-      in_stack_00000048 = (void *)((longlong)in_stack_00000048 + (ulonglong)uStack0000000000000040);

-      uVar7 = uVar7 - uStack0000000000000040;

-      if (uVar7 == 0) {

-        return unaff_EDI;

-      }

-      uVar6 = uVar6 + unaff_EBX;

-      piVar5 = piVar5 + 1;

-      plVar4 = plVar4 + 1;

-    } while (uVar6 < unaff_ESI);

-  }

-  return unaff_EDI;

+  return param_1;

 }
```

## `utl::make_unique<_MS_TELEMETRY_DATA,0>`  (modified)

```diff
--- utl::make_unique<_MS_TELEMETRY_DATA,0>
+++ operator_new
@@ -1,2 +1,12 @@
-Failed to decompile refs.sys - .ProgramDB utl::make_unique<_MS_TELEMETRY_DATA,0> : Error: Decompile error: 
-Marshaling error: Did not see expected closing element+

+/* void * __ptr64 __cdecl operator new(unsigned __int64,struct std::nothrow_t const & __ptr64) */

+

+void * __cdecl operator_new(__uint64 param_1,nothrow_t *param_2)

+

+{

+  void *pvVar1;

+  

+  pvVar1 = (void *)ExAllocatePoolWithTag(0x200,param_1,0x6950534d);

+  return pvVar1;

+}

+
```

## `NTOSKRNL.EXE::ExAllocatePoolWithTag`  (modified)

```diff
--- NTOSKRNL.EXE::ExAllocatePoolWithTag calling
+++ NTOSKRNL.EXE::ExAllocatePoolWithTag calling
@@ -2,0 +3 @@
+CheckIndexHeaderRecurse
@@ -60 +60,0 @@
-CmsVolume::ReadAndRepairSelfChecksumBlock
@@ -81,2 +81,2 @@
-FUN_14003b515
-FUN_1401c81d2
+FUN_140039795
+FUN_1401c89a4
@@ -131,0 +132 @@
+MspInitializeReadCopyContext
@@ -174,2 +174,0 @@
-RefsFindIndexEntry
-RefsFindIndexEntryByRow
```

## `NTOSKRNL.EXE::ExFreePoolWithTag`  (modified)

```diff
--- NTOSKRNL.EXE::ExFreePoolWithTag calling
+++ NTOSKRNL.EXE::ExFreePoolWithTag calling
@@ -3,0 +4 @@
+CheckIndexHeaderRecurse
@@ -155,12 +156,12 @@
-FUN_1400148a4
-FUN_14001bcd5
-FUN_14003b515
-FUN_140047bac
-FUN_14004bbfc
-FUN_1401c4be8
-FUN_1401c4c1d
-FUN_1401c4ca6
-FUN_1401c53f4
-FUN_1401c6811
-FUN_1401c9c40
-FUN_140308fe4
+FUN_140012d24
+FUN_14001a155
+FUN_140039795
+FUN_140050c5c
+FUN_140056a3c
+FUN_1401c5194
+FUN_1401c51c9
+FUN_1401c5252
+FUN_1401c6e90
+FUN_1401c75c1
+FUN_1401ca412
+FUN_140309f1e
@@ -300,2 +300,0 @@
-RefsFindIndexEntry
-RefsFindIndexEntryByRow
```
