WinFsp rebranding support

This commit is contained in:
Bill Zissimopoulos
2021-04-12 17:47:34 -07:00
parent a7cfabeff8
commit 023c925fb6
21 changed files with 209 additions and 152 deletions

View File

@ -30,7 +30,7 @@
#include <shared/ku/config.h>
#define LIBRARY_NAME "WinFsp"
#define LIBRARY_NAME FSP_FSCTL_PRODUCT_NAME
/* DEBUGLOG */
#if !defined(NDEBUG)

View File

@ -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

View File

@ -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);
}
/// <summary>
@ -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;

View File

@ -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();
}

View File

@ -25,7 +25,7 @@
#include <sddl.h>
#include <userenv.h>
#define PROGNAME "WinFsp.Launcher"
#define PROGNAME FSP_FSCTL_PRODUCT_NAME ".Launcher"
static NTSTATUS (NTAPI *SvcNtOpenSymbolicLinkObject)(
PHANDLE LinkHandle,

View File

@ -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)
{

View File

@ -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 */

View File

@ -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