mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-26 13:27:05 +08:00
update
This commit is contained in:
parent
833a8217f4
commit
9d47c30a6b
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(FluentUI VERSION 1.0)
|
||||
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
#让Release也生成pdb文件
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
||||
|
@ -12,6 +12,20 @@
|
||||
|
||||
#pragma comment(lib, "Dbghelp.lib")
|
||||
|
||||
static void miniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam){
|
||||
typedef HRESULT (WINAPI* MiniDumpWriteDumpPtr)(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
|
||||
HMODULE module = LoadLibraryW(L"Dbghelp.dll");
|
||||
if (module)
|
||||
{
|
||||
MiniDumpWriteDumpPtr mini_dump_write_dump;
|
||||
mini_dump_write_dump= reinterpret_cast<MiniDumpWriteDumpPtr>(GetProcAddress(module, "MiniDumpWriteDump"));
|
||||
if (mini_dump_write_dump)
|
||||
{
|
||||
mini_dump_write_dump(hProcess,ProcessId,hFile,DumpType,ExceptionParam,UserStreamParam,CallbackParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CALLBACK MyMiniDumpCallback(PVOID, const PMINIDUMP_CALLBACK_INPUT input, PMINIDUMP_CALLBACK_OUTPUT output) {
|
||||
if (input == NULL || output == NULL)
|
||||
return FALSE;
|
||||
@ -42,12 +56,12 @@ void WriteDump(EXCEPTION_POINTERS* exp, const std::wstring& path) {
|
||||
MINIDUMP_EXCEPTION_INFORMATION info;
|
||||
info.ThreadId = ::GetCurrentThreadId();
|
||||
info.ExceptionPointers = exp;
|
||||
info.ClientPointers = NULL;
|
||||
info.ClientPointers = FALSE;
|
||||
MINIDUMP_CALLBACK_INFORMATION mci;
|
||||
mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)MyMiniDumpCallback;
|
||||
mci.CallbackParam = 0;
|
||||
MINIDUMP_TYPE mdt = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory);
|
||||
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, mdt, &info, NULL, &mci);
|
||||
miniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, mdt, &info, NULL, &mci);
|
||||
::CloseHandle(h);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user