Cleanup/Remove Windows XP/Vista version checks from Windows sandbox code

903c28eb7d6d9cc14b0c67066e849608b6e5ada1
Initial sandbox VP/Vista version check sanitization

2f6c387f12b9570c59906356ec4d45437411542b
Fixed build error

Review URL: https://codereview.chromium.org/1814863004

Cr-Commit-Position: refs/heads/master@{#382419}
diff --git a/sandbox/win/BUILD.gn b/sandbox/win/BUILD.gn
index 327396b..21828ad 100644
--- a/sandbox/win/BUILD.gn
+++ b/sandbox/win/BUILD.gn
@@ -141,7 +141,6 @@
 
   if (current_cpu == "x64") {
     sources += [
-      "src/Wow64_64.cc",
       "src/interceptors_64.cc",
       "src/interceptors_64.h",
       "src/resolver_64.cc",
@@ -149,8 +148,6 @@
     ]
   } else if (current_cpu == "x86") {
     sources += [
-      "src/Wow64.cc",
-      "src/Wow64.h",
       "src/resolver_32.cc",
       "src/service_resolver_32.cc",
       "src/sidestep/ia32_modrm_map.cpp",
diff --git a/sandbox/win/sandbox_win.gypi b/sandbox/win/sandbox_win.gypi
index f0d275a..d90130af 100644
--- a/sandbox/win/sandbox_win.gypi
+++ b/sandbox/win/sandbox_win.gypi
@@ -148,7 +148,6 @@
               'src/interceptors_64.h',
               'src/resolver_64.cc',
               'src/service_resolver_64.cc',
-              'src/Wow64_64.cc',
             ],
           }],
           ['target_arch=="ia32"', {
@@ -164,8 +163,6 @@
               'src/sidestep\mini_disassembler.h',
               'src/sidestep\preamble_patcher_with_stub.cpp',
               'src/sidestep\preamble_patcher.h',
-              'src/Wow64.cc',
-              'src/Wow64.h',
             ],
           }],
         ],
diff --git a/sandbox/win/src/Wow64.cc b/sandbox/win/src/Wow64.cc
deleted file mode 100644
index c5984d6..0000000
--- a/sandbox/win/src/Wow64.cc
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sandbox/win/src/Wow64.h"
-
-#include <stddef.h>
-
-#include <sstream>
-
-#include "base/bit_cast.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/win/scoped_process_information.h"
-#include "base/win/windows_version.h"
-#include "sandbox/win/src/target_process.h"
-
-namespace {
-
-// Holds the information needed for the interception of NtMapViewOfSection on
-// 64 bits.
-// Warning: do not modify this definition without changing also the code on the
-// 64 bit helper process.
-struct PatchInfo32 {
-  HANDLE dll_load;  // Event to signal the broker.
-  ULONG pad1;
-  HANDLE continue_load;  // Event to wait for the broker.
-  ULONG pad2;
-  HANDLE section;  // First argument of the call.
-  ULONG pad3;
-  void* orig_MapViewOfSection;
-  ULONG original_high;
-  void* signal_and_wait;
-  ULONG pad4;
-  void* patch_location;
-  ULONG patch_high;
-};
-
-// Size of the 64 bit service entry.
-const SIZE_T kServiceEntry64Size = 0x10;
-
-// Removes the interception of ntdll64.
-bool Restore64Code(HANDLE child, PatchInfo32* patch_info) {
-  PatchInfo32 local_patch_info;
-  SIZE_T actual;
-  if (!::ReadProcessMemory(child, patch_info, &local_patch_info,
-                           sizeof(local_patch_info), &actual))
-    return false;
-  if (sizeof(local_patch_info) != actual)
-    return false;
-
-  if (local_patch_info.original_high)
-    return false;
-  if (local_patch_info.patch_high)
-    return false;
-
-  char buffer[kServiceEntry64Size];
-
-  if (!::ReadProcessMemory(child, local_patch_info.orig_MapViewOfSection,
-                           &buffer, kServiceEntry64Size, &actual))
-    return false;
-  if (kServiceEntry64Size != actual)
-    return false;
-
-  if (!::WriteProcessMemory(child, local_patch_info.patch_location, &buffer,
-                            kServiceEntry64Size, &actual))
-    return false;
-  if (kServiceEntry64Size != actual)
-    return false;
-  return true;
-}
-
-typedef BOOL (WINAPI* IsWow64ProcessFunction)(HANDLE process, BOOL* wow64);
-
-}  // namespace
-
-namespace sandbox {
-
-Wow64::Wow64(TargetProcess* child, HMODULE ntdll)
-    : child_(child), ntdll_(ntdll), dll_load_(NULL), continue_load_(NULL) {
-}
-
-Wow64::~Wow64() {
-}
-
-// The basic idea is to allocate one page of memory on the child, and initialize
-// the first part of it with our version of PatchInfo32. Then launch the helper
-// process passing it that address on the child. The helper process will patch
-// the 64 bit version of NtMapViewOfFile, and the interception will signal the
-// first event on the buffer. We'll be waiting on that event and after the 32
-// bit version of ntdll is loaded, we'll remove the interception and return to
-// our caller.
-bool Wow64::WaitForNtdll() {
-  if (base::win::OSInfo::GetInstance()->wow64_status() !=
-      base::win::OSInfo::WOW64_ENABLED)
-    return true;
-
-  const size_t page_size = 4096;
-
-  // Create some default manual reset un-named events, not signaled.
-  dll_load_.Set(::CreateEvent(NULL, TRUE, FALSE, NULL));
-  continue_load_.Set(::CreateEvent(NULL, TRUE, FALSE, NULL));
-  HANDLE current_process = ::GetCurrentProcess();
-  HANDLE remote_load, remote_continue;
-  DWORD access = EVENT_MODIFY_STATE | SYNCHRONIZE;
-  if (!::DuplicateHandle(current_process, dll_load_.Get(), child_->Process(),
-                         &remote_load, access, FALSE, 0)) {
-    return false;
-  }
-  if (!::DuplicateHandle(current_process, continue_load_.Get(),
-                         child_->Process(), &remote_continue, access, FALSE,
-                         0)) {
-    return false;
-  }
-
-  void* buffer = ::VirtualAllocEx(child_->Process(), NULL, page_size,
-                                  MEM_COMMIT, PAGE_EXECUTE_READWRITE);
-  DCHECK(buffer);
-  if (!buffer)
-    return false;
-
-  PatchInfo32* patch_info = reinterpret_cast<PatchInfo32*>(buffer);
-  PatchInfo32 local_patch_info = {0};
-  local_patch_info.dll_load = remote_load;
-  local_patch_info.continue_load = remote_continue;
-  SIZE_T written;
-  if (!::WriteProcessMemory(child_->Process(), patch_info, &local_patch_info,
-                            offsetof(PatchInfo32, section), &written))
-    return false;
-  if (offsetof(PatchInfo32, section) != written)
-    return false;
-
-  if (!RunWowHelper(buffer))
-    return false;
-
-  // The child is intercepted on 64 bit, go on and wait for our event.
-  if (!DllMapped())
-    return false;
-
-  // The 32 bit version is available, cleanup the child.
-  return Restore64Code(child_->Process(), patch_info);
-}
-
-bool Wow64::RunWowHelper(void* buffer) {
-  static_assert(sizeof(buffer) <= sizeof(DWORD), "unsupported 64 bits");
-
-  // Get the path to the helper (beside the exe).
-  wchar_t prog_name[MAX_PATH];
-  GetModuleFileNameW(NULL, prog_name, MAX_PATH);
-  base::string16 path(prog_name);
-  size_t name_pos = path.find_last_of(L"\\");
-  if (base::string16::npos == name_pos)
-    return false;
-  path.resize(name_pos + 1);
-
-  std::basic_stringstream<base::char16> command;
-  command << std::hex << std::showbase << L"\"" << path <<
-               L"wow_helper.exe\" " << child_->ProcessId() << " " <<
-               bit_cast<ULONG>(buffer);
-
-  scoped_ptr<wchar_t, base::FreeDeleter>
-      writable_command(_wcsdup(command.str().c_str()));
-
-  STARTUPINFO startup_info = {0};
-  startup_info.cb = sizeof(startup_info);
-  PROCESS_INFORMATION temp_process_info = {};
-  if (!::CreateProcess(NULL, writable_command.get(), NULL, NULL, FALSE, 0, NULL,
-                       NULL, &startup_info, &temp_process_info))
-    return false;
-  base::win::ScopedProcessInformation process_info(temp_process_info);
-
-  DWORD reason = ::WaitForSingleObject(process_info.process_handle(), INFINITE);
-
-  DWORD code;
-  bool ok =
-      ::GetExitCodeProcess(process_info.process_handle(), &code) ? true : false;
-
-  if (WAIT_TIMEOUT == reason)
-    return false;
-
-  return ok && (0 == code);
-}
-
-// First we must wake up the child, then wait for dll loads on the child until
-// the one we care is loaded; at that point we must suspend the child again.
-bool Wow64::DllMapped() {
-  if (1 != ::ResumeThread(child_->MainThread())) {
-    NOTREACHED();
-    return false;
-  }
-
-  for (;;) {
-    DWORD reason = ::WaitForSingleObject(dll_load_.Get(), INFINITE);
-    if (WAIT_TIMEOUT == reason || WAIT_ABANDONED == reason)
-      return false;
-
-    if (!::ResetEvent(dll_load_.Get()))
-      return false;
-
-    bool found = NtdllPresent();
-    if (found) {
-      if (::SuspendThread(child_->MainThread()))
-        return false;
-    }
-
-    if (!::SetEvent(continue_load_.Get()))
-      return false;
-
-    if (found)
-      return true;
-  }
-}
-
-bool Wow64::NtdllPresent() {
-  const size_t kBufferSize = 512;
-  char buffer[kBufferSize];
-  SIZE_T read;
-  if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize,
-                           &read))
-    return false;
-  if (kBufferSize != read)
-    return false;
-  return true;
-}
-
-}  // namespace sandbox
diff --git a/sandbox/win/src/Wow64.h b/sandbox/win/src/Wow64.h
deleted file mode 100644
index acabc35..0000000
--- a/sandbox/win/src/Wow64.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SANDBOX_SRC_WOW64_H__
-#define SANDBOX_SRC_WOW64_H__
-
-#include <windows.h>
-
-#include "base/macros.h"
-#include "base/win/scoped_handle.h"
-#include "sandbox/win/src/sandbox_types.h"
-
-namespace sandbox {
-
-class TargetProcess;
-
-// This class wraps the code needed to interact with the Windows On Windows
-// subsystem on 64 bit OSes, from the point of view of interceptions.
-class Wow64 {
- public:
-  Wow64(TargetProcess* child, HMODULE ntdll);
-  ~Wow64();
-
-  // Waits for the 32 bit DLL to get loaded on the child process. This function
-  // will return immediately if not running under WOW, or launch the helper
-  // process and wait until ntdll is ready.
-  bool WaitForNtdll();
-
- private:
-  // Runs the WOW helper process, passing the address of a buffer allocated on
-  // the child (one page).
-  bool RunWowHelper(void* buffer);
-
-  // This method receives "notifications" whenever a DLL is mapped on the child.
-  bool DllMapped();
-
-  // Returns true if ntdll.dll is mapped on the child.
-  bool NtdllPresent();
-
-  TargetProcess* child_;  // Child process.
-  HMODULE ntdll_;         // ntdll on the parent.
-  // Event that is signaled on dll load.
-  base::win::ScopedHandle dll_load_;
-  // Event to signal to continue execution on the child.
-  base::win::ScopedHandle continue_load_;
-  DISALLOW_IMPLICIT_CONSTRUCTORS(Wow64);
-};
-
-}  // namespace sandbox
-
-#endif  // SANDBOX_SRC_WOW64_H__
diff --git a/sandbox/win/src/Wow64_64.cc b/sandbox/win/src/Wow64_64.cc
deleted file mode 100644
index 357deb85..0000000
--- a/sandbox/win/src/Wow64_64.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Wow64 implementation for native 64-bit Windows (in other words, never WOW).
-
-#include "sandbox/win/src/wow64.h"
-
-namespace sandbox {
-
-Wow64::Wow64(TargetProcess* child, HMODULE ntdll)
-    : child_(child), ntdll_(ntdll), dll_load_(NULL), continue_load_(NULL) {
-}
-
-Wow64::~Wow64() {
-}
-
-bool Wow64::WaitForNtdll() {
-  return true;
-}
-
-}  // namespace sandbox
diff --git a/sandbox/win/src/address_sanitizer_test.cc b/sandbox/win/src/address_sanitizer_test.cc
index b4be8bc..a18cab7 100644
--- a/sandbox/win/src/address_sanitizer_test.cc
+++ b/sandbox/win/src/address_sanitizer_test.cc
@@ -88,17 +88,13 @@
     std::string data;
     ASSERT_TRUE(base::ReadFileToString(base::FilePath(temp_file_name), &data));
     // Redirection uses a feature that was added in Windows Vista.
-    if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
-      ASSERT_TRUE(
-          strstr(data.c_str(), "ERROR: AddressSanitizer: heap-buffer-overflow"))
-          << "There doesn't seem to be an ASan report:\n" << data;
-      ASSERT_TRUE(strstr(data.c_str(), "AddressSanitizerTests_Report"))
-          << "The ASan report doesn't appear to be symbolized:\n" << data;
-      ASSERT_TRUE(strstr(data.c_str(), strrchr(__FILE__, '\\')))
-          << "The stack trace doesn't have a correct filename:\n" << data;
-    } else {
-      LOG(WARNING) << "Pre-Vista versions are not supported.";
-    }
+    ASSERT_TRUE(
+        strstr(data.c_str(), "ERROR: AddressSanitizer: heap-buffer-overflow"))
+        << "There doesn't seem to be an ASan report:\n" << data;
+    ASSERT_TRUE(strstr(data.c_str(), "AddressSanitizerTests_Report"))
+        << "The ASan report doesn't appear to be symbolized:\n" << data;
+    ASSERT_TRUE(strstr(data.c_str(), strrchr(__FILE__, '\\')))
+        << "The stack trace doesn't have a correct filename:\n" << data;
   } else {
     LOG(WARNING) << "Not an AddressSanitizer build, skipping the run.";
   }
diff --git a/sandbox/win/src/broker_services.cc b/sandbox/win/src/broker_services.cc
index c3b4909..f60c30b 100644
--- a/sandbox/win/src/broker_services.cc
+++ b/sandbox/win/src/broker_services.cc
@@ -347,85 +347,83 @@
 
   bool inherit_handles = false;
 
-  if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
-    int attribute_count = 0;
-    const AppContainerAttributes* app_container =
-        policy_base->GetAppContainer();
-    if (app_container)
-      ++attribute_count;
+  int attribute_count = 0;
+  const AppContainerAttributes* app_container =
+      policy_base->GetAppContainer();
+  if (app_container)
+    ++attribute_count;
 
-    size_t mitigations_size;
-    ConvertProcessMitigationsToPolicy(policy_base->GetProcessMitigations(),
-                                      &mitigations, &mitigations_size);
-    if (mitigations)
-      ++attribute_count;
+  size_t mitigations_size;
+  ConvertProcessMitigationsToPolicy(policy_base->GetProcessMitigations(),
+                                    &mitigations, &mitigations_size);
+  if (mitigations)
+    ++attribute_count;
 
-    bool restrict_child_process_creation = false;
-    if (base::win::GetVersion() >= base::win::VERSION_WIN10_TH2 &&
-        policy_base->GetJobLevel() <= JOB_LIMITED_USER) {
-      restrict_child_process_creation = true;
-      ++attribute_count;
-    }
+  bool restrict_child_process_creation = false;
+  if (base::win::GetVersion() >= base::win::VERSION_WIN10_TH2 &&
+      policy_base->GetJobLevel() <= JOB_LIMITED_USER) {
+    restrict_child_process_creation = true;
+    ++attribute_count;
+  }
 
-    HANDLE stdout_handle = policy_base->GetStdoutHandle();
-    HANDLE stderr_handle = policy_base->GetStderrHandle();
+  HANDLE stdout_handle = policy_base->GetStdoutHandle();
+  HANDLE stderr_handle = policy_base->GetStderrHandle();
 
-    if (stdout_handle != INVALID_HANDLE_VALUE)
-      inherited_handle_list.push_back(stdout_handle);
+  if (stdout_handle != INVALID_HANDLE_VALUE)
+    inherited_handle_list.push_back(stdout_handle);
 
-    // Handles in the list must be unique.
-    if (stderr_handle != stdout_handle && stderr_handle != INVALID_HANDLE_VALUE)
-      inherited_handle_list.push_back(stderr_handle);
+  // Handles in the list must be unique.
+  if (stderr_handle != stdout_handle && stderr_handle != INVALID_HANDLE_VALUE)
+    inherited_handle_list.push_back(stderr_handle);
 
-    const base::HandlesToInheritVector& policy_handle_list =
-        policy_base->GetHandlesBeingShared();
+  const base::HandlesToInheritVector& policy_handle_list =
+      policy_base->GetHandlesBeingShared();
 
-    for (HANDLE handle : policy_handle_list)
-      inherited_handle_list.push_back(handle);
+  for (HANDLE handle : policy_handle_list)
+    inherited_handle_list.push_back(handle);
 
-    if (inherited_handle_list.size())
-      ++attribute_count;
+  if (inherited_handle_list.size())
+    ++attribute_count;
 
-    if (!startup_info.InitializeProcThreadAttributeList(attribute_count))
+  if (!startup_info.InitializeProcThreadAttributeList(attribute_count))
+    return SBOX_ERROR_PROC_THREAD_ATTRIBUTES;
+
+  if (app_container) {
+    result = app_container->ShareForStartup(&startup_info);
+    if (SBOX_ALL_OK != result)
+      return result;
+  }
+
+  if (mitigations) {
+    if (!startup_info.UpdateProcThreadAttribute(
+              PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY, &mitigations,
+              mitigations_size)) {
       return SBOX_ERROR_PROC_THREAD_ATTRIBUTES;
-
-    if (app_container) {
-      result = app_container->ShareForStartup(&startup_info);
-      if (SBOX_ALL_OK != result)
-        return result;
     }
+  }
 
-    if (mitigations) {
-      if (!startup_info.UpdateProcThreadAttribute(
-               PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY, &mitigations,
-               mitigations_size)) {
-        return SBOX_ERROR_PROC_THREAD_ATTRIBUTES;
-      }
+  if (restrict_child_process_creation) {
+    if (!startup_info.UpdateProcThreadAttribute(
+            PROC_THREAD_ATTRIBUTE_CHILD_PROCESS_POLICY,
+            &child_process_creation, sizeof(child_process_creation))) {
+      return SBOX_ERROR_PROC_THREAD_ATTRIBUTES;
     }
+  }
 
-    if (restrict_child_process_creation) {
-      if (!startup_info.UpdateProcThreadAttribute(
-              PROC_THREAD_ATTRIBUTE_CHILD_PROCESS_POLICY,
-              &child_process_creation, sizeof(child_process_creation))) {
-        return SBOX_ERROR_PROC_THREAD_ATTRIBUTES;
-      }
+  if (inherited_handle_list.size()) {
+    if (!startup_info.UpdateProcThreadAttribute(
+            PROC_THREAD_ATTRIBUTE_HANDLE_LIST,
+            &inherited_handle_list[0],
+            sizeof(HANDLE) * inherited_handle_list.size())) {
+      return SBOX_ERROR_PROC_THREAD_ATTRIBUTES;
     }
-
-    if (inherited_handle_list.size()) {
-      if (!startup_info.UpdateProcThreadAttribute(
-              PROC_THREAD_ATTRIBUTE_HANDLE_LIST,
-              &inherited_handle_list[0],
-              sizeof(HANDLE) * inherited_handle_list.size())) {
-        return SBOX_ERROR_PROC_THREAD_ATTRIBUTES;
-      }
-      startup_info.startup_info()->dwFlags |= STARTF_USESTDHANDLES;
-      startup_info.startup_info()->hStdInput = INVALID_HANDLE_VALUE;
-      startup_info.startup_info()->hStdOutput = stdout_handle;
-      startup_info.startup_info()->hStdError = stderr_handle;
-      // Allowing inheritance of handles is only secure now that we
-      // have limited which handles will be inherited.
-      inherit_handles = true;
-    }
+    startup_info.startup_info()->dwFlags |= STARTF_USESTDHANDLES;
+    startup_info.startup_info()->hStdInput = INVALID_HANDLE_VALUE;
+    startup_info.startup_info()->hStdOutput = stdout_handle;
+    startup_info.startup_info()->hStdError = stderr_handle;
+    // Allowing inheritance of handles is only secure now that we
+    // have limited which handles will be inherited.
+    inherit_handles = true;
   }
 
   // Construct the thread pool here in case it is expensive.
diff --git a/sandbox/win/src/file_policy_test.cc b/sandbox/win/src/file_policy_test.cc
index f7509bd3..d4ac9082 100644
--- a/sandbox/win/src/file_policy_test.cc
+++ b/sandbox/win/src/file_policy_test.cc
@@ -280,8 +280,6 @@
 }
 
 TEST(FilePolicyTest, AllowNtCreateWithNativePath) {
-  if (base::win::GetVersion() < base::win::VERSION_WIN7)
-    return;
 
   base::string16 calc = MakePathToSys(L"calc.exe", false);
   base::string16 nt_path;
@@ -336,8 +334,6 @@
 
 // Tests support of "\\\\.\\DeviceName" kind of paths.
 TEST(FilePolicyTest, AllowImplicitDeviceName) {
-  if (base::win::GetVersion() < base::win::VERSION_WIN7)
-    return;
 
   TestRunner runner;
 
diff --git a/sandbox/win/src/handle_inheritance_test.cc b/sandbox/win/src/handle_inheritance_test.cc
index d8c2808d..939ace6 100644
--- a/sandbox/win/src/handle_inheritance_test.cc
+++ b/sandbox/win/src/handle_inheritance_test.cc
@@ -42,11 +42,7 @@
   std::string data;
   ASSERT_TRUE(base::ReadFileToString(base::FilePath(temp_file_name), &data));
   // Redirection uses a feature that was added in Windows Vista.
-  if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
-    ASSERT_EQ("Example output to stdout\r\n", data);
-  } else {
-    ASSERT_EQ("", data);
-  }
+  ASSERT_EQ("Example output to stdout\r\n", data);
 }
 
 }  // namespace sandbox
diff --git a/sandbox/win/src/integrity_level_test.cc b/sandbox/win/src/integrity_level_test.cc
index f962033..1eef869 100644
--- a/sandbox/win/src/integrity_level_test.cc
+++ b/sandbox/win/src/integrity_level_test.cc
@@ -45,8 +45,6 @@
 }
 
 TEST(IntegrityLevelTest, TestLowILReal) {
-  if (base::win::GetVersion() != base::win::VERSION_VISTA)
-    return;
 
   TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE);
 
@@ -62,8 +60,6 @@
 }
 
 TEST(DelayedIntegrityLevelTest, TestLowILDelayed) {
-  if (base::win::GetVersion() != base::win::VERSION_VISTA)
-    return;
 
   TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE);
 
@@ -78,8 +74,6 @@
 }
 
 TEST(IntegrityLevelTest, TestNoILChange) {
-  if (base::win::GetVersion() != base::win::VERSION_VISTA)
-    return;
 
   TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE);
 
diff --git a/sandbox/win/src/interception.cc b/sandbox/win/src/interception.cc
index f0a2a61..0243c24 100644
--- a/sandbox/win/src/interception.cc
+++ b/sandbox/win/src/interception.cc
@@ -23,7 +23,6 @@
 #include "sandbox/win/src/service_resolver.h"
 #include "sandbox/win/src/target_interceptions.h"
 #include "sandbox/win/src/target_process.h"
-#include "sandbox/win/src/wow64.h"
 
 namespace sandbox {
 
@@ -469,12 +468,6 @@
       return false;
   }
 
-  if (base::win::GetVersion() <= base::win::VERSION_VISTA) {
-    Wow64 WowHelper(child_, ntdll_base);
-    if (!WowHelper.WaitForNtdll())
-      return false;
-  }
-
   char* interceptor_base = NULL;
 
 #if SANDBOX_EXPORTS
diff --git a/sandbox/win/src/lpc_policy_test.cc b/sandbox/win/src/lpc_policy_test.cc
index 22db795..51931c66 100644
--- a/sandbox/win/src/lpc_policy_test.cc
+++ b/sandbox/win/src/lpc_policy_test.cc
@@ -128,10 +128,6 @@
 }
 
 TEST(LpcPolicyTest, GetUserDefaultLocaleName) {
-  // GetUserDefaultLocaleName is not available before Vista.
-  if (base::win::GetVersion() < base::win::VERSION_VISTA) {
-    return;
-  }
   static GetUserDefaultLocaleNameFunction GetUserDefaultLocaleName_func = NULL;
   if (!GetUserDefaultLocaleName_func) {
     // GetUserDefaultLocaleName is not available on WIN XP.  So we'll
diff --git a/sandbox/win/src/named_pipe_policy_test.cc b/sandbox/win/src/named_pipe_policy_test.cc
index 813cf1f..04f0488 100644
--- a/sandbox/win/src/named_pipe_policy_test.cc
+++ b/sandbox/win/src/named_pipe_policy_test.cc
@@ -71,12 +71,8 @@
   EXPECT_EQ(SBOX_TEST_SUCCEEDED,
             runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\testbleh"));
 
-  // On XP, the sandbox can create a pipe without any help but it fails on
-  // Vista+, this is why we do not test the "denied" case.
-  if (base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_VISTA) {
-    EXPECT_EQ(SBOX_TEST_DENIED,
-              runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\bleh"));
-  }
+  EXPECT_EQ(SBOX_TEST_DENIED,
+            runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\bleh"));
 }
 
 // Tests if we can create a pipe with a path traversal in the sandbox.
@@ -88,18 +84,14 @@
                              TargetPolicy::NAMEDPIPES_ALLOW_ANY,
                               L"\\\\.\\pipe\\test*"));
 
-  // On XP, the sandbox can create a pipe without any help but it fails on
-  // Vista+, this is why we do not test the "denied" case.
-  if (base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_VISTA) {
-    EXPECT_EQ(SBOX_TEST_DENIED,
-              runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\test\\..\\bleh"));
-    EXPECT_EQ(SBOX_TEST_DENIED,
-              runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\test/../bleh"));
-    EXPECT_EQ(SBOX_TEST_DENIED,
-              runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\test\\../bleh"));
-    EXPECT_EQ(SBOX_TEST_DENIED,
-              runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\test/..\\bleh"));
-  }
+  EXPECT_EQ(SBOX_TEST_DENIED,
+            runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\test\\..\\bleh"));
+  EXPECT_EQ(SBOX_TEST_DENIED,
+            runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\test/../bleh"));
+  EXPECT_EQ(SBOX_TEST_DENIED,
+            runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\test\\../bleh"));
+  EXPECT_EQ(SBOX_TEST_DENIED,
+            runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\test/..\\bleh"));
 }
 
 // This tests that path canonicalization is actually disabled if we use \\?\
@@ -129,12 +121,8 @@
   EXPECT_EQ(SBOX_TEST_SUCCEEDED,
             runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\testbleh"));
 
-  // On XP, the sandbox can create a pipe without any help but it fails on
-  // Vista+, this is why we do not test the "denied" case.
-  if (base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_VISTA) {
-    EXPECT_EQ(SBOX_TEST_DENIED,
-              runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\bleh"));
-  }
+  EXPECT_EQ(SBOX_TEST_DENIED,
+            runner.RunTest(L"NamedPipe_Create \\\\.\\pipe\\bleh"));
 }
 
 }  // namespace sandbox
diff --git a/sandbox/win/src/policy_broker.cc b/sandbox/win/src/policy_broker.cc
index 74a93f0..f6ff13c 100644
--- a/sandbox/win/src/policy_broker.cc
+++ b/sandbox/win/src/policy_broker.cc
@@ -110,17 +110,14 @@
       !INTERCEPT_NT(manager, NtOpenThreadToken, OPEN_THREAD_TOKEN_ID, 20))
     return false;
 
-  if (base::win::GetVersion() >= base::win::VERSION_XP) {
-    // Bug 27218: We don't have dispatch for some x64 syscalls.
-    // This one is also provided by process_thread_policy.
-    if (!INTERCEPT_NT(manager, NtOpenProcessTokenEx, OPEN_PROCESS_TOKEN_EX_ID,
-                      20))
-      return false;
+  // This one is also provided by process_thread_policy.
+  if (!INTERCEPT_NT(manager, NtOpenProcessTokenEx, OPEN_PROCESS_TOKEN_EX_ID,
+                    20))
+    return false;
 
-    if (!INTERCEPT_NT(manager, NtOpenThreadTokenEx, OPEN_THREAD_TOKEN_EX_ID,
-                      24))
-      return false;
-  }
+  if (!INTERCEPT_NT(manager, NtOpenThreadTokenEx, OPEN_THREAD_TOKEN_EX_ID,
+                    24))
+    return false;
 
   if (!is_csrss_connected) {
     if (!INTERCEPT_EAT(manager, kKerneldllName, CreateThread, CREATE_THREAD_ID,
diff --git a/sandbox/win/src/policy_target_test.cc b/sandbox/win/src/policy_target_test.cc
index 013fddf..71054abd 100644
--- a/sandbox/win/src/policy_target_test.cc
+++ b/sandbox/win/src/policy_target_test.cc
@@ -170,25 +170,20 @@
 
 TEST(PolicyTargetTest, SetInformationThread) {
   TestRunner runner;
-  if (base::win::GetVersion() >= base::win::VERSION_XP) {
-    runner.SetTestState(BEFORE_REVERT);
-    EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_token"));
-  }
+  runner.SetTestState(BEFORE_REVERT);
+  EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_token"));
 
   runner.SetTestState(AFTER_REVERT);
   EXPECT_EQ(ERROR_NO_TOKEN, runner.RunTest(L"PolicyTargetTest_token"));
 
   runner.SetTestState(EVERY_STATE);
-  if (base::win::GetVersion() >= base::win::VERSION_XP)
-    EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"PolicyTargetTest_steal"));
+  EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"PolicyTargetTest_steal"));
 }
 
 TEST(PolicyTargetTest, OpenThreadToken) {
   TestRunner runner;
-  if (base::win::GetVersion() >= base::win::VERSION_XP) {
-    runner.SetTestState(BEFORE_REVERT);
-    EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_token2"));
-  }
+  runner.SetTestState(BEFORE_REVERT);
+  EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_token2"));
 
   runner.SetTestState(AFTER_REVERT);
   EXPECT_EQ(ERROR_NO_TOKEN, runner.RunTest(L"PolicyTargetTest_token2"));
@@ -196,8 +191,6 @@
 
 TEST(PolicyTargetTest, OpenThreadTokenEx) {
   TestRunner runner;
-  if (base::win::GetVersion() < base::win::VERSION_XP)
-    return;
 
   runner.SetTestState(BEFORE_REVERT);
   EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_token3"));
@@ -356,9 +349,6 @@
 // Launches the app in the sandbox and share a handle with it. The app should
 // be able to use the handle.
 TEST(PolicyTargetTest, ShareHandleTest) {
-  // The way we share handles via STARTUPINFOEX does not work on XP.
-  if (base::win::GetVersion() < base::win::VERSION_VISTA)
-    return;
 
   BrokerServices* broker = GetBroker();
   ASSERT_TRUE(broker != NULL);
diff --git a/sandbox/win/src/process_mitigations.cc b/sandbox/win/src/process_mitigations.cc
index ba191d6..adcc17c9 100644
--- a/sandbox/win/src/process_mitigations.cc
+++ b/sandbox/win/src/process_mitigations.cc
@@ -38,8 +38,7 @@
   base::win::Version version = base::win::GetVersion();
   HMODULE module = ::GetModuleHandleA("kernel32.dll");
 
-  if (version >= base::win::VERSION_VISTA &&
-      (flags & MITIGATION_DLL_SEARCH_ORDER)) {
+  if (flags & MITIGATION_DLL_SEARCH_ORDER) {
     SetDefaultDllDirectoriesFunction set_default_dll_directories =
         reinterpret_cast<SetDefaultDllDirectoriesFunction>(
             ::GetProcAddress(module, "SetDefaultDllDirectories"));
@@ -54,8 +53,7 @@
   }
 
   // Set the heap to terminate on corruption
-  if (version >= base::win::VERSION_VISTA &&
-      (flags & MITIGATION_HEAP_TERMINATE)) {
+  if (flags & MITIGATION_HEAP_TERMINATE) {
     if (!::HeapSetInformation(NULL, HeapEnableTerminationOnCorruption,
                               NULL, 0) &&
         ERROR_ACCESS_DENIED != ::GetLastError()) {
@@ -63,8 +61,7 @@
     }
   }
 
-  if (version >= base::win::VERSION_WIN7 &&
-      (flags & MITIGATION_HARDEN_TOKEN_IL_POLICY)) {
+  if (flags & MITIGATION_HARDEN_TOKEN_IL_POLICY) {
       DWORD error = HardenProcessIntegrityLevelPolicy();
       if ((error != ERROR_SUCCESS) && (error != ERROR_ACCESS_DENIED))
         return false;
@@ -73,8 +70,6 @@
 #if !defined(_WIN64)  // DEP is always enabled on 64-bit.
   if (flags & MITIGATION_DEP) {
     DWORD dep_flags = PROCESS_DEP_ENABLE;
-    // DEP support is quirky on XP, so don't force a failure in that case.
-    const bool return_on_fail = version >= base::win::VERSION_VISTA;
 
     if (flags & MITIGATION_DEP_NO_ATL_THUNK)
       dep_flags |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
@@ -84,31 +79,11 @@
             ::GetProcAddress(module, "SetProcessDEPPolicy"));
     if (set_process_dep_policy) {
       if (!set_process_dep_policy(dep_flags) &&
-          ERROR_ACCESS_DENIED != ::GetLastError() && return_on_fail) {
+        ERROR_ACCESS_DENIED != ::GetLastError()) {
         return false;
       }
-    } else {
-      // We're on XP sp2, so use the less standard approach.
-      // For reference: http://www.uninformed.org/?v=2&a=4
-      static const int MEM_EXECUTE_OPTION_DISABLE = 2;
-      static const int MEM_EXECUTE_OPTION_ATL7_THUNK_EMULATION = 4;
-      static const int MEM_EXECUTE_OPTION_PERMANENT = 8;
-
-      NtSetInformationProcessFunction set_information_process = NULL;
-      ResolveNTFunctionPtr("NtSetInformationProcess",
-                           &set_information_process);
-      if (!set_information_process)
-        return false;
-      ULONG dep = MEM_EXECUTE_OPTION_DISABLE | MEM_EXECUTE_OPTION_PERMANENT;
-      if (!(dep_flags & PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION))
-        dep |= MEM_EXECUTE_OPTION_ATL7_THUNK_EMULATION;
-      if (!SUCCEEDED(set_information_process(GetCurrentProcess(),
-                                             ProcessExecuteFlags,
-                                             &dep, sizeof(dep))) &&
-          ERROR_ACCESS_DENIED != ::GetLastError() && return_on_fail) {
-        return false;
-      }
-    }
+    } else
+      return false;
   }
 #endif
 
@@ -229,10 +204,6 @@
 #error This platform is not supported.
 #endif
 
-  // Nothing for Win XP or Vista.
-  if (version <= base::win::VERSION_VISTA)
-    return;
-
   // DEP and SEHOP are not valid for 64-bit Windows
 #if !defined(_WIN64)
   if (flags & MITIGATION_DEP) {
@@ -312,19 +283,6 @@
 MitigationFlags FilterPostStartupProcessMitigations(MitigationFlags flags) {
   base::win::Version version = base::win::GetVersion();
 
-  // Windows XP SP2+.
-  if (version < base::win::VERSION_VISTA) {
-    return flags & (MITIGATION_DEP |
-                    MITIGATION_DEP_NO_ATL_THUNK);
-  }
-
-  // Windows Vista
-  if (version < base::win::VERSION_WIN7) {
-    return flags & (MITIGATION_BOTTOM_UP_ASLR |
-                    MITIGATION_DLL_SEARCH_ORDER |
-                    MITIGATION_HEAP_TERMINATE);
-  }
-
   // Windows 7.
   if (version < base::win::VERSION_WIN8) {
     return flags & (MITIGATION_BOTTOM_UP_ASLR |
diff --git a/sandbox/win/src/registry_dispatcher.cc b/sandbox/win/src/registry_dispatcher.cc
index fef727d..b8d94c8c 100644
--- a/sandbox/win/src/registry_dispatcher.cc
+++ b/sandbox/win/src/registry_dispatcher.cc
@@ -68,11 +68,7 @@
 
   if (IPC_NTOPENKEY_TAG == service) {
     bool result = INTERCEPT_NT(manager, NtOpenKey, OPEN_KEY_ID, 16);
-    if (base::win::GetVersion() >= base::win::VERSION_WIN7 ||
-        (base::win::GetVersion() == base::win::VERSION_VISTA &&
-         base::win::OSInfo::GetInstance()->version_type() ==
-             base::win::SUITE_SERVER))
-      result &= INTERCEPT_NT(manager, NtOpenKeyEx, OPEN_KEY_EX_ID, 20);
+    result &= INTERCEPT_NT(manager, NtOpenKeyEx, OPEN_KEY_EX_ID, 20);
     return result;
   }
 
diff --git a/sandbox/win/src/restricted_token_utils.cc b/sandbox/win/src/restricted_token_utils.cc
index 4a3d05c..9a062233 100644
--- a/sandbox/win/src/restricted_token_utils.cc
+++ b/sandbox/win/src/restricted_token_utils.cc
@@ -78,12 +78,11 @@
       restricted_token.AddRestrictingSid(WinRestrictedCodeSid);
 
       // This token has to be able to create objects in BNO.
-      // Unfortunately, on vista, it needs the current logon sid
+      // Unfortunately, on Vista+, it needs the current logon sid
       // in the token to achieve this. You should also set the process to be
       // low integrity level so it can't access object created by other
       // processes.
-      if (base::win::GetVersion() >= base::win::VERSION_VISTA)
-        restricted_token.AddRestrictingSidLogonSession();
+      restricted_token.AddRestrictingSidLogonSession();
       break;
     }
     case USER_RESTRICTED: {
@@ -198,8 +197,6 @@
   return NULL;
 }
 DWORD SetTokenIntegrityLevel(HANDLE token, IntegrityLevel integrity_level) {
-  if (base::win::GetVersion() < base::win::VERSION_VISTA)
-    return ERROR_SUCCESS;
 
   const wchar_t* integrity_level_str = GetIntegrityLevelString(integrity_level);
   if (!integrity_level_str) {
@@ -225,8 +222,6 @@
 }
 
 DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) {
-  if (base::win::GetVersion() < base::win::VERSION_VISTA)
-    return ERROR_SUCCESS;
 
   // We don't check for an invalid level here because we'll just let it
   // fail on the SetTokenIntegrityLevel call later on.
@@ -246,8 +241,6 @@
 }
 
 DWORD HardenTokenIntegrityLevelPolicy(HANDLE token) {
-  if (base::win::GetVersion() < base::win::VERSION_WIN7)
-    return ERROR_SUCCESS;
 
   DWORD last_error = 0;
   DWORD length_needed = 0;
@@ -295,8 +288,6 @@
 }
 
 DWORD HardenProcessIntegrityLevelPolicy() {
-  if (base::win::GetVersion() < base::win::VERSION_WIN7)
-    return ERROR_SUCCESS;
 
   HANDLE token_handle;
   if (!::OpenProcessToken(GetCurrentProcess(), READ_CONTROL | WRITE_OWNER,
diff --git a/sandbox/win/src/sandbox_policy_base.cc b/sandbox/win/src/sandbox_policy_base.cc
index 99e5b74..35440e5 100644
--- a/sandbox/win/src/sandbox_policy_base.cc
+++ b/sandbox/win/src/sandbox_policy_base.cc
@@ -475,8 +475,7 @@
   // not already low enough for our process.
   if (alternate_desktop_handle_ && use_alternate_desktop_ &&
       integrity_level_ != INTEGRITY_LEVEL_LAST &&
-      alternate_desktop_integrity_level_label_ < integrity_level_ &&
-      base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_VISTA) {
+      alternate_desktop_integrity_level_label_ < integrity_level_) {
     // Integrity label enum is reversed (higher level is a lower value).
     static_assert(INTEGRITY_LEVEL_SYSTEM < INTEGRITY_LEVEL_UNTRUSTED,
                   "Integrity level ordering reversed.");
diff --git a/sandbox/win/src/target_services.cc b/sandbox/win/src/target_services.cc
index 7537245b..2c037b9f 100644
--- a/sandbox/win/src/target_services.cc
+++ b/sandbox/win/src/target_services.cc
@@ -76,26 +76,23 @@
   // warmup all of these functions, but let's not assume that.
   ::GetUserDefaultLangID();
   ::GetUserDefaultLCID();
-  if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
-    static GetUserDefaultLocaleNameFunction GetUserDefaultLocaleName_func =
-        NULL;
-    if (!GetUserDefaultLocaleName_func) {
-      HMODULE kernel32_dll = ::GetModuleHandle(kKernel32DllName);
-      if (!kernel32_dll) {
-        return false;
-      }
-      GetUserDefaultLocaleName_func =
-          reinterpret_cast<GetUserDefaultLocaleNameFunction>(
-              GetProcAddress(kernel32_dll, "GetUserDefaultLocaleName"));
-      if (!GetUserDefaultLocaleName_func) {
-        return false;
-      }
+  static GetUserDefaultLocaleNameFunction GetUserDefaultLocaleName_func =
+      NULL;
+  if (!GetUserDefaultLocaleName_func) {
+    HMODULE kernel32_dll = ::GetModuleHandle(kKernel32DllName);
+    if (!kernel32_dll) {
+      return false;
     }
-    wchar_t localeName[LOCALE_NAME_MAX_LENGTH] = {0};
-    return (0 != GetUserDefaultLocaleName_func(
-                     localeName, LOCALE_NAME_MAX_LENGTH * sizeof(wchar_t)));
+    GetUserDefaultLocaleName_func =
+        reinterpret_cast<GetUserDefaultLocaleNameFunction>(
+            GetProcAddress(kernel32_dll, "GetUserDefaultLocaleName"));
+    if (!GetUserDefaultLocaleName_func) {
+      return false;
+    }
   }
-  return true;
+  wchar_t localeName[LOCALE_NAME_MAX_LENGTH] = {0};
+  return (0 != GetUserDefaultLocaleName_func(
+                    localeName, LOCALE_NAME_MAX_LENGTH * sizeof(wchar_t)));
 }
 
 // Used as storage for g_target_services, because other allocation facilities
diff --git a/sandbox/win/tests/validation_tests/suite.cc b/sandbox/win/tests/validation_tests/suite.cc
index 9fe25ce..14fba74 100644
--- a/sandbox/win/tests/validation_tests/suite.cc
+++ b/sandbox/win/tests/validation_tests/suite.cc
@@ -121,9 +121,6 @@
 // Tests that the permissions on the Windowstation does not allow the sandbox
 // to get to the interactive desktop or to make the sbox desktop interactive.
 TEST(ValidationSuite, TestAlternateDesktop) {
-  base::win::Version version = base::win::GetVersion();
-  if (version < base::win::VERSION_WIN7)
-    return;
 
   TestRunner runner;
   EXPECT_EQ(SBOX_TEST_DENIED, runner.RunTest(L"EnumAlternateWinsta NULL"));
@@ -167,9 +164,6 @@
 // Tests that a low-integrity process cannot open a locked-down process (due
 // to the integrity label changing after startup via SetDelayedIntegrityLevel).
 TEST(ValidationSuite, TestProcessDenyLowIntegrity) {
-  // This test applies only to Vista and above.
-  if (base::win::GetVersion() < base::win::VERSION_VISTA)
-    return;
 
   TestRunner runner;
   TestRunner target;
@@ -188,9 +182,6 @@
 
 // Tests that a locked-down process cannot open a low-integrity process.
 TEST(ValidationSuite, TestProcessDenyBelowLowIntegrity) {
-  //  This test applies only to Vista and above.
-  if (base::win::GetVersion() < base::win::VERSION_VISTA)
-    return;
 
   TestRunner runner;
   TestRunner target;