Hi, all
My need is to apply and release some system resources through user application control, such as DMA Transaction and MmProbeAndLockPages.
Once I had accquired these system resource, I need them to be hold until I released by IOCTL cmd manually. Under normal circumstances, everything works fine, but once the application crashed(bug or any other reason) before release them, the OS will be hang out while sytem rebooting unless press the computer’s Reset button. Whitout rebooting, if re-run the application directly, this may leads OS to blue screen.
Is there a safe and effective way to proactively recycle or shut down these resources when the application crashed?
Thanks.
until I released by IOCTL cmd manually
Instead of IOCTL command to release, make the IOCTL pending (waiting in a KMDF queue). To release, cancel the ioctl.
If the app exits or crashes, the IOCTL will be canceled automatically for you. Bingo.
– pa
Is there a safe and effective way to proactively recycle or shut down these resources when the application crashed?
Well, even if the client app crashes before sending an IOCTL, your driver is still going to receive IRP_MJ_CLOSE anyway , right. Therefore, as long as your driver is properly written, you still have a chance to make a proper cleanup even if the client app does not exit gracefully…
Anton Bassov
Well, even if the client app crashes before sending an IOCTL, your driver is still going to receive IRP_MJ_CLOSE anyway , right. Therefore, as long as your driver is properly written, you still have a chance to make a proper cleanup even if the client app does not exit gracefully…
This is another question for me
In the routine EVT_WDF_DRIVER_DEVICE_ADD, I’d registered the EVT_WDF_FILE_CLEANUP and EVT_WDF_FILE_CLOSE
EVT_WDF_DEVICE_FILE_CREATE DeviceFileCreate;
EVT_WDF_FILE_CLEANUP FileCleanup;
EVT_WDF_FILE_CLOSE FileClose;
WDF_FILEOBJECT_CONFIG_INIT(&fileConfig,
DeviceFileCreate,
FileCleanup,
FileClose);
VOID FileCleanup(IN WDFFILEOBJECT FileObject)
{
UNREFERENCED_PARAMETER(FileObject);
KdPrint(("Enther File Cleanup"));
}
VOID FileClose(IN WDFFILEOBJECT FileObject)
{
UNREFERENCED_PARAMETER(FileObject);
KdPrint(("Enther File Close"));
}
The DebugView is always opened during program execution, but the log doesn’t give any output when the program crashes.
Occasionally, I found that after about six minutes, the log was output. I’m so confused…