diff --git a/Vfs.dproj b/Vfs.dproj
index 8963cd2..cbaa36b 100644
--- a/Vfs.dproj
+++ b/Vfs.dproj
@@ -30,23 +30,7 @@
Delphi.PersonalityVCLApplication
-FalseTrueFalseTrueTrue1000FalseFalseFalseFalseFalse10491251Alexander Shostak (aka EtherniDee)Virtual File System1.0.0.01.0.0.0Vfs.dpr
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+FalseTrueFalseTrueTrue1010FalseFalseFalseFalseFalse10491251Alexander Shostak (aka EtherniDee)Virtual File System1.0.1.01.0.0.0Vfs.dprMicrosoft Office 2000 Sample Automation Server Wrapper Components
diff --git a/Vfs.res b/Vfs.res
index 2670d72..9d145b4 100644
Binary files a/Vfs.res and b/Vfs.res differ
diff --git a/VfsControl.pas b/VfsControl.pas
index 7335b52..6b83f5d 100644
--- a/VfsControl.pas
+++ b/VfsControl.pas
@@ -37,6 +37,7 @@ type
function RunVfs (DirListingOrder: VfsBase.TDirListingSortType): LONGBOOL; stdcall;
var
CurrDir: WideString;
+ SysDir: WideString;
begin
with VfsBase.VfsCritSection do begin
@@ -47,11 +48,16 @@ begin
if result then begin
VfsHooks.InstallHooks;
- // Try to ensure, that current directory handle is tracked by VfsOpenFiles
+ // Hask: Try to ensure, that current directory handle is tracked by VfsOpenFiles
+ // Windows SetCurrentDirectoryW is does not reopen directory for the same path, thus
+ // not triggering NtCreateFile
+ // Not thread safe
CurrDir := WinUtils.GetCurrentDirW;
+ SysDir := WinUtils.GetSysDirW;
- if CurrDir <> '' then begin
- WinUtils.SetCurrentDirW(CurrDir);
+ if (CurrDir <> '') and (SysDir <> '') then begin
+ WinUtils.SetCurrentDirW(SysDir);
+ {!} Assert(WinUtils.SetCurrentDirW(CurrDir), 'Failed to restore current directory from system directory during VFS initialization');
end;
end;
diff --git a/VfsHooks.pas b/VfsHooks.pas
index 46b3c61..44a8a66 100644
--- a/VfsHooks.pas
+++ b/VfsHooks.pas
@@ -9,7 +9,7 @@ unit VfsHooks;
uses
Windows, SysUtils, Math,
Utils, WinNative, Concur,
- StrLib, Alg,
+ StrLib, Alg, WinUtils,
VfsBase, VfsUtils, VfsPatching,
VfsDebug, VfsApiDigger, VfsOpenFiles;
@@ -48,6 +48,10 @@ var
function GetFilePathByHandle (hFile: THandle): WideString;
begin
result := VfsOpenFiles.GetOpenedFilePath(hFile);
+
+ if (result = '') and VfsDebug.LoggingEnabled then begin
+ WriteLog('GetFilePathByHandle', Format('Failed to get path for handle %x. Current directory is: %s', [integer(hFile), WinUtils.GetCurrentDirW]));
+ end;
end;
(* Returns single absolute path, not dependant on RootDirectory member. '\??\' prefix is always removed, \\.\ and \\?\ paths remain not touched. *)