Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: sandbox/win/src/window.cc

Issue 2193603004: Ignore desktop creation errors in the sandbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/sandbox_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "sandbox/win/src/window.h" 5 #include "sandbox/win/src/window.h"
6 6
7 #include <aclapi.h> 7 #include <aclapi.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 28 matching lines...) Expand all
39 // Get the security attributes from the current window station; we will 39 // Get the security attributes from the current window station; we will
40 // use this as the base security attributes for the new window station. 40 // use this as the base security attributes for the new window station.
41 HWINSTA current_winsta = ::GetProcessWindowStation(); 41 HWINSTA current_winsta = ::GetProcessWindowStation();
42 if (!current_winsta) 42 if (!current_winsta)
43 return SBOX_ERROR_CANNOT_GET_WINSTATION; 43 return SBOX_ERROR_CANNOT_GET_WINSTATION;
44 44
45 SECURITY_ATTRIBUTES attributes = {0}; 45 SECURITY_ATTRIBUTES attributes = {0};
46 if (!GetSecurityAttributes(current_winsta, &attributes)) 46 if (!GetSecurityAttributes(current_winsta, &attributes))
47 return SBOX_ERROR_CANNOT_QUERY_WINSTATION_SECURITY; 47 return SBOX_ERROR_CANNOT_QUERY_WINSTATION_SECURITY;
48 48
49 // Create the window station using NULL for the name to ask the os to 49 // Create the window station using nullptr for the name to ask the os to
50 // generate it. 50 // generate it.
51 *winsta = ::CreateWindowStationW( 51 *winsta = ::CreateWindowStationW(
52 NULL, 0, GENERIC_READ | WINSTA_CREATEDESKTOP, &attributes); 52 nullptr, 0, GENERIC_READ | WINSTA_CREATEDESKTOP, &attributes);
53 if (*winsta == nullptr && ::GetLastError() == ERROR_ACCESS_DENIED) {
54 *winsta = ::CreateWindowStationW(
55 nullptr, 0, WINSTA_READATTRIBUTES | WINSTA_CREATEDESKTOP, &attributes);
56 }
53 LocalFree(attributes.lpSecurityDescriptor); 57 LocalFree(attributes.lpSecurityDescriptor);
54 58
55 if (*winsta) 59 if (*winsta)
56 return SBOX_ALL_OK; 60 return SBOX_ALL_OK;
57 61
58 return SBOX_ERROR_CANNOT_CREATE_WINSTATION; 62 return SBOX_ERROR_CANNOT_CREATE_WINSTATION;
59 } 63 }
60 64
61 ResultCode CreateAltDesktop(HWINSTA winsta, HDESK* desktop) { 65 ResultCode CreateAltDesktop(HWINSTA winsta, HDESK* desktop) {
62 base::string16 desktop_name = L"sbox_alternate_desktop_"; 66 base::string16 desktop_name = L"sbox_alternate_desktop_";
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (winsta) { 163 if (winsta) {
160 name = GetWindowObjectName(winsta); 164 name = GetWindowObjectName(winsta);
161 name += L'\\'; 165 name += L'\\';
162 } 166 }
163 167
164 name += GetWindowObjectName(desktop); 168 name += GetWindowObjectName(desktop);
165 return name; 169 return name;
166 } 170 }
167 171
168 } // namespace sandbox 172 } // namespace sandbox
OLDNEW
« no previous file with comments | « content/common/sandbox_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698