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 <simon@rozman.si>
This commit is contained in:
Simon Rozman 2021-04-30 13:38:26 +02:00 committed by Jason A. Donenfeld
parent 71e1ab6940
commit f19945b3c6

View File

@ -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)