summaryrefslogtreecommitdiff
path: root/zen
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:29:28 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:29:28 +0200
commit75c07011b7c4d06acd7b45dabdcd60ab9d80f385 (patch)
tree8853c3978dd152ef377e652239448b1352320206 /zen
parent5.22 (diff)
downloadFreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.gz
FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.bz2
FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.zip
5.23
Diffstat (limited to 'zen')
-rw-r--r--zen/FindFilePlus/FindFilePlus.vcxproj131
-rw-r--r--zen/IFileOperation/FileOperation.vcxproj (renamed from zen/IFileOperation/FileOperation_Vista.vcxproj)119
-rw-r--r--zen/debug_minidump.h4
-rw-r--r--zen/dir_watcher.cpp12
-rw-r--r--zen/file_handling.cpp225
-rw-r--r--zen/file_handling.h4
-rw-r--r--zen/file_id.cpp65
-rw-r--r--zen/file_id.h22
-rw-r--r--zen/file_traverser.cpp2
-rw-r--r--zen/fixed_list.h46
-rw-r--r--zen/format_unit.cpp7
-rw-r--r--zen/int64.h2
-rw-r--r--zen/recycler.cpp6
13 files changed, 210 insertions, 435 deletions
diff --git a/zen/FindFilePlus/FindFilePlus.vcxproj b/zen/FindFilePlus/FindFilePlus.vcxproj
index 56650735..eb5c672e 100644
--- a/zen/FindFilePlus/FindFilePlus.vcxproj
+++ b/zen/FindFilePlus/FindFilePlus.vcxproj
@@ -19,7 +19,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
- <ProjectGuid>{70394AEF-5897-4911-AFA1-82EAF0581EFA}</ProjectGuid>
+ <ProjectGuid>{814047ED-7701-494D-BBAF-AFEDF43EDC4E}</ProjectGuid>
<RootNamespace>ShadowDll</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
@@ -47,8 +47,6 @@
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ -61,188 +59,109 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
- <PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OBJ\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OBJ\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\FreeFileSync\Build\Bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\FreeFileSync\Obj\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\FreeFileSync\Build\Bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\FreeFileSync\Obj\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\FreeFileSync\Build\Bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\FreeFileSync\Obj\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\FreeFileSync\Build\Bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\FreeFileSync\Obj\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">FindFilePlus_$(Platform)</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">FindFilePlus_$(Platform)</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">FindFilePlus_$(Platform)</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">FindFilePlus_$(Platform)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_$(Platform)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_$(Platform)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_$(Platform)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)_$(Platform)</TargetName>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Data\C++\WinDDK\inc\ddk;C:\Data\C++\WinDDK\inc\api;C:\Data\C++\WinDDK\inc\crt;$(WindowsSdkDir)\include;$(VCInstallDir)include</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Data\C++\WinDDK\inc\ddk;C:\Data\C++\WinDDK\inc\api;C:\Data\C++\WinDDK\inc\crt;$(WindowsSdkDir)\include;$(VCInstallDir)include</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\Data\C++\WinDDK\inc\ddk;C:\Data\C++\WinDDK\inc\api;C:\Data\C++\WinDDK\inc\crt;$(WindowsSdkDir)\include;$(VCInstallDir)include</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\Data\C++\WinDDK\inc\ddk;C:\Data\C++\WinDDK\inc\api;C:\Data\C++\WinDDK\inc\crt;$(WindowsSdkDir)\include;$(VCInstallDir)include</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)Build.html</Path>
- </BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_X86_;_DEBUG;_WINDOWS;_USRDLL;FIND_FILE_PLUS_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4100</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4100;4996;4512</DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>C:\Data\Projects;</AdditionalIncludeDirectories>
<SmallerTypeCheck>true</SmallerTypeCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
- <ProfileGuidedDatabase>
- </ProfileGuidedDatabase>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)Build.html</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_AMD64_;_DEBUG;_WINDOWS;_USRDLL;FIND_FILE_PLUS_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4100;4996;4512</DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>C:\Data\Projects;</AdditionalIncludeDirectories>
<SmallerTypeCheck>true</SmallerTypeCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
- <ProfileGuidedDatabase>
- </ProfileGuidedDatabase>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX64</TargetMachine>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)Build.html</Path>
- </BuildLog>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_X86_;NDEBUG;_WINDOWS;_USRDLL;FIND_FILE_PLUS_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4100;4996;4512</DisableSpecificWarnings>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\Projects;</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <ProfileGuidedDatabase>
- </ProfileGuidedDatabase>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)Build.html</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FIND_FILE_PLUS_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4100</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4100;4996;4512</DisableSpecificWarnings>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\Projects;</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <ProfileGuidedDatabase>
- </ProfileGuidedDatabase>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX64</TargetMachine>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\debug_memory_leaks.cpp" />
- <ClCompile Include="dll_main.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- </PrecompiledHeader>
- <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- </PrecompiledHeader>
- <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- </PrecompiledHeader>
- <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- </PrecompiledHeader>
- <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
- </ClCompile>
+ <ClCompile Include="dll_main.cpp" />
<ClCompile Include="find_file_plus.cpp" />
<ClCompile Include="load_dll.cpp" />
</ItemGroup>
@@ -251,6 +170,4 @@
<ClInclude Include="load_dll.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
</Project> \ No newline at end of file
diff --git a/zen/IFileOperation/FileOperation_Vista.vcxproj b/zen/IFileOperation/FileOperation.vcxproj
index 3ff45843..3f6923f3 100644
--- a/zen/IFileOperation/FileOperation_Vista.vcxproj
+++ b/zen/IFileOperation/FileOperation.vcxproj
@@ -19,8 +19,8 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
- <ProjectName>Vista IFileOperation</ProjectName>
- <ProjectGuid>{70394AEF-5897-4911-AFA1-82EAF0581EFA}</ProjectGuid>
+ <ProjectName>FileOperation</ProjectName>
+ <ProjectGuid>{F6D3A51C-15EF-4710-BB67-3FCE9C0B5D92}</ProjectGuid>
<RootNamespace>ShadowDll</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
@@ -48,8 +48,6 @@
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ -62,41 +60,32 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
- <PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OBJ\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OBJ\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\FreeFileSync\Build\Bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\FreeFileSync\Obj\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\FreeFileSync\Build\Bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\FreeFileSync\Obj\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\FreeFileSync\Build\Bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\FreeFileSync\Obj\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">OBJ\$(ProjectName)_$(Configuration)_$(Platform)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\FreeFileSync\Build\Bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\FreeFileSync\Obj\$(ProjectName)_VCPP_$(PlatformName)_$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">FileOperation_$(Platform)</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">FileOperation_$(Platform)</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">FileOperation_$(Platform)</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">FileOperation_$(Platform)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_$(Platform)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_$(Platform)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_$(Platform)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)_$(Platform)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <BuildLog>
- <Path>$(IntDir)Build.html</Path>
- </BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WXINTL_NO_GETTEXT_MACRO;ZEN_WIN;_DEBUG;_WINDOWS;_USRDLL;FILE_OP_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4100;4996;4512</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>../..;C:\Data\C++\boost</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\Projects;C:\Data\C++\boost</AdditionalIncludeDirectories>
<SmallerTypeCheck>true</SmallerTypeCheck>
<ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -104,132 +93,74 @@
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
- <ProfileGuidedDatabase>
- </ProfileGuidedDatabase>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>C:\Data\C++\Boost\stage\lib</AdditionalLibraryDirectories>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <BuildLog>
- <Path>$(IntDir)Build.html</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WXINTL_NO_GETTEXT_MACRO;ZEN_WIN;_DEBUG;_WINDOWS;_USRDLL;FILE_OP_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4100;4996;4512</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>../..;C:\Data\C++\boost</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\Projects;C:\Data\C++\boost</AdditionalIncludeDirectories>
<SmallerTypeCheck>true</SmallerTypeCheck>
<ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
- <ProfileGuidedDatabase>
- </ProfileGuidedDatabase>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX64</TargetMachine>
<AdditionalLibraryDirectories>C:\Data\C++\Boost\stage_x64\lib</AdditionalLibraryDirectories>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <BuildLog>
- <Path>$(IntDir)Build.html</Path>
- </BuildLog>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WXINTL_NO_GETTEXT_MACRO;ZEN_WIN;NDEBUG;_WINDOWS;_USRDLL;FILE_OP_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<DisableSpecificWarnings>4100;4996;4512</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>../..;C:\Data\C++\boost</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\Projects;C:\Data\C++\boost</AdditionalIncludeDirectories>
<ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <ProfileGuidedDatabase>
- </ProfileGuidedDatabase>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>C:\Data\C++\Boost\stage\lib</AdditionalLibraryDirectories>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <BuildLog>
- <Path>$(IntDir)Build.html</Path>
- </BuildLog>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WXINTL_NO_GETTEXT_MACRO;ZEN_WIN;NDEBUG;_WINDOWS;_USRDLL;FILE_OP_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeader>
- </PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<DisableSpecificWarnings>4100;4996;4512</DisableSpecificWarnings>
- <AdditionalIncludeDirectories>../..;C:\Data\C++\boost</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>C:\Data\Projects;C:\Data\C++\boost</AdditionalIncludeDirectories>
<ForcedIncludeFiles>zen/warn_static.h</ForcedIncludeFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
- <SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <ProfileGuidedDatabase>
- </ProfileGuidedDatabase>
- <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <TargetMachine>MachineX64</TargetMachine>
<AdditionalLibraryDirectories>C:\Data\C++\Boost\stage_x64\lib</AdditionalLibraryDirectories>
- <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@@ -245,6 +176,4 @@
<ClInclude Include="file_op.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
</Project> \ No newline at end of file
diff --git a/zen/debug_minidump.h b/zen/debug_minidump.h
index e2605038..2ef43039 100644
--- a/zen/debug_minidump.h
+++ b/zen/debug_minidump.h
@@ -21,11 +21,11 @@ Minidumps http://msdn.microsoft.com/en-us/library/windows/desktop/ee416349(v=vs.
----------------------------------------------------------------------------------------
1. Compile "debug_minidump.cpp"
2. Compile "release" build with:
+ - C/C++ -> General: Debug Information Format: "Program Database" (/Zi).
+ - C/C++ -> Optimization: Omit Frame Pointers: No (/Oy-) - avoid call stack mess up!
- Linker -> Debugging: Generate Debug Info: Yes (/DEBUG)
- Linker -> Optimization: References: Yes (/OPT:REF).
- Linker -> Optimization: Enable COMDAT Folding: Yes (/OPT:ICF).
- - C/C++ -> General: Debug Information Format: "Program Database" (/Zi).
- - C/C++ -> Optimization: Omit Frame Pointers: No (/Oy-) - avoid call stack mess up!
Optional:
- C/C++ -> Optimization: Disabled (/Od)
*/
diff --git a/zen/dir_watcher.cpp b/zen/dir_watcher.cpp
index 17efda00..1945ada7 100644
--- a/zen/dir_watcher.cpp
+++ b/zen/dir_watcher.cpp
@@ -22,7 +22,7 @@
#elif defined ZEN_MAC
//#include <sys/types.h>
-#include <sys/event.h>
+//#include <sys/event.h>
//#include <sys/time.h>
#include "file_traverser.h"
#endif
@@ -519,6 +519,13 @@ std::vector<DirWatcher::Entry> DirWatcher::getChanges(const std::function<void()
}
#elif defined ZEN_MAC
+warn_static("finish");
+struct DirWatcher::Pimpl {};
+DirWatcher::DirWatcher(const Zstring& directory) {}
+DirWatcher::~DirWatcher() {}
+std::vector<DirWatcher::Entry> DirWatcher::getChanges(const std::function<void()>&) { return std::vector<DirWatcher::Entry>(); }
+
+#if 0
namespace
{
class DirsOnlyTraverser : public zen::TraverseCallback
@@ -694,3 +701,6 @@ std::vector<DirWatcher::Entry> DirWatcher::getChanges(const std::function<void()
return output;
}
#endif
+
+
+#endif
diff --git a/zen/file_handling.cpp b/zen/file_handling.cpp
index fd4239ed..621c2b1b 100644
--- a/zen/file_handling.cpp
+++ b/zen/file_handling.cpp
@@ -143,9 +143,10 @@ Zstring getLockingProcessNames(const Zstring& filename) //throw(), empty string
return Zstring();
}
#endif
+}
-void getFileAttrib(const Zstring& filename, FileAttrib& attr, ProcSymlink procSl) //throw FileError
+UInt64 zen::getFilesize(const Zstring& filename) //throw FileError
{
#ifdef ZEN_WIN
WIN32_FIND_DATA fileInfo = {};
@@ -160,24 +161,8 @@ void getFileAttrib(const Zstring& filename, FileAttrib& attr, ProcSymlink procSl
// GetFileExInfoStandard, //__in GET_FILEEX_INFO_LEVELS fInfoLevelId,
// &sourceAttr)) //__out LPVOID lpFileInformation
- if (!isSymlink(fileInfo) || procSl == SYMLINK_DIRECT)
- {
- //####################################### DST hack ###########################################
- const bool isDirectory = (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
- if (!isDirectory && dst::isFatDrive(filename)) //throw()
- {
- const dst::RawTime rawTime(fileInfo.ftCreationTime, fileInfo.ftLastWriteTime);
- if (dst::fatHasUtcEncoded(rawTime)) //throw std::runtime_error
- {
- fileInfo.ftLastWriteTime = dst::fatDecodeUtcTime(rawTime); //return last write time in real UTC, throw (std::runtime_error)
- ::GetSystemTimeAsFileTime(&fileInfo.ftCreationTime); //real creation time information is not available...
- }
- }
- //####################################### DST hack ###########################################
-
- attr.fileSize = UInt64(fileInfo.nFileSizeLow, fileInfo.nFileSizeHigh);
- attr.modificationTime = toTimeT(fileInfo.ftLastWriteTime);
- }
+ if (!isSymlink(fileInfo))
+ return UInt64(fileInfo.nFileSizeLow, fileInfo.nFileSizeHigh);
else
{
const HANDLE hFile = ::CreateFile(applyLongPathPrefix(filename).c_str(), //open handle to target of symbolic link
@@ -195,42 +180,19 @@ void getFileAttrib(const Zstring& filename, FileAttrib& attr, ProcSymlink procSl
if (!::GetFileInformationByHandle(hFile, &fileInfoHnd))
throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtFileName(filename)), formatSystemError(L"GetFileInformationByHandle", getLastError()));
- attr.fileSize = UInt64(fileInfoHnd.nFileSizeLow, fileInfoHnd.nFileSizeHigh);
- attr.modificationTime = toTimeT(fileInfoHnd.ftLastWriteTime);
+ return UInt64(fileInfoHnd.nFileSizeLow, fileInfoHnd.nFileSizeHigh);
}
#elif defined ZEN_LINUX || defined ZEN_MAC
struct ::stat fileInfo = {};
-
- const int rv = procSl == SYMLINK_FOLLOW ?
- :: stat(filename.c_str(), &fileInfo) :
- ::lstat(filename.c_str(), &fileInfo);
- if (rv != 0)
+ if (::stat(filename.c_str(), &fileInfo) != 0)
throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtFileName(filename)), formatSystemError(L"stat", getLastError()));
- attr.fileSize = UInt64(fileInfo.st_size);
- attr.modificationTime = fileInfo.st_mtime;
+ return UInt64(fileInfo.st_size);
#endif
}
-Int64 getFileTime(const Zstring& filename, ProcSymlink procSl) //throw FileError
-{
- FileAttrib attr;
- getFileAttrib(filename, attr, procSl); //throw FileError
- return attr.modificationTime;
-}
-}
-
-
-UInt64 zen::getFilesize(const Zstring& filename) //throw FileError
-{
- FileAttrib attr;
- getFileAttrib(filename, attr, SYMLINK_FOLLOW); //throw FileError
- return attr.fileSize;
-}
-
-
UInt64 zen::getFreeDiskSpace(const Zstring& path) //throw FileError
{
#ifdef ZEN_WIN
@@ -614,34 +576,11 @@ void removeDirectoryImpl(const Zstring& directory, CallbackRemoveDir* callback)
//Sample code: http://us.generation-nt.com/answer/createfile-directory-handles-removing-parent-help-29126332.html
}
}
-}
-
-
-void zen::removeDirectory(const Zstring& directory, CallbackRemoveDir* callback)
-{
- //no error situation if directory is not existing! manual deletion relies on it!
- if (!somethingExists(directory))
- return; //neither directory nor any other object (e.g. broken symlink) with that name existing
- removeDirectoryImpl(directory, callback);
-}
-
-void zen::setFileTime(const Zstring& filename, const Int64& modTime, ProcSymlink procSl) //throw FileError
-{
#ifdef ZEN_WIN
- FILETIME creationTime = {};
- FILETIME lastWriteTime = tofiletime(modTime);
-
- //####################################### DST hack ###########################################
- if (dst::isFatDrive(filename)) //throw()
- {
- const dst::RawTime encodedTime = dst::fatEncodeUtcTime(lastWriteTime); //throw std::runtime_error
- creationTime = encodedTime.createTimeRaw;
- lastWriteTime = encodedTime.writeTimeRaw;
- }
- //####################################### DST hack ###########################################
-
+void setFileTimeRaw(const Zstring& filename, const FILETIME& creationTime, const FILETIME& lastWriteTime, ProcSymlink procSl) //throw FileError
+{
{
//extra scope for debug check below
@@ -856,31 +795,59 @@ void zen::setFileTime(const Zstring& filename, const Int64& modTime, ProcSymlink
throw FileError(errorMsg, errorDescr);
}
}
-#ifndef NDEBUG //dst hack: verify data written
- if (dst::isFatDrive(filename) && fileExists(filename)) //throw()
- {
- FILETIME creationTimeDbg = {};
- FILETIME lastWriteTimeDbg = {};
-
- HANDLE hFile = ::CreateFile(applyLongPathPrefix(filename).c_str(),
- FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES,
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- nullptr,
- OPEN_EXISTING,
- 0,
- nullptr);
- assert(hFile != INVALID_HANDLE_VALUE);
- ZEN_ON_SCOPE_EXIT(::CloseHandle(hFile));
+#ifndef NDEBUG //verify written data: mainly required to check consistency of DST hack
+ FILETIME creationTimeDbg = {};
+ FILETIME lastWriteTimeDbg = {};
- assert(::GetFileTime(hFile, //probably more up to date than GetFileAttributesEx()!?
- &creationTimeDbg,
- nullptr,
- &lastWriteTimeDbg));
+ HANDLE hFile = ::CreateFile(applyLongPathPrefix(filename).c_str(),
+ FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ nullptr,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS | //needed to open a directory
+ (procSl == SYMLINK_DIRECT ? FILE_FLAG_OPEN_REPARSE_POINT : 0),
+ nullptr);
+ assert(hFile != INVALID_HANDLE_VALUE);
+ ZEN_ON_SCOPE_EXIT(::CloseHandle(hFile));
- assert(::CompareFileTime(&creationTimeDbg, &creationTime) == 0);
- assert(::CompareFileTime(&lastWriteTimeDbg, &lastWriteTime) == 0);
- }
+ assert(::GetFileTime(hFile, //probably more up to date than GetFileAttributesEx()!?
+ &creationTimeDbg,
+ nullptr,
+ &lastWriteTimeDbg));
+
+ assert(::CompareFileTime(&creationTimeDbg, &creationTime) == 0);
+ assert(::CompareFileTime(&lastWriteTimeDbg, &lastWriteTime) == 0);
#endif
+}
+#endif
+}
+
+
+void zen::removeDirectory(const Zstring& directory, CallbackRemoveDir* callback)
+{
+ //no error situation if directory is not existing! manual deletion relies on it!
+ if (!somethingExists(directory))
+ return; //neither directory nor any other object (e.g. broken symlink) with that name existing
+ removeDirectoryImpl(directory, callback);
+}
+
+
+void zen::setFileTime(const Zstring& filename, const Int64& modTime, ProcSymlink procSl) //throw FileError
+{
+#ifdef ZEN_WIN
+ FILETIME creationTime = {};
+ FILETIME lastWriteTime = toFileTime(modTime);
+
+ //####################################### DST hack ###########################################
+ if (dst::isFatDrive(filename)) //throw(); hacky: does not consider symlinks pointing to FAT!
+ {
+ const dst::RawTime encodedTime = dst::fatEncodeUtcTime(lastWriteTime); //throw std::runtime_error
+ creationTime = encodedTime.createTimeRaw;
+ lastWriteTime = encodedTime.writeTimeRaw;
+ }
+ //####################################### DST hack ###########################################
+
+ setFileTimeRaw(filename, creationTime, lastWriteTime, procSl); //throw FileError
#elif defined ZEN_LINUX || defined ZEN_MAC
//sigh, we can't use utimensat on NTFS volumes on Ubuntu: silent failure!!! what morons are programming this shit???
@@ -1423,10 +1390,22 @@ void zen::copySymlink(const Zstring& sourceLink, const Zstring& targetLink, bool
});
//file times: essential for sync'ing a symlink: enforce this! (don't just try!)
- {
- const Int64 modTime = getFileTime(sourceLink, SYMLINK_DIRECT); //throw FileError
- setFileTime(targetLink, modTime, SYMLINK_DIRECT); //throw FileError
- }
+#ifdef ZEN_WIN
+ WIN32_FILE_ATTRIBUTE_DATA sourceAttr = {};
+ if (!::GetFileAttributesEx(applyLongPathPrefix(sourceLink).c_str(), //__in LPCTSTR lpFileName,
+ GetFileExInfoStandard, //__in GET_FILEEX_INFO_LEVELS fInfoLevelId,
+ &sourceAttr)) //__out LPVOID lpFileInformation
+ throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtFileName(sourceLink)), formatSystemError(L"GetFileAttributesEx", getLastError()));
+
+ setFileTimeRaw(targetLink, sourceAttr.ftCreationTime, sourceAttr.ftLastWriteTime, SYMLINK_DIRECT); //throw FileError
+
+#elif defined ZEN_LINUX || defined ZEN_MAC
+ struct ::stat srcInfo = {};
+ if (::lstat(sourceLink.c_str(), &srcInfo) != 0)
+ throw FileError(replaceCpy(_("Cannot read file attributes of %x."), L"%x", fmtFileName(sourceLink)), formatSystemError(L"lstat", getLastError()));
+
+ setFileTime(targetLink, Int64(srcInfo.st_mtime), SYMLINK_DIRECT); //throw FileError
+#endif
if (copyFilePermissions)
copyObjectPermissions(sourceLink, targetLink, SYMLINK_DIRECT); //throw FileError
@@ -1538,7 +1517,7 @@ bool canCopyAsSparse(const Zstring& sourceFile, const Zstring& targetFile) //thr
void copyFileWindowsSparse(const Zstring& sourceFile,
const Zstring& targetFile,
CallbackCopyFile* callback,
- FileAttrib* newAttrib) //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting, ErrorFileLocked
+ InSyncAttributes* newAttrib) //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting, ErrorFileLocked
{
assert(canCopyAsSparse(sourceFile, targetFile));
@@ -1894,6 +1873,7 @@ DWORD CALLBACK copyCallbackInternal(LARGE_INTEGER totalFileSize,
//#################### copy file creation time ################################
::SetFileTime(hDestinationFile, &cbd.fileInfoSrc.ftCreationTime, nullptr, nullptr); //no error handling!
+ //=> not really needed here, creation time is set anyway at the end of copyFileWindowsDefault()!
//#################### copy NTFS compressed attribute #########################
const bool sourceIsCompressed = (cbd.fileInfoSrc.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) != 0;
@@ -1945,7 +1925,7 @@ const bool supportNonEncryptedDestination = winXpOrLater(); //encrypted destinat
void copyFileWindowsDefault(const Zstring& sourceFile,
const Zstring& targetFile,
CallbackCopyFile* callback,
- FileAttrib* newAttrib) //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting, ErrorFileLocked, ErrorShouldCopyAsSparse
+ InSyncAttributes* newAttrib) //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting, ErrorFileLocked, ErrorShouldCopyAsSparse
{
//try to get backup read and write privileges: who knows, maybe this helps solve some obscure "access denied" errors
try { activatePrivilege(SE_BACKUP_NAME); }
@@ -2034,21 +2014,44 @@ void copyFileWindowsDefault(const Zstring& sourceFile,
if (newAttrib)
{
newAttrib->fileSize = UInt64(cbd.fileInfoSrc.nFileSizeLow, cbd.fileInfoSrc.nFileSizeHigh);
- newAttrib->modificationTime = toTimeT(cbd.fileInfoSrc.ftLastWriteTime); //no DST hack (yet)
+ //newAttrib->modificationTime = -> set further below
newAttrib->sourceFileId = extractFileID(cbd.fileInfoSrc);
newAttrib->targetFileId = extractFileID(cbd.fileInfoTrg);
}
{
- //DST hack
- const Int64 modTime = getFileTime(sourceFile, SYMLINK_FOLLOW); //throw FileError
- setFileTime(targetFile, modTime, SYMLINK_FOLLOW); //throw FileError
- //caveat: - ::CopyFileEx() silently *ignores* failure to set modification time!!! => we need to set it again but with proper error checking!
- // - this sequence leads to a loss of precision of up to 1 sec!
- // - perf-loss on USB sticks with many small files of about 30%! damn!
+ FILETIME creationtime = cbd.fileInfoSrc.ftCreationTime;
+ FILETIME lastWriteTimeRaw = cbd.fileInfoSrc.ftLastWriteTime;
+ //####################################### DST hack ###########################################
+ if (dst::isFatDrive(sourceFile)) //throw(); hacky: does not consider symlinks pointing to FAT!
+ {
+ const dst::RawTime rawTime(creationtime, lastWriteTimeRaw);
+ if (dst::fatHasUtcEncoded(rawTime)) //throw std::runtime_error
+ {
+ lastWriteTimeRaw = dst::fatDecodeUtcTime(rawTime); //return last write time in real UTC, throw (std::runtime_error)
+ ::GetSystemTimeAsFileTime(&creationtime); //real creation time information is not available...
+ }
+ }
+ //####################################### DST hack ###########################################
if (newAttrib)
- newAttrib->modificationTime = modTime;
+ newAttrib->modificationTime = toTimeT(lastWriteTimeRaw);
+
+ //caveat: - ::CopyFileEx() silently *ignores* failure to set modification time!!! => we always need to set it again but with proper error checking!
+ // - perf-loss on USB sticks with many small files of about 30%!
+ FILETIME creationTimeOut = creationtime;
+ FILETIME lastWriteTimeOut = lastWriteTimeRaw;
+
+ //####################################### DST hack ###########################################
+ if (dst::isFatDrive(targetFile)) //throw(); target cannot be a symlink in this context!
+ {
+ const dst::RawTime encodedTime = dst::fatEncodeUtcTime(lastWriteTimeRaw); //throw std::runtime_error
+ creationTimeOut = encodedTime.createTimeRaw;
+ lastWriteTimeOut = encodedTime.writeTimeRaw;
+ }
+ //####################################### DST hack ###########################################
+
+ setFileTimeRaw(targetFile, creationTimeOut, lastWriteTimeOut, SYMLINK_FOLLOW); //throw FileError
}
guardTarget.dismiss(); //target has been created successfully!
@@ -2057,7 +2060,7 @@ void copyFileWindowsDefault(const Zstring& sourceFile,
//another layer to support copying sparse files
inline
-void copyFileWindowsSelectRoutine(const Zstring& sourceFile, const Zstring& targetFile, CallbackCopyFile* callback, FileAttrib* sourceAttr)
+void copyFileWindowsSelectRoutine(const Zstring& sourceFile, const Zstring& targetFile, CallbackCopyFile* callback, InSyncAttributes* sourceAttr)
{
try
{
@@ -2072,7 +2075,7 @@ void copyFileWindowsSelectRoutine(const Zstring& sourceFile, const Zstring& targ
//another layer of indirection solving 8.3 name clashes
inline
-void copyFileWindows(const Zstring& sourceFile, const Zstring& targetFile, CallbackCopyFile* callback, FileAttrib* sourceAttr)
+void copyFileWindows(const Zstring& sourceFile, const Zstring& targetFile, CallbackCopyFile* callback, InSyncAttributes* sourceAttr)
{
try
{
@@ -2096,7 +2099,7 @@ void copyFileWindows(const Zstring& sourceFile, const Zstring& targetFile, Callb
void copyFileLinuxMac(const Zstring& sourceFile,
const Zstring& targetFile,
CallbackCopyFile* callback,
- FileAttrib* newAttrib) //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting
+ InSyncAttributes* newAttrib) //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting
{
//open sourceFile for reading
FileInputUnbuffered fileIn(sourceFile); //throw FileError
@@ -2187,7 +2190,7 @@ copyFileWindowsDefault(::CopyFileEx) copyFileWindowsSparse(::BackupRead/::Backu
*/
inline
-void copyFileSelectOs(const Zstring& sourceFile, const Zstring& targetFile, CallbackCopyFile* callback, FileAttrib* sourceAttr)
+void copyFileSelectOs(const Zstring& sourceFile, const Zstring& targetFile, CallbackCopyFile* callback, InSyncAttributes* sourceAttr)
{
#ifdef ZEN_WIN
copyFileWindows(sourceFile, targetFile, callback, sourceAttr); //throw FileError, ErrorTargetPathMissing, ErrorTargetExisting, ErrorFileLocked
@@ -2204,7 +2207,7 @@ void zen::copyFile(const Zstring& sourceFile, //throw FileError, ErrorTargetPath
bool copyFilePermissions,
bool transactionalCopy,
CallbackCopyFile* callback,
- FileAttrib* sourceAttr)
+ InSyncAttributes* sourceAttr)
{
if (transactionalCopy)
{
diff --git a/zen/file_handling.h b/zen/file_handling.h
index 2c4f7938..b3d5ca1a 100644
--- a/zen/file_handling.h
+++ b/zen/file_handling.h
@@ -52,7 +52,7 @@ void makeDirectory(const Zstring& directory, bool failIfExists = false); //throw
//templateDir may be empty
void makeDirectoryPlain(const Zstring& directory, const Zstring& templateDir, bool copyFilePermissions); //throw FileError, ErrorTargetExisting, ErrorTargetPathMissing
-struct FileAttrib
+struct InSyncAttributes
{
UInt64 fileSize;
Int64 modificationTime; //time_t UTC compatible
@@ -65,7 +65,7 @@ void copyFile(const Zstring& sourceFile, //throw FileError, ErrorTargetPathMissi
bool copyFilePermissions,
bool transactionalCopy,
CallbackCopyFile* callback, //may be nullptr
- FileAttrib* newAttrib = nullptr); //return current attributes at the time of copy
+ InSyncAttributes* newAttrib = nullptr); //return current attributes at the time of copy
//Note: it MAY happen that copyFile() leaves temp files behind, e.g. temporary network drop.
// => clean them up at an appropriate time (automatically set sync directions to delete them). They have the following ending:
const Zstring TEMP_FILE_ENDING = Zstr(".ffs_tmp");
diff --git a/zen/file_id.cpp b/zen/file_id.cpp
deleted file mode 100644
index 310390da..00000000
--- a/zen/file_id.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#include "file_id.h"
-
-#ifdef ZEN_WIN
-#include "win.h" //includes "windows.h"
-#include "long_path_prefix.h"
-#include "scope_guard.h"
-
-#elif defined ZEN_LINUX || defined ZEN_MAC
-#include <sys/stat.h>
-#endif
-
-
-zen::FileId zen::getFileID(const Zstring& filename)
-{
-#ifdef ZEN_WIN
- //WARNING: CreateFile() is SLOW, while GetFileInformationByHandle() is cheap! http://msdn.microsoft.com/en-us/library/aa363788(VS.85).aspx
- //privilege SE_BACKUP_NAME doesn't seem to be required here at all
-
- const HANDLE hFile = ::CreateFile(zen::applyLongPathPrefix(filename).c_str(),
- 0,
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- nullptr,
- OPEN_EXISTING,
- FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, //FILE_FLAG_BACKUP_SEMANTICS needed to open a directory
- nullptr);
- if (hFile != INVALID_HANDLE_VALUE)
- {
- ZEN_ON_SCOPE_EXIT(::CloseHandle(hFile));
-
- BY_HANDLE_FILE_INFORMATION fileInfo = {};
- if (::GetFileInformationByHandle(hFile, &fileInfo))
- return extractFileID(fileInfo);
- }
-
-#elif defined ZEN_LINUX || defined ZEN_MAC
- struct ::stat fileInfo = {};
- if (::lstat(filename.c_str(), &fileInfo) == 0)
- return extractFileID(fileInfo);
-#endif
-
- return zen::FileId();
-}
-
-//test whether two distinct paths point to the same file or directory:
-// true: paths point to same files/dirs
-// false: error occurred OR point to different files/dirs
-//bool zen::samePhysicalFile(const Zstring& file1, const Zstring& file2)
-//{
-// if (EqualFilename()(file1, file2)) //quick check
-// return true;
-//
-// const auto id1 = getFileID(file1);
-// const auto id2 = getFileID(file2);
-//
-// if (id1 == zen::FileId() || id2 == zen::FileId())
-// return false;
-//
-// return id1 == id2;
-//}
diff --git a/zen/file_id.h b/zen/file_id.h
deleted file mode 100644
index 0ff6d7ec..00000000
--- a/zen/file_id.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef FILEID_H_INCLUDED_32q87634289562345
-#define FILEID_H_INCLUDED_32q87634289562345
-
-#include "file_id_def.h"
-#include "zstring.h"
-
-//unique file identifier
-
-namespace zen
-{
-//get unique file id (symbolic link handling: opens the link!!!)
-//returns initial FileId() on error!
-FileId getFileID(const Zstring& filename);
-}
-
-#endif //FILEID_H_INCLUDED_32q87634289562345
diff --git a/zen/file_traverser.cpp b/zen/file_traverser.cpp
index 959a6071..0e06d6c5 100644
--- a/zen/file_traverser.cpp
+++ b/zen/file_traverser.cpp
@@ -464,7 +464,7 @@ private:
//even at this point it's not sure whether data was written correctly, again cloud storages tend to lie about success status
if (filesToValidate-- > 0)
{
- const dst::RawTime encodedTime = dst::fatEncodeUtcTime(tofiletime(it->second)); //throw std::runtime_error
+ const dst::RawTime encodedTime = dst::fatEncodeUtcTime(toFileTime(it->second)); //throw std::runtime_error
//dst hack: verify data written; attention: this check may fail for "sync.ffs_lock"
WIN32_FILE_ATTRIBUTE_DATA debugeAttr = {};
diff --git a/zen/fixed_list.h b/zen/fixed_list.h
index d38dbae5..7e35f012 100644
--- a/zen/fixed_list.h
+++ b/zen/fixed_list.h
@@ -34,7 +34,7 @@ class FixedList
public:
FixedList() :
- first(nullptr),
+ firstInsert(nullptr),
lastInsert(nullptr),
sz(0) {}
@@ -60,17 +60,17 @@ public:
typedef T& reference;
typedef const T& const_reference;
- iterator begin() { return first; }
+ iterator begin() { return firstInsert; }
iterator end() { return iterator(); }
- const_iterator begin() const { return first; }
+ const_iterator begin() const { return firstInsert; }
const_iterator end () const { return const_iterator(); }
- const_iterator cbegin() const { return first; }
+ const_iterator cbegin() const { return firstInsert; }
const_iterator cend () const { return const_iterator(); }
- reference front() { return first->val; }
- const_reference front() const { return first->val; }
+ reference front() { return firstInsert->val; }
+ const_reference front() const { return firstInsert->val; }
reference& back() { return lastInsert->val; }
const_reference& back() const { return lastInsert->val; }
@@ -88,18 +88,20 @@ public:
void remove_if(Predicate pred)
{
Node* prev = nullptr;
- Node* ptr = first;
+ Node* ptr = firstInsert;
while (ptr)
if (pred(ptr->val))
{
- Node* tmp = ptr->next;
+ Node* next = ptr->next;
deleteNode(ptr);
+ ptr = next;
+
if (prev)
- prev->next = ptr = tmp;
+ prev->next = next;
else
- first = ptr = tmp;
- if (!tmp)
+ firstInsert = next;
+ if (!next)
lastInsert = prev;
}
else
@@ -111,19 +113,19 @@ public:
void clear()
{
- Node* ptr = first;
+ Node* ptr = firstInsert;
while (ptr)
{
- Node* tmp = ptr;
- ptr = ptr->next;
- delete tmp;
+ Node* next = ptr->next;
+ deleteNode(ptr);
+ ptr = next;
}
- first = lastInsert = nullptr;
- sz = 0;
+ firstInsert = lastInsert = nullptr;
+ assert(sz == 0);
}
- bool empty() const { return first == nullptr; }
+ bool empty() const { return firstInsert == nullptr; }
size_t size() const { return sz; }
private:
@@ -132,11 +134,10 @@ private:
void pushNode(Node* newNode) //throw()
{
- ++sz;
if (lastInsert == nullptr)
{
- assert(first == nullptr);
- first = lastInsert = newNode;
+ assert(firstInsert == nullptr && sz == 0);
+ firstInsert = lastInsert = newNode;
}
else
{
@@ -144,6 +145,7 @@ private:
lastInsert->next = newNode;
lastInsert = newNode;
}
+ ++sz;
}
void deleteNode(Node* oldNode)
@@ -153,7 +155,7 @@ private:
delete oldNode;
}
- Node* first;
+ Node* firstInsert;
Node* lastInsert; //point to last insertion; required by efficient emplace_back()
size_t sz;
};
diff --git a/zen/format_unit.cpp b/zen/format_unit.cpp
index 4b39d5a9..1568b616 100644
--- a/zen/format_unit.cpp
+++ b/zen/format_unit.cpp
@@ -287,11 +287,12 @@ std::wstring zen::utcToLocalTimeString(Int64 utcTime)
auto errorMsg = [&] { return _("Error") + L" (time_t: " + numberTo<std::wstring>(utcTime) + L")"; };
#ifdef ZEN_WIN
- FILETIME lastWriteTimeUtc = tofiletime(utcTime); //convert ansi C time to FILETIME
+ FILETIME lastWriteTimeUtc = toFileTime(utcTime); //convert ansi C time to FILETIME
SYSTEMTIME systemTimeLocal = {};
- if (useNewLocalTimeCalculation) //use DST setting from source date (like in Windows 7, see http://msdn.microsoft.com/en-us/library/ms724277(VS.85).aspx
+ //http://msdn.microsoft.com/en-us/library/ms724277(VS.85).aspx
+ if (useNewLocalTimeCalculation) //DST conversion like in Windows 7: NTFS stays fixed, but FAT jumps by one hour
{
SYSTEMTIME systemTimeUtc = {};
if (!::FileTimeToSystemTime(&lastWriteTimeUtc, //__in const FILETIME *lpFileTime,
@@ -303,7 +304,7 @@ std::wstring zen::utcToLocalTimeString(Int64 utcTime)
&systemTimeLocal)) //__out LPSYSTEMTIME lpLocalTime
return errorMsg();
}
- else //use DST setting (like in Windows 2000 and XP)
+ else //DST conversion like in Windows 2000 and XP: FAT times stay fixed, while NTFS jumps
{
FILETIME fileTimeLocal = {};
if (!::FileTimeToLocalFileTime(&lastWriteTimeUtc, //_In_ const FILETIME *lpFileTime,
diff --git a/zen/int64.h b/zen/int64.h
index 7d03f35d..6901ebeb 100644
--- a/zen/int64.h
+++ b/zen/int64.h
@@ -219,7 +219,7 @@ Int64 toTimeT(const FILETIME& ft)
}
inline
-FILETIME tofiletime(const Int64& utcTime)
+FILETIME toFileTime(const Int64& utcTime)
{
const UInt64 fileTimeLong = to<UInt64>(utcTime + Int64(3054539008UL, 2)) * 10000000U;
const FILETIME output = { fileTimeLong.getLo(), fileTimeLong.getHi() };
diff --git a/zen/recycler.cpp b/zen/recycler.cpp
index 20e1a4af..a1353f0b 100644
--- a/zen/recycler.cpp
+++ b/zen/recycler.cpp
@@ -95,7 +95,7 @@ void zen::recycleOrDelete(const std::vector<Zstring>& filenames, CallbackRecycli
replaceCpy(_("Cannot load file %x."), L"%x", fmtFileName(getDllName())));
std::vector<const wchar_t*> cNames;
- for (auto it = filenames.begin(); it != filenames.end(); ++it) //caution to not create temporary strings here!!
+ for (auto it = filenames.begin(); it != filenames.end(); ++it) //CAUTION: to not create temporary strings here!!
cNames.push_back(it->c_str());
CallbackData cbd(callback);
@@ -114,9 +114,9 @@ void zen::recycleOrDelete(const std::vector<Zstring>& filenames, CallbackRecycli
else //regular recycle bin usage: available since XP
{
Zstring filenamesDoubleNull;
- for (auto it = filenames.begin(); it != filenames.end(); ++it)
+ for (const Zstring& filename : filenames)
{
- filenamesDoubleNull += *it;
+ filenamesDoubleNull += filename;
filenamesDoubleNull += L'\0';
}
bgstack15