Skip to content

Commit 4eb306a

Browse files
rozmansizx2c4
authored andcommitted
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 <[email protected]>
1 parent aba41fc commit 4eb306a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

driver/wintun.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,12 @@ TunForceHandlesClosed(_Inout_ DEVICE_OBJECT *DeviceObject)
838838
return DidClose;
839839
}
840840

841+
_Must_inspect_result_
842+
static NTSTATUS TunInitializeDispatchSecurityDescriptor(VOID);
843+
#ifdef ALLOC_PRAGMA
844+
# pragma alloc_text(INIT, TunInitializeDispatchSecurityDescriptor)
845+
#endif
846+
_Use_decl_annotations_
841847
static NTSTATUS TunInitializeDispatchSecurityDescriptor(VOID)
842848
{
843849
NTSTATUS Status;
@@ -1451,6 +1457,9 @@ TunUnload(PDRIVER_OBJECT DriverObject)
14511457
}
14521458

14531459
DRIVER_INITIALIZE DriverEntry;
1460+
#ifdef ALLOC_PRAGMA
1461+
# pragma alloc_text(INIT, DriverEntry)
1462+
#endif
14541463
_Use_decl_annotations_
14551464
NTSTATUS
14561465
DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath)

0 commit comments

Comments
 (0)