mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-01 20:24:40 +01:00
Support building with WIN32_LEAN_AND_MEAN (#60)
- All Windows code now builds with WIN32_LEAN_AND_MEAN by default. - Header inclusion is adjusted as needed. Remove use of UuidToString (#39) - Also breaks dependency on RpcStringFree and therefore rpcrt4.lib. r=bryner http://groups.google.com/group/airbag-dev/browse_thread/thread/30f844cfc7ccd37f git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@51 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
aa57b8e3de
commit
29401d2457
15 changed files with 171 additions and 52 deletions
|
|
@ -27,11 +27,12 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <assert.h>
|
||||
#include <ObjBase.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "client/windows/handler/exception_handler.h"
|
||||
#include "common/windows/guid_string.h"
|
||||
|
||||
namespace google_airbag {
|
||||
|
||||
|
|
@ -42,9 +43,9 @@ ExceptionHandler::ExceptionHandler(const wstring &dump_path,
|
|||
void *callback_context,
|
||||
bool install_handler)
|
||||
: callback_(callback), callback_context_(callback_context),
|
||||
dump_path_(dump_path), next_minidump_id_(NULL),
|
||||
dbghelp_module_(NULL), minidump_write_dump_(NULL),
|
||||
previous_handler_(current_handler_), previous_filter_(NULL) {
|
||||
dump_path_(dump_path), dbghelp_module_(NULL),
|
||||
minidump_write_dump_(NULL), previous_handler_(current_handler_),
|
||||
previous_filter_(NULL) {
|
||||
UpdateNextID();
|
||||
dbghelp_module_ = LoadLibrary(L"dbghelp.dll");
|
||||
if (dbghelp_module_) {
|
||||
|
|
@ -61,9 +62,6 @@ ExceptionHandler::~ExceptionHandler() {
|
|||
if (dbghelp_module_) {
|
||||
FreeLibrary(dbghelp_module_);
|
||||
}
|
||||
if (next_minidump_id_) {
|
||||
RpcStringFree(&next_minidump_id_);
|
||||
}
|
||||
if (current_handler_ == this) {
|
||||
SetUnhandledExceptionFilter(previous_filter_);
|
||||
current_handler_ = previous_handler_;
|
||||
|
|
@ -95,7 +93,7 @@ bool ExceptionHandler::WriteMinidump(const wstring &dump_path,
|
|||
bool ExceptionHandler::WriteMinidumpWithException(EXCEPTION_POINTERS *exinfo) {
|
||||
wchar_t dump_file_name[MAX_PATH];
|
||||
swprintf_s(dump_file_name, MAX_PATH, L"%s\\%s.dmp",
|
||||
dump_path_.c_str(), next_minidump_id_);
|
||||
dump_path_.c_str(), next_minidump_id_.c_str());
|
||||
|
||||
bool success = false;
|
||||
if (minidump_write_dump_) {
|
||||
|
|
@ -126,10 +124,7 @@ bool ExceptionHandler::WriteMinidumpWithException(EXCEPTION_POINTERS *exinfo) {
|
|||
}
|
||||
|
||||
if (callback_) {
|
||||
// This looks nasty, but RPC_WSTR is really just a wide string,
|
||||
// and there are no "supported" ways to convert them other than casting.
|
||||
callback_(reinterpret_cast<wchar_t*>(next_minidump_id_),
|
||||
callback_context_, success);
|
||||
callback_(next_minidump_id_, callback_context_, success);
|
||||
}
|
||||
// TODO(bryner): log an error on failure
|
||||
|
||||
|
|
@ -137,12 +132,9 @@ bool ExceptionHandler::WriteMinidumpWithException(EXCEPTION_POINTERS *exinfo) {
|
|||
}
|
||||
|
||||
void ExceptionHandler::UpdateNextID() {
|
||||
if (next_minidump_id_) {
|
||||
RpcStringFree(&next_minidump_id_);
|
||||
}
|
||||
GUID id;
|
||||
CoCreateGuid(&id);
|
||||
UuidToString(&id, &next_minidump_id_);
|
||||
next_minidump_id_ = GUIDString::GUIDToWString(&id);
|
||||
}
|
||||
|
||||
} // namespace google_airbag
|
||||
|
|
|
|||
|
|
@ -54,13 +54,13 @@
|
|||
// This will put the exception filter stack into an inconsistent state.
|
||||
//
|
||||
// To use this library in your project, you will need to link against
|
||||
// rpcrt4.lib and ole32.lib.
|
||||
// ole32.lib.
|
||||
|
||||
#ifndef CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__
|
||||
#define CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__
|
||||
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#include <Windows.h>
|
||||
#include <DbgHelp.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ class ExceptionHandler {
|
|||
void *callback_context_;
|
||||
|
||||
wstring dump_path_;
|
||||
RPC_WSTR next_minidump_id_;
|
||||
wstring next_minidump_id_;
|
||||
|
||||
HMODULE dbghelp_module_;
|
||||
MiniDumpWriteDump_type minidump_write_dump_;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;WIN32_LEAN_AND_MEAN"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;WIN32_LEAN_AND_MEAN"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;WIN32_LEAN_AND_MEAN"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
|
|
@ -228,7 +228,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;WIN32_LEAN_AND_MEAN"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
|
|
@ -276,6 +276,10 @@
|
|||
RelativePath=".\exception_handler.cc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\common\windows\guid_string.cc"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
|
@ -286,6 +290,10 @@
|
|||
RelativePath=".\exception_handler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\common\windows\guid_string.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue