sys: IoCreateDeviceSecure: tighten down who can open the device

This commit is contained in:
Bill Zissimopoulos
2015-11-21 16:37:46 -08:00
parent d6d98384f2
commit 7dda01ef48
5 changed files with 33 additions and 7 deletions

View File

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

View File

@ -8,9 +8,12 @@
#define WINFSP_SYS_DRIVER_H_INCLUDED
#include <ntifs.h>
#include <fsctl.h>
#include <wdmsec.h>
#include <winfsp/fsctl.h>
#define DRIVER_NAME "WinFsp"
#define DRIVER_SDDL "D:P(A;;GA;;;SY)(A;;GA;;;BA)"
/* system and builtin administrators have full access */
/* DEBUGLOG */
#if DBG