# CVE-2026-50371 — luafv.sys patch diff

`luafv.sys` 10.0.26100.8521 -> 10.0.26100.8875 (ghidriff).

## `GetUserDesktopPath`  (modified)

```diff
--- GetUserDesktopPath
+++ LuafvFindUser
@@ -1,130 +1,93 @@
 

-int GetUserDesktopPath(undefined8 param_1,short *param_2,ushort *param_3,undefined8 *param_4)

+int LuafvFindUser(undefined8 param_1,longlong *param_2)

 

 {

-  ulonglong uVar1;

-  undefined8 uVar2;

+  longlong lVar1;

+  longlong lVar2;

   char cVar3;

-  ushort uVar4;

-  short sVar5;

-  int iVar6;

-  uint *puVar7;

-  uint uVar8;

-  uint local_res8 [2];

-  longlong local_90;

-  undefined8 local_88;

-  uint *puStack_80;

-  undefined8 local_78;

-  undefined8 uStack_70;

-  undefined8 local_68;

-  uint *puStack_60;

-  undefined8 local_58;

-  undefined8 local_50;

-  undefined *local_48;

-  undefined4 local_40;

-  undefined4 local_3c;

-  undefined8 local_38;

-  undefined8 uStack_30;

+  int iVar4;

+  longlong local_res10;

+  longlong local_res18;

+  undefined8 local_48;

+  longlong lStack_40;

+  longlong local_38;

+  longlong lStack_30;

+  undefined8 local_28;

+  longlong lStack_20;

   

-  local_3c = 0;

-  local_res8[0] = 0;

-  local_90 = 0;

-  local_58 = 0x30;

-  local_48 = &UserShellFoldersPath;

-  local_40 = 0x240;

-  local_78 = 0;

-  uStack_70 = (uint *)0x0;

-  puVar7 = (uint *)0x0;

-  local_68 = 0;

-  puStack_60 = (uint *)0x0;

-  local_88 = 0;

-  puStack_80 = (uint *)0x0;

-  *param_4 = 0;

-  param_4[1] = 0;

+  local_res10 = 0;

+  local_res18 = 0;

+  *param_2 = 0;

+  local_48 = 0;

+  lStack_40 = 0;

   local_38 = 0;

-  uStack_30 = 0;

-  local_50 = param_1;

-  iVar6 = ZwOpenKey(&local_90,0x20019,&local_58);

-  if (-1 < iVar6) {

-    uVar8 = 0x214;

-    puVar7 = LuafvAllocatePool(1,0x214,'\x01');

-    while (puVar7 != (uint *)0x0) {

-      iVar6 = ZwQueryValueKey(local_90,&DesktopFolderValue,2,puVar7,uVar8,local_res8);

-      if (-1 < iVar6) {

-        if (1 < puVar7[1] - 1) {

-          iVar6 = -0x3fffffdc;

-          goto LAB_0;

-        }

-        uVar4 = (short)puVar7[2] - 2;

-        local_68._0_4_ = CONCAT22((short)puVar7[2],uVar4);

-        puStack_60 = LuafvAllocatePool(1,(uint)uVar4,'\x02');

-        if (puStack_60 == (uint *)0x0) break;

-        memmove(puStack_60,puVar7 + 3,local_68 & 0xffff);

-        local_88 = local_68;

-        puStack_80 = puStack_60;

-        cVar3 = RtlPrefixUnicodeString(&UserProfileEnvironmentString,&local_68,1);

-        uVar1 = local_88;

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

-          cVar3 = RtlPrefixUnicodeString(param_3,&local_68,1);

-          uVar1 = local_88;

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

-            uVar4 = *param_3;

-            local_88 = CONCAT62(local_88._2_6_,(short)local_88 - uVar4);

-            uVar2 = local_88;

-            puStack_80 = (uint *)((longlong)puStack_80 + ((ulonglong)uVar4 & 0xfffffffffffffffe));

-            local_88._2_2_ = SUB82(uVar1,2);

-            sVar5 = local_88._2_2_ - uVar4;

-            local_88 = uVar2;

-            goto LAB_1;

-          }

-        }

-        else {

-          local_88 = CONCAT62(local_88._2_6_,(short)local_88 - UserProfileEnvironmentString);

-          uVar2 = local_88;

-          puStack_80 = (uint *)((longlong)puStack_80 +

-                               (ulonglong)(UserProfileEnvironmentString >> 1) * 2);

-          local_88._2_2_ = SUB82(uVar1,2);

-          sVar5 = local_88._2_2_ - UserProfileEnvironmentString;

-          local_88 = uVar2;

+  lStack_30 = 0;

+  local_28 = 0;

+  lStack_20 = 0;

+  cVar3 = ExAcquireRundownProtection(&DAT_0);

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

+    return 0;

+  }

+  FltAcquirePushLockSharedEx(&UserListLock);

+  iVar4 = FindUserWithToken(param_1,'\0',&local_res10);

+  if (iVar4 < 0) {

 LAB_1:

-          local_88._0_4_ = CONCAT22(sVar5,(short)local_88);

-          local_78._0_4_ = CONCAT22(sVar5 + *param_2,(undefined2)local_78);

-          uStack_70 = LuafvAllocatePool(1,(uint)(ushort)(sVar5 + *param_2),'\x02');

-          if (uStack_70 == (uint *)0x0) break;

-          RtlCopyUnicodeString(&local_78,param_2);

-          iVar6 = RtlAppendUnicodeStringToString(&local_78,&local_88);

-          if (iVar6 < 0) goto LAB_0;

-        }

-        *(undefined4 *)param_4 = (undefined4)local_78;

-        *(undefined4 *)((longlong)param_4 + 4) = local_78._4_4_;

-        *(undefined4 *)(param_4 + 1) = (undefined4)uStack_70;

-        *(undefined4 *)((longlong)param_4 + 0xc) = uStack_70._4_4_;

-        if (iVar6 < 0) goto LAB_0;

+    FltReleasePushLockEx(&UserListLock,0);

+  }

+  else {

+    if (((local_res10 == 0) || (*(longlong *)(local_res10 + 0x70) == 0)) ||

+       (*(longlong *)(local_res10 + 0xb8) == 0)) {

+      FltReleasePushLockEx(&UserListLock,0);

+      iVar4 = LuafvFetchProfileDataForToken

+                        (param_1,(ushort *)&local_48,&local_38,&local_res18,&local_28);

+      if (iVar4 < 0) goto LAB_2;

+      FltAcquirePushLockExclusiveEx(&UserListLock,0);

+      iVar4 = FindUserWithToken(param_1,'\x01',&local_res10);

+      lVar2 = lStack_20;

+      lVar1 = local_res18;

+      if (iVar4 < 0) goto LAB_1;

+      if (local_res10 == 0) {

+        FltReleasePushLockEx(&UserListLock,0);

+        iVar4 = -0x3ffffddb;

         goto LAB_2;

       }

-      if ((iVar6 != -0x3fffffdd) && (iVar6 != -0x7ffffffb)) goto LAB_0;

-      LuafvFreePool((longlong)puVar7);

-      uVar8 = local_res8[0];

-      puVar7 = LuafvAllocatePool(1,local_res8[0],'\x01');

+      if (*(longlong *)(local_res10 + 0x70) == 0) {

+        *(undefined8 *)(local_res10 + 0x68) = local_48;

+        *(longlong *)(local_res10 + 0x70) = lStack_40;

+        *(longlong *)(local_res10 + 0x78) = local_38;

+        *(longlong *)(local_res10 + 0x80) = lStack_30;

+        lStack_40 = 0;

+        lStack_30 = 0;

+      }

+      if (*(longlong *)(local_res10 + 0xb8) == 0) {

+        local_res18 = 0;

+        lStack_20 = 0;

+        *(longlong *)(local_res10 + 0xb8) = lVar1;

+        *(undefined8 *)(local_res10 + 0x98) = local_28;

+        *(longlong *)(local_res10 + 0xa0) = lVar2;

+      }

+      *param_2 = local_res10;

     }

-    iVar6 = -0x3fffff66;

+    else {

+      *param_2 = local_res10;

+    }

+    FltReleasePushLockEx(&UserListLock,0);

+    iVar4 = 0;

   }

-LAB_0:

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

-    LuafvFreePool((longlong)uStack_70);

+LAB_2:

+  if (lStack_40 != 0) {

+    LuafvFreePool(lStack_40);

   }

-  *param_4 = 0;

-  param_4[1] = 0;

-LAB_2:

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

-    LuafvFreePool((longlong)puVar7);

+  if (lStack_30 != 0) {

+    LuafvFreePool(lStack_30);

   }

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

-    LuafvFreePool((longlong)puStack_60);

+  if (lStack_20 != 0) {

+    LuafvFreePool(lStack_20);

   }

-  if (local_90 != 0) {

+  if (local_res18 != 0) {

     ZwClose();

   }

-  return iVar6;

+  ExReleaseRundownProtection(&DAT_0);

+  return iVar4;

 }
```

