diff --git a/build/VStudio/dotnet/winfsp.net.csproj b/build/VStudio/dotnet/winfsp.net.csproj index e7de1b73..006d4522 100644 --- a/build/VStudio/dotnet/winfsp.net.csproj +++ b/build/VStudio/dotnet/winfsp.net.csproj @@ -9,7 +9,7 @@ Library winfsp.net Fsp - winfsp-msil + $(MyProductFileName)-msil v3.5 512 @@ -25,7 +25,7 @@ prompt 4 true - $(BaseIntermediateOutputPath)$(Configuration)\winfsp-msil.xml + $(BaseIntermediateOutputPath)$(Configuration)\$(MyProductFileName)-msil.xml 1591 @@ -38,7 +38,7 @@ prompt 4 true - $(BaseIntermediateOutputPath)$(Configuration)\winfsp-msil.xml + $(BaseIntermediateOutputPath)$(Configuration)\$(MyProductFileName)-msil.xml 1591 diff --git a/build/VStudio/installer/Product.wxs b/build/VStudio/installer/Product.wxs index 13ab172b..fd6d308d 100644 --- a/build/VStudio/installer/Product.wxs +++ b/build/VStudio/installer/Product.wxs @@ -20,7 +20,7 @@ AllowSameVersionUpgrades="no" DisallowUpgradeErrorMessage="An older version of $(var.MyProductName) is already installed. You must uninstall it before you can install this version." DowngradeErrorMessage="A newer version of $(var.MyProductName) is already installed." /> - + $(var.MyProductName).Launcher Software\$(var.MyProductName)\Services @@ -36,7 +36,7 @@ - + @@ -55,54 +55,54 @@ Name="InstallDir" Type="string" Value="[INSTALLDIR]" /> - + - - + + - - + + - - - + + + VersionNT64 - - + + VersionNT64 - - - + + + NOT VersionNT64 - - + + NOT VersionNT64 - - + + - - + + @@ -297,11 +297,11 @@ - - + + - - + + @@ -565,17 +565,17 @@ - - + + - - + + - - + + - - + + @@ -603,13 +603,13 @@ - - - - - - - + + + + + + + @@ -621,7 +621,7 @@ - + @@ -635,15 +635,15 @@ - - - + + + - + @@ -651,12 +651,12 @@ - + - + @@ -704,11 +704,11 @@ - - - - - + + + + + @@ -718,15 +718,15 @@ - - - + + + - + @@ -757,8 +757,8 @@ AllowAdvertise="no" InstallDefault="local" Absent="disallow"> - - + + - - - - - + + + + + - + - + diff --git a/build/VStudio/installer/winfsp_msi.wixproj b/build/VStudio/installer/winfsp_msi.wixproj index 92067fff..2b08a239 100644 --- a/build/VStudio/installer/winfsp_msi.wixproj +++ b/build/VStudio/installer/winfsp_msi.wixproj @@ -7,7 +7,7 @@ 3.10 d53aac39-4c57-4ca5-a4f3-c2b24888c594 2.0 - winfsp-$(MyVersion) + $(MyProductFileName)-$(MyVersion) Package $(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets @@ -16,7 +16,7 @@ $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(Name).build\$(Configuration)\$(Platform)\ - Debug;MyProductName=$(MyProductName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyProductVersion=$(MyProductVersion);MyProductStage=$(MyProductStage);MyVersion=$(MyVersion);MyFullVersion=$(MyFullVersion) + Debug;MyProductName=$(MyProductName);MyProductFileName=$(MyProductFileName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyProductVersion=$(MyProductVersion);MyProductStage=$(MyProductStage);MyVersion=$(MyVersion);MyFullVersion=$(MyFullVersion) False True True @@ -25,7 +25,7 @@ $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(Name).build\$(Configuration)\$(Platform)\ - MyProductName=$(MyProductName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyProductVersion=$(MyProductVersion);MyProductStage=$(MyProductStage);MyVersion=$(MyVersion);MyFullVersion=$(MyFullVersion) + MyProductName=$(MyProductName);MyProductFileName=$(MyProductFileName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyProductVersion=$(MyProductVersion);MyProductStage=$(MyProductStage);MyVersion=$(MyVersion);MyFullVersion=$(MyFullVersion) False True True diff --git a/build/VStudio/version.properties b/build/VStudio/version.properties index 399d0fd9..d6255f18 100644 --- a/build/VStudio/version.properties +++ b/build/VStudio/version.properties @@ -12,14 +12,15 @@ $(MyGitHead.Substring(0, 7)) WinFsp + winfsp Windows File System Proxy Navimatics LLC 2015-$([System.DateTime]::Now.ToString(`yyyy`)) Bill Zissimopoulos - 1.9 + 1.10 - 2021 - Gold + 2021.1 + Beta $(MyCanonicalVersion).$(MyBuildNumber) $(MyVersion.Replace('.',',')),0 @@ -27,14 +28,18 @@ $(MyCanonicalVersion.Substring(0,$(MyVersion.IndexOf('.')))).0 $(MyAssemblyPolicyVersion).0.0 + + + { 0x6f9d25fa, 0x6dee, 0x4a9d, { 0x80, 0xf5, 0xe9, 0x8e, 0x14, 0xf3, 0x5e, 0x54 } } + { 0xb48171c3, 0xdd50, 0x4852, { 0x83, 0xa3, 0x34, 0x4c, 0x50, 0xd9, 0x3b, 0x17 } } - NTDDI_VERSION=0x06010000;_WIN32_WINNT=0x0601 + NTDDI_VERSION=0x06010000;_WIN32_WINNT=0x0601;MyProductName=$(MyProductName);MyProductFileName=$(MyProductFileName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyProductVersion=$(MyProductVersion);MyProductStage=$(MyProductStage);MyVersion=$(MyVersion);MyVersionWithCommas=$(MyVersionWithCommas);MyFullVersion=$(MyFullVersion);MyFspFsctlDeviceClassGuid=$(MyFspFsctlDeviceClassGuid);MyFspFsvrtDeviceClassGuid=$(MyFspFsvrtDeviceClassGuid) - MyProductName=$(MyProductName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyProductVersion=$(MyProductVersion);MyProductStage=$(MyProductStage);MyVersion=$(MyVersion);MyVersionWithCommas=$(MyVersionWithCommas);MyFullVersion=$(MyFullVersion) + MyProductName=$(MyProductName);MyProductFileName=$(MyProductFileName);MyDescription=$(MyDescription);MyCompanyName=$(MyCompanyName);MyCopyright=$(MyCopyright);MyProductVersion=$(MyProductVersion);MyProductStage=$(MyProductStage);MyVersion=$(MyVersion);MyVersionWithCommas=$(MyVersionWithCommas);MyFullVersion=$(MyFullVersion)MyFspFsctlDeviceClassGuid=$(MyFspFsctlDeviceClassGuid);MyFspFsvrtDeviceClassGuid=$(MyFspFsvrtDeviceClassGuid) diff --git a/build/VStudio/winfsp_dll.vcxproj b/build/VStudio/winfsp_dll.vcxproj index 349b1b02..0c40b456 100644 --- a/build/VStudio/winfsp_dll.vcxproj +++ b/build/VStudio/winfsp_dll.vcxproj @@ -130,7 +130,7 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf {4A7C0B21-9E10-4C81-92DE-1493EFCF24EB} Win32Proj winfspdll - $(LatestTargetPlatformVersion) + 10.0 winfsp.dll @@ -182,25 +182,25 @@ copy /b $(OutDir)fuse3-$(PlatformTarget).pc + %(FullPath) $(OutDir)fuse3-$(Platf true $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\ - $(SolutionName)-$(PlatformTarget) + $(MyProductFileName)-$(PlatformTarget) true $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\ - $(SolutionName)-$(PlatformTarget) + $(MyProductFileName)-$(PlatformTarget) false $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\ - $(SolutionName)-$(PlatformTarget) + $(MyProductFileName)-$(PlatformTarget) false $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\ - $(SolutionName)-$(PlatformTarget) + $(MyProductFileName)-$(PlatformTarget) diff --git a/build/VStudio/winfsp_sys.vcxproj b/build/VStudio/winfsp_sys.vcxproj index 659fb9e7..e4edca83 100644 --- a/build/VStudio/winfsp_sys.vcxproj +++ b/build/VStudio/winfsp_sys.vcxproj @@ -75,28 +75,28 @@ DbgengKernelDebugger $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\ - $(SolutionName)-$(PlatformTarget) + $(MyProductFileName)-$(PlatformTarget) false DbgengKernelDebugger $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\ - $(SolutionName)-$(PlatformTarget) + $(MyProductFileName)-$(PlatformTarget) false DbgengKernelDebugger $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\ - $(SolutionName)-$(PlatformTarget) + $(MyProductFileName)-$(PlatformTarget) false DbgengKernelDebugger $(SolutionDir)build\$(Configuration)\ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\ - $(SolutionName)-$(PlatformTarget) + $(MyProductFileName)-$(PlatformTarget) false diff --git a/inc/winfsp/fsctl.h b/inc/winfsp/fsctl.h index 0964a148..600b683f 100644 --- a/inc/winfsp/fsctl.h +++ b/inc/winfsp/fsctl.h @@ -35,17 +35,26 @@ extern "C" { #define FSP_FSCTL_STATIC_ASSERT(e,m) static_assert(1,"") #endif -#define FSP_FSCTL_DRIVER_NAME "WinFsp" -#define FSP_FSCTL_DISK_DEVICE_NAME "WinFsp.Disk" -#define FSP_FSCTL_NET_DEVICE_NAME "WinFsp.Net" -#define FSP_FSCTL_MUP_DEVICE_NAME "WinFsp.Mup" +#define FSP_FSCTL_STR(x) FSP_FSCTL_STR_(x) +#define FSP_FSCTL_STR_(x) #x +#if defined(MyProductName) +#define FSP_FSCTL_PRODUCT_NAME FSP_FSCTL_STR(MyProductName) +#else +#define FSP_FSCTL_PRODUCT_NAME "WinFsp" +#endif +#if defined(MyProductFileName) +#define FSP_FSCTL_PRODUCT_FILE_NAME FSP_FSCTL_STR(MyProductFileName) +#else +#define FSP_FSCTL_PRODUCT_FILE_NAME "winfsp" +#endif -// {6F9D25FA-6DEE-4A9D-80F5-E98E14F35E54} -extern const __declspec(selectany) GUID FspFsctlDeviceClassGuid = - { 0x6f9d25fa, 0x6dee, 0x4a9d, { 0x80, 0xf5, 0xe9, 0x8e, 0x14, 0xf3, 0x5e, 0x54 } }; -// {B48171C3-DD50-4852-83A3-344C50D93B17} -extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid = - { 0xb48171c3, 0xdd50, 0x4852, { 0x83, 0xa3, 0x34, 0x4c, 0x50, 0xd9, 0x3b, 0x17 } }; +#define FSP_FSCTL_DRIVER_NAME FSP_FSCTL_PRODUCT_NAME +#define FSP_FSCTL_DISK_DEVICE_NAME FSP_FSCTL_DRIVER_NAME ".Disk" +#define FSP_FSCTL_NET_DEVICE_NAME FSP_FSCTL_DRIVER_NAME ".Net" +#define FSP_FSCTL_MUP_DEVICE_NAME FSP_FSCTL_DRIVER_NAME ".Mup" + +extern const __declspec(selectany) GUID FspFsctlDeviceClassGuid = MyFspFsctlDeviceClassGuid; +extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid = MyFspFsvrtDeviceClassGuid; /* alignment macros */ #define FSP_FSCTL_ALIGN_UP(x, s) (((x) + ((s) - 1L)) & ~((s) - 1L)) diff --git a/inc/winfsp/launch.h b/inc/winfsp/launch.h index 81067f8e..0a043c94 100644 --- a/inc/winfsp/launch.h +++ b/inc/winfsp/launch.h @@ -32,10 +32,10 @@ extern "C" { #endif -#define FSP_LAUNCH_REGKEY "Software\\WinFsp\\Services" +#define FSP_LAUNCH_REGKEY "Software\\" FSP_FSCTL_PRODUCT_NAME "\\Services" #define FSP_LAUNCH_REGKEY_WOW64 KEY_WOW64_32KEY -#define FSP_LAUNCH_PIPE_NAME "\\\\.\\pipe\\WinFsp.{14E7137D-22B4-437A-B0C1-D21D1BDF3767}" +#define FSP_LAUNCH_PIPE_NAME "\\\\.\\pipe\\" FSP_FSCTL_PRODUCT_NAME ".{14E7137D-22B4-437A-B0C1-D21D1BDF3767}" #define FSP_LAUNCH_PIPE_BUFFER_SIZE 4096 #define FSP_LAUNCH_PIPE_OWNER ((PSID)WinLocalSystemSid) diff --git a/inc/winfsp/winfsp.h b/inc/winfsp/winfsp.h index b1952142..ff07e0b3 100644 --- a/inc/winfsp/winfsp.h +++ b/inc/winfsp/winfsp.h @@ -2112,9 +2112,9 @@ static inline NTSTATUS FspLoad(PVOID *PModule) { #if defined(_WIN64) -#define FSP_DLLNAME "winfsp-x64.dll" +#define FSP_DLLNAME FSP_FSCTL_PRODUCT_FILE_NAME "-x64.dll" #else -#define FSP_DLLNAME "winfsp-x86.dll" +#define FSP_DLLNAME FSP_FSCTL_PRODUCT_FILE_NAME "-x86.dll" #endif #define FSP_DLLPATH "bin\\" FSP_DLLNAME @@ -2142,7 +2142,7 @@ NTSTATUS FspLoad(PVOID *PModule) Module = LoadLibraryW(L"" FSP_DLLNAME); if (0 == Module) { - Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\WinFsp", + Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\" FSP_FSCTL_PRODUCT_NAME, 0, KEY_READ | KEY_WOW64_32KEY, &RegKey); if (ERROR_SUCCESS == Result) { diff --git a/inc/winfsp/winfsp.hpp b/inc/winfsp/winfsp.hpp index 22e9be19..6fa9b0b9 100644 --- a/inc/winfsp/winfsp.hpp +++ b/inc/winfsp/winfsp.hpp @@ -649,7 +649,7 @@ public: NTSTATUS Preflight(PWSTR MountPoint) { return FspFileSystemPreflight( - _VolumeParams.Prefix[0] ? L"WinFsp.Net" : L"WinFsp.Disk", + _VolumeParams.Prefix[0] ? L"" FSP_FSCTL_NET_DEVICE_NAME : L"" FSP_FSCTL_DISK_DEVICE_NAME, MountPoint); } NTSTATUS Mount(PWSTR MountPoint, @@ -669,7 +669,7 @@ public: if (!NT_SUCCESS(Result)) return Result; Result = FspFileSystemCreate( - _VolumeParams.Prefix[0] ? L"WinFsp.Net" : L"WinFsp.Disk", + _VolumeParams.Prefix[0] ? L"" FSP_FSCTL_NET_DEVICE_NAME : L"" FSP_FSCTL_DISK_DEVICE_NAME, &_VolumeParams, Interface(), &_FileSystemPtr); if (!NT_SUCCESS(Result)) return Result; diff --git a/src/dll/library.h b/src/dll/library.h index a79d1c57..054cee32 100644 --- a/src/dll/library.h +++ b/src/dll/library.h @@ -30,7 +30,7 @@ #include -#define LIBRARY_NAME "WinFsp" +#define LIBRARY_NAME FSP_FSCTL_PRODUCT_NAME /* DEBUGLOG */ #if !defined(NDEBUG) diff --git a/src/dll/version.rc b/src/dll/version.rc index 07f0e199..180dff7d 100644 --- a/src/dll/version.rc +++ b/src/dll/version.rc @@ -23,9 +23,9 @@ BEGIN VALUE "CompanyName", STR(MyCompanyName) VALUE "FileDescription", STR(MyDescription) VALUE "FileVersion", STR(MyFullVersion) - VALUE "InternalName", "winfsp.dll" + VALUE "InternalName", STR(MyProductFileName) ".dll" VALUE "LegalCopyright", STR(MyCopyright) - VALUE "OriginalFilename", "winfsp.dll" + VALUE "OriginalFilename", STR(MyProductFileName) ".dll" VALUE "ProductName", STR(MyProductName) VALUE "ProductVersion", STR(MyProductVersion) END diff --git a/src/dotnet/FileSystemHost.cs b/src/dotnet/FileSystemHost.cs index db674d28..44987214 100644 --- a/src/dotnet/FileSystemHost.cs +++ b/src/dotnet/FileSystemHost.cs @@ -342,7 +342,7 @@ namespace Fsp public Int32 Preflight(String MountPoint) { return Api.FspFileSystemPreflight( - _VolumeParams.IsPrefixEmpty() ? "WinFsp.Disk" : "WinFsp.Net", + _VolumeParams.IsPrefixEmpty() ? Api.ProductName + ".Disk" : Api.ProductName + ".Net", MountPoint); } /// @@ -416,7 +416,7 @@ namespace Fsp if (0 > Result) return Result; Result = Api.FspFileSystemCreate( - _VolumeParams.IsPrefixEmpty() ? "WinFsp.Disk" : "WinFsp.Net", + _VolumeParams.IsPrefixEmpty() ? Api.ProductName + ".Disk" : Api.ProductName + ".Net", ref _VolumeParams, _FileSystemInterfacePtr, out _FileSystemPtr); if (0 > Result) return Result; diff --git a/src/dotnet/Interop.cs b/src/dotnet/Interop.cs index b0d7df73..9b0ac5c7 100644 --- a/src/dotnet/Interop.cs +++ b/src/dotnet/Interop.cs @@ -1425,13 +1425,17 @@ namespace Fsp.Interop } /* initialization */ + internal static String ProductName = "WinFsp"; + internal static String ProductFileName = "winfsp"; private static IntPtr LoadDll() { String DllPath = null; - String DllName = 8 == IntPtr.Size ? "winfsp-x64.dll" : "winfsp-x86.dll"; + String DllName = 8 == IntPtr.Size ? + ProductFileName + "-x64.dll" : + ProductFileName + "-x86.dll"; String KeyName = 8 == IntPtr.Size ? - "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\WinFsp" : - "HKEY_LOCAL_MACHINE\\Software\\WinFsp"; + "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\" + ProductName : + "HKEY_LOCAL_MACHINE\\Software\\" + ProductName; IntPtr Module; Module = LoadLibraryW(DllName); if (IntPtr.Zero == Module) @@ -1525,6 +1529,15 @@ namespace Fsp.Interop if (Debugger.IsAttached) Debugger.Break(); #endif + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes( + typeof(AssemblyProductAttribute), false); + if (null != attributes && + 0 < attributes.Length && + null != attributes[0] as AssemblyProductAttribute) + { + ProductName = (attributes[0] as AssemblyProductAttribute).Product; + ProductFileName = ProductName.ToLowerInvariant(); + } LoadProto(LoadDll()); CheckVersion(); } diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 53800082..6f363241 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -25,7 +25,7 @@ #include #include -#define PROGNAME "WinFsp.Launcher" +#define PROGNAME FSP_FSCTL_PRODUCT_NAME ".Launcher" static NTSTATUS (NTAPI *SvcNtOpenSymbolicLinkObject)( PHANDLE LinkHandle, diff --git a/src/shared/ku/posix.c b/src/shared/ku/posix.c index 255f7005..3e7708d5 100644 --- a/src/shared/ku/posix.c +++ b/src/shared/ku/posix.c @@ -181,7 +181,7 @@ static VOID FspPosixInitializeFromRegistry(VOID) DistinctPermsForSameOwnerGroup = 0; - Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\WinFsp", + Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\" FSP_FSCTL_PRODUCT_NAME, 0, KEY_READ | KEY_WOW64_32KEY, &RegKey); if (ERROR_SUCCESS == Result) { diff --git a/src/sys/driver.h b/src/sys/driver.h index 93b826fe..bd23ae3d 100644 --- a/src/sys/driver.h +++ b/src/sys/driver.h @@ -42,9 +42,9 @@ #define DRIVER_NAME FSP_FSCTL_DRIVER_NAME #if _WIN64 -#define FSP_REGKEY "\\Registry\\Machine\\Software\\WOW6432Node\\WinFsp" +#define FSP_REGKEY "\\Registry\\Machine\\Software\\WOW6432Node\\" FSP_FSCTL_PRODUCT_NAME #else -#define FSP_REGKEY "\\Registry\\Machine\\Software\\WinFsp" +#define FSP_REGKEY "\\Registry\\Machine\\Software\\" FSP_FSCTL_PRODUCT_NAME #endif /* IoCreateDeviceSecure default SDDL's */ diff --git a/src/sys/version.rc b/src/sys/version.rc index e86c7eab..90dd07aa 100644 --- a/src/sys/version.rc +++ b/src/sys/version.rc @@ -23,9 +23,9 @@ BEGIN VALUE "CompanyName", STR(MyCompanyName) VALUE "FileDescription", STR(MyDescription) VALUE "FileVersion", STR(MyFullVersion) - VALUE "InternalName", "winfsp.sys" + VALUE "InternalName", STR(MyProductFileName) ".sys" VALUE "LegalCopyright", STR(MyCopyright) - VALUE "OriginalFilename", "winfsp.sys" + VALUE "OriginalFilename", STR(MyProductFileName) ".sys" VALUE "ProductName", STR(MyProductName) VALUE "ProductVersion", STR(MyProductVersion) END diff --git a/tools/build-choco.bat b/tools/build-choco.bat index 01aa2856..58f504db 100755 --- a/tools/build-choco.bat +++ b/tools/build-choco.bat @@ -3,10 +3,12 @@ setlocal setlocal EnableDelayedExpansion -set MsiName="WinFsp - Windows File System Proxy" +call "%~dp0myinfo.bat" + +set MsiName="%MyProductName% - %MyDescription%" set CrossCert="%~dp0DigiCert High Assurance EV Root CA.crt" set Issuer="DigiCert" -set Subject="Navimatics LLC" +set Subject="%MyCompanyName%" set Configuration=Release set SignedPackage= @@ -14,6 +16,9 @@ set SignedPackage= if not X%1==X set Configuration=%1 if not X%2==X set SignedPackage=%2 +echo Configuration=%Configuration% +echo: + if X%~nx0==Xbuild-choco.bat ( cd %~dp0..\build\VStudio goto :choco @@ -22,9 +27,9 @@ if X%~nx0==Xbuild-choco.bat ( call "%~dp0vcvarsall.bat" x64 if not X%SignedPackage%==X ( - if not exist "%~dp0..\build\VStudio\build\%Configuration%\winfsp-*.msi" (echo previous build not found >&2 & exit /b 1) + if not exist "%~dp0..\build\VStudio\build\%Configuration%\%MyProductFileName%-*.msi" (echo previous build not found >&2 & exit /b 1) if not exist "%SignedPackage%" (echo signed package not found >&2 & exit /b 1) - del "%~dp0..\build\VStudio\build\%Configuration%\winfsp-*.msi" + del "%~dp0..\build\VStudio\build\%Configuration%\%MyProductFileName%-*.msi" if exist "%~dp0..\build\VStudio\build\%Configuration%\winfsp.*.nupkg" del "%~dp0..\build\VStudio\build\%Configuration%\winfsp.*.nupkg" for /R "%SignedPackage%" %%f in (*.sys) do ( copy "%%f" "%~dp0..\build\VStudio\build\%Configuration%" >nul @@ -44,7 +49,7 @@ if X%SignedPackage%==X ( devenv winfsp.sln /build "%Configuration%|x86" if errorlevel 1 goto fail - for %%f in (build\%Configuration%\winfsp-x64.sys build\%Configuration%\winfsp-x86.sys) do ( + for %%f in (build\%Configuration%\%MyProductFileName%-x64.sys build\%Configuration%\%MyProductFileName%-x86.sys) do ( signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha1 /t http://timestamp.digicert.com %%f if errorlevel 1 set /a signfail=signfail+1 signtool sign /as /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 %%f @@ -66,10 +71,10 @@ if X%SignedPackage%==X ( echo .Set DiskDirectory1=. >>driver.ddf echo .Set DestinationDir=x64 >>driver.ddf echo driver-x64.inf >>driver.ddf - echo winfsp-x64.sys >>driver.ddf + echo %MyProductFileName%-x64.sys >>driver.ddf echo .Set DestinationDir=x86 >>driver.ddf echo driver-x86.inf >>driver.ddf - echo winfsp-x86.sys >>driver.ddf + echo %MyProductFileName%-x86.sys >>driver.ddf makecab /F driver.ddf signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /t http://timestamp.digicert.com driver.cab if errorlevel 1 set /a signfail=signfail+1 @@ -79,7 +84,7 @@ if X%SignedPackage%==X ( devenv winfsp.sln /build "Installer.%Configuration%|x86" if errorlevel 1 goto fail -for %%f in (build\%Configuration%\winfsp-*.msi) do ( +for %%f in (build\%Configuration%\%MyProductFileName%-*.msi) do ( signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha1 /t http://timestamp.digicert.com /d %MsiName% %%f if errorlevel 1 set /a signfail=signfail+1 REM signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d %MsiName% %%f @@ -89,8 +94,8 @@ for %%f in (build\%Configuration%\winfsp-*.msi) do ( if not %signfail%==0 echo SIGNING FAILED! The product has been successfully built, but not signed. set Version= -for %%f in (build\%Configuration%\winfsp-*.msi) do set Version=%%~nf -set Version=!Version:winfsp-=! +for %%f in (build\%Configuration%\%MyProductFileName%-*.msi) do set Version=%%~nf +set Version=!Version:%MyProductFileName%-=! if X%SignedPackage%==X ( pushd build\%Configuration% powershell -command "Compress-Archive -Path winfsp-tests-*.exe,..\..\..\..\License.txt,..\..\..\..\tst\winfsp-tests\README.md -DestinationPath winfsp-tests-!Version!.zip" @@ -99,10 +104,10 @@ if X%SignedPackage%==X ( ) :choco -if not exist "build\%Configuration%\winfsp-*.msi" (echo installer msi not found >&2 & exit /b 1) +if not exist "build\%Configuration%\%MyProductFileName%-*.msi" (echo installer msi not found >&2 & exit /b 1) set Version= -for %%f in (build\%Configuration%\winfsp-*.msi) do set Version=%%~nf -set Version=!Version:winfsp-=! +for %%f in (build\%Configuration%\%MyProductFileName%-*.msi) do set Version=%%~nf +set Version=!Version:%MyProductFileName%-=! set ProductStage= for /f "delims=<> tokens=3" %%i in ('findstr "" version.properties') do ( set MyProductStage=%%i @@ -115,7 +120,7 @@ where /q choco.exe if %ERRORLEVEL% equ 0 ( copy ..\choco\* build\%Configuration% copy ..\choco\LICENSE.TXT /B + ..\..\License.txt /B build\%Configuration%\LICENSE.txt /B - certutil -hashfile build\%Configuration%\winfsp-!Version!.msi SHA256 >>build\%Configuration%\VERIFICATION.txt + certutil -hashfile build\%Configuration%\%MyProductFileName%-!Version!.msi SHA256 >>build\%Configuration%\VERIFICATION.txt choco pack build\%Configuration%\winfsp.nuspec --version=!PackageVersion! --outputdirectory=build\%Configuration% MsiVersion=!Version! if errorlevel 1 goto fail ) diff --git a/tools/build.bat b/tools/build.bat index 01aa2856..58f504db 100755 --- a/tools/build.bat +++ b/tools/build.bat @@ -3,10 +3,12 @@ setlocal setlocal EnableDelayedExpansion -set MsiName="WinFsp - Windows File System Proxy" +call "%~dp0myinfo.bat" + +set MsiName="%MyProductName% - %MyDescription%" set CrossCert="%~dp0DigiCert High Assurance EV Root CA.crt" set Issuer="DigiCert" -set Subject="Navimatics LLC" +set Subject="%MyCompanyName%" set Configuration=Release set SignedPackage= @@ -14,6 +16,9 @@ set SignedPackage= if not X%1==X set Configuration=%1 if not X%2==X set SignedPackage=%2 +echo Configuration=%Configuration% +echo: + if X%~nx0==Xbuild-choco.bat ( cd %~dp0..\build\VStudio goto :choco @@ -22,9 +27,9 @@ if X%~nx0==Xbuild-choco.bat ( call "%~dp0vcvarsall.bat" x64 if not X%SignedPackage%==X ( - if not exist "%~dp0..\build\VStudio\build\%Configuration%\winfsp-*.msi" (echo previous build not found >&2 & exit /b 1) + if not exist "%~dp0..\build\VStudio\build\%Configuration%\%MyProductFileName%-*.msi" (echo previous build not found >&2 & exit /b 1) if not exist "%SignedPackage%" (echo signed package not found >&2 & exit /b 1) - del "%~dp0..\build\VStudio\build\%Configuration%\winfsp-*.msi" + del "%~dp0..\build\VStudio\build\%Configuration%\%MyProductFileName%-*.msi" if exist "%~dp0..\build\VStudio\build\%Configuration%\winfsp.*.nupkg" del "%~dp0..\build\VStudio\build\%Configuration%\winfsp.*.nupkg" for /R "%SignedPackage%" %%f in (*.sys) do ( copy "%%f" "%~dp0..\build\VStudio\build\%Configuration%" >nul @@ -44,7 +49,7 @@ if X%SignedPackage%==X ( devenv winfsp.sln /build "%Configuration%|x86" if errorlevel 1 goto fail - for %%f in (build\%Configuration%\winfsp-x64.sys build\%Configuration%\winfsp-x86.sys) do ( + for %%f in (build\%Configuration%\%MyProductFileName%-x64.sys build\%Configuration%\%MyProductFileName%-x86.sys) do ( signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha1 /t http://timestamp.digicert.com %%f if errorlevel 1 set /a signfail=signfail+1 signtool sign /as /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 %%f @@ -66,10 +71,10 @@ if X%SignedPackage%==X ( echo .Set DiskDirectory1=. >>driver.ddf echo .Set DestinationDir=x64 >>driver.ddf echo driver-x64.inf >>driver.ddf - echo winfsp-x64.sys >>driver.ddf + echo %MyProductFileName%-x64.sys >>driver.ddf echo .Set DestinationDir=x86 >>driver.ddf echo driver-x86.inf >>driver.ddf - echo winfsp-x86.sys >>driver.ddf + echo %MyProductFileName%-x86.sys >>driver.ddf makecab /F driver.ddf signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /t http://timestamp.digicert.com driver.cab if errorlevel 1 set /a signfail=signfail+1 @@ -79,7 +84,7 @@ if X%SignedPackage%==X ( devenv winfsp.sln /build "Installer.%Configuration%|x86" if errorlevel 1 goto fail -for %%f in (build\%Configuration%\winfsp-*.msi) do ( +for %%f in (build\%Configuration%\%MyProductFileName%-*.msi) do ( signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha1 /t http://timestamp.digicert.com /d %MsiName% %%f if errorlevel 1 set /a signfail=signfail+1 REM signtool sign /ac %CrossCert% /i %Issuer% /n %Subject% /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d %MsiName% %%f @@ -89,8 +94,8 @@ for %%f in (build\%Configuration%\winfsp-*.msi) do ( if not %signfail%==0 echo SIGNING FAILED! The product has been successfully built, but not signed. set Version= -for %%f in (build\%Configuration%\winfsp-*.msi) do set Version=%%~nf -set Version=!Version:winfsp-=! +for %%f in (build\%Configuration%\%MyProductFileName%-*.msi) do set Version=%%~nf +set Version=!Version:%MyProductFileName%-=! if X%SignedPackage%==X ( pushd build\%Configuration% powershell -command "Compress-Archive -Path winfsp-tests-*.exe,..\..\..\..\License.txt,..\..\..\..\tst\winfsp-tests\README.md -DestinationPath winfsp-tests-!Version!.zip" @@ -99,10 +104,10 @@ if X%SignedPackage%==X ( ) :choco -if not exist "build\%Configuration%\winfsp-*.msi" (echo installer msi not found >&2 & exit /b 1) +if not exist "build\%Configuration%\%MyProductFileName%-*.msi" (echo installer msi not found >&2 & exit /b 1) set Version= -for %%f in (build\%Configuration%\winfsp-*.msi) do set Version=%%~nf -set Version=!Version:winfsp-=! +for %%f in (build\%Configuration%\%MyProductFileName%-*.msi) do set Version=%%~nf +set Version=!Version:%MyProductFileName%-=! set ProductStage= for /f "delims=<> tokens=3" %%i in ('findstr "" version.properties') do ( set MyProductStage=%%i @@ -115,7 +120,7 @@ where /q choco.exe if %ERRORLEVEL% equ 0 ( copy ..\choco\* build\%Configuration% copy ..\choco\LICENSE.TXT /B + ..\..\License.txt /B build\%Configuration%\LICENSE.txt /B - certutil -hashfile build\%Configuration%\winfsp-!Version!.msi SHA256 >>build\%Configuration%\VERIFICATION.txt + certutil -hashfile build\%Configuration%\%MyProductFileName%-!Version!.msi SHA256 >>build\%Configuration%\VERIFICATION.txt choco pack build\%Configuration%\winfsp.nuspec --version=!PackageVersion! --outputdirectory=build\%Configuration% MsiVersion=!Version! if errorlevel 1 goto fail ) diff --git a/tools/myinfo.bat b/tools/myinfo.bat new file mode 100644 index 00000000..88234e3f --- /dev/null +++ b/tools/myinfo.bat @@ -0,0 +1,20 @@ +@echo off + +for /F "tokens=2,3,4 delims=<>" %%a in (%~dp0..\build\VStudio\version.properties) do ( + if "/%%a"=="%%c" ( + if "%%a"=="MyProductName" ( + set MyProductName=%%b + ) else if "%%a"=="MyProductFileName" ( + set MyProductFileName=%%b + ) else if "%%a"=="MyDescription" ( + set MyDescription=%%b + ) else if "%%a"=="MyCompanyName" ( + set MyCompanyName=%%b + ) + ) +) + +echo MyProductName=%MyProductName% +echo MyProductFileName=%MyProductFileName% +echo MyDescription=%MyDescription% +echo MyCompanyName=%MyCompanyName%