mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 17:03:12 -05:00
inc: fsctl: FSP_FSCTL_VOLUME_PARAMS changes:
- increase size of VolumePrefix - add FileSystemName field (currently unused)
This commit is contained in:
parent
b7a2b5e17a
commit
817beebb63
@ -24,12 +24,17 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* static_assert is a C++11 feature, but seems to work with C on MSVC 2015 */
|
||||||
|
#if defined(WINFSP_SYS_INTERNAL) || defined(WINFSP_DLL_INTERNAL)
|
||||||
|
#define FSP_FSCTL_STATIC_ASSERT(e,m) static_assert(e,m)
|
||||||
|
#else
|
||||||
|
#define FSP_FSCTL_STATIC_ASSERT(e,m)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FSP_FSCTL_DRIVER_NAME "WinFsp"
|
#define FSP_FSCTL_DRIVER_NAME "WinFsp"
|
||||||
#define FSP_FSCTL_DISK_DEVICE_NAME "WinFsp.Disk"
|
#define FSP_FSCTL_DISK_DEVICE_NAME "WinFsp.Disk"
|
||||||
#define FSP_FSCTL_NET_DEVICE_NAME "WinFsp.Net"
|
#define FSP_FSCTL_NET_DEVICE_NAME "WinFsp.Net"
|
||||||
|
|
||||||
#define FSP_FSCTL_VOLUME_PARAMS_PREFIX "\\VolumeParams="
|
|
||||||
|
|
||||||
// {6F9D25FA-6DEE-4A9D-80F5-E98E14F35E54}
|
// {6F9D25FA-6DEE-4A9D-80F5-E98E14F35E54}
|
||||||
extern const __declspec(selectany) GUID FspFsctlDeviceClassGuid =
|
extern const __declspec(selectany) GUID FspFsctlDeviceClassGuid =
|
||||||
{ 0x6f9d25fa, 0x6dee, 0x4a9d, { 0x80, 0xf5, 0xe9, 0x8e, 0x14, 0xf3, 0x5e, 0x54 } };
|
{ 0x6f9d25fa, 0x6dee, 0x4a9d, { 0x80, 0xf5, 0xe9, 0x8e, 0x14, 0xf3, 0x5e, 0x54 } };
|
||||||
@ -55,9 +60,14 @@ extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid =
|
|||||||
#define FSP_FSCTL_STOP \
|
#define FSP_FSCTL_STOP \
|
||||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'S', METHOD_BUFFERED, FILE_ANY_ACCESS)
|
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'S', METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
|
|
||||||
|
#define FSP_FSCTL_VOLUME_PARAMS_PREFIX "\\VolumeParams="
|
||||||
|
|
||||||
#define FSP_FSCTL_VOLUME_NAME_SIZE (64 * sizeof(WCHAR))
|
#define FSP_FSCTL_VOLUME_NAME_SIZE (64 * sizeof(WCHAR))
|
||||||
#define FSP_FSCTL_VOLUME_PREFIX_SIZE (64 * sizeof(WCHAR))
|
#define FSP_FSCTL_VOLUME_PREFIX_SIZE (192 * sizeof(WCHAR))
|
||||||
|
#define FSP_FSCTL_VOLUME_FSNAME_SIZE (16 * sizeof(WCHAR))
|
||||||
#define FSP_FSCTL_VOLUME_NAME_SIZEMAX (FSP_FSCTL_VOLUME_NAME_SIZE + FSP_FSCTL_VOLUME_PREFIX_SIZE)
|
#define FSP_FSCTL_VOLUME_NAME_SIZEMAX (FSP_FSCTL_VOLUME_NAME_SIZE + FSP_FSCTL_VOLUME_PREFIX_SIZE)
|
||||||
|
FSP_FSCTL_STATIC_ASSERT(FSP_FSCTL_VOLUME_NAME_SIZEMAX <= 260 * sizeof(WCHAR),
|
||||||
|
"Max volume name size is greater than MAX_PATH.");
|
||||||
|
|
||||||
#define FSP_FSCTL_TRANSACT_PATH_SIZEMAX 2048
|
#define FSP_FSCTL_TRANSACT_PATH_SIZEMAX 2048
|
||||||
|
|
||||||
@ -135,6 +145,7 @@ typedef struct
|
|||||||
UINT32 ExtendedAttributes:1; /* unimplemented; set to 0 */
|
UINT32 ExtendedAttributes:1; /* unimplemented; set to 0 */
|
||||||
UINT32 ReadOnlyVolume:1;
|
UINT32 ReadOnlyVolume:1;
|
||||||
WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */
|
WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */
|
||||||
|
WCHAR FileSystemName[FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)];
|
||||||
} FSP_FSCTL_VOLUME_PARAMS;
|
} FSP_FSCTL_VOLUME_PARAMS;
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -776,14 +776,8 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
|||||||
*/
|
*/
|
||||||
NTSTATUS (*Reserved[41])();
|
NTSTATUS (*Reserved[41])();
|
||||||
} FSP_FILE_SYSTEM_INTERFACE;
|
} FSP_FILE_SYSTEM_INTERFACE;
|
||||||
#if defined(WINFSP_DLL_INTERNAL)
|
FSP_FSCTL_STATIC_ASSERT(sizeof(FSP_FILE_SYSTEM_INTERFACE) == 64 * sizeof(NTSTATUS (*)()),
|
||||||
/*
|
|
||||||
* Static_assert is a C++11 feature, but seems to work with C on MSVC 2015.
|
|
||||||
* Use it to verify that FSP_FILE_SYSTEM_INTERFACE has the right size.
|
|
||||||
*/
|
|
||||||
static_assert(sizeof(FSP_FILE_SYSTEM_INTERFACE) == 64 * sizeof(NTSTATUS (*)()),
|
|
||||||
"FSP_FILE_SYSTEM_INTERFACE must have 64 entries.");
|
"FSP_FILE_SYSTEM_INTERFACE must have 64 entries.");
|
||||||
#endif
|
|
||||||
typedef struct _FSP_FILE_SYSTEM
|
typedef struct _FSP_FILE_SYSTEM
|
||||||
{
|
{
|
||||||
UINT16 Version;
|
UINT16 Version;
|
||||||
|
@ -32,7 +32,7 @@ FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath,
|
|||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
PWSTR DeviceRoot;
|
PWSTR DeviceRoot;
|
||||||
SIZE_T DeviceRootSize, DevicePathSize;
|
SIZE_T DeviceRootSize, DevicePathSize;
|
||||||
WCHAR DevicePathBuf[MAX_PATH], *DevicePathPtr, *DevicePathEnd;
|
WCHAR DevicePathBuf[MAX_PATH + sizeof *VolumeParams], *DevicePathPtr, *DevicePathEnd;
|
||||||
HANDLE VolumeHandle = INVALID_HANDLE_VALUE;
|
HANDLE VolumeHandle = INVALID_HANDLE_VALUE;
|
||||||
DWORD Bytes;
|
DWORD Bytes;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath,
|
|||||||
VolumeNameBuf[0] = L'\0';
|
VolumeNameBuf[0] = L'\0';
|
||||||
*PVolumeHandle = INVALID_HANDLE_VALUE;
|
*PVolumeHandle = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
/* check lengths; everything (including encoded volume params) must fit within MAX_PATH */
|
/* check lengths; everything (including encoded volume params) must fit within DevicePathBuf */
|
||||||
DeviceRoot = L'\\' == DevicePath[0] ? GLOBALROOT : GLOBALROOT "\\Device\\";
|
DeviceRoot = L'\\' == DevicePath[0] ? GLOBALROOT : GLOBALROOT "\\Device\\";
|
||||||
DeviceRootSize = lstrlenW(DeviceRoot) * sizeof(WCHAR);
|
DeviceRootSize = lstrlenW(DeviceRoot) * sizeof(WCHAR);
|
||||||
DevicePathSize = lstrlenW(DevicePath) * sizeof(WCHAR);
|
DevicePathSize = lstrlenW(DevicePath) * sizeof(WCHAR);
|
||||||
|
@ -1153,6 +1153,7 @@ NTSTATUS MemfsCreate(
|
|||||||
VolumeParams.ReparsePointsAccessCheck = 0;
|
VolumeParams.ReparsePointsAccessCheck = 0;
|
||||||
if (0 != VolumePrefix)
|
if (0 != VolumePrefix)
|
||||||
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
|
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
|
||||||
|
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR), L"MEMFS");
|
||||||
|
|
||||||
Result = FspFileSystemCreate(DevicePath, &VolumeParams, &MemfsInterface, &Memfs->FileSystem);
|
Result = FspFileSystemCreate(DevicePath, &VolumeParams, &MemfsInterface, &Memfs->FileSystem);
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user