## `RtlCopyToUser`  (modified)

```diff
--- RtlCopyToUser
+++ RtlWriteULongToUser
@@ -1,13 +1,11 @@
 

-/* WARNING: Removing unreachable block (ram,0x000140014a10) */

+/* WARNING: Removing unreachable block (ram,0x000140014b07) */

 

-void RtlCopyToUser(void *param_1,void *param_2,size_t param_3)

+void RtlWriteULongToUser(undefined4 *param_1,undefined4 param_2)

 

 {

-  if (param_3 != 0) {

-    ProbeForRead(param_1,param_3,1);

-    RtlCopyVolatileMemory(param_1,param_2,param_3);

-  }

+  ProbeForRead(param_1,4,1);

+  *param_1 = param_2;

   return;

 }
```

## `FUN_1400149cc`  (modified)

```diff
--- FUN_1400149cc
+++ FUN_140014a8c
@@ -1,8 +1,11 @@
 

-void FUN_1400149cc(undefined8 param_1,undefined8 param_2)

+/* WARNING: Removing unreachable block (ram,0x000140014ab0) */

+

+void FUN_140014a8c(longlong *param_1,undefined8 param_2,undefined1 *param_3)

 

 {

-  RtlConvertSidToUnicodeString(param_1,param_2,1);

+  ProbeForRead(param_1,param_3,1);

+  RtlSetVolatileMemory(param_1,(uint)param_2 & 0xff,(size_t)param_3);

   return;

 }
```

