This commit is contained in:
Bill Zissimopoulos 2015-11-22 16:08:13 -08:00
parent 80d6afc7b6
commit cb72cad355
4 changed files with 21 additions and 11 deletions

View File

@ -10,8 +10,11 @@
#include <devioctl.h> #include <devioctl.h>
// {6F9D25FA-6DEE-4A9D-80F5-E98E14F35E54} // {6F9D25FA-6DEE-4A9D-80F5-E98E14F35E54}
extern const __declspec(selectany) GUID FspDeviceClassGuid = 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 } };
// {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_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"

View File

@ -24,18 +24,20 @@ DriverEntry(
/* create the file system control device objects */ /* create the file system control device objects */
UNICODE_STRING DeviceSddl; UNICODE_STRING DeviceSddl;
UNICODE_STRING DeviceName; UNICODE_STRING DeviceName;
RtlInitUnicodeString(&DeviceSddl, L"" DEVICE_SDDL); RtlInitUnicodeString(&DeviceSddl, L"" FSP_FSCTL_DEVICE_SDDL);
RtlInitUnicodeString(&DeviceName, L"\\Device\\" FSP_FSCTL_DISK_DEVICE_NAME); RtlInitUnicodeString(&DeviceName, L"\\Device\\" FSP_FSCTL_DISK_DEVICE_NAME);
Result = IoCreateDeviceSecure(DriverObject, Result = IoCreateDeviceSecure(DriverObject,
sizeof(FSP_FSCTL_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_DISK_FILE_SYSTEM, 0, FALSE, sizeof(FSP_FSCTL_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_DISK_FILE_SYSTEM,
&DeviceSddl, &FspDeviceClassGuid, FILE_DEVICE_SECURE_OPEN, FALSE,
&DeviceSddl, &FspFsctlDeviceClassGuid,
&FspFsctlDiskDeviceObject); &FspFsctlDiskDeviceObject);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
FSP_RETURN(); FSP_RETURN();
RtlInitUnicodeString(&DeviceName, L"\\Device\\" FSP_FSCTL_NET_DEVICE_NAME); RtlInitUnicodeString(&DeviceName, L"\\Device\\" FSP_FSCTL_NET_DEVICE_NAME);
Result = IoCreateDeviceSecure(DriverObject, Result = IoCreateDeviceSecure(DriverObject,
sizeof(FSP_FSCTL_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_NETWORK_FILE_SYSTEM, 0, FALSE, sizeof(FSP_FSCTL_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_NETWORK_FILE_SYSTEM,
&DeviceSddl, &FspDeviceClassGuid, FILE_DEVICE_SECURE_OPEN, FALSE,
&DeviceSddl, &FspFsctlDeviceClassGuid,
&FspFsctlNetDeviceObject); &FspFsctlNetDeviceObject);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
FSP_RETURN(IoDeleteDevice(FspFsctlDiskDeviceObject)); FSP_RETURN(IoDeleteDevice(FspFsctlDiskDeviceObject));

View File

@ -13,8 +13,10 @@
#include <winfsp/fsctl.h> #include <winfsp/fsctl.h>
#define DRIVER_NAME "WinFsp" #define DRIVER_NAME "WinFsp"
#define DEVICE_SDDL "D:P(A;;GA;;;SY)(A;;GA;;;BA)" #define FSP_FSCTL_DEVICE_SDDL "D:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GRGW;;;WD)"
/* system and builtin administrators have full access */ /* System:GENERIC_ALL, Administrators:GENERIC_ALL, World:GENERIC_READ|GENERIC_WRITE */
#define FSP_FSVRT_DEVICE_SDDL "D:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GRGW;;;WD)"
/* System:GENERIC_ALL, Administrators:GENERIC_ALL, World:GENERIC_READ|GENERIC_WRITE */
/* DEBUGLOG */ /* DEBUGLOG */
#if DBG #if DBG

View File

@ -43,11 +43,13 @@ static NTSTATUS FspFsctlCreateVolume(
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
return Result; return Result;
/* create the virtual volume device */
PDEVICE_OBJECT FsvrtDeviceObject; PDEVICE_OBJECT FsvrtDeviceObject;
UNICODE_STRING DeviceSddl; UNICODE_STRING DeviceSddl;
UNICODE_STRING DeviceName; UNICODE_STRING DeviceName;
RtlInitUnicodeString(&DeviceSddl, L"" DEVICE_SDDL); RtlInitUnicodeString(&DeviceSddl, L"" FSP_FSVRT_DEVICE_SDDL);
RtlInitEmptyUnicodeString(&DeviceName, Irp->AssociatedIrp.SystemBuffer, FSP_FSCTL_CREATE_BUFFER_SIZEMAX); RtlInitEmptyUnicodeString(&DeviceName,
Irp->AssociatedIrp.SystemBuffer, FSP_FSCTL_CREATE_BUFFER_SIZEMAX);
Result = RtlUnicodeStringPrintf(&DeviceName, Result = RtlUnicodeStringPrintf(&DeviceName,
L"\\Device\\Volume{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", L"\\Device\\Volume{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
Guid.Data1, Guid.Data2, Guid.Data3, Guid.Data1, Guid.Data2, Guid.Data3,
@ -55,7 +57,8 @@ static NTSTATUS FspFsctlCreateVolume(
Guid.Data4[4], Guid.Data4[5], Guid.Data4[6], Guid.Data4[7]); Guid.Data4[4], Guid.Data4[5], Guid.Data4[6], Guid.Data4[7]);
ASSERT(NT_SUCCESS(Result)); ASSERT(NT_SUCCESS(Result));
Result = IoCreateDeviceSecure(DeviceObject->DriverObject, Result = IoCreateDeviceSecure(DeviceObject->DriverObject,
sizeof(FSP_FSVRT_DEVICE_EXTENSION), &DeviceName, DeviceObject->DeviceType, 0, FALSE, sizeof(FSP_FSVRT_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_VIRTUAL_DISK,
FILE_DEVICE_SECURE_OPEN, FALSE,
&DeviceSddl, 0, &DeviceSddl, 0,
&FsvrtDeviceObject); &FsvrtDeviceObject);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))