mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
sys: WIP
This commit is contained in:
parent
80d6afc7b6
commit
cb72cad355
@ -10,8 +10,11 @@
|
||||
#include <devioctl.h>
|
||||
|
||||
// {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 } };
|
||||
// {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_NET_DEVICE_NAME "WinFsp.Net"
|
||||
|
@ -24,18 +24,20 @@ DriverEntry(
|
||||
/* create the file system control device objects */
|
||||
UNICODE_STRING DeviceSddl;
|
||||
UNICODE_STRING DeviceName;
|
||||
RtlInitUnicodeString(&DeviceSddl, L"" DEVICE_SDDL);
|
||||
RtlInitUnicodeString(&DeviceSddl, L"" FSP_FSCTL_DEVICE_SDDL);
|
||||
RtlInitUnicodeString(&DeviceName, L"\\Device\\" FSP_FSCTL_DISK_DEVICE_NAME);
|
||||
Result = IoCreateDeviceSecure(DriverObject,
|
||||
sizeof(FSP_FSCTL_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_DISK_FILE_SYSTEM, 0, FALSE,
|
||||
&DeviceSddl, &FspDeviceClassGuid,
|
||||
sizeof(FSP_FSCTL_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_DISK_FILE_SYSTEM,
|
||||
FILE_DEVICE_SECURE_OPEN, FALSE,
|
||||
&DeviceSddl, &FspFsctlDeviceClassGuid,
|
||||
&FspFsctlDiskDeviceObject);
|
||||
if (!NT_SUCCESS(Result))
|
||||
FSP_RETURN();
|
||||
RtlInitUnicodeString(&DeviceName, L"\\Device\\" FSP_FSCTL_NET_DEVICE_NAME);
|
||||
Result = IoCreateDeviceSecure(DriverObject,
|
||||
sizeof(FSP_FSCTL_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_NETWORK_FILE_SYSTEM, 0, FALSE,
|
||||
&DeviceSddl, &FspDeviceClassGuid,
|
||||
sizeof(FSP_FSCTL_DEVICE_EXTENSION), &DeviceName, FILE_DEVICE_NETWORK_FILE_SYSTEM,
|
||||
FILE_DEVICE_SECURE_OPEN, FALSE,
|
||||
&DeviceSddl, &FspFsctlDeviceClassGuid,
|
||||
&FspFsctlNetDeviceObject);
|
||||
if (!NT_SUCCESS(Result))
|
||||
FSP_RETURN(IoDeleteDevice(FspFsctlDiskDeviceObject));
|
||||
|
@ -13,8 +13,10 @@
|
||||
#include <winfsp/fsctl.h>
|
||||
|
||||
#define DRIVER_NAME "WinFsp"
|
||||
#define DEVICE_SDDL "D:P(A;;GA;;;SY)(A;;GA;;;BA)"
|
||||
/* system and builtin administrators have full access */
|
||||
#define FSP_FSCTL_DEVICE_SDDL "D:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GRGW;;;WD)"
|
||||
/* 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 */
|
||||
#if DBG
|
||||
|
@ -43,11 +43,13 @@ static NTSTATUS FspFsctlCreateVolume(
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
/* create the virtual volume device */
|
||||
PDEVICE_OBJECT FsvrtDeviceObject;
|
||||
UNICODE_STRING DeviceSddl;
|
||||
UNICODE_STRING DeviceName;
|
||||
RtlInitUnicodeString(&DeviceSddl, L"" DEVICE_SDDL);
|
||||
RtlInitEmptyUnicodeString(&DeviceName, Irp->AssociatedIrp.SystemBuffer, FSP_FSCTL_CREATE_BUFFER_SIZEMAX);
|
||||
RtlInitUnicodeString(&DeviceSddl, L"" FSP_FSVRT_DEVICE_SDDL);
|
||||
RtlInitEmptyUnicodeString(&DeviceName,
|
||||
Irp->AssociatedIrp.SystemBuffer, FSP_FSCTL_CREATE_BUFFER_SIZEMAX);
|
||||
Result = RtlUnicodeStringPrintf(&DeviceName,
|
||||
L"\\Device\\Volume{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
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]);
|
||||
ASSERT(NT_SUCCESS(Result));
|
||||
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,
|
||||
&FsvrtDeviceObject);
|
||||
if (!NT_SUCCESS(Result))
|
||||
|
Loading…
x
Reference in New Issue
Block a user