| 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 "components/crash/tools/crash_service.h" | 5 #include "components/crash/tools/crash_service.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <sddl.h> | 9 #include <sddl.h> |
| 10 #include <fstream> | 10 #include <fstream> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // This is the main and only application window. | 85 // This is the main and only application window. |
| 86 HWND g_top_window = NULL; | 86 HWND g_top_window = NULL; |
| 87 | 87 |
| 88 bool CreateTopWindow(HINSTANCE instance, bool visible) { | 88 bool CreateTopWindow(HINSTANCE instance, bool visible) { |
| 89 WNDCLASSEXW wcx = {0}; | 89 WNDCLASSEXW wcx = {0}; |
| 90 wcx.cbSize = sizeof(wcx); | 90 wcx.cbSize = sizeof(wcx); |
| 91 wcx.style = CS_HREDRAW | CS_VREDRAW; | 91 wcx.style = CS_HREDRAW | CS_VREDRAW; |
| 92 wcx.lpfnWndProc = CrashSvcWndProc; | 92 wcx.lpfnWndProc = CrashSvcWndProc; |
| 93 wcx.hInstance = instance; | 93 wcx.hInstance = instance; |
| 94 wcx.lpszClassName = L"crash_svc_class"; | 94 wcx.lpszClassName = L"crash_svc_class"; |
| 95 ATOM atom = ::RegisterClassExW(&wcx); | 95 ::RegisterClassExW(&wcx); |
| 96 DWORD style = visible ? WS_POPUPWINDOW | WS_VISIBLE : WS_OVERLAPPED; | 96 DWORD style = visible ? WS_POPUPWINDOW | WS_VISIBLE : WS_OVERLAPPED; |
| 97 | 97 |
| 98 // The window size is zero but being a popup window still shows in the | 98 // The window size is zero but being a popup window still shows in the |
| 99 // task bar and can be closed using the system menu or using task manager. | 99 // task bar and can be closed using the system menu or using task manager. |
| 100 HWND window = CreateWindowExW(0, wcx.lpszClassName, L"crash service", style, | 100 HWND window = CreateWindowExW(0, wcx.lpszClassName, L"crash service", style, |
| 101 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, | 101 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, |
| 102 NULL, NULL, instance, NULL); | 102 NULL, NULL, instance, NULL); |
| 103 if (!window) | 103 if (!window) |
| 104 return false; | 104 return false; |
| 105 | 105 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 << "\ndumps serviced :" << requests_handled_ | 459 << "\ndumps serviced :" << requests_handled_ |
| 460 << "\ndumps reported :" << requests_sent_; | 460 << "\ndumps reported :" << requests_sent_; |
| 461 | 461 |
| 462 return static_cast<int>(msg.wParam); | 462 return static_cast<int>(msg.wParam); |
| 463 } | 463 } |
| 464 | 464 |
| 465 PSECURITY_DESCRIPTOR CrashService::GetSecurityDescriptorForLowIntegrity() { | 465 PSECURITY_DESCRIPTOR CrashService::GetSecurityDescriptorForLowIntegrity() { |
| 466 // Build the SDDL string for the label. | 466 // Build the SDDL string for the label. |
| 467 std::wstring sddl = L"S:(ML;;NW;;;S-1-16-4096)"; | 467 std::wstring sddl = L"S:(ML;;NW;;;S-1-16-4096)"; |
| 468 | 468 |
| 469 DWORD error = ERROR_SUCCESS; | |
| 470 PSECURITY_DESCRIPTOR sec_desc = NULL; | 469 PSECURITY_DESCRIPTOR sec_desc = NULL; |
| 471 | 470 |
| 472 PACL sacl = NULL; | 471 PACL sacl = NULL; |
| 473 BOOL sacl_present = FALSE; | 472 BOOL sacl_present = FALSE; |
| 474 BOOL sacl_defaulted = FALSE; | 473 BOOL sacl_defaulted = FALSE; |
| 475 | 474 |
| 476 if (::ConvertStringSecurityDescriptorToSecurityDescriptorW(sddl.c_str(), | 475 if (::ConvertStringSecurityDescriptorToSecurityDescriptorW(sddl.c_str(), |
| 477 SDDL_REVISION, | 476 SDDL_REVISION, |
| 478 &sec_desc, NULL)) { | 477 &sec_desc, NULL)) { |
| 479 if (::GetSecurityDescriptorSacl(sec_desc, &sacl_present, &sacl, | 478 if (::GetSecurityDescriptorSacl(sec_desc, &sacl_present, &sacl, |
| 480 &sacl_defaulted)) { | 479 &sacl_defaulted)) { |
| 481 return sec_desc; | 480 return sec_desc; |
| 482 } | 481 } |
| 483 } | 482 } |
| 484 | 483 |
| 485 return NULL; | 484 return NULL; |
| 486 } | 485 } |
| 487 | 486 |
| 488 } // namespace breakpad | 487 } // namespace breakpad |
| OLD | NEW |