mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-28 08:10:47 +02:00
* Added breakpad support for Linux.
This commit is contained in:
53
thirdparty/breakpad/client/windows/tests/crash_generation_app/abstract_class.cc
vendored
Normal file
53
thirdparty/breakpad/client/windows/tests/crash_generation_app/abstract_class.cc
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2008, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (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 "client/windows/tests/crash_generation_app/abstract_class.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
Base::Base(Derived* derived)
|
||||
: derived_(derived) {
|
||||
}
|
||||
|
||||
Base::~Base() {
|
||||
derived_->DoSomething();
|
||||
}
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4355)
|
||||
// Disable warning C4355: 'this' : used in base member initializer list.
|
||||
Derived::Derived()
|
||||
: Base(this) { // C4355
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
void Derived::DoSomething() {
|
||||
}
|
||||
|
||||
} // namespace google_breakpad
|
57
thirdparty/breakpad/client/windows/tests/crash_generation_app/abstract_class.h
vendored
Normal file
57
thirdparty/breakpad/client/windows/tests/crash_generation_app/abstract_class.h
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2008, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_ABSTRACT_CLASS_H__
|
||||
#define CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_ABSTRACT_CLASS_H__
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
// Dummy classes to help generate a pure call violation.
|
||||
|
||||
class Derived;
|
||||
|
||||
class Base {
|
||||
public:
|
||||
Base(Derived* derived);
|
||||
virtual ~Base();
|
||||
virtual void DoSomething() = 0;
|
||||
|
||||
private:
|
||||
Derived* derived_;
|
||||
};
|
||||
|
||||
class Derived : public Base {
|
||||
public:
|
||||
Derived();
|
||||
virtual void DoSomething();
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_CRASH_GENERATION_APP_H__
|
520
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.cc
vendored
Normal file
520
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.cc
vendored
Normal file
@@ -0,0 +1,520 @@
|
||||
// Copyright (c) 2008, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// crash_generation_app.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "client/windows/tests/crash_generation_app/crash_generation_app.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "client/windows/crash_generation/client_info.h"
|
||||
#include "client/windows/crash_generation/crash_generation_server.h"
|
||||
#include "client/windows/handler/exception_handler.h"
|
||||
#include "client/windows/common/ipc_protocol.h"
|
||||
|
||||
#include "client/windows/tests/crash_generation_app/abstract_class.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
const int kMaxLoadString = 100;
|
||||
const wchar_t kPipeName[] = L"\\\\.\\pipe\\BreakpadCrashServices\\TestServer";
|
||||
|
||||
const DWORD kEditBoxStyles = WS_CHILD |
|
||||
WS_VISIBLE |
|
||||
WS_VSCROLL |
|
||||
ES_LEFT |
|
||||
ES_MULTILINE |
|
||||
ES_AUTOVSCROLL |
|
||||
ES_READONLY;
|
||||
|
||||
// Maximum length of a line in the edit box.
|
||||
const size_t kMaximumLineLength = 256;
|
||||
|
||||
// CS to access edit control in a thread safe way.
|
||||
static CRITICAL_SECTION* cs_edit = NULL;
|
||||
|
||||
// Edit control.
|
||||
static HWND client_status_edit_box;
|
||||
|
||||
HINSTANCE current_instance; // Current instance.
|
||||
TCHAR title[kMaxLoadString]; // Title bar text.
|
||||
TCHAR window_class[kMaxLoadString]; // Main window class name.
|
||||
|
||||
ATOM MyRegisterClass(HINSTANCE instance);
|
||||
BOOL InitInstance(HINSTANCE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
static int kCustomInfoCount = 2;
|
||||
static CustomInfoEntry kCustomInfoEntries[] = {
|
||||
CustomInfoEntry(L"prod", L"CrashTestApp"),
|
||||
CustomInfoEntry(L"ver", L"1.0"),
|
||||
};
|
||||
|
||||
static ExceptionHandler* handler = NULL;
|
||||
static CrashGenerationServer* crash_server = NULL;
|
||||
|
||||
// Registers the window class.
|
||||
//
|
||||
// This function and its usage are only necessary if you want this code
|
||||
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
|
||||
// function that was added to Windows 95. It is important to call this
|
||||
// function so that the application will get 'well formed' small icons
|
||||
// associated with it.
|
||||
ATOM MyRegisterClass(HINSTANCE instance) {
|
||||
WNDCLASSEX wcex;
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = instance;
|
||||
wcex.hIcon = LoadIcon(instance,
|
||||
MAKEINTRESOURCE(IDI_CRASHGENERATIONAPP));
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CRASHGENERATIONAPP);
|
||||
wcex.lpszClassName = window_class;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
||||
|
||||
return RegisterClassEx(&wcex);
|
||||
}
|
||||
|
||||
// Saves instance handle and creates main window
|
||||
//
|
||||
// In this function, we save the instance handle in a global variable and
|
||||
// create and display the main program window.
|
||||
BOOL InitInstance(HINSTANCE instance, int command_show) {
|
||||
current_instance = instance;
|
||||
HWND wnd = CreateWindow(window_class,
|
||||
title,
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,
|
||||
0,
|
||||
CW_USEDEFAULT,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
instance,
|
||||
NULL);
|
||||
|
||||
if (!wnd) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ShowWindow(wnd, command_show);
|
||||
UpdateWindow(wnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void AppendTextToEditBox(TCHAR* text) {
|
||||
EnterCriticalSection(cs_edit);
|
||||
SYSTEMTIME current_time;
|
||||
GetLocalTime(¤t_time);
|
||||
TCHAR line[kMaximumLineLength];
|
||||
int result = swprintf_s(line,
|
||||
kMaximumLineLength,
|
||||
L"[%.2d-%.2d-%.4d %.2d:%.2d:%.2d] %s",
|
||||
current_time.wMonth,
|
||||
current_time.wDay,
|
||||
current_time.wYear,
|
||||
current_time.wHour,
|
||||
current_time.wMinute,
|
||||
current_time.wSecond,
|
||||
text);
|
||||
|
||||
if (result == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int length = GetWindowTextLength(client_status_edit_box);
|
||||
SendMessage(client_status_edit_box,
|
||||
EM_SETSEL,
|
||||
(WPARAM)length,
|
||||
(LPARAM)length);
|
||||
SendMessage(client_status_edit_box,
|
||||
EM_REPLACESEL,
|
||||
(WPARAM)FALSE,
|
||||
(LPARAM)line);
|
||||
LeaveCriticalSection(cs_edit);
|
||||
}
|
||||
|
||||
static DWORD WINAPI AppendTextWorker(void* context) {
|
||||
TCHAR* text = reinterpret_cast<TCHAR*>(context);
|
||||
|
||||
AppendTextToEditBox(text);
|
||||
delete[] text;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ShowDumpResults(const wchar_t* dump_path,
|
||||
const wchar_t* minidump_id,
|
||||
void* context,
|
||||
EXCEPTION_POINTERS* exinfo,
|
||||
MDRawAssertionInfo* assertion,
|
||||
bool succeeded) {
|
||||
TCHAR* text = new TCHAR[kMaximumLineLength];
|
||||
text[0] = _T('\0');
|
||||
int result = swprintf_s(text,
|
||||
kMaximumLineLength,
|
||||
TEXT("Dump generation request %s\r\n"),
|
||||
succeeded ? TEXT("succeeded") : TEXT("failed"));
|
||||
if (result == -1) {
|
||||
delete [] text;
|
||||
}
|
||||
|
||||
QueueUserWorkItem(AppendTextWorker, text, WT_EXECUTEDEFAULT);
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
static void _cdecl ShowClientConnected(void* context,
|
||||
const ClientInfo* client_info) {
|
||||
TCHAR* line = new TCHAR[kMaximumLineLength];
|
||||
line[0] = _T('\0');
|
||||
int result = swprintf_s(line,
|
||||
kMaximumLineLength,
|
||||
L"Client connected:\t\t%d\r\n",
|
||||
client_info->pid());
|
||||
|
||||
if (result == -1) {
|
||||
delete[] line;
|
||||
return;
|
||||
}
|
||||
|
||||
QueueUserWorkItem(AppendTextWorker, line, WT_EXECUTEDEFAULT);
|
||||
}
|
||||
|
||||
static void _cdecl ShowClientCrashed(void* context,
|
||||
const ClientInfo* client_info,
|
||||
const wstring* dump_path) {
|
||||
TCHAR* line = new TCHAR[kMaximumLineLength];
|
||||
line[0] = _T('\0');
|
||||
int result = swprintf_s(line,
|
||||
kMaximumLineLength,
|
||||
TEXT("Client requested dump:\t%d\r\n"),
|
||||
client_info->pid());
|
||||
|
||||
if (result == -1) {
|
||||
delete[] line;
|
||||
return;
|
||||
}
|
||||
|
||||
QueueUserWorkItem(AppendTextWorker, line, WT_EXECUTEDEFAULT);
|
||||
|
||||
CustomClientInfo custom_info = client_info->GetCustomInfo();
|
||||
if (custom_info.count <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
wstring str_line;
|
||||
for (size_t i = 0; i < custom_info.count; ++i) {
|
||||
if (i > 0) {
|
||||
str_line += L", ";
|
||||
}
|
||||
str_line += custom_info.entries[i].name;
|
||||
str_line += L": ";
|
||||
str_line += custom_info.entries[i].value;
|
||||
}
|
||||
|
||||
line = new TCHAR[kMaximumLineLength];
|
||||
line[0] = _T('\0');
|
||||
result = swprintf_s(line,
|
||||
kMaximumLineLength,
|
||||
L"%s\n",
|
||||
str_line.c_str());
|
||||
if (result == -1) {
|
||||
delete[] line;
|
||||
return;
|
||||
}
|
||||
QueueUserWorkItem(AppendTextWorker, line, WT_EXECUTEDEFAULT);
|
||||
}
|
||||
|
||||
static void _cdecl ShowClientExited(void* context,
|
||||
const ClientInfo* client_info) {
|
||||
TCHAR* line = new TCHAR[kMaximumLineLength];
|
||||
line[0] = _T('\0');
|
||||
int result = swprintf_s(line,
|
||||
kMaximumLineLength,
|
||||
TEXT("Client exited:\t\t%d\r\n"),
|
||||
client_info->pid());
|
||||
|
||||
if (result == -1) {
|
||||
delete[] line;
|
||||
return;
|
||||
}
|
||||
|
||||
QueueUserWorkItem(AppendTextWorker, line, WT_EXECUTEDEFAULT);
|
||||
}
|
||||
|
||||
void CrashServerStart() {
|
||||
// Do not create another instance of the server.
|
||||
if (crash_server) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring dump_path = L"C:\\Dumps\\";
|
||||
crash_server = new CrashGenerationServer(kPipeName,
|
||||
NULL,
|
||||
ShowClientConnected,
|
||||
NULL,
|
||||
ShowClientCrashed,
|
||||
NULL,
|
||||
ShowClientExited,
|
||||
NULL,
|
||||
true,
|
||||
&dump_path);
|
||||
|
||||
if (!crash_server->Start()) {
|
||||
MessageBoxW(NULL, L"Unable to start server", L"Dumper", MB_OK);
|
||||
delete crash_server;
|
||||
crash_server = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CrashServerStop() {
|
||||
delete crash_server;
|
||||
crash_server = NULL;
|
||||
}
|
||||
|
||||
void DerefZeroCrash() {
|
||||
int* x = 0;
|
||||
*x = 1;
|
||||
}
|
||||
|
||||
void InvalidParamCrash() {
|
||||
printf(NULL);
|
||||
}
|
||||
|
||||
void PureCallCrash() {
|
||||
Derived derived;
|
||||
}
|
||||
|
||||
void RequestDump() {
|
||||
if (!handler->WriteMinidump()) {
|
||||
MessageBoxW(NULL, L"Dump request failed", L"Dumper", MB_OK);
|
||||
}
|
||||
kCustomInfoEntries[1].set_value(L"1.1");
|
||||
}
|
||||
|
||||
void CleanUp() {
|
||||
if (cs_edit) {
|
||||
DeleteCriticalSection(cs_edit);
|
||||
delete cs_edit;
|
||||
}
|
||||
|
||||
if (handler) {
|
||||
delete handler;
|
||||
}
|
||||
|
||||
if (crash_server) {
|
||||
delete crash_server;
|
||||
}
|
||||
}
|
||||
|
||||
// Processes messages for the main window.
|
||||
//
|
||||
// WM_COMMAND - process the application menu.
|
||||
// WM_PAINT - Paint the main window.
|
||||
// WM_DESTROY - post a quit message and return.
|
||||
LRESULT CALLBACK WndProc(HWND wnd,
|
||||
UINT message,
|
||||
WPARAM w_param,
|
||||
LPARAM l_param) {
|
||||
int message_id;
|
||||
int message_event;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4312)
|
||||
// Disable warning C4312: 'type cast' : conversion from 'LONG' to
|
||||
// 'HINSTANCE' of greater size.
|
||||
// The value returned by GetwindowLong in the case below returns unsigned.
|
||||
HINSTANCE instance = (HINSTANCE)GetWindowLong(wnd, GWL_HINSTANCE);
|
||||
#pragma warning(pop)
|
||||
|
||||
switch (message) {
|
||||
case WM_COMMAND:
|
||||
// Parse the menu selections.
|
||||
message_id = LOWORD(w_param);
|
||||
message_event = HIWORD(w_param);
|
||||
switch (message_id) {
|
||||
case IDM_ABOUT:
|
||||
DialogBox(current_instance,
|
||||
MAKEINTRESOURCE(IDD_ABOUTBOX),
|
||||
wnd,
|
||||
About);
|
||||
break;
|
||||
case IDM_EXIT:
|
||||
DestroyWindow(wnd);
|
||||
break;
|
||||
case ID_SERVER_START:
|
||||
CrashServerStart();
|
||||
break;
|
||||
case ID_SERVER_STOP:
|
||||
CrashServerStop();
|
||||
break;
|
||||
case ID_CLIENT_DEREFZERO:
|
||||
DerefZeroCrash();
|
||||
break;
|
||||
case ID_CLIENT_INVALIDPARAM:
|
||||
InvalidParamCrash();
|
||||
break;
|
||||
case ID_CLIENT_PURECALL:
|
||||
PureCallCrash();
|
||||
break;
|
||||
case ID_CLIENT_REQUESTEXPLICITDUMP:
|
||||
RequestDump();
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(wnd, message, w_param, l_param);
|
||||
}
|
||||
break;
|
||||
case WM_CREATE:
|
||||
client_status_edit_box = CreateWindow(TEXT("EDIT"),
|
||||
NULL,
|
||||
kEditBoxStyles,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
wnd,
|
||||
NULL,
|
||||
instance,
|
||||
NULL);
|
||||
break;
|
||||
case WM_SIZE:
|
||||
// Make the edit control the size of the window's client area.
|
||||
MoveWindow(client_status_edit_box,
|
||||
0,
|
||||
0,
|
||||
LOWORD(l_param), // width of client area.
|
||||
HIWORD(l_param), // height of client area.
|
||||
TRUE); // repaint window.
|
||||
break;
|
||||
case WM_SETFOCUS:
|
||||
SetFocus(client_status_edit_box);
|
||||
break;
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(wnd, &ps);
|
||||
EndPaint(wnd, &ps);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
CleanUp();
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(wnd, message, w_param, l_param);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Message handler for about box.
|
||||
INT_PTR CALLBACK About(HWND dlg,
|
||||
UINT message,
|
||||
WPARAM w_param,
|
||||
LPARAM l_param) {
|
||||
UNREFERENCED_PARAMETER(l_param);
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
return (INT_PTR)TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(w_param) == IDOK || LOWORD(w_param) == IDCANCEL) {
|
||||
EndDialog(dlg, LOWORD(w_param));
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (INT_PTR)FALSE;
|
||||
}
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
int APIENTRY _tWinMain(HINSTANCE instance,
|
||||
HINSTANCE previous_instance,
|
||||
LPTSTR command_line,
|
||||
int command_show) {
|
||||
using namespace google_breakpad;
|
||||
|
||||
UNREFERENCED_PARAMETER(previous_instance);
|
||||
UNREFERENCED_PARAMETER(command_line);
|
||||
|
||||
cs_edit = new CRITICAL_SECTION();
|
||||
InitializeCriticalSection(cs_edit);
|
||||
|
||||
CustomClientInfo custom_info = {kCustomInfoEntries, kCustomInfoCount};
|
||||
|
||||
CrashServerStart();
|
||||
// This is needed for CRT to not show dialog for invalid param
|
||||
// failures and instead let the code handle it.
|
||||
_CrtSetReportMode(_CRT_ASSERT, 0);
|
||||
handler = new ExceptionHandler(L"C:\\dumps\\",
|
||||
NULL,
|
||||
google_breakpad::ShowDumpResults,
|
||||
NULL,
|
||||
ExceptionHandler::HANDLER_ALL,
|
||||
MiniDumpNormal,
|
||||
kPipeName,
|
||||
&custom_info);
|
||||
|
||||
// Initialize global strings.
|
||||
LoadString(instance, IDS_APP_TITLE, title, kMaxLoadString);
|
||||
LoadString(instance,
|
||||
IDC_CRASHGENERATIONAPP,
|
||||
window_class,
|
||||
kMaxLoadString);
|
||||
MyRegisterClass(instance);
|
||||
|
||||
// Perform application initialization.
|
||||
if (!InitInstance (instance, command_show)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HACCEL accel_table = LoadAccelerators(
|
||||
instance,
|
||||
MAKEINTRESOURCE(IDC_CRASHGENERATIONAPP));
|
||||
|
||||
// Main message loop.
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
if (!TranslateAccelerator(msg.hwnd, accel_table, &msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
return (int)msg.wParam;
|
||||
}
|
61
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.gyp
vendored
Normal file
61
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.gyp
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# Copyright (c) 2010, Google Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
{
|
||||
'includes': [
|
||||
'../../build/common.gypi',
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'crash_generation_app',
|
||||
'type': 'executable',
|
||||
'sources': [
|
||||
'abstract_class.cc',
|
||||
'abstract_class.h',
|
||||
'crash_generation_app.cc',
|
||||
'crash_generation_app.h',
|
||||
'crash_generation_app.ico',
|
||||
'crash_generation_app.rc',
|
||||
'resource.h',
|
||||
'small.ico',
|
||||
],
|
||||
'dependencies': [
|
||||
'../../breakpad_client.gyp:common',
|
||||
'../../crash_generation/crash_generation.gyp:crash_generation_server',
|
||||
'../../crash_generation/crash_generation.gyp:crash_generation_client',
|
||||
'../../handler/exception_handler.gyp:exception_handler',
|
||||
],
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'SubSystem': '2', # Windows Subsystem as opposed to a console app
|
||||
},
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
35
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.h
vendored
Normal file
35
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.h
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2008, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_CRASH_GENERATION_APP_H__
|
||||
#define CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_CRASH_GENERATION_APP_H__
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#endif // CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_CRASH_GENERATION_APP_H__
|
BIN
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.ico
vendored
Normal file
BIN
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.ico
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
144
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.rc
vendored
Normal file
144
thirdparty/breakpad/client/windows/tests/crash_generation_app/crash_generation_app.rc
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "windows.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_CRASHGENERATIONAPP ICON "crash_generation_app.ico"
|
||||
IDI_SMALL ICON "small.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDC_CRASHGENERATIONAPP MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "E&xit", IDM_EXIT
|
||||
END
|
||||
POPUP "&Server"
|
||||
BEGIN
|
||||
MENUITEM "&Start", ID_SERVER_START
|
||||
MENUITEM "S&top", ID_SERVER_STOP
|
||||
END
|
||||
POPUP "&Client"
|
||||
BEGIN
|
||||
MENUITEM "&Deref Zero", ID_CLIENT_DEREFZERO
|
||||
MENUITEM "&Invalid Param", ID_CLIENT_INVALIDPARAM
|
||||
MENUITEM "&Pure Call", ID_CLIENT_PURECALL
|
||||
MENUITEM "&Request Dump", ID_CLIENT_REQUESTEXPLICITDUMP
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDC_CRASHGENERATIONAPP ACCELERATORS
|
||||
BEGIN
|
||||
"?", IDM_ABOUT, ASCII, ALT
|
||||
"/", IDM_ABOUT, ASCII, ALT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOG 22, 17, 230, 75
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
ICON IDI_CRASHGENERATIONAPP,IDC_MYICON,14,9,16,16
|
||||
LTEXT "CrashGenerationApp Version 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX
|
||||
LTEXT "Copyright (C) 2008",IDC_STATIC,49,20,119,8
|
||||
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""windows.h""\r\n"
|
||||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_APP_TITLE "CrashGenerationApp"
|
||||
IDC_CRASHGENERATIONAPP "CRASHGENERATIONAPP"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
73
thirdparty/breakpad/client/windows/tests/crash_generation_app/resource.h
vendored
Normal file
73
thirdparty/breakpad/client/windows/tests/crash_generation_app/resource.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) 2008, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// PreCompile.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#ifndef CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_RESOURCE_H__
|
||||
#define CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_RESOURCE_H__
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by crash_generation_app.rc
|
||||
//
|
||||
#define IDC_MYICON 2
|
||||
#define IDD_CRASHGENERATIONAPP_DIALOG 102
|
||||
#define IDS_APP_TITLE 103
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_CRASHGENERATIONAPP 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_CRASHGENERATIONAPP 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define ID_SERVER_START 32771
|
||||
#define ID_SERVER_STOP 32772
|
||||
#define ID_CLIENT_INVALIDPARAM 32773
|
||||
#define ID_CLIENT_ASSERTFAILURE 32774
|
||||
#define ID_CLIENT_DEREFZERO 32775
|
||||
#define ID_CLIENT_PURECALL 32777
|
||||
#define ID_CLIENT_REQUESTEXPLICITDUMP 32778
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32780
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // CLIENT_WINDOWS_TESTS_CRASH_GENERATION_APP_RESOURCE_H__
|
BIN
thirdparty/breakpad/client/windows/tests/crash_generation_app/small.ico
vendored
Normal file
BIN
thirdparty/breakpad/client/windows/tests/crash_generation_app/small.ico
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
Reference in New Issue
Block a user