Driver: Expand kernel stack for driver entry

This commit is contained in:
Nodir Temirkhodjaev 2023-04-19 10:18:48 +03:00
parent 7a805d77c9
commit 5846e535da

View File

@ -82,6 +82,23 @@ static void fort_driver_unload(PDRIVER_OBJECT driver)
fort_device_set(NULL);
}
static void NTAPI fort_driver_load_device_expand(PVOID param)
{
NTSTATUS *status = param;
*status = fort_device_load();
}
inline static void fort_driver_load_device(NTSTATUS *status)
{
const NTSTATUS status_expand = KeExpandKernelStackAndCallout(
&fort_driver_load_device_expand, status, KERNEL_STACK_SIZE);
if (!NT_SUCCESS(status_expand)) {
*status = status_expand;
}
}
static NTSTATUS fort_driver_load(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
{
NTSTATUS status;
@ -106,7 +123,9 @@ static NTSTATUS fort_driver_load(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = &fort_device_control;
driver->MajorFunction[IRP_MJ_SHUTDOWN] = &fort_device_shutdown;
return fort_device_load();
fort_driver_load_device(&status);
return status;
}
NTSTATUS DriverCallbacksSetup(PFORT_PROXYCB_INFO cb_info)