diff --git a/build/VStudio/installer/Product.wxs b/build/VStudio/installer/Product.wxs
index 2f35d2db..3ec3a886 100644
--- a/build/VStudio/installer/Product.wxs
+++ b/build/VStudio/installer/Product.wxs
@@ -158,6 +158,13 @@
+
+
+
+
+
+
+
@@ -427,6 +434,12 @@
+
+
+
+
+
+
@@ -448,6 +461,8 @@
+
+
@@ -504,6 +519,8 @@
+
+
diff --git a/build/VStudio/tools/fsptool.vcxproj b/build/VStudio/tools/fsptool.vcxproj
new file mode 100644
index 00000000..913a6390
--- /dev/null
+++ b/build/VStudio/tools/fsptool.vcxproj
@@ -0,0 +1,193 @@
+
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}
+ Win32Proj
+ fsptool
+ 8.1
+
+
+
+ Application
+ true
+ v140
+ Unicode
+
+
+ Application
+ false
+ v140
+ true
+ Unicode
+
+
+ Application
+ true
+ v140
+ Unicode
+
+
+ Application
+ false
+ v140
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)build\$(Configuration)\
+ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\
+ $(ProjectName)-$(PlatformTarget)
+
+
+ true
+ $(SolutionDir)build\$(Configuration)\
+ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\
+ $(ProjectName)-$(PlatformTarget)
+
+
+ false
+ $(SolutionDir)build\$(Configuration)\
+ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\
+ $(ProjectName)-$(PlatformTarget)
+
+
+ false
+ $(SolutionDir)build\$(Configuration)\
+ $(SolutionDir)build\$(ProjectName).build\$(Configuration)\$(PlatformTarget)\
+ $(ProjectName)-$(PlatformTarget)
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ ..\..\..\src;..\..\..\inc
+ Default
+ MultiThreaded
+ false
+
+
+ Console
+ true
+ true
+ $(OutDir)$(TargetName).public.pdb
+
+
+
+
+
+
+ Level3
+ Disabled
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ ..\..\..\src;..\..\..\inc
+ Default
+ MultiThreaded
+ false
+
+
+ Console
+ true
+ true
+ $(OutDir)$(TargetName).public.pdb
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ ..\..\..\src;..\..\..\inc
+ MultiThreaded
+ false
+
+
+ Console
+ true
+ true
+ true
+ true
+ $(OutDir)$(TargetName).public.pdb
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ ..\..\..\src;..\..\..\inc
+ MultiThreaded
+ false
+
+
+ Console
+ true
+ true
+ true
+ true
+ $(OutDir)$(TargetName).public.pdb
+
+
+
+
+ {4a7c0b21-9e10-4c81-92de-1493efcf24eb}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/VStudio/tools/fsptool.vcxproj.filters b/build/VStudio/tools/fsptool.vcxproj.filters
new file mode 100644
index 00000000..077b0dba
--- /dev/null
+++ b/build/VStudio/tools/fsptool.vcxproj.filters
@@ -0,0 +1,23 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;xsd
+
+
+
+
+ Source
+
+
+
+
+ Source
+
+
+
\ No newline at end of file
diff --git a/build/VStudio/winfsp.sln b/build/VStudio/winfsp.sln
index 54b85cef..d726e30a 100644
--- a/build/VStudio/winfsp.sln
+++ b/build/VStudio/winfsp.sln
@@ -56,6 +56,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "launcher", "tools\launcher.
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "launchctl", "tools\launchctl.vcxproj", "{264A5D09-126F-4760-A3F1-4B3B95C925AA}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsptool", "tools\fsptool.vcxproj", "{1E997BEC-1642-4A5C-B252-852DA094E11E}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -229,11 +231,9 @@ Global
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Debug|x86.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Debug|x86.Build.0 = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Debug|Any CPU.Build.0 = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Debug|x64.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Debug|x86.ActiveCfg = Debug|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Release|Any CPU.Build.0 = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Release|x64.ActiveCfg = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Installer.Release|x86.ActiveCfg = Release|Any CPU
{4920E350-D496-4652-AE98-6C4208AEC1D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -248,11 +248,9 @@ Global
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Debug|x86.ActiveCfg = Debug|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Debug|x86.Build.0 = Debug|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Debug|Any CPU.ActiveCfg = Release|x64
- {6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Debug|Any CPU.Build.0 = Release|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Debug|x64.ActiveCfg = Debug|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Release|Any CPU.ActiveCfg = Release|x64
- {6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Release|Any CPU.Build.0 = Release|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Release|x64.ActiveCfg = Release|x64
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Installer.Release|x86.ActiveCfg = Release|Win32
{6CDF9411-B852-4EAC-822D-8F930675F17B}.Release|Any CPU.ActiveCfg = Release|Win32
@@ -266,11 +264,9 @@ Global
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Debug|x86.ActiveCfg = Debug|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Debug|x86.Build.0 = Debug|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Debug|Any CPU.ActiveCfg = Release|x64
- {264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Debug|Any CPU.Build.0 = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Debug|x64.ActiveCfg = Debug|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Debug|x86.ActiveCfg = Debug|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Release|Any CPU.ActiveCfg = Release|x64
- {264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Release|Any CPU.Build.0 = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Release|x64.ActiveCfg = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Installer.Release|x86.ActiveCfg = Release|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|Any CPU.ActiveCfg = Release|Win32
@@ -278,6 +274,22 @@ Global
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|x64.Build.0 = Release|x64
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|x86.ActiveCfg = Release|Win32
{264A5D09-126F-4760-A3F1-4B3B95C925AA}.Release|x86.Build.0 = Release|Win32
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|x64.ActiveCfg = Debug|x64
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|x64.Build.0 = Debug|x64
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|x86.ActiveCfg = Debug|Win32
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Debug|x86.Build.0 = Debug|Win32
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Debug|Any CPU.ActiveCfg = Release|x64
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Debug|x64.ActiveCfg = Debug|x64
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Debug|x86.ActiveCfg = Debug|Win32
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Release|Any CPU.ActiveCfg = Release|x64
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Release|x64.ActiveCfg = Release|x64
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Installer.Release|x86.ActiveCfg = Release|Win32
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|Any CPU.ActiveCfg = Release|Win32
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|x64.ActiveCfg = Release|x64
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|x64.Build.0 = Release|x64
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|x86.ActiveCfg = Release|Win32
+ {1E997BEC-1642-4A5C-B252-852DA094E11E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -293,5 +305,6 @@ Global
{4920E350-D496-4652-AE98-6C4208AEC1D8} = {69439FD1-C07D-4BF1-98DC-3CCFECE53A49}
{6CDF9411-B852-4EAC-822D-8F930675F17B} = {04A4762C-FAB9-4196-9AC8-0757F3E8AB79}
{264A5D09-126F-4760-A3F1-4B3B95C925AA} = {04A4762C-FAB9-4196-9AC8-0757F3E8AB79}
+ {1E997BEC-1642-4A5C-B252-852DA094E11E} = {04A4762C-FAB9-4196-9AC8-0757F3E8AB79}
EndGlobalSection
EndGlobal
diff --git a/src/fsptool/fsptool-version.rc b/src/fsptool/fsptool-version.rc
new file mode 100644
index 00000000..c8939019
--- /dev/null
+++ b/src/fsptool/fsptool-version.rc
@@ -0,0 +1,37 @@
+#include
+
+#define STR(x) STR_(x)
+#define STR_(x) #x
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION MyVersionWithCommas
+PRODUCTVERSION MyVersionWithCommas
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+#ifdef _DEBUG
+FILEFLAGS VS_FF_DEBUG
+#else
+FILEFLAGS 0
+#endif
+FILEOS VOS_NT
+FILETYPE VFT_APP
+FILESUBTYPE 0
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", STR(MyCompanyName)
+ VALUE "FileDescription", STR(MyDescription)
+ VALUE "FileVersion", STR(MyFullVersion)
+ VALUE "InternalName", "fsptool.exe"
+ VALUE "LegalCopyright", STR(MyCopyright)
+ VALUE "OriginalFilename", "fsptool.exe"
+ VALUE "ProductName", STR(MyProductName)
+ VALUE "ProductVersion", STR(MyProductVersion)
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/src/fsptool/fsptool.c b/src/fsptool/fsptool.c
new file mode 100644
index 00000000..fa1d1c65
--- /dev/null
+++ b/src/fsptool/fsptool.c
@@ -0,0 +1,159 @@
+/**
+ * @file fsptool/fsptool.c
+ *
+ * @copyright 2015-2017 Bill Zissimopoulos
+ */
+/*
+ * This file is part of WinFsp.
+ *
+ * You can redistribute it and/or modify it under the terms of the GNU
+ * General Public License version 3 as published by the Free Software
+ * Foundation.
+ *
+ * Licensees holding a valid commercial license may use this file in
+ * accordance with the commercial license agreement provided with the
+ * software.
+ */
+
+#include
+#include
+
+#define PROGNAME "fsptool"
+
+#define info(format, ...) printlog(GetStdHandle(STD_OUTPUT_HANDLE), format, __VA_ARGS__)
+#define warn(format, ...) printlog(GetStdHandle(STD_ERROR_HANDLE), format, __VA_ARGS__)
+#define fatal(ExitCode, format, ...) (warn(format, __VA_ARGS__), ExitProcess(ExitCode))
+
+static void vprintlog(HANDLE h, const char *format, va_list ap)
+{
+ char buf[1024];
+ /* wvsprintf is only safe with a 1024 byte buffer */
+ size_t len;
+ DWORD BytesTransferred;
+
+ wvsprintfA(buf, format, ap);
+ buf[sizeof buf - 1] = '\0';
+
+ len = lstrlenA(buf);
+ buf[len++] = '\n';
+
+ WriteFile(h, buf, (DWORD)len, &BytesTransferred, 0);
+}
+
+static void printlog(HANDLE h, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ vprintlog(h, format, ap);
+ va_end(ap);
+}
+
+static void usage(void)
+{
+ fatal(ERROR_INVALID_PARAMETER,
+ "usage: %s COMMAND ARGS\n"
+ "\n"
+ "commands:\n"
+ " lsvol list file system devices (volumes)\n"
+ //" list list running file system processes\n"
+ //" kill kill file system process\n"
+ " getsid get current SID\n"
+ " getuid get current POSIX UID\n"
+ " getgid get current POSIX GID\n"
+ " uidtosid get SID from POSIX UID\n"
+ " sidtouid get POSIX UID from SID\n"
+ " permtosd get security descriptor from POSIX permissions\n"
+ " sdtoperm get POSIX permissions from security descriptor\n"
+ PROGNAME);
+}
+
+static int lsvol(int argc, wchar_t **argv)
+{
+ return 1;
+}
+
+static int getsid(int argc, wchar_t **argv)
+{
+ return 1;
+}
+
+static int getuid(int argc, wchar_t **argv)
+{
+ return 1;
+}
+
+static int getgid(int argc, wchar_t **argv)
+{
+ return 1;
+}
+
+static int uidtosid(int argc, wchar_t **argv)
+{
+ return 1;
+}
+
+static int sidtouid(int argc, wchar_t **argv)
+{
+ return 1;
+}
+
+static int permtosd(int argc, wchar_t **argv)
+{
+ return 1;
+}
+
+static int sdtoperm(int argc, wchar_t **argv)
+{
+ return 1;
+}
+
+int wmain(int argc, wchar_t **argv)
+{
+ argc--;
+ argv++;
+
+ if (0 == argc)
+ usage();
+
+ if (0 == invariant_wcscmp(L"lsvol", argv[0]))
+ return lsvol(argc, argv);
+ else
+ if (0 == invariant_wcscmp(L"getsid", argv[0]))
+ return getsid(argc, argv);
+ else
+ if (0 == invariant_wcscmp(L"getuid", argv[0]))
+ return getuid(argc, argv);
+ else
+ if (0 == invariant_wcscmp(L"getgid", argv[0]))
+ return getgid(argc, argv);
+ else
+ if (0 == invariant_wcscmp(L"uidtosid", argv[0]))
+ return uidtosid(argc, argv);
+ else
+ if (0 == invariant_wcscmp(L"sidtouid", argv[0]))
+ return sidtouid(argc, argv);
+ else
+ if (0 == invariant_wcscmp(L"permtosd", argv[0]))
+ return permtosd(argc, argv);
+ else
+ if (0 == invariant_wcscmp(L"sdtoperm", argv[0]))
+ return sdtoperm(argc, argv);
+
+ else
+ usage();
+
+ return 0;
+}
+
+void wmainCRTStartup(void)
+{
+ DWORD Argc;
+ PWSTR *Argv;
+
+ Argv = CommandLineToArgvW(GetCommandLineW(), &Argc);
+ if (0 == Argv)
+ ExitProcess(GetLastError());
+
+ ExitProcess(wmain(Argc, Argv));
+}