diff --git a/build/VStudio/testing/winfsp-tests.vcxproj b/build/VStudio/testing/winfsp-tests.vcxproj
index 91878e5e..6db59b59 100644
--- a/build/VStudio/testing/winfsp-tests.vcxproj
+++ b/build/VStudio/testing/winfsp-tests.vcxproj
@@ -107,7 +107,7 @@
Console
- ntdll.lib;netapi32.lib;%(AdditionalDependencies)
+ ntdll.lib;netapi32.lib;dbghelp.lib;%(AdditionalDependencies)
@@ -123,7 +123,7 @@
Console
- ntdll.lib;netapi32.lib;%(AdditionalDependencies)
+ ntdll.lib;netapi32.lib;dbghelp.lib;%(AdditionalDependencies)
@@ -143,7 +143,7 @@
Console
true
true
- ntdll.lib;netapi32.lib;%(AdditionalDependencies)
+ ntdll.lib;netapi32.lib;dbghelp.lib;%(AdditionalDependencies)
@@ -163,7 +163,7 @@
Console
true
true
- ntdll.lib;netapi32.lib;%(AdditionalDependencies)
+ ntdll.lib;netapi32.lib;dbghelp.lib;%(AdditionalDependencies)
diff --git a/tst/winfsp-tests/winfsp-tests.c b/tst/winfsp-tests/winfsp-tests.c
index 130ba689..3a79a083 100644
--- a/tst/winfsp-tests/winfsp-tests.c
+++ b/tst/winfsp-tests/winfsp-tests.c
@@ -20,6 +20,7 @@
*/
#include
+#include
#include
#include
#include
@@ -177,12 +178,32 @@ LONG WINAPI UnhandledExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo)
{
if (0 != ExceptionInfo && 0 != ExceptionInfo->ExceptionRecord)
{
- static CHAR Buf[64];
- static DWORD Bytes;
- wsprintfA(Buf, "\nEXCEPTION 0x%lx at 0x%p\n",
- ExceptionInfo->ExceptionRecord->ExceptionCode,
- ExceptionInfo->ExceptionRecord->ExceptionAddress);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), Buf, lstrlenA(Buf), &Bytes, 0);
+ static CHAR OutBuf[128];
+ static union
+ {
+ SYMBOL_INFO V;
+ UINT8 Buf[sizeof(SYMBOL_INFO) + 64];
+ } Info;
+ LARGE_INTEGER Large;
+ Info.V.SizeOfStruct = sizeof(SYMBOL_INFO);
+ Info.V.MaxNameLen = 64;
+ if (SymFromAddr(GetCurrentProcess(),
+ (DWORD64)ExceptionInfo->ExceptionRecord->ExceptionAddress,
+ &Large.QuadPart,
+ &Info.V))
+ {
+ wsprintfA(OutBuf, "\nEXCEPTION 0x%lX at %s+0x%lX\n",
+ ExceptionInfo->ExceptionRecord->ExceptionCode,
+ Info.V.Name,
+ Large.LowPart);
+ }
+ else
+ {
+ wsprintfA(OutBuf, "\nEXCEPTION 0x%lX at 0x%p\n",
+ ExceptionInfo->ExceptionRecord->ExceptionCode,
+ ExceptionInfo->ExceptionRecord->ExceptionAddress);
+ }
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), OutBuf, lstrlenA(OutBuf), &Large.LowPart, 0);
}
exiting();
@@ -226,6 +247,8 @@ int main(int argc, char *argv[])
TESTSUITE(wsl_tests);
TESTSUITE(volpath_tests);
+ SymInitialize(GetCurrentProcess(), 0, TRUE);
+
atexit(exiting);
signal(SIGABRT, abort_handler);
SetUnhandledExceptionFilter(UnhandledExceptionHandler);