mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +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)
|
project(FluentUI VERSION 1.0)
|
||||||
|
|
||||||
if(WIN32)
|
if(MSVC)
|
||||||
#让Release也生成pdb文件
|
#让Release也生成pdb文件
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
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")
|
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")
|
#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) {
|
BOOL CALLBACK MyMiniDumpCallback(PVOID, const PMINIDUMP_CALLBACK_INPUT input, PMINIDUMP_CALLBACK_OUTPUT output) {
|
||||||
if (input == NULL || output == NULL)
|
if (input == NULL || output == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -38,16 +52,16 @@ BOOL CALLBACK MyMiniDumpCallback(PVOID, const PMINIDUMP_CALLBACK_INPUT input, PM
|
|||||||
|
|
||||||
void WriteDump(EXCEPTION_POINTERS* exp, const std::wstring& path) {
|
void WriteDump(EXCEPTION_POINTERS* exp, const std::wstring& path) {
|
||||||
HANDLE h = ::CreateFileW(path.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, CREATE_ALWAYS,
|
HANDLE h = ::CreateFileW(path.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, CREATE_ALWAYS,
|
||||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
MINIDUMP_EXCEPTION_INFORMATION info;
|
MINIDUMP_EXCEPTION_INFORMATION info;
|
||||||
info.ThreadId = ::GetCurrentThreadId();
|
info.ThreadId = ::GetCurrentThreadId();
|
||||||
info.ExceptionPointers = exp;
|
info.ExceptionPointers = exp;
|
||||||
info.ClientPointers = NULL;
|
info.ClientPointers = FALSE;
|
||||||
MINIDUMP_CALLBACK_INFORMATION mci;
|
MINIDUMP_CALLBACK_INFORMATION mci;
|
||||||
mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)MyMiniDumpCallback;
|
mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)MyMiniDumpCallback;
|
||||||
mci.CallbackParam = 0;
|
mci.CallbackParam = 0;
|
||||||
MINIDUMP_TYPE mdt = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory);
|
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);
|
::CloseHandle(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user