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

Side by Side Diff: sandbox/src/interception.cc

Issue 6610029: Create a "GetWOW64Status()" utility function and make the rest of the codebas... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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
OLDNEW
1 // Copyright (c) 2006-2010 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 // For information about interceptions as a whole see 5 // For information about interceptions as a whole see
6 // http://dev.chromium.org/developers/design-documents/sandbox . 6 // http://dev.chromium.org/developers/design-documents/sandbox .
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "sandbox/src/interception.h" 10 #include "sandbox/src/interception.h"
11 11
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // Bypass purify's interception. 417 // Bypass purify's interception.
418 wchar_t* loader_get = reinterpret_cast<wchar_t*>( 418 wchar_t* loader_get = reinterpret_cast<wchar_t*>(
419 ntdll_image.GetProcAddress("LdrGetDllHandle")); 419 ntdll_image.GetProcAddress("LdrGetDllHandle"));
420 if (loader_get) { 420 if (loader_get) {
421 if (!GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 421 if (!GetModuleHandleHelper(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
422 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, 422 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
423 loader_get, &ntdll_base)) 423 loader_get, &ntdll_base))
424 return false; 424 return false;
425 } 425 }
426 426
427 Wow64 WowHelper(child_, ntdll_base);
428 if (base::win::GetVersion() <= base::win::VERSION_VISTA) { 427 if (base::win::GetVersion() <= base::win::VERSION_VISTA) {
429 if (!WowHelper.WaitForNtdll(INFINITE)) 428 Wow64 WowHelper(child_, ntdll_base);
429 if (!WowHelper.WaitForNtdll())
430 return false; 430 return false;
431 } 431 }
432 432
433 char* interceptor_base = NULL; 433 char* interceptor_base = NULL;
434 434
435 #if SANDBOX_EXPORTS 435 #if SANDBOX_EXPORTS
436 interceptor_base = reinterpret_cast<char*>(child_->MainModule()); 436 interceptor_base = reinterpret_cast<char*>(child_->MainModule());
437 HMODULE local_interceptor = ::LoadLibrary(child_->Name()); 437 HMODULE local_interceptor = ::LoadLibrary(child_->Name());
438 #endif 438 #endif
439 439
440 ServiceResolverThunk* thunk; 440 ServiceResolverThunk* thunk;
441 if (WowHelper.IsWow64()) 441 if (base::win::GetWOW64Status() == base::win::WOW64_ENABLED)
442 thunk = new Wow64ResolverThunk(child_->Process(), relaxed_); 442 thunk = new Wow64ResolverThunk(child_->Process(), relaxed_);
443 else if (!IsXPSP2OrLater()) 443 else if (!IsXPSP2OrLater())
444 thunk = new Win2kResolverThunk(child_->Process(), relaxed_); 444 thunk = new Win2kResolverThunk(child_->Process(), relaxed_);
445 else 445 else
446 thunk = new ServiceResolverThunk(child_->Process(), relaxed_); 446 thunk = new ServiceResolverThunk(child_->Process(), relaxed_);
447 447
448 std::list<InterceptionData>::iterator it = interceptions_.begin(); 448 std::list<InterceptionData>::iterator it = interceptions_.begin();
449 for (; it != interceptions_.end(); ++it) { 449 for (; it != interceptions_.end(); ++it) {
450 const std::wstring ntdll(kNtdllName); 450 const std::wstring ntdll(kNtdllName);
451 if (it->dll != ntdll) 451 if (it->dll != ntdll)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 ::FreeLibrary(local_interceptor); 495 ::FreeLibrary(local_interceptor);
496 #endif 496 #endif
497 497
498 if (it != interceptions_.end()) 498 if (it != interceptions_.end())
499 return false; 499 return false;
500 500
501 return true; 501 return true;
502 } 502 }
503 503
504 } // namespace sandbox 504 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698