From f19945b3c6d59c9cf361890630424293db0645d4 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 30 Apr 2021 13:38:26 +0200 Subject: [PATCH] driver: move init-only functions into INIT segment Reference: https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/writing-a-driverentry-routine Signed-off-by: Simon Rozman --- driver/wintun.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/driver/wintun.c b/driver/wintun.c index 6366ebd..3e615bb 100644 --- a/driver/wintun.c +++ b/driver/wintun.c @@ -838,6 +838,12 @@ cleanup: return DidClose; } +_Must_inspect_result_ +static NTSTATUS TunInitializeDispatchSecurityDescriptor(VOID); +#ifdef ALLOC_PRAGMA +# pragma alloc_text(INIT, TunInitializeDispatchSecurityDescriptor) +#endif +_Use_decl_annotations_ static NTSTATUS TunInitializeDispatchSecurityDescriptor(VOID) { NTSTATUS Status; @@ -1451,6 +1457,9 @@ TunUnload(PDRIVER_OBJECT DriverObject) } DRIVER_INITIALIZE DriverEntry; +#ifdef ALLOC_PRAGMA +# pragma alloc_text(INIT, DriverEntry) +#endif _Use_decl_annotations_ NTSTATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath)