mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-25 18:02:24 -05:00
sys: disallow driver unloading based on macro FSP_UNLOAD
This commit is contained in:
parent
785c4ba29d
commit
edf5eb2219
@ -6,15 +6,27 @@
|
||||
|
||||
#include <sys/driver.h>
|
||||
|
||||
/*
|
||||
* Define the following macro to include FspUnload.
|
||||
*
|
||||
* Note that this driver is no longer unloadable.
|
||||
* See the comments in DriverEntry as to why!
|
||||
*/
|
||||
//#define FSP_UNLOAD
|
||||
|
||||
DRIVER_INITIALIZE DriverEntry;
|
||||
static VOID FspDriverMultiVersionInitialize(VOID);
|
||||
#if defined(FSP_UNLOAD)
|
||||
DRIVER_UNLOAD FspUnload;
|
||||
#endif
|
||||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
#pragma alloc_text(INIT, DriverEntry)
|
||||
#pragma alloc_text(INIT, FspDriverMultiVersionInitialize)
|
||||
#if defined(FSP_UNLOAD)
|
||||
#pragma alloc_text(PAGE, FspUnload)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
NTSTATUS DriverEntry(
|
||||
PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||
@ -49,7 +61,9 @@ NTSTATUS DriverEntry(
|
||||
ASSERT(STATUS_SUCCESS == Result);
|
||||
|
||||
/* setup the driver object */
|
||||
#if defined(FSP_UNLOAD)
|
||||
DriverObject->DriverUnload = FspUnload;
|
||||
#endif
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = FspCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = FspClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = FspRead;
|
||||
@ -160,6 +174,7 @@ static VOID FspDriverMultiVersionInitialize(VOID)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FSP_UNLOAD)
|
||||
VOID FspUnload(
|
||||
PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
@ -175,6 +190,7 @@ VOID FspUnload(
|
||||
FSP_LEAVE_VOID("DriverName=\"%wZ\"",
|
||||
&DriverObject->DriverName);
|
||||
}
|
||||
#endif
|
||||
|
||||
PDRIVER_OBJECT FspDriverObject;
|
||||
PDEVICE_OBJECT FspFsctlDiskDeviceObject;
|
||||
|
Loading…
x
Reference in New Issue
Block a user