OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "stdafx.h" | 5 #include "stdafx.h" |
6 #include "win8/metro_driver/metro_driver.h" | 6 #include "win8/metro_driver/metro_driver.h" |
7 | 7 |
8 #include <roerrorapi.h> | 8 #include <roerrorapi.h> |
9 #include <shobjidl.h> | 9 #include <shobjidl.h> |
10 | 10 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/logging_win.h" | 14 #include "base/logging_win.h" |
15 #include "base/win/scoped_comptr.h" | 15 #include "base/win/scoped_comptr.h" |
16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
17 #include "win8/metro_driver/winrt_utils.h" | 17 #include "win8/metro_driver/winrt_utils.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
| 21 #if !defined(NDEBUG) |
21 LONG WINAPI ErrorReportingHandler(EXCEPTION_POINTERS* ex_info) { | 22 LONG WINAPI ErrorReportingHandler(EXCEPTION_POINTERS* ex_info) { |
22 // See roerrorapi.h for a description of the | 23 // See roerrorapi.h for a description of the |
23 // exception codes and parameters. | 24 // exception codes and parameters. |
24 DWORD code = ex_info->ExceptionRecord->ExceptionCode; | 25 DWORD code = ex_info->ExceptionRecord->ExceptionCode; |
25 ULONG_PTR* info = ex_info->ExceptionRecord->ExceptionInformation; | 26 ULONG_PTR* info = ex_info->ExceptionRecord->ExceptionInformation; |
26 if (code == EXCEPTION_RO_ORIGINATEERROR) { | 27 if (code == EXCEPTION_RO_ORIGINATEERROR) { |
27 base::string16 msg(reinterpret_cast<wchar_t*>(info[2]), info[1]); | 28 base::string16 msg(reinterpret_cast<wchar_t*>(info[2]), info[1]); |
28 LOG(ERROR) << "VEH: Metro error 0x" << std::hex << info[0] << ": " << msg; | 29 LOG(ERROR) << "VEH: Metro error 0x" << std::hex << info[0] << ": " << msg; |
29 } else if (code == EXCEPTION_RO_TRANSFORMERROR) { | 30 } else if (code == EXCEPTION_RO_TRANSFORMERROR) { |
30 base::string16 msg(reinterpret_cast<wchar_t*>(info[3]), info[2]); | 31 base::string16 msg(reinterpret_cast<wchar_t*>(info[3]), info[2]); |
31 LOG(ERROR) << "VEH: Metro old error 0x" << std::hex << info[0] | 32 LOG(ERROR) << "VEH: Metro old error 0x" << std::hex << info[0] |
32 << " new error 0x" << info[1] << ": " << msg; | 33 << " new error 0x" << info[1] << ": " << msg; |
33 } | 34 } |
34 | 35 |
35 return EXCEPTION_CONTINUE_SEARCH; | 36 return EXCEPTION_CONTINUE_SEARCH; |
36 } | 37 } |
| 38 #endif |
37 | 39 |
38 void SetMetroReportingFlags() { | 40 void SetMetroReportingFlags() { |
39 #if !defined(NDEBUG) | 41 #if !defined(NDEBUG) |
40 // Set the error reporting flags to always raise an exception, | 42 // Set the error reporting flags to always raise an exception, |
41 // which is then processed by our vectored exception handling | 43 // which is then processed by our vectored exception handling |
42 // above to log the error message. | 44 // above to log the error message. |
43 winfoundtn::Diagnostics::SetErrorReportingFlags( | 45 winfoundtn::Diagnostics::SetErrorReportingFlags( |
44 winfoundtn::Diagnostics::UseSetErrorInfo | | 46 winfoundtn::Diagnostics::UseSetErrorInfo | |
45 winfoundtn::Diagnostics::ForceExceptions); | 47 winfoundtn::Diagnostics::ForceExceptions); |
46 #endif | 48 #endif |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 extern "C" __declspec(dllexport) | 126 extern "C" __declspec(dllexport) |
125 HRESULT ActivateApplication(const wchar_t* app_id) { | 127 HRESULT ActivateApplication(const wchar_t* app_id) { |
126 base::win::ScopedComPtr<IApplicationActivationManager> activator; | 128 base::win::ScopedComPtr<IApplicationActivationManager> activator; |
127 HRESULT hr = activator.CreateInstance(CLSID_ApplicationActivationManager); | 129 HRESULT hr = activator.CreateInstance(CLSID_ApplicationActivationManager); |
128 if (SUCCEEDED(hr)) { | 130 if (SUCCEEDED(hr)) { |
129 DWORD pid = 0; | 131 DWORD pid = 0; |
130 hr = activator->ActivateApplication(app_id, L"", AO_NONE, &pid); | 132 hr = activator->ActivateApplication(app_id, L"", AO_NONE, &pid); |
131 } | 133 } |
132 return hr; | 134 return hr; |
133 } | 135 } |
OLD | NEW |