## `GetUserProfilePaths`  (modified)

```diff
--- GetUserProfilePaths
+++ OpenProfileKey
@@ -1,69 +1,48 @@
 

-int GetUserProfilePaths(longlong param_1,undefined8 *param_2,longlong *param_3)

+int OpenProfileKey(undefined8 param_1,undefined8 *param_2)

 

 {

-  longlong lVar1;

-  int iVar2;

-  undefined8 uVar3;

-  longlong local_res8;

-  longlong local_res20;

+  int iVar1;

+  undefined8 local_res8;

   undefined8 local_58;

   longlong lStack_50;

-  longlong local_48;

-  undefined8 uStack_40;

+  undefined *local_48;

+  undefined8 local_40;

   undefined8 local_38;

-  ulonglong uStack_30;

+  undefined8 uStack_30;

+  undefined8 *local_28;

+  undefined8 uStack_20;

+  undefined8 local_18;

+  ulonglong uStack_10;

   

   local_res8 = 0;

-  local_res20 = 0;

+  *param_2 = 0;

+  local_18 = 0;

+  uStack_10 = uStack_10 & 0xffffffff00000000;

+  local_48 = &UserHivePrefix;

   local_38 = 0;

-  uStack_30 = uStack_30 & 0xffffffff00000000;

+  uStack_30 = 0;

+  local_28 = (undefined8 *)0x0;

+  uStack_20 = 0;

   local_58 = 0;

   lStack_50 = 0;

-  local_48 = 0;

-  uStack_40 = 0;

-  if (((param_1 == 0) || (param_2 == (undefined8 *)0x0)) || (param_3 == (longlong *)0x0)) {

-    iVar2 = -0x3ffffff3;

-  }

-  else {

-    *param_2 = 0;

-    param_2[1] = 0;

-    *param_3 = 0;

-    param_3[1] = 0;

-    uVar3 = OpenProfileListKey(&local_res20);

-    lVar1 = local_res20;

-    iVar2 = (int)uVar3;

-    if (-1 < iVar2) {

-      local_58 = CONCAT44(local_58._4_4_,0x30);

-      lStack_50 = local_res20;

-      uStack_40 = CONCAT44(uStack_40._4_4_,0x240);

-      local_38 = 0;

-      uStack_30 = 0;

-      local_48 = param_1;

-      iVar2 = ZwOpenKey(&local_res8,0x20019,&local_58);

-      if (-1 < iVar2) {

-        iVar2 = QueryProfilePaths(local_res8,param_2,param_3);

-      }

-    }

-    if (lVar1 != 0) {

-      ZwClose(lVar1);

-    }

-    if (local_res8 != 0) {

-      ZwClose();

-    }

-    if (iVar2 < 0) {

-      if (param_2[1] != 0) {

-        LuafvFreePool(param_2[1]);

-        *param_2 = 0;

-        param_2[1] = 0;

-      }

-      if (param_3[1] != 0) {

-        LuafvFreePool(param_3[1]);

-        *param_3 = 0;

-        param_3[1] = 0;

-      }

+  local_40 = param_1;

+  iVar1 = LuafvAllocateAndBuildString(&local_48,2,&local_58);

+  if (-1 < iVar1) {

+    uStack_30 = 0;

+    local_28 = &local_58;

+    local_38 = CONCAT44(local_38._4_4_,0x30);

+    uStack_20 = CONCAT44(uStack_20._4_4_,0x240);

+    local_18 = 0;

+    uStack_10 = 0;

+    iVar1 = ZwOpenKey(&local_res8,0x20019,&local_38);

+    if (-1 < iVar1) {

+      *param_2 = local_res8;

     }

   }

-  return iVar2;

+  if (lStack_50 != 0) {

+    LuafvFreePool(lStack_50);

+  }

+  return iVar1;

 }
```

