diff --git a/.gitignore b/.gitignore
index 21ac699..1498465 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,5 +4,6 @@
*.ini
*.identcache
*.map
+*.res
_LOG_.txt
__history/
\ No newline at end of file
diff --git a/Vfs.dproj b/Vfs.dproj
index e6e9842..e89a8aa 100644
--- a/Vfs.dproj
+++ b/Vfs.dproj
@@ -30,7 +30,11 @@
Delphi.Personality
VCLApplication
-FalseTrueFalseTrueTrue1024FalseFalseFalseFalseFalse10491251Alexander Shostak (aka EtherniDee)Virtual File System1.0.2.41.0.0.0Vfs.dpr
+FalseTrueFalseTrueTrue1032FalseFalseFalseFalseFalse10491251Alexander Shostak (aka EtherniDee)Virtual File System1.0.3.21.0.0.0Vfs.dpr
+
+
+
+
Microsoft Office 2000 Sample Automation Server Wrapper Components
diff --git a/Vfs.res b/Vfs.res
deleted file mode 100644
index 43bf048..0000000
Binary files a/Vfs.res and /dev/null differ
diff --git a/VfsHooks.pas b/VfsHooks.pas
index 2c47110..061822d 100644
--- a/VfsHooks.pas
+++ b/VfsHooks.pas
@@ -31,6 +31,8 @@ var
NativeNtCreateFile: WinNative.TNtCreateFile;
NativeNtClose: WinNative.TNtClose;
NativeNtQueryDirectoryFile: WinNative.TNtQueryDirectoryFile;
+ NativeNtQueryDirectoryFileEx: WinNative.TNtQueryDirectoryFileEx;
+
NtQueryAttributesFilePatch: VfsPatching.TAppliedPatch;
NtQueryFullAttributesFilePatch: VfsPatching.TAppliedPatch;
@@ -38,6 +40,7 @@ var
NtCreateFilePatch: VfsPatching.TAppliedPatch;
NtClosePatch: VfsPatching.TAppliedPatch;
NtQueryDirectoryFilePatch: VfsPatching.TAppliedPatch;
+ NtQueryDirectoryFileExPatch: VfsPatching.TAppliedPatch;
(* There is no 100% portable and reliable way to get file path by handle, unless file creation/opening
@@ -543,11 +546,28 @@ begin
end;
end; // .function Hook_NtQueryDirectoryFile
+function Hook_NtQueryDirectoryFileEx (OrigFunc: WinNative.TNtQueryDirectoryFileEx; FileHandle: HANDLE; Event: HANDLE; ApcRoutine: pointer; ApcContext: PVOID; Io: PIO_STATUS_BLOCK;
+ Buffer: PVOID; BufLength: ULONG; InfoClass: integer (* FILE_INFORMATION_CLASS *); QueryFlags: integer; Mask: PUNICODE_STRING): NTSTATUS; stdcall;
+var
+ SingleEntry: LONGBOOL;
+ RestartScan: LONGBOOL;
+
+begin
+ if VfsDebug.LoggingEnabled then begin
+ WriteLog('NtQueryDirectoryFileEx', Format('Handle: %x. QueryFlags: %x', [FileHandle, QueryFlags]));
+ end;
+
+ RestartScan := Utils.Flags(QueryFlags).Have(WinNative.SL_RESTART_SCAN);
+ SingleEntry := Utils.Flags(QueryFlags).Have(WinNative.SL_RETURN_SINGLE_ENTRY);
+ result := WinNative.NtQueryDirectoryFile(FileHandle, Event, ApcRoutine, ApcContext, Io, Buffer, BufLength, InfoClass, SingleEntry, Mask, RestartScan);
+end;
+
procedure InstallHooks;
var
- SetProcessDEPPolicy: function (dwFlags: integer): LONGBOOL; stdcall;
- hDll: Windows.THandle;
- NtdllHandle: integer;
+ SetProcessDEPPolicy: function (dwFlags: integer): LONGBOOL; stdcall;
+ hDll: Windows.THandle;
+ NtdllHandle: integer;
+ NtQueryDirectoryFileExAddr: WinNative.TNtQueryDirectoryFileEx;
begin
with HooksCritSection do begin
@@ -622,6 +642,18 @@ begin
@Hook_NtQueryDirectoryFile,
@NtQueryDirectoryFilePatch
);
+
+ NtQueryDirectoryFileExAddr := VfsApiDigger.GetRealProcAddress(NtdllHandle, 'NtQueryDirectoryFileEx');
+
+ if @NtQueryDirectoryFileExAddr <> nil then begin
+ WriteLog('InstallHook', 'Installing NtQueryDirectoryFileEx hook');
+ NativeNtQueryDirectoryFileEx := VfsPatching.SpliceWinApi
+ (
+ @NtQueryDirectoryFileExAddr,
+ @Hook_NtQueryDirectoryFileEx,
+ @NtQueryDirectoryFileExPatch
+ );
+ end;
end; // .if
Leave;
@@ -639,6 +671,7 @@ begin
NtCreateFilePatch.Rollback;
NtClosePatch.Rollback;
NtQueryDirectoryFilePatch.Rollback;
+ NtQueryDirectoryFileExPatch.Rollback;
Leave;
end;
diff --git a/_update_dll.bat b/_update_dll.bat
index 42c1beb..c715557 100644
--- a/_update_dll.bat
+++ b/_update_dll.bat
@@ -4,7 +4,7 @@ cls
set h3dir=D:\Heroes 3
copy /Y Vfs.dll "%h3dir%\vfs.dll"
copy /Y Vfs.map "%h3dir%\Vfs.map"
-php "%h3dir%\Tools\ExeMapCompiler\compile.phc" "vfs.map" "./DebugMaps"
+php "%h3dir%\Tools\ExeMapCompiler\compile.phc" "vfs.map" "%h3dir%/DebugMaps"
echo.
echo.
echo %date% %time%