mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-28 03:14:22 +01:00
Remove dependency on ole32 on Windows (#132). Patch by Sorin Jianu <sorinj>, r=me.
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@237 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
b801cd6d0f
commit
469580e2df
@ -62,6 +62,8 @@ ExceptionHandler::ExceptionHandler(const wstring &dump_path,
|
||||
next_minidump_path_c_(NULL),
|
||||
dbghelp_module_(NULL),
|
||||
minidump_write_dump_(NULL),
|
||||
rpcrt4_module_(NULL),
|
||||
uuid_create_(NULL),
|
||||
handler_types_(handler_types),
|
||||
previous_filter_(NULL),
|
||||
previous_pch_(NULL),
|
||||
@ -78,10 +80,6 @@ ExceptionHandler::ExceptionHandler(const wstring &dump_path,
|
||||
previous_iph_ = NULL;
|
||||
#endif // _MSC_VER >= 1400
|
||||
|
||||
// set_dump_path calls UpdateNextID. This sets up all of the path and id
|
||||
// strings, and their equivalent c_str pointers.
|
||||
set_dump_path(dump_path);
|
||||
|
||||
// Set synchronization primitives and the handler thread. Each
|
||||
// ExceptionHandler object gets its own handler thread because that's the
|
||||
// only way to reliably guarantee sufficient stack space in an exception,
|
||||
@ -105,6 +103,19 @@ ExceptionHandler::ExceptionHandler(const wstring &dump_path,
|
||||
GetProcAddress(dbghelp_module_, "MiniDumpWriteDump"));
|
||||
}
|
||||
|
||||
// Load this library dynamically to not affect existing projects. Most
|
||||
// projects don't link against this directly, it's usually dynamically
|
||||
// loaded by dependent code.
|
||||
rpcrt4_module_ = LoadLibrary(L"rpcrt4.dll");
|
||||
if (rpcrt4_module_) {
|
||||
uuid_create_ = reinterpret_cast<UuidCreate_type>(
|
||||
GetProcAddress(rpcrt4_module_, "UuidCreate"));
|
||||
}
|
||||
|
||||
// set_dump_path calls UpdateNextID. This sets up all of the path and id
|
||||
// strings, and their equivalent c_str pointers.
|
||||
set_dump_path(dump_path);
|
||||
|
||||
if (handler_types != HANDLER_NONE) {
|
||||
if (!handler_stack_critical_section_initialized_) {
|
||||
InitializeCriticalSection(&handler_stack_critical_section_);
|
||||
@ -140,6 +151,10 @@ ExceptionHandler::~ExceptionHandler() {
|
||||
FreeLibrary(dbghelp_module_);
|
||||
}
|
||||
|
||||
if (rpcrt4_module_) {
|
||||
FreeLibrary(rpcrt4_module_);
|
||||
}
|
||||
|
||||
if (handler_types_ != HANDLER_NONE) {
|
||||
EnterCriticalSection(&handler_stack_critical_section_);
|
||||
|
||||
@ -518,8 +533,11 @@ bool ExceptionHandler::WriteMinidumpWithException(
|
||||
}
|
||||
|
||||
void ExceptionHandler::UpdateNextID() {
|
||||
GUID id;
|
||||
CoCreateGuid(&id);
|
||||
assert(uuid_create_);
|
||||
UUID id = {0};
|
||||
if (uuid_create_) {
|
||||
uuid_create_(&id);
|
||||
}
|
||||
next_minidump_id_ = GUIDString::GUIDToWString(&id);
|
||||
next_minidump_id_c_ = next_minidump_id_.c_str();
|
||||
|
||||
|
@ -52,9 +52,6 @@
|
||||
// ExceptionHandler *f = new ExceptionHandler(...);
|
||||
// delete e;
|
||||
// This will put the exception filter stack into an inconsistent state.
|
||||
//
|
||||
// To use this library in your project, you will need to link against
|
||||
// ole32.lib.
|
||||
|
||||
#ifndef CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__
|
||||
#define CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__
|
||||
@ -62,6 +59,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <Windows.h>
|
||||
#include <DbgHelp.h>
|
||||
#include <rpc.h>
|
||||
|
||||
#pragma warning( push )
|
||||
// Disable exception handler warnings.
|
||||
@ -195,6 +193,9 @@ class ExceptionHandler {
|
||||
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
|
||||
CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
|
||||
|
||||
// Function pointer type for UuidCreate, which is looked up dynamically.
|
||||
typedef RPC_STATUS (RPC_ENTRY *UuidCreate_type)(UUID *Uuid);
|
||||
|
||||
// Runs the main loop for the exception handler thread.
|
||||
static DWORD WINAPI ExceptionHandlerThreadMain(void *lpParameter);
|
||||
|
||||
@ -272,6 +273,9 @@ class ExceptionHandler {
|
||||
HMODULE dbghelp_module_;
|
||||
MiniDumpWriteDump_type minidump_write_dump_;
|
||||
|
||||
HMODULE rpcrt4_module_;
|
||||
UuidCreate_type uuid_create_;
|
||||
|
||||
// Tracks the handler types that were installed according to the
|
||||
// handler_types constructor argument.
|
||||
int handler_types_;
|
||||
|
3
src/processor/testdata/test_app.cc
vendored
3
src/processor/testdata/test_app.cc
vendored
@ -29,8 +29,7 @@
|
||||
|
||||
// This file is used to generate minidump2.dmp and minidump2.sym.
|
||||
// cl /Zi test_app.cc /Fetest_app.exe /I google_breakpad/src \
|
||||
// google_breakpad/src/client/windows/releasestaticcrt/exception_handler.lib \
|
||||
// ole32.lib
|
||||
// google_breakpad/src/client/windows/releasestaticcrt/exception_handler.lib
|
||||
// Then run test_app to generate a dump, and dump_syms to create the .sym file.
|
||||
|
||||
#include <cstdio>
|
||||
|
Loading…
Reference in New Issue
Block a user