## `FUN_1400050a0`  (modified)

```diff
--- FUN_1400050a0
+++ FUN_140005740
@@ -1,9 +1,16 @@
 

-ulonglong FUN_1400050a0(undefined8 param_1,char param_2,char param_3,undefined8 *param_4)

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

+

+ulonglong FUN_140005740(longlong param_1)

 

 {

-  do {

-                    /* WARNING: Do nothing block with infinite loop */

-  } while( true );

+  undefined1 in_AH;

+  longlong unaff_RBX;

+  longlong unaff_RBP;

+  

+  *(char *)(unaff_RBX + 0xfc085d8) = *(char *)(unaff_RBX + 0xfc085d8) + (char)param_1;

+  *(undefined1 *)(unaff_RBP + -2) = in_AH;

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

+  halt_baddata();

 }
```

## `FLTMGR.SYS::FltAcquirePushLockSharedEx`  (modified)

```diff
--- FLTMGR.SYS::FltAcquirePushLockSharedEx calling
+++ FLTMGR.SYS::FltAcquirePushLockSharedEx calling
@@ -1,8 +1,9 @@
-FUN_140005814
-FUN_140014348
-FUN_140015a98
-FUN_1400179f0
-FUN_140019560
-FUN_14001b5ec
-FUN_14001c4b0
-FUN_1400207f0
+LuafvBuildTableNodeName
+LuafvBuildTableNodeName2
+LuafvCopyShortName
+LuafvFindUser
+LuafvFindUserStore
+LuafvPreAcquireForSectionSynchronization
+LuafvReadAndCacheSecurityDescriptor
+LuafvScavengeFileTable
+LuafvUpdateFileTableForChangeRecord
```

## `NTOSKRNL.EXE::SeQueryInformationToken`  (modified)

```diff
--- NTOSKRNL.EXE::SeQueryInformationToken calling
+++ NTOSKRNL.EXE::SeQueryInformationToken calling
@@ -1,8 +1,9 @@
-FUN_140004610
-FUN_1400049e8
-FUN_140004aa0
-FUN_1400050a0
-FUN_140017e60
-FUN_14001cc98
-FUN_14001ee60
-FUN_14001effc
+FindUser
+FindUserWithToken
+LuafvBuildAdminInformation
+LuafvFetchProfileDataForToken
+LuafvGetUserAndLinkedSystemManagedAdmin
+LuafvIsInstallerCaller
+LuafvIsSystemManagedAdminCaller
+LuafvLogFileEvent
+LuafvQueryVirtualizationCaller
```

## `NTOSKRNL.EXE::ZwClose`  (modified)

```diff
--- NTOSKRNL.EXE::ZwClose calling
+++ NTOSKRNL.EXE::ZwClose calling
@@ -1,19 +1,21 @@
-FUN_140003b8c
-FUN_140004610
-FUN_140004b58
-FUN_140004d5c
-FUN_140005488
-FUN_140005740
-FUN_140014200
-FUN_140015820
-FUN_1400175d0
-FUN_1400183fc
-FUN_140019ae0
-FUN_14001ac1c
-FUN_140022de0
-FUN_140027008
-FUN_140027234
-FUN_1400277e4
-FUN_140027bac
-FUN_1400284e8
-FUN_1400291ec
+ConvertDosPathToNtPath
+DereferenceDvfcb
+GetFileInformation
+GetLocalAppDataStorePath
+GetStaticEntryRoots
+GetUserDesktopPath
+GetUserProfilePaths
+GetVolumeRootFileId
+LuafvCreateMirrorFile
+LuafvDereferenceUser
+LuafvFetchProfileDataForToken
+LuafvFindTableNode
+LuafvFindUser
+LuafvGetUserAndLinkedSystemManagedAdmin
+LuafvInitializeUsn
+LuafvLookupSystemManagedAdminAndUser
+LuafvReadFileTable
+LuafvReadSettings
+LuafvReadSettings$fin$0
+LuafvSkipDriverLoad
+TranslatePath
```

## `FLTMGR.SYS::FltSetCallbackDataDirty`  (modified)

```diff
--- FLTMGR.SYS::FltSetCallbackDataDirty calling
+++ FLTMGR.SYS::FltSetCallbackDataDirty calling
@@ -1,9 +1,9 @@
-FUN_1400010f0
-FUN_140001190
-FUN_1400018d0
-FUN_14001f7d0
-FUN_14001fff0
-FUN_1400204b0
-FUN_1400211ec
-FUN_1400247f0
-FUN_1400254a0
+LuafvPreAcquireForSectionSynchronization
+LuafvPreCreate
+LuafvPreDirectoryControl
+LuafvPreQueryInformation
+LuafvPreRedirect
+LuafvPreRedirectWithCallback
+LuafvPreReleaseForSectionSynchronization
+LuafvPreWrite
+LuafvReparse
```

## `FLTMGR.SYS::FltReleasePushLockEx`  (modified)

```diff
--- FLTMGR.SYS::FltReleasePushLockEx calling
+++ FLTMGR.SYS::FltReleasePushLockEx calling
@@ -1,49 +1,51 @@
-FUN_140001330
-FUN_140005814
-FUN_140005bd0
-FUN_140014200
-FUN_140014348
-FUN_140014d20
-FUN_140014f80
-FUN_1400153b4
-FUN_140015720
-FUN_140015a98
-FUN_140015d80
-FUN_140015f0c
-FUN_1400169ac
-FUN_1400176d4
-FUN_140017798
-FUN_140017894
-FUN_1400179f0
-FUN_140017e60
-FUN_1400183fc
-FUN_140018a74
-FUN_1400193f0
-FUN_140019560
-FUN_140019ae0
-FUN_14001a27c
-FUN_14001aaec
-FUN_14001b150
-FUN_14001b3d0
-FUN_14001b460
-FUN_14001b5ec
-FUN_14001b8f0
-FUN_14001bbec
-FUN_14001bc90
-FUN_14001c4b0
-FUN_14001cc98
-FUN_14001d1b0
-FUN_14001d2f8
-FUN_14001d524
-FUN_14001f668
-FUN_14001fcb0
-FUN_14001fff0
-FUN_1400207f0
-FUN_140020cc0
-FUN_140021544
-FUN_1400216d8
-FUN_140022c3c
-FUN_140022de0
-FUN_1400230a0
-FUN_140023c80
-FUN_140024590
+AcknowledgePauseRequest
+ClearFileTablePostWorker
+CreateChildTable
+CreateTableNode
+DereferenceDvfcb
+FindOrCreateDvfcb
+FindUser
+GetLocalAppDataStorePath
+InsertFileIdTableNode
+LuafvAllocatePool
+LuafvBuildAdminInformation
+LuafvBuildTableNodeName
+LuafvBuildTableNodeName2
+LuafvCopyShortName
+LuafvCreateVirtualFile
+LuafvDereferenceCachedSecurityDescriptor
+LuafvDereferenceTableNodeEx
+LuafvEnumerateFileTable
+LuafvFindTableNode
+LuafvFindUser
+LuafvFindUserStore
+LuafvFreePool
+LuafvGetVolumeProperties
+LuafvInitializeFileTableForVolume
+LuafvInitializeUsn
+LuafvIsTargetWRP
+LuafvOpenDirectory
+LuafvPauseUsn
+LuafvPerformDelayedVirtualization
+LuafvPerformRename
+LuafvPostAcquireForSectionSynchronization
+LuafvPreAcquireForSectionSynchronization
+LuafvPreCleanup
+LuafvPreReleaseForSectionSynchronization
+LuafvPrepareDelayedVirtualization
+LuafvQueryStoreDirectory
+LuafvReadAndCacheSecurityDescriptor
+LuafvResumeUsn
+LuafvScavengeFileTable
+LuafvScavengeUserList
+LuafvTerminateFileTableForVolume
+LuafvTerminatePool
+LuafvTerminateUserStoresForVolume
+LuafvTerminateUsn
+LuafvUnlinkFsContextFromDvfcb
+LuafvUpdateFileTableForChangeRecord
+LuafvUpdateFileTableForFileChange
+RemoveTableNode
+UpdateTableNode
+UserLogoffCallback
+UsnThread
```

## `NTOSKRNL.EXE::ExFreePoolWithTag`  (modified)

```diff
--- NTOSKRNL.EXE::ExFreePoolWithTag calling
+++ NTOSKRNL.EXE::ExFreePoolWithTag calling
@@ -1,11 +1,12 @@
-FUN_1400050a0
-FUN_140016b78
-FUN_140017e60
-FUN_14001b460
-FUN_14001cc98
-FUN_14001effc
-FUN_14001fcb0
-FUN_1400211ec
-FUN_140021940
-FUN_1400247f0
-FUN_14002589b
+FindUser
+FindUserWithToken
+LuafvBuildAdminInformation
+LuafvCopyFile
+LuafvCopyFile$fin$0
+LuafvFetchProfileDataForToken
+LuafvFreePool
+LuafvIsTargetWRP
+LuafvLogFileEvent
+LuafvPreCreate
+LuafvReparse
+LuafvReportAuditVirtualizationEvent
```
