WDK的内核驱动范例里面还没有发现使用try..catch的。
MS doc says
"Note that structured exception handling is distinct from C++ exceptions. The kernel does not support C++ exceptions."
in
https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/handling-exceptions
Explanation:
This is a kernel internal error. This error could be caused by a mismatch between KeEnterCriticalRegion and KeLeaveCriticalRegion in a file system.
只是进出临界共不匹配,其实应当不是try的问题,是否有其它方面的问题而在这里有所表现,比如进入本函数时候调用了KeEnterCriticalRegion, 而你在这里return了,没有可能调用finally下面的KeLeaveCriticalRegion呢