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

Side by Side Diff: sandbox/win/tests/common/controller.cc

Issue 10951038: Remove GetModuleHandleHelper(), which was only needed for Win2k (which we don't support). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/win/src/service_resolver_32.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) 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 "sandbox/win/tests/common/controller.h" 5 #include "sandbox/win/tests/common/controller.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
11 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
12 #include "base/win/windows_version.h" 12 #include "base/win/windows_version.h"
13 #include "sandbox/win/src/sandbox_factory.h" 13 #include "sandbox/win/src/sandbox_factory.h"
14 #include "sandbox/win/src/sandbox_utils.h"
15 14
16 namespace { 15 namespace {
17 16
18 static const int kDefaultTimeout = 10000; 17 static const int kDefaultTimeout = 10000;
19 18
20 // Constructs a full path to a file inside the system32 folder. 19 // Constructs a full path to a file inside the system32 folder.
21 std::wstring MakePathToSys32(const wchar_t* name, bool is_obj_man_path) { 20 std::wstring MakePathToSys32(const wchar_t* name, bool is_obj_man_path) {
22 wchar_t windows_path[MAX_PATH] = {0}; 21 wchar_t windows_path[MAX_PATH] = {0};
23 if (0 == ::GetSystemWindowsDirectoryW(windows_path, MAX_PATH)) 22 if (0 == ::GetSystemWindowsDirectoryW(windows_path, MAX_PATH))
24 return std::wstring(); 23 return std::wstring();
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 292 }
294 293
295 if (0 == _wcsicmp(argv[3], L"ping")) 294 if (0 == _wcsicmp(argv[3], L"ping"))
296 return SBOX_TEST_PING_OK; 295 return SBOX_TEST_PING_OK;
297 296
298 SboxTestsState state = static_cast<SboxTestsState>(_wtoi(argv[2])); 297 SboxTestsState state = static_cast<SboxTestsState>(_wtoi(argv[2]));
299 if ((state <= MIN_STATE) || (state >= MAX_STATE)) 298 if ((state <= MIN_STATE) || (state >= MAX_STATE))
300 return SBOX_TEST_INVALID_PARAMETER; 299 return SBOX_TEST_INVALID_PARAMETER;
301 300
302 HMODULE module; 301 HMODULE module;
303 if (!GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 302 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
304 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, 303 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
305 reinterpret_cast<wchar_t*>(&DispatchCall), 304 reinterpret_cast<wchar_t*>(&DispatchCall), &module))
306 &module))
307 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 305 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
308 306
309 std::string command_name = base::SysWideToMultiByte(argv[3], CP_UTF8); 307 std::string command_name = base::SysWideToMultiByte(argv[3], CP_UTF8);
310 CommandFunction command = reinterpret_cast<CommandFunction>( 308 CommandFunction command = reinterpret_cast<CommandFunction>(
311 ::GetProcAddress(module, command_name.c_str())); 309 ::GetProcAddress(module, command_name.c_str()));
312 if (!command) 310 if (!command)
313 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 311 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
314 312
315 if (BEFORE_INIT == state) 313 if (BEFORE_INIT == state)
316 return command(argc - 4, argv + 4); 314 return command(argc - 4, argv + 4);
(...skipping 12 matching lines...) Expand all
329 327
330 target->LowerToken(); 328 target->LowerToken();
331 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { 329 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) {
332 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 330 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
333 } 331 }
334 332
335 return command(argc - 4, argv + 4); 333 return command(argc - 4, argv + 4);
336 } 334 }
337 335
338 } // namespace sandbox 336 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/service_resolver_